qdisc_restart - readability changes, one bug fix.
Subsystems (3)
PATCH 1/2 qdisc_restart - readability changes, one bug fix.
- Converted to use switch/case code which looks neater.
- "if (ret == NETDEV_TX_LOCKED && lockless)" is buggy, and the lockless check should be removed, since driver will return NETDEV_TX_LOCKED only if lockless is true and driver has to do the locking. In the original code as well as the latest code, this code can result in a bug where if LLTX is not set for a driver (lockless == 0) but the driver is written wrongly to do a trylock (despite LLTX being set), the driver returns LOCKED. But since lockless is zero, the packet is requeue'd instead of calling collision code, issuing a warning and freeing up the skb. This skb will be retried with this driver next time, and the same result will ensue. Removing this check will catch these driver bugs instead of hiding the problem. I am keeping this change to readability section since :
a. it is confusing to check two things as it is; and
b. it is difficult to keep this check in the changed 'switch' code.
- Changed some names, like try_get_tx_pkt to dequeue_skb (as that is the work being done and easier to understand) and do_dev_requeue to requeue_skb, merged handle_dev_cpu_collision and tx_islocked to dev_handle_collision (handle_dev_cpu_collision is a small routine with only one caller, so there is no need to have two separate routines which also results in getting rid of two macros, etc.
- Removed an XXX comment as it should never fail (I suspect this was related to batch skb WIP, Jamal ?). Converted some functions to original coding style of having the return values and the function name on same line, eg prio2list.
---
net/sched/sch_generic.c +82 -81
@@ -34,9 +34,6 @@#include <net/sock.h> #include <net/pkt_sched.h> -#define SCHED_TX_DROP -2 -#define SCHED_TX_QUEUE -3 -/* Main transmission queue. */ /* Modifications to data participating in scheduling must be protected with
@@ -68,41 +65,24 @@ static inline int qdisc_qlen(struct Qdisreturn q->q.qlen; } -static inline int handle_dev_cpu_collision (struct net_device *dev) -{ -if (unlikely (dev->xmit_lock_owner ==smp_processor_id ())) { -if (net_ratelimit ()) -printk (KERN_WARNING -"Dead loop on netdevice %s, fix it urgently!\n" , - dev->name); -return SCHED_TX_DROP ; - } -__get_cpu_var (netdev_rx_stat).cpu_collision++; -return SCHED_TX_QUEUE ; -} - -static inline int -do_dev_requeue (struct sk_buff *skb,struct net_device *dev,struct Qdisc *q) +static inline int requeue_skb (struct sk_buff *skb,struct net_device *dev, +struct Qdisc *q) { -if (unlikely (skb->next)) dev->gso_skb = skb;else q->ops->requeue (skb, q); -/* XXX: Could netif_schedule fail? Or is the fact we are -* requeueing imply the hardware path is closed -* and even if we fail, some interupt will wake us -*/ +netif_schedule (dev);return 0 ; } -static inline struct sk_buff * -try_get_tx_pkt (struct net_device *dev,struct Qdisc *q) +static inline struct sk_buff *dequeue_skb (struct net_device *dev, +struct Qdisc *q) { -struct sk_buff *skb = dev->gso_skb; +struct sk_buff *skb; -if (skb) +if ((skb = dev->gso_skb)) dev->gso_skb =NULL ;else skb = q->dequeue (q);
@@ -110,92 +90,113 @@ try_get_tx_pkt(struct net_device *dev, sreturn skb; } -static inline int -tx_islocked (struct sk_buff *skb,struct net_device *dev,struct Qdisc *q) +static inline int handle_dev_cpu_collision (struct sk_buff *skb, +struct net_device *dev, +struct Qdisc *q) { -int ret =handle_dev_cpu_collision (dev); +int ret; -if (ret ==SCHED_TX_DROP ) { +if (unlikely (dev->xmit_lock_owner ==smp_processor_id ())) { +/* +* Same CPU holding the lock. It may be a transient +* configuration error, when hard_start_xmit() recurses. We +* detect it by checking xmit owner and drop the packet when +* deadloop is detected. Return OK to try the next skb. +*/ kfree_skb (skb); -return qdisc_qlen (q); +if (net_ratelimit ()) +printk (KERN_DEBUG "Dead loop on netdevice %s, " +"fix it urgently!\n" , dev->name); + ret =qdisc_qlen (q); + }else { +/* +* Another cpu is holding lock, requeue & delay xmits for +* some time. +*/ +__get_cpu_var (netdev_rx_stat).cpu_collision++; + ret =requeue_skb (skb, dev, q); } -return do_dev_requeue (skb, dev, q); +return ret; } -/* -NOTE: Called under dev->queue_lock with locally disabled BH. - -__LINK_STATE_QDISC_RUNNING guarantees only one CPU -can enter this region at a time. - -dev->queue_lock serializes queue accesses for this device -AND dev->qdisc pointer itself. - -netif_tx_lock serializes accesses to device driver. - -dev->queue_lock and netif_tx_lock are mutually exclusive, -if one is grabbed, another must be free. - -Multiple CPUs may contend for the two locks. - -Note, that this procedure can be called by a watchdog timer - -Returns to the caller: -Returns: 0 - queue is empty or throttled. ->0 - queue is not empty. - -*/ - +* NOTE: Called under dev->queue_lock with locally disabled BH. +* +* __LINK_STATE_QDISC_RUNNING guarantees only one CPU can process this +* device at a time. dev->queue_lock serializes queue accesses for +* this device AND dev->qdisc pointer itself. +* +* netif_tx_lock serializes accesses to device driver. +* +* dev->queue_lock and netif_tx_lock are mutually exclusive, +* if one is grabbed, another must be free. +* +* Note, that this procedure can be called by a watchdog timer +* +* Returns to the caller: +* 0 - queue is empty or throttled. +* >0 - queue is not empty. +* +*/ static inline int qdisc_restart (struct net_device *dev) {struct Qdisc *q = dev->qdisc; -unsigned lockless = (dev->features &NETIF_F_LLTX );struct sk_buff *skb; +unsigned lockless;int ret; - skb =try_get_tx_pkt (dev, q); -if (skb ==NULL ) +/* Dequeue packet */ +if (unlikely ((skb =dequeue_skb (dev, q)) ==NULL ))return 0 ; -/* we have a packet to send */ -if (!lockless) { -if (!netif_tx_trylock (dev)) -return tx_islocked (skb, dev, q); +/* +* When the driver has LLTX set, it does its own locking in +* start_xmit. These checks are worth it because even uncongested +* locks can be quite expensive. The driver can do a trylock, as +* is being done here; in case of lock contention it should return +* NETDEV_TX_LOCKED and the packet will be requeued. +*/ + lockless = (dev->features &NETIF_F_LLTX ); + +if (!lockless && !netif_tx_trylock (dev)) { +/* Another CPU grabbed the driver tx lock */ +return handle_dev_cpu_collision (skb, dev, q); } -/* all clear .. */ + +/* And release queue */ spin_unlock (&dev->queue_lock); ret =NETDEV_TX_BUSY ;if (!netif_queue_stopped (dev)) -/* churn baby churn .. */ ret =dev_hard_start_xmit (skb, dev);if (!lockless)netif_tx_unlock (dev);spin_lock (&dev->queue_lock); - -/* we need to refresh q because it may be invalid since -* we dropped dev->queue_lock earlier ... -* So dont try to be clever grasshopper -*/ q = dev->qdisc; -/* most likely result, packet went ok */ -if (ret ==NETDEV_TX_OK ) -return qdisc_qlen (q); -/* only for lockless drivers .. */ -if (ret ==NETDEV_TX_LOCKED && lockless) -return tx_islocked (skb, dev, q); -if (unlikely (ret !=NETDEV_TX_BUSY &&net_ratelimit ())) -printk (KERN_WARNING " BUG %s code %d qlen %d\n" ,dev->name, ret, q->q.qlen); +switch (ret) { +case NETDEV_TX_OK : +/* Driver sent out skb successfully */ + ret =qdisc_qlen (q); +break ; + +case NETDEV_TX_LOCKED : +/* Driver try lock failed */ + ret =handle_dev_cpu_collision (skb, dev, q); +break ; + +default : +/* Driver returned NETDEV_TX_BUSY - requeue skb */ + ret =requeue_skb (skb, dev, q); +break ; + } -return do_dev_requeue (skb, dev, q); +return ret; } -void __qdisc_run (struct net_device *dev) { do {
Quoted 14 lines
- "if (ret ==
NETDEV_TX_LOCKED&& lockless)" is buggy, and the lockless
check should be removed, since driver will returnNETDEV_TX_LOCKEDonly
if lockless is true and driver has to do the locking. In
the original
code as well as the latest code, this code can result in a bug where if LLTX is not set for a driver (lockless == 0) but the
driver is written
wrongly to do a trylock (despite LLTX being set), the driver returns LOCKED. But since lockless is zero, the packet is requeue'd
instead of
calling collision code, issuing a warning and freeing up
the skb. This
Quoted 8 lines
skb will be retried with this driver next time, and the
same result will
ensue. Removing this check will catch these driver bugs
instead of hiding
the problem. I am keeping this change to readability section since :
a. it is confusing to check two things as it is; and b. it is difficult to keep this check in the changed
'switch' code.
I agree that the case shouldn't happen, and will only surface if the driver is indeed buggy. I've thought about this conditional being removed for awhile, since it will protect against a poorly written driver wrt locking, but then again a driver behaving like that shouldn't be making it into the kernel. That being said, out-of-tree drivers are heavily used (we have an out-of-tree e1000), and something like this could be missed. But since that is the corner case of a crappy driver, I'm ok with this being removed.
Quoted 5 lines
- Changed some names, like
try_get_tx_pkttodequeue_skb(as that is the work
being done and easier to understand) anddo_dev_requeuetorequeue_skb,
These, at a glance, look very similar to the qdisc ->enqueue() and ->dequeue() function pointers. I know I had to look a few times to realize they were separate calls through the qdisc and this new function name. Perhaps dequeue_skb() can become dev_dequeue_skb() and requeue_skb() can be dev_requeue_skb()? Something that helps differentiate these from the function pointers of the qdisc_ops might help distinguish what layer the operation is running on.
Quoted 27 lines
net/sched/sch_generic.c +8
-2+static inline int handle_dev_cpu_collision (struct sk_buff *skb, +struct net_device *dev, +struct Qdisc *q) { -int ret =handle_dev_cpu_collision (dev); +int ret; -if (ret ==SCHED_TX_DROP ) { +if (unlikely (dev->xmit_lock_owner ==smp_processor_id ())) { +/* +* Same CPU holding the lock. It may be a transient +* configuration error, when hard_start_xmit() recurses. We
(quoted diff) +1
-0+ * detect it by checking xmit owner and dropthe packet when
net/sched/sch_generic.c +9
-1+* deadloop is detected. Return OK to try the next skb. +*/ kfree_skb (skb); -return qdisc_qlen (q); +if (net_ratelimit ()) +printk (KERN_DEBUG "Dead loop on netdevice %s, " +"fix it urgently!\n" , dev->name); + ret =qdisc_qlen (q); + }else { +/* +* Another cpu is holding lock, requeue & delay xmits for
net/sched/sch_generic.c try_get_tx_pkt(struct net_device *dev, s · line 121
Quoted 9 lines
net/sched/sch_generic.c +5
-1+* some time. +*/ +__get_cpu_var (netdev_rx_stat).cpu_collision++; + ret =requeue_skb (skb, dev, q); } -return do_dev_requeue (skb, dev, q); +return ret; }
I like the single return here.
net/sched/sch_generic.c try_get_tx_pkt(struct net_device *dev, s · line 151
Quoted 12 lines
static inline int
qdisc_restart(struct net_device *dev){net/sched/sch_generic.c +3
-3struct Qdisc *q = dev->qdisc; -unsigned lockless = (dev->features &NETIF_F_LLTX );struct sk_buff *skb; +unsigned lockless;int ret; - skb =try_get_tx_pkt (dev, q); -if (skb ==NULL ) +/* Dequeue packet */ +if (unlikely ((skb =dequeue_skb (dev, q)) ==NULL ))return 0 ;
I know there's been discussion on the driver side of the world to stop using unlikely() and likely() clauses. I personally think it's ok in situations like this where you have one corner-case conditional without an else, but it's something to keep in mind when using them in new/rewritten code like this.
net/sched/sch_generic.c try_get_tx_pkt(struct net_device *dev, s · line 172
Quoted 2 lines
net/sched/sch_generic.c +0
-0if (!netif_queue_stopped (dev)) ret =dev_hard_start_xmit (skb, dev);
I thought you were removing this check of netif_queue_stopped(dev)? Nevermind, I see the followup patch takes care of this.
Quoted 6 lines
net/sched/sch_generic.c +6
-0+switch (ret) { +case NETDEV_TX_OK : +/* Driver sent out skb successfully */ + ret =qdisc_qlen (q); +break ; +
net/sched/sch_generic.c try_get_tx_pkt(struct net_device *dev, s · line 195
Quoted 10 lines
net/sched/sch_generic.c +10
-0+case NETDEV_TX_LOCKED : +/* Driver try lock failed */ + ret =handle_dev_cpu_collision (skb, dev, q); +break ; + +default : +/* Driver returned NETDEV_TX_BUSY - requeue skb */ + ret =requeue_skb (skb, dev, q); +break ; + }
Ooo. I like this; very clean and simple.
The patch looks fine to me outside of the choice of names for dequeue_skb() and requeue_skb(), but I can be easily swayed.
Cheers,
-PJ Waskiewicz
On Fri, 2007-06-15 at 11:01 -0700, Waskiewicz Jr, Peter P wrote:
Hi Peter,
Quoted 8 lines
I agree that the case shouldn't happen, and will only surface if the driver is indeed buggy. I've thought about this conditional being removed for awhile, since it will protect against a poorly written driver wrt locking, but then again a driver behaving like that shouldn't be making it into the kernel. That being said, out-of-tree drivers are heavily used (we have an out-of-tree e1000), and something like this could be missed. But since that is the corner case of a crappy driver, I'm ok with this being removed.
Removing this check will work more efficiently for correctly written drivers, but it will also catch the wrongly written drivers and free up all the skbs (and print messages) as without this change, nothing happens and resources are never freed up.
Quoted 7 lines
These, at a glance, look very similar to the qdisc ->enqueue() and ->dequeue() function pointers. I know I had to look a few times to realize they were separate calls through the qdisc and this new function name. Perhaps
dequeue_skb()can becomedev_dequeue_skb()andrequeue_skb()can bedev_requeue_skb()? Something that helps differentiate these from the function pointers of theqdisc_opsmight help distinguish what layer the operation is running on.
That is definitely required, I will send out a revised patch.
Quoted 5 lines
I know there's been discussion on the driver side of the world to stop using
unlikely()andlikely()clauses. I personally think it's ok in situations like this where you have one corner-case conditional without an else, but it's something to keep in mind when using them in new/rewritten code like this.
OK. The reason I had put the unlikely is that we are executing qdisc_restart due to the synchronous queuing of a packet, or since we were rescheduled after either :
a. not getting tx lock (and when qdisc_restart had atleast one
packet in the queue, look for the qdisc_qlen return value in handle_dev_cpu_collision).
b. tx was busy and packet was requeue'd.
So in most (all?) cases, an skb should be found (I was not able to find a case where skb can be NULL).
Quoted 2 lines
The patch looks fine to me outside of the choice of names for
dequeue_skb()andrequeue_skb(), but I can be easily swayed.
I will send an updated patch for review. Thanks for your review comments.
- KK
PATCH 1/2 qdisc_restart - readability changes plus one bug fix.
In reply to Krishna KumarNew changes :
- Incorporated Peter Waskiewicz's comments.
- Re-added back one warning message (on driver returning wrong value).
Previous changes :
- Converted to use switch/case code which looks neater.
- "if (ret == NETDEV_TX_LOCKED && lockless)" is buggy, and the lockless check should be removed, since driver will return NETDEV_TX_LOCKED only if lockless is true and driver has to do the locking. In the original code as well as the latest code, this code can result in a bug where if LLTX is not set for a driver (lockless == 0) but the driver is written wrongly to do a trylock (despite LLTX being set), the driver returns LOCKED. But since lockless is zero, the packet is requeue'd instead of calling collision code which will issue warning and free up the skb. Instead this skb will be retried with this driver next time, and the same result will ensue. Removing this check will catch these driver bugs instead of hiding the problem. I am keeping this change to readability section since :
a. it is confusing to check two things as it is; and
b. it is difficult to keep this check in the changed 'switch' code.
- Changed some names, like try_get_tx_pkt to dev_dequeue_skb (as that is the work being done and easier to understand) and do_dev_requeue to dev_requeue_skb, merged handle_dev_cpu_collision and tx_islocked to dev_handle_collision (handle_dev_cpu_collision is a small routine with only one caller, so there is no need to have two separate routines which also results in getting rid of two macros, etc.
- Removed an XXX comment as it should never fail (I suspect this was related to batch skb WIP, Jamal ?). Converted some functions to original coding style of having the return values and the function name on same line, eg prio2list.
---
net/sched/sch_generic.c +86 -81
@@ -34,9 +34,6 @@#include <net/sock.h> #include <net/pkt_sched.h> -#define SCHED_TX_DROP -2 -#define SCHED_TX_QUEUE -3 -/* Main transmission queue. */ /* Modifications to data participating in scheduling must be protected with
@@ -68,41 +65,24 @@ static inline int qdisc_qlen(struct Qdisreturn q->q.qlen; } -static inline int handle_dev_cpu_collision (struct net_device *dev) -{ -if (unlikely (dev->xmit_lock_owner ==smp_processor_id ())) { -if (net_ratelimit ()) -printk (KERN_WARNING -"Dead loop on netdevice %s, fix it urgently!\n" , - dev->name); -return SCHED_TX_DROP ; - } -__get_cpu_var (netdev_rx_stat).cpu_collision++; -return SCHED_TX_QUEUE ; -} - -static inline int -do_dev_requeue (struct sk_buff *skb,struct net_device *dev,struct Qdisc *q) +static inline int dev_requeue_skb (struct sk_buff *skb,struct net_device *dev, +struct Qdisc *q) { -if (unlikely (skb->next)) dev->gso_skb = skb;else q->ops->requeue (skb, q); -/* XXX: Could netif_schedule fail? Or is the fact we are -* requeueing imply the hardware path is closed -* and even if we fail, some interupt will wake us -*/ +netif_schedule (dev);return 0 ; } -static inline struct sk_buff * -try_get_tx_pkt (struct net_device *dev,struct Qdisc *q) +static inline struct sk_buff *dev_dequeue_skb (struct net_device *dev, +struct Qdisc *q) { -struct sk_buff *skb = dev->gso_skb; +struct sk_buff *skb; -if (skb) +if ((skb = dev->gso_skb)) dev->gso_skb =NULL ;else skb = q->dequeue (q);
@@ -110,91 +90,116 @@ try_get_tx_pkt(struct net_device *dev, sreturn skb; } -static inline int -tx_islocked (struct sk_buff *skb,struct net_device *dev,struct Qdisc *q) +static inline int handle_dev_cpu_collision (struct sk_buff *skb, +struct net_device *dev, +struct Qdisc *q) { -int ret =handle_dev_cpu_collision (dev); +int ret; -if (ret ==SCHED_TX_DROP ) { +if (unlikely (dev->xmit_lock_owner ==smp_processor_id ())) { +/* +* Same CPU holding the lock. It may be a transient +* configuration error, when hard_start_xmit() recurses. We +* detect it by checking xmit owner and drop the packet when +* deadloop is detected. Return OK to try the next skb. +*/ kfree_skb (skb); -return qdisc_qlen (q); +if (net_ratelimit ()) +printk (KERN_WARNING "Dead loop on netdevice %s, " +"fix it urgently!\n" , dev->name); + ret =qdisc_qlen (q); + }else { +/* +* Another cpu is holding lock, requeue & delay xmits for +* some time. +*/ +__get_cpu_var (netdev_rx_stat).cpu_collision++; + ret =dev_requeue_skb (skb, dev, q); } -return do_dev_requeue (skb, dev, q); +return ret; } -/* -NOTE: Called under dev->queue_lock with locally disabled BH. - -__LINK_STATE_QDISC_RUNNING guarantees only one CPU -can enter this region at a time. - -dev->queue_lock serializes queue accesses for this device -AND dev->qdisc pointer itself. - -netif_tx_lock serializes accesses to device driver. - -dev->queue_lock and netif_tx_lock are mutually exclusive, -if one is grabbed, another must be free. - -Multiple CPUs may contend for the two locks. - -Note, that this procedure can be called by a watchdog timer - -Returns to the caller: -Returns: 0 - queue is empty or throttled. ->0 - queue is not empty. - -*/ - +* NOTE: Called under dev->queue_lock with locally disabled BH. +* +* __LINK_STATE_QDISC_RUNNING guarantees only one CPU can process this +* device at a time. dev->queue_lock serializes queue accesses for +* this device AND dev->qdisc pointer itself. +* +* netif_tx_lock serializes accesses to device driver. +* +* dev->queue_lock and netif_tx_lock are mutually exclusive, +* if one is grabbed, another must be free. +* +* Note, that this procedure can be called by a watchdog timer +* +* Returns to the caller: +* 0 - queue is empty or throttled. +* >0 - queue is not empty. +* +*/ static inline int qdisc_restart (struct net_device *dev) {struct Qdisc *q = dev->qdisc; -unsigned lockless = (dev->features &NETIF_F_LLTX );struct sk_buff *skb; +unsigned lockless;int ret; - skb =try_get_tx_pkt (dev, q); -if (skb ==NULL ) +/* Dequeue packet */ +if (unlikely ((skb =dev_dequeue_skb (dev, q)) ==NULL ))return 0 ; -/* we have a packet to send */ -if (!lockless) { -if (!netif_tx_trylock (dev)) -return tx_islocked (skb, dev, q); +/* +* When the driver has LLTX set, it does its own locking in +* start_xmit. These checks are worth it because even uncongested +* locks can be quite expensive. The driver can do a trylock, as +* is being done here; in case of lock contention it should return +* NETDEV_TX_LOCKED and the packet will be requeued. +*/ + lockless = (dev->features &NETIF_F_LLTX ); + +if (!lockless && !netif_tx_trylock (dev)) { +/* Another CPU grabbed the driver tx lock */ +return handle_dev_cpu_collision (skb, dev, q); } -/* all clear .. */ + +/* And release queue */ spin_unlock (&dev->queue_lock); ret =NETDEV_TX_BUSY ;if (!netif_queue_stopped (dev)) -/* churn baby churn .. */ ret =dev_hard_start_xmit (skb, dev);if (!lockless)netif_tx_unlock (dev);spin_lock (&dev->queue_lock); - -/* we need to refresh q because it may be invalid since -* we dropped dev->queue_lock earlier ... -* So dont try to be clever grasshopper -*/ q = dev->qdisc; -/* most likely result, packet went ok */ -if (ret ==NETDEV_TX_OK ) -return qdisc_qlen (q); -/* only for lockless drivers .. */ -if (ret ==NETDEV_TX_LOCKED && lockless) -return tx_islocked (skb, dev, q); -if (unlikely (ret !=NETDEV_TX_BUSY &&net_ratelimit ())) -printk (KERN_WARNING " BUG %s code %d qlen %d\n" ,dev->name, ret, q->q.qlen); +switch (ret) { +case NETDEV_TX_OK : +/* Driver sent out skb successfully */ + ret =qdisc_qlen (q); +break ; + +case NETDEV_TX_LOCKED : +/* Driver try lock failed */ + ret =handle_dev_cpu_collision (skb, dev, q); +break ; + +default : +/* Driver returned NETDEV_TX_BUSY - requeue skb */ +if (unlikely (ret !=NETDEV_TX_BUSY &&net_ratelimit ())) +printk (KERN_WARNING "BUG %s code %d qlen %d\n" , + dev->name, ret, q->q.qlen); -return do_dev_requeue (skb, dev, q); -} + ret =dev_requeue_skb (skb, dev, q); +break ; + } +return ret; +}void __qdisc_run (struct net_device *dev) {
RE: [PATCH 1/2 - rev2] qdisc_restart - readability changes plus onebug fix.
Quoted 9 lines
-----Original Message-----
From: Krishna Kumar [mailto:[email protected]]
Sent: Sunday, June 17, 2007 9:51 PM
To: [email protected]
Cc: [email protected]; [email protected]; Waskiewicz Jr, Peter P; [email protected]; [email protected]; [email protected]
Subject: [PATCH 1/2 - rev2]qdisc_restart- readability changes plus onebug fix.
Quoted 4 lines
New changes :
- Incorporated Peter Waskiewicz's comments.
- Re-added back one warning message (on driver returning wrong value).
I've run these patches last night and this morning without issue. I see no issues with these updated patches from my testing.
Thanks,
-PJ Waskiewicz
RE: [PATCH 1/2 - rev2] qdisc_restart - readability changes plus onebug fix.
Thanks Peter for testing out. I forgot to mention that I had also ran a 64 process
netperf (tcp & udp) on 2--CPU SMP systems without any issues.
Dave, does it make sense to add this to 2.6.23 ? Herbert and Peter had earlier reviewed
Patch 2/2 and said they were OK with it.
thanks,
- KK
[email protected] wrote on 06/18/2007 11:21:46 PM:
Quoted 23 lines
Quoted 9 lines
-----Original Message-----
From: Krishna Kumar [mailto:[email protected]]
Sent: Sunday, June 17, 2007 9:51 PM
To: [email protected]
Cc: [email protected]; [email protected]; Waskiewicz Jr, Peter P; [email protected]; [email protected]; [email protected]
Subject: [PATCH 1/2 - rev2]qdisc_restart- readability changes plus onebug fix.Quoted 4 lines
New changes :
- Incorporated Peter Waskiewicz's comments.
- Re-added back one warning message (on driver returning wrong value).I've run these patches last night and this morning without issue. I see no issues with these updated patches from my testing.
Thanks,
(quoted diff) +0
-2-PJ Waskiewicz -To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
David Miller
maintainerRe: [PATCH 1/2 - rev2] qdisc_restart - readability changes plus onebug fix.
From: Krishna Kumar2 <[email protected]>
Date: Tue, 19 Jun 2007 09:05:28 +0530
Quoted 2 lines
Dave, does it make sense to add this to 2.6.23 ? Herbert and Peter had earlier reviewed Patch 2/2 and said they were OK with it.
What does Jamal think of it :-)
Re: [PATCH 1/2 - rev2] qdisc_restart - readability changes plus onebug fix.
Hi Dave,
I have copied him in these patches, so he doesn't have to read the netdev to get them :)
- KK
David Miller <[email protected]> wrote on 06/19/2007 09:28:31 AM:
Quoted 7 lines
From: Krishna Kumar2 <[email protected]>
Date: Tue, 19 Jun 2007 09:05:28 +0530Quoted 2 lines
Dave, does it make sense to add this to 2.6.23 ? Herbert and Peter had earlier reviewed Patch 2/2 and said they were OK with it.
What does Jamal think of it :-)
Re: [PATCH 1/2 - rev2] qdisc_restart - readability changes plus onebug fix.
In reply to David MillerQuoted 7 lines · David Miller
From: Krishna Kumar2 <[email protected]>
Date: Tue, 19 Jun 2007 09:05:28 +0530Quoted 2 lines
Dave, does it make sense to add this to 2.6.23 ? Herbert and Peter had earlier reviewed Patch 2/2 and said they were OK with it.
What does Jamal think of it :-)
I think Krishna has worked hard and produced the patches - and given the wisdom of crowds - the patches deserve to go in.
I dont have the proper energy to review at the moment (I am a conservative when touching that area of the code) - Thomas do you have time? I will have time end of week.
cheers,
jamal
Re: [PATCH 1/2 - rev2] qdisc_restart - readability changes plus onebug fix.
Hi Jamal, Dave (and anyone else interested),
Could you review this patch ?
Thanks,
- KK
Quoted 18 lines · jamal
Quoted 7 lines · David Miller
From: Krishna Kumar2 <[email protected]>
Date: Tue, 19 Jun 2007 09:05:28 +0530Quoted 2 lines
Dave, does it make sense to add this to 2.6.23 ? Herbert and Peter had earlier reviewed Patch 2/2 and said they were OK with it.
What does Jamal think of it :-)
I think Krishna has worked hard and produced the patches - and given the wisdom of crowds - the patches deserve to go in.
I dont have the proper energy to review at the moment (I am a conservative when touching that area of the code) - Thomas do you have time? I will have time end of week.cheers,
jamal
David Miller
maintainerRe: [PATCH 1/2 - rev2] qdisc_restart - readability changes plus onebug fix.
From: Krishna Kumar <[email protected]>
Date: Mon, 25 Jun 2007 08:18:32 +0530
Quoted 3 lines
Hi Jamal, Dave (and anyone else interested),
Could you review this patch ?
I definitely will.
David Miller
maintainerRe: [PATCH 1/2 - rev2] qdisc_restart - readability changes plus one bug fix.
In reply to Krishna KumarFrom: Krishna Kumar <[email protected]>
Date: Mon, 18 Jun 2007 10:21:24 +0530
Quoted 31 lines
New changes :
- Incorporated Peter Waskiewicz's comments.
- Re-added back one warning message (on driver returning wrong value).Previous changes :
- Converted to use switch/case code which looks neater.
- "if (ret ==
NETDEV_TX_LOCKED&& lockless)" is buggy, and the lockless check should be removed, since driver will returnNETDEV_TX_LOCKEDonly if lockless is true and driver has to do the locking. In the original code as well as the latest code, this code can result in a bug where if LLTX is not set for a driver (lockless == 0) but the driver is written wrongly to do a trylock (despite LLTX being set), the driver returns LOCKED. But since lockless is zero, the packet is requeue'd instead of calling collision code which will issue warning and free up the skb. Instead this skb will be retried with this driver next time, and the same result will ensue. Removing this check will catch these driver bugs instead of hiding the problem. I am keeping this change to readability section since :
a. it is confusing to check two things as it is; and
b. it is difficult to keep this check in the changed 'switch' code.- Changed some names, like
try_get_tx_pkttodev_dequeue_skb(as that is the work being done and easier to understand) anddo_dev_requeuetodev_requeue_skb, mergedhandle_dev_cpu_collisionandtx_islockedtodev_handle_collision(handle_dev_cpu_collisionis a small routine with only one caller, so there is no need to have two separate routines which also results in getting rid of two macros, etc.
Quoted 6 lines
- Removed an XXX comment as it should never fail (I suspect this was related to batch skb WIP, Jamal ?). Converted some functions to original coding style of having the return values and the function name on same line, eg prio2list.
Signed-off-by Krishna Kumar <[email protected]>
Looks good, applied and pushed to net-2.6.23