All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: netdev@oss.sgi.com
Cc: dfages@arkoon.net
Subject: Fw: [BUG/PATCH] CONFIG_NET_HW_FLOWCONTROL and SMP
Date: Mon, 29 Sep 2003 12:37:34 -0700	[thread overview]
Message-ID: <20030929123734.5bd97a47.akpm@osdl.org> (raw)



Begin forwarded message:

Date: Mon, 29 Sep 2003 14:08:54 +0200
From: dfages@arkoon.net
To: linux-kernel@vger.kernel.org
Subject: [BUG/PATCH] CONFIG_NET_HW_FLOWCONTROL and SMP




Hi,
by testing the CONFIG_NET_HW_FLOWCONTROL (NIC Hardware throttling) on
a SMP system, I found a bug in net/core/dev.c : the netdev_dropping
variable can be set to a negative value (the result is that a CPU can
be locked in "throttle" state).
This bug seems to exist in 2.4 and in 2.6 kernels.

Here's a typical scenario :

- Throttling --> (CPU 0)queue->throttle==1 && (CPU 1)queue->throttle==1
     && netdev_dropping == 2
- 1st packet Unthrottle ( in net_rx_action() ), received by CPU 0
     --> (CPU 0)queue->throttle==1 && (CPU 1)queue->throttle==1
     && netdev_dropping == 1
- 2nd packet Unthrottle ( in net_rx_action() ), received by CPU 0
     --> (CPU 0)queue->throttle==0 && (CPU 1)queue->throttle==1
     && netdev_dropping == 0
- 3nd packet Unthrottle ( in net_rx_action() ), received by CPU 1
     --> (CPU 0)queue->throttle==0 && (CPU 1)queue->throttle==0
     && netdev_dropping == -1

and so on...

The problem is that the (CPU)queue->throttle should be set to zero every
time the netdev_dropping variable is decremented.


Here's a patch for the 2.4.19 kernel (tested with success) :

--- linux-2.4.19/net/core/dev.c.orig     Mon Sep 29 12:49:14 2003
+++ linux-2.4.19/net/core/dev.c    Tue Sep 23 18:35:35 2003
@@ -1519,8 +1519,8 @@

 #ifdef CONFIG_NET_HW_FLOWCONTROL
     if (queue->throttle && queue->input_pkt_queue.qlen < no_cong_thresh ) {
+         queue->throttle = 0;
          if (atomic_dec_and_test(&netdev_dropping)) {
-              queue->throttle = 0;
               netdev_wakeup();
               goto softnet_break;
          }




I haven't done a patch for 2.4.22 (as we currently use 2.4.19) but the same
modification should be applied around lines 1572 to 1577 of net/core/dev.c

For 2.6.0-test5, the lines to modified are arount 1631 to 1637.

Regards,
---
Daniel FAGES
ARKOON Network Security    http://www.arkoon.net



             reply	other threads:[~2003-09-29 19:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-29 19:37 Andrew Morton [this message]
2003-09-29 21:25 ` Fw: [BUG/PATCH] CONFIG_NET_HW_FLOWCONTROL and SMP Robert Olsson
2003-09-29 21:39   ` Jeff Garzik
2003-09-30 14:45     ` Robert Olsson
2003-10-02 15:31     ` Robert Olsson
2003-10-02 17:47       ` Jeff Garzik
2003-10-02 19:34         ` Andrew Morton
2003-10-03 14:10         ` Robert Olsson
2003-09-30  2:17 ` jamal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030929123734.5bd97a47.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=dfages@arkoon.net \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.