[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100823202452.GC12906@hmsreliant.think-freely.org>
Date: Mon, 23 Aug 2010 16:24:52 -0400
From: Neil Horman <nhorman@...driver.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH] Fix deadlock between boomerang_interrupt and
boomerang_start_tx in 3c59x
On Mon, Aug 23, 2010 at 10:01:34PM +0200, Eric Dumazet wrote:
> Le mercredi 11 août 2010 à 11:12 -0400, Neil Horman a écrit :
> > If netconsole is in use, there is a possibility for deadlock in 3c59x between
> > boomerang_interrupt and boomerang_start_xmit. Both routines take the vp->lock,
> > and if netconsole is in use, a pr_* call from the boomerang_interrupt routine
> > will result in the netconsole code attempting to trnasmit an skb, which can try
> > to take the same spin lock, resulting in deadlock.
> >
> > The fix is pretty straightforward. This patch allocats a bit in the 3c59x
> > private structure to indicate that its handling an interrupt. If we get into
> > the transmit routine and that bit is set, we can be sure that we have recursed
> > and will deadlock if we continue, so instead we just return NETDEV_TX_BUSY, so
> > the stack requeues the skb to try again later.
> >
> > Signed-off-by: Neil Horman <nhorman@...driver.com>
> > ---
> > drivers/net/3c59x.c | 15 ++++++++++++++-
> > 1 files changed, 14 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
> > index c754d88..c685a55 100644
> > --- a/drivers/net/3c59x.c
> > +++ b/drivers/net/3c59x.c
> > @@ -633,7 +633,8 @@ struct vortex_private {
> > open:1,
> > medialock:1,
> > must_free_region:1, /* Flag: if zero, Cardbus owns the I/O region */
> > - large_frames:1; /* accept large frames */
> > + large_frames:1, /* accept large frames */
> > + handling_irq:1; /* private in_irq indicator */
>
>
> It would be safer and faster to use a dedicated 'int' instead of a
> bitfield.
>
>
>
>
Faster I agree with, although I'm not sure if speed is really a big issue here,
given that this is a ancient (but fairly well used) 10/100 adapter. And we
still have space in the octet that that bitfield is living in, so I figured I'd
use that anyway.
As for safe, I'm not sure I follow you on that point. Is there something
inherently dangerous about using a bitfield in this case?
Neil
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists