WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [linux-2.6.18-xen] netback: optionally return TX respons

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [linux-2.6.18-xen] netback: optionally return TX responses out-of-order
From: "Xen patchbot-linux-2.6.18-xen" <patchbot-linux-2.6.18-xen@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 27 May 2009 04:31:04 -0700
Delivery-date: Wed, 27 May 2009 04:34:07 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1243419660 -3600
# Node ID 2ab54cc407616623d36efec300a1dd2ac11b7fc5
# Parent  eba6fe6d8d53168cc5c3c8b6b209646a02ffd580
netback: optionally return TX responses out-of-order

Add a mode to netback in which it tries to return TX responses in a
slightly less predictable order.  This can make some otherwise
hardware-specific frontend bugs reproduce much more easily, which is
obviously rather useful when trying to fix them.  It'd also be quite
useful for making sure they didn't happen in the first place.

Randomisation is only done if a module parameter is set, and defaults
to off.  It certainly isn't something you'd ever want to run with in
production, but it might be useful for other people developing
frontend drivers.  I don't know if that's considered an adequate
reason to apply it, but, if anyone wants it, here it is.

Signed-off-by: Steven Smith <steven.smith@xxxxxxxxxxxxx>
---
 drivers/xen/netback/netback.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+)

diff -r eba6fe6d8d53 -r 2ab54cc40761 drivers/xen/netback/netback.c
--- a/drivers/xen/netback/netback.c     Tue May 26 11:23:16 2009 +0100
+++ b/drivers/xen/netback/netback.c     Wed May 27 11:21:00 2009 +0100
@@ -142,6 +142,9 @@ static int MODPARM_copy_skb = 1;
 static int MODPARM_copy_skb = 1;
 module_param_named(copy_skb, MODPARM_copy_skb, bool, 0);
 MODULE_PARM_DESC(copy_skb, "Copy data received from netfront without netloop");
+static int MODPARM_permute_returns = 0;
+module_param_named(permute_returns, MODPARM_permute_returns, bool, 
S_IRUSR|S_IWUSR);
+MODULE_PARM_DESC(permute_returns, "Randomly permute the order in which TX 
responses are sent to the frontend");
 
 int netbk_copy_skb_mode;
 
@@ -866,6 +869,25 @@ static inline int copy_pending_req(PEND_
                                      &mmap_pages[pending_idx]);
 }
 
+static void permute_dealloc_ring(PEND_RING_IDX dc, PEND_RING_IDX dp)
+{
+       static unsigned random_src = 0x12345678;
+       unsigned dst_offset;
+       PEND_RING_IDX dest;
+       u16 tmp;
+
+       while (dc != dp) {
+               dst_offset = (random_src / 256) % (dp - dc);
+               dest = dc + dst_offset;
+               tmp = dealloc_ring[MASK_PEND_IDX(dest)];
+               dealloc_ring[MASK_PEND_IDX(dest)] =
+                       dealloc_ring[MASK_PEND_IDX(dc)];
+               dealloc_ring[MASK_PEND_IDX(dc)] = tmp;
+               dc++;
+               random_src *= 68389;
+       }
+}
+
 inline static void net_tx_action_dealloc(void)
 {
        struct netbk_tx_pending_inuse *inuse, *n;
@@ -887,6 +909,9 @@ inline static void net_tx_action_dealloc
 
                /* Ensure we see all indices enqueued by netif_idx_release(). */
                smp_rmb();
+
+               if (MODPARM_permute_returns)
+                       permute_dealloc_ring(dc, dp);
 
                while (dc != dp) {
                        unsigned long pfn;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [linux-2.6.18-xen] netback: optionally return TX responses out-of-order, Xen patchbot-linux-2.6.18-xen <=