linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarek Poplawski <jarkao2@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: johannes@sipsolutions.net, netdev@axxeo.de, peterz@infradead.org,
	Larry.Finger@lwfinger.net, kaber@trash.net,
	torvalds@linux-foundation.org, akpm@linux-foundation.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-wireless@vger.kernel.org, mingo@redhat.com
Subject: Re: Kernel WARNING: at net/core/dev.c:1330 __netif_schedule+0x2c/0x98()
Date: Fri, 1 Aug 2008 06:48:10 +0000	[thread overview]
Message-ID: <20080801064810.GA4435@ff.dom.local> (raw)
In-Reply-To: <20080731.052932.110299354.davem@davemloft.net>

On Thu, Jul 31, 2008 at 05:29:32AM -0700, David Miller wrote:
> From: Jarek Poplawski <jarkao2@gmail.com>
> Date: Sun, 27 Jul 2008 22:37:57 +0200
> 
> > Looks like enough to me. (Probably it could even share space with
> > the state.)

Alas I've some doubts here...

...
>  static inline void netif_tx_unlock(struct net_device *dev)
>  {
>  	unsigned int i;
>  
>  	for (i = 0; i < dev->num_tx_queues; i++) {
>  		struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
> -		__netif_tx_unlock(txq);
> -	}
>  
> +		/* No need to grab the _xmit_lock here.  If the
> +		 * queue is not stopped for another reason, we
> +		 * force a schedule.
> +		 */
> +		clear_bit(__QUEUE_STATE_FROZEN, &txq->state);

The comments in asm-x86/bitops.h to set_bit/clear_bit are rather queer
about reordering on non x86: isn't eg. smp_mb_before_clear_bit()
useful  here?

> +		if (!test_bit(__QUEUE_STATE_XOFF, &txq->state))
> +			__netif_schedule(txq->qdisc);
> +	}
> +	spin_unlock(&dev->tx_global_lock);
>  }
...

> diff --git a/net/core/dev.c b/net/core/dev.c
> index 63d6bcd..69320a5 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -4200,6 +4200,7 @@ static void netdev_init_queues(struct net_device *dev)
>  {
>  	netdev_init_one_queue(dev, &dev->rx_queue, NULL);
>  	netdev_for_each_tx_queue(dev, netdev_init_one_queue, NULL);
> +	spin_lock_init(&dev->tx_global_lock);

This will probably need some lockdep annotations similar to
_xmit_lock.

> diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
> index 345838a..9c9cd4d 100644
> --- a/net/sched/sch_generic.c
> +++ b/net/sched/sch_generic.c
> @@ -135,7 +135,8 @@ static inline int qdisc_restart(struct Qdisc *q)
>  	txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb));
>  
>  	HARD_TX_LOCK(dev, txq, smp_processor_id());
> -	if (!netif_subqueue_stopped(dev, skb))
> +	if (!netif_tx_queue_stopped(txq) &&
> +	    !netif_tx_queue_frozen(txq))
>  		ret = dev_hard_start_xmit(skb, dev, txq);
>  	HARD_TX_UNLOCK(dev, txq);

This thing is the most doubtful to me: before this patch callers would
wait on this lock. Now they take the lock without problems, check the
flags, and let to take this lock again, doing some re-queing in the
meantime.

So, it seems HARD_TX_LOCK should rather do some busy looping now with
a trylock, and re-checking the _FROZEN flag. Maybe even this should
be done in __netif_tx_lock(). On the other hand, this shouldn't block
too much the owner of tx_global_lock() with taking such a lock.

Jarek P.

  parent reply	other threads:[~2008-08-01  6:42 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080721133059.GA30637@elte.hu>
     [not found] ` <20080721134506.GA27598@elte.hu>
     [not found]   ` <20080721143023.GA32451@elte.hu>
2008-07-21 15:10     ` [crash] BUG: unable to handle kernel NULL pointer dereference at 0000000000000370 David Miller
     [not found]     ` <20080721150446.GA17746@elte.hu>
2008-07-21 15:24       ` David Miller
2008-07-21 18:18         ` Ian Schram
2008-07-21 19:06           ` Ingo Molnar
2008-07-21 19:13             ` Larry Finger
2008-07-21 19:34               ` Ingo Molnar
2008-07-21 19:43                 ` Larry Finger
2008-07-21 19:47                   ` Linus Torvalds
2008-07-21 20:15                     ` David Miller
2008-07-21 20:28                     ` Larry Finger
2008-07-21 20:21                   ` David Miller
2008-07-21 20:38                     ` Larry Finger
2008-07-21 20:46                       ` David Miller
2008-07-21 20:51                         ` Patrick McHardy
2008-07-21 21:01                           ` David Miller
2008-07-21 21:06                             ` Patrick McHardy
2008-07-21 21:35                               ` Patrick McHardy
2008-07-21 21:42                                 ` Patrick McHardy
2008-07-21 21:51                                 ` Larry Finger
2008-07-21 22:04                                   ` Patrick McHardy
2008-07-21 22:40                                     ` Larry Finger
2008-07-21 23:15                                       ` David Miller
2008-07-22  6:34                                         ` Larry Finger
2008-07-22 10:51                                           ` Jarek Poplawski
2008-07-22 11:32                                           ` David Miller
2008-07-22 12:52                                             ` Larry Finger
2008-07-22 20:43                                               ` David Miller
2008-07-22 13:02                                             ` Larry Finger
2008-07-22 14:53                                               ` Patrick McHardy
2008-07-22 21:17                                                 ` David Miller
2008-07-22 16:39                                               ` Kernel WARNING: at net/core/dev.c:1330 __netif_schedule+0x2c/0x98() Larry Finger
2008-07-22 17:20                                                 ` Patrick McHardy
2008-07-22 18:39                                                   ` Larry Finger
2008-07-22 18:44                                                     ` Patrick McHardy
2008-07-22 19:30                                                       ` Larry Finger
2008-07-22 23:04                                                     ` David Miller
2008-07-23  6:20                                                       ` Jarek Poplawski
2008-07-23  7:59                                                         ` David Miller
2008-07-23  8:54                                                           ` Jarek Poplawski
2008-07-23  9:03                                                             ` Peter Zijlstra
2008-07-23  9:35                                                               ` Jarek Poplawski
2008-07-23  9:50                                                                 ` Peter Zijlstra
2008-07-23 10:13                                                                   ` Jarek Poplawski
2008-07-23 10:58                                                                     ` Peter Zijlstra
2008-07-23 11:35                                                                       ` Jarek Poplawski
2008-07-23 11:49                                                                         ` Jarek Poplawski
2008-07-23 20:16                                                                           ` David Miller
2008-07-23 20:43                                                                             ` Jarek Poplawski
2008-07-23 20:55                                                                               ` David Miller
2008-07-24  9:10                                                                             ` Peter Zijlstra
2008-07-24  9:20                                                                               ` David Miller
2008-07-24  9:27                                                                                 ` Peter Zijlstra
2008-07-24  9:32                                                                                   ` David Miller
2008-07-24 10:08                                                                                     ` Peter Zijlstra
2008-07-24 10:38                                                                                       ` Nick Piggin
2008-07-24 10:55                                                                                         ` Miklos Szeredi
2008-07-24 11:06                                                                                           ` Nick Piggin
2008-08-01 21:10                                                                                             ` Paul E. McKenney
2008-07-24 10:59                                                                                         ` Peter Zijlstra
2008-08-01 21:10                                                                                         ` Paul E. McKenney
2008-07-23 20:14                                                                       ` David Miller
2008-07-24  7:00                                                                         ` Peter Zijlstra
2008-07-25 17:04                                                                         ` Ingo Oeser
2008-07-25 18:36                                                                           ` Jarek Poplawski
2008-07-25 19:16                                                                             ` Johannes Berg
2008-07-25 19:34                                                                               ` Jarek Poplawski
2008-07-25 19:36                                                                                 ` Johannes Berg
2008-07-25 20:01                                                                                   ` Jarek Poplawski
2008-07-26  9:18                                                                                     ` David Miller
2008-07-26 10:53                                                                                       ` Jarek Poplawski
2008-07-26 13:18                                                                                       ` Jarek Poplawski
2008-07-27  0:34                                                                                         ` David Miller
2008-07-27 20:37                                                                                           ` Jarek Poplawski
2008-07-31 12:29                                                                                             ` David Miller
2008-07-31 12:38                                                                                               ` Nick Piggin
2008-07-31 12:44                                                                                                 ` David Miller
2008-08-01  4:27                                                                                               ` David Miller
2008-08-01  7:09                                                                                                 ` Peter Zijlstra
2008-08-01  6:48                                                                                               ` Jarek Poplawski [this message]
2008-08-01  7:00                                                                                                 ` David Miller
2008-08-01  7:01                                                                                                 ` Jarek Poplawski
2008-08-01  7:01                                                                                                   ` David Miller
2008-08-01  7:41                                                                                                     ` Jarek Poplawski

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=20080801064810.GA4435@ff.dom.local \
    --to=jarkao2@gmail.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=johannes@sipsolutions.net \
    --cc=kaber@trash.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=netdev@axxeo.de \
    --cc=netdev@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=torvalds@linux-foundation.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).