From: "Michael Chan" <mchan@broadcom.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@oss.sgi.com
Subject: Re: Locking model for NAPI drivers
Date: Wed, 01 Jun 2005 13:33:39 -0700 [thread overview]
Message-ID: <1117658019.4310.58.camel@rh4> (raw)
In-Reply-To: <20050531.154847.63995530.davem@davemloft.net>
On Tue, 2005-05-31 at 15:48 -0700, David S. Miller wrote:
> Once we make this transformation, we need some way to synchronize
> with the IRQ handler when shutting down the device or making major
> configuration changes to the chip.
>
> The idea I came up with is a two-bit atomic bitmask. When base
> level code wants to quiesce interrupt processing, it takes the
> necessary driver spinlocks, sets the "SYNC" bit in the bitmask,
> forces and IRQ to be asserted by the tg3 card, then waits for the
> COMPLETE bit to get set by the interrupt handler.
>
During light testing, I found a race condition that caused
tg3_irq_quiesce() to spin forever. The race condition is shown below.
CPU1 CPU2
tg3_interrupt_tagged()
tg3_netif_stop()
netif_poll_disable()
netif_rx_schedule() will do nothing
tg3_full_lock()
tg3_irq_quiesce()
Because netif_poll_disable() is called, netif_rx_schedule() will do
nothing in the interrupt handler. As a result, tg3_poll() will never be
called to re-enable interrupts. Since interrupts are disabled,
tg3_irq_quiesce() will not be able to set the interrupts and cause the
interrupt handler to be called again, and therefore will wait forever.
Even adding another call to tg3_irq_sync() at the end of the interrupt
handler does not eliminate the race condition.
I suppose we can enable interrupts in tg3_irq_quiesce() after setting
the SYNC bit.
next prev parent reply other threads:[~2005-06-01 20:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-31 22:48 Locking model for NAPI drivers David S. Miller
2005-06-01 6:28 ` Andi Kleen
2005-06-01 8:42 ` Herbert Xu
2005-06-01 8:16 ` Greg Banks
2005-06-01 20:33 ` Michael Chan [this message]
2005-06-01 22:21 ` David S. Miller
2005-06-01 21:34 ` Michael Chan
2005-06-02 19:56 ` Michael Chan
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=1117658019.4310.58.camel@rh4 \
--to=mchan@broadcom.com \
--cc=davem@davemloft.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.