Netdev List
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: buytenh@wantstofly.org
Cc: Tristram.Ha@micrel.com, dannyfeng@tencent.com,
	netdev@vger.kernel.org, cphealy@gmail.com
Subject: Re: [PATCH] ksz884x: fix receive polling race condition
Date: Wed, 19 Dec 2012 12:45:17 -0800 (PST)	[thread overview]
Message-ID: <20121219.124517.1102318399340089630.davem@davemloft.net> (raw)
In-Reply-To: <20121218135700.GT23447@wantstofly.org>

From: Lennert Buytenhek <buytenh@wantstofly.org>
Date: Tue, 18 Dec 2012 14:57:00 +0100

> The ksz884x driver does receive processing in a custom tasklet, and
> seems to be assuming that since it takes its private interface spinlock
> with spin_lock_irq(), it won't be running concurrently with its own
> interrupt handler, as it cannot be preempted by it, but since its
> interrupt handler doesn't do any locking whatsoever, the receive
> processing tasklet and interrupt handler can end up running concurrently
> on different CPUs.
> 
> As a result of this, the ksz884x receive path ends up locking up fairly
> easily, when the receive processing tasklet's reenabling of receive
> interrupts (due to it being done with polling the receive ring) races
> with the interrupt handler's disabling of receive interrupts (due to a
> new receive interrupt coming in) resulting in the receive interrupt
> being masked but the receive processing tasklet not being scheduled.
> 
> Fix this by making the ksz884x interrupt handler take its private
> interface spinlock.  This requires upgrading the spin_lock() in the
> transmit cleanup tasklet to a spin_lock_irq(), as otherwise the IRQ
> handler can preempt transmit cleanup and deadlock the system, but
> with those two changes, no more receive lockups have been observed.
> 
> Reported-by: Chris Healy <cphealy@gmail.com>
> Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>

Applied, thanks.

      reply	other threads:[~2012-12-19 20:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-18 13:57 [PATCH] ksz884x: fix receive polling race condition Lennert Buytenhek
2012-12-19 20:45 ` David Miller [this message]

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=20121219.124517.1102318399340089630.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=Tristram.Ha@micrel.com \
    --cc=buytenh@wantstofly.org \
    --cc=cphealy@gmail.com \
    --cc=dannyfeng@tencent.com \
    --cc=netdev@vger.kernel.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