netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Francois Romieu <romieu@fr.zoreil.com>
Cc: Matt Mackall <mpm@selenic.com>,
	Mark Broadbent <markb@wetlettuce.com>,
	linux-kernel@vger.kernel.org, netdev@oss.sgi.com
Subject: Re: Lockup with 2.6.9-ac15 related to netconsole
Date: Wed, 22 Dec 2004 15:57:57 +0100	[thread overview]
Message-ID: <41C98B75.9020802@trash.net> (raw)
In-Reply-To: <20041222123940.GA4241@electric-eye.fr.zoreil.com>

Francois Romieu wrote:
> Patrick McHardy <kaber@trash.net> :
> [...]
> 
>>at least the queued messages ordered. But you need to grab
>>dev->queue_lock, otherwise you risk corrupting qdisc internal data.
>>You should probably also deal with the noqueue-qdisc, which doesn't
>>have an enqueue function. So it should look something like this:
> 
> 
> If I am not mistaken, a failure on spin_trylock + the test on
> xmit_lock_owner imply that it is safe to directly handle the
> queue. It means that qdisc_run() has been interrupted on the
> current cpu and the other paths seem fine as well. Counter-example
> is welcome (no joke).

enqueue is only protected by dev->queue_lock, and dev->queue_lock
is dropped as soon as dev->xmit_lock is grabbed, so any other CPU
might call enqueue at the same time.

Example:

CPU1					CPU2

dev_queue_xmit				dev_queue_xmit
  lock(dev->queue_lock)			 lock(dev->queue_lock)
q->enqueue
qdisc_run
qdisc_restart
  trylock(dev->xmit_lock), ok
  unlock(dev->queue_lock)
...
printk("something")
...
netpoll_send_skb
  trylock(dev->xmit_lock), fails
q->enqueue				q->enqueue

> Of course the patch is completely ugly and violates any layering
> principle one could think of. It was not submitted for inclusion :o)

Sure, but I think we should have a short-term workaround until
a better solution has been invented. Maybe dropping the packets
would be best for now, it only affects printks issued in paths
starting at qdisc_restart (-> hard_start_xmit -> ...). Queueing
the packets might also cause reordering since not all packets
are queued.

>>while (!spin_trylock(&np->dev->xmit_lock)) {
>>	if (np->dev->xmit_lock_owner == smp_processor_id()) {
>>		struct Qdisc *q;
>>
>>		rcu_read_lock();
>>		q = rcu_dereference(dev->qdisc);
>>		if (q->enqueue) {
>>			spin_lock(&dev->queue_lock);
> 
> 
> I'd expect it to deadlock if dev_queue_xmit -> qdisc_run is interrupted
> on the current cpu and a printk is issued as dev->queue_lock will have
> been taken elsewhere.

Hmm this is complicated, let me think some more about it.

Regards
Patrick

  parent reply	other threads:[~2004-12-22 14:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <59719.192.102.214.6.1103214002.squirrel@webmail.wetlettuce.com>
     [not found] ` <20041216211024.GK2767@waste.org>
     [not found]   ` <34721.192.102.214.6.1103274614.squirrel@webmail.wetlettuce.com>
     [not found]     ` <20041217215752.GP2767@waste.org>
     [not found]       ` <20041217233524.GA11202@electric-eye.fr.zoreil.com>
2004-12-20  9:42         ` Lockup with 2.6.9-ac15 related to netconsole Mark Broadbent
2004-12-20 21:14           ` Matt Mackall
2004-12-21  0:22             ` Francois Romieu
2004-12-21  0:55               ` Matt Mackall
2004-12-21 10:23                 ` Mark Broadbent
2004-12-21 12:37                   ` Francois Romieu
2004-12-21 13:29                     ` Mark Broadbent
2004-12-21 20:48                       ` Francois Romieu
2004-12-21 21:27                         ` Matt Mackall
2004-12-21 22:58                           ` Francois Romieu
2004-12-22  9:34                             ` Patrick McHardy
2004-12-22 10:54                               ` Patrick McHardy
2004-12-22 12:39                                 ` Francois Romieu
2004-12-22 13:33                                   ` jamal
2004-12-22 14:57                                   ` Patrick McHardy [this message]
2004-12-22 17:18                                     ` Matt Mackall
2004-12-25 11:26                                       ` Wish you all a Merry Christmas Pranav
2004-12-25 11:30                                         ` Jan Engelhardt
2004-12-28 13:45                                       ` Lockup with 2.6.9-ac15 related to netconsole jamal
2004-12-22 14:37                                 ` Mark Broadbent

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=41C98B75.9020802@trash.net \
    --to=kaber@trash.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markb@wetlettuce.com \
    --cc=mpm@selenic.com \
    --cc=netdev@oss.sgi.com \
    --cc=romieu@fr.zoreil.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 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).