From: Olaf Kirch <okir@lst.de>
To: Jarek Poplawski <jarkao2@o2.pl>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: Races in net_rx_action vs netpoll?
Date: Thu, 12 Jul 2007 15:54:32 +0200 [thread overview]
Message-ID: <200707121554.33915.okir@lst.de> (raw)
In-Reply-To: <20070712125949.GC1708@ff.dom.local>
Hi Jarek,
On Thursday 12 July 2007 14:59, Jarek Poplawski wrote:
> > +#ifdef CONFIG_NETPOLL
> > + /* Prevent race with netpoll - yes, this is a kludge.
> > + * But at least it doesn't penalize the non-netpoll
> > + * code path. */
>
> Alas, this can penalize those who have it enabled (e.g. by distro),
> but don't use.
Well, the test_bit is actually cheap; it's not atomic, and has no memory
ordering requirements by all I know. The costly thing is set_bit/clear_bit
in poll_napi; and you only ever get there when you *use* netpoll.
> And it looks like _netif_rx_complete should be a better place,
> at least considering such cards as: 8139too, skge, sungem and
> maybe more (according to 2.6.22).
Why?
> > + set_bit(__LINK_STATE_POLL_LIST_FROZEN, &np->dev->state);
> > npinfo->rx_flags |= NETPOLL_RX_DROP;
>
> I wonder, why this flag cannot be used for this check?
I tried, but it made the patch rather icky. netpoll_info is defined
in netpoll.h, which includes netdevice.h. So you cannot inline the
check, and have to use an out-of-line function instead, along the
lines of
extern int am_i_being_called_by_poll_napi(struct net_device *);
netif_rx_complete(struct net_device *dev)
{
#ifdef CONFIG_NETPOLL
if (unlikely(dev->npinfo && am_i_being_called_by_poll_napi(dev))
return;
#endif
...
}
If you don't mind that, yes - this flag (or better, a newly introduced
NETPOLL_RX_NAPI) may work as well.
One thing I was a little worried about was whether dev->npinfo can
go away all of a sudden. It's really just protected by an rcu_readlock...
> BTW, I'd be very glad if somebody could hint me what is the main
> reason for such troublesome function as poll_napi: if it's about
> performance isn't this enough to increase budget for netpoll in
> net_rx_action?
I think one reason is that you want to get the kernel oops out even
when the machine is so hosed that it doesn't even service softirqs
anymore.
Olaf
--
Olaf Kirch | --- o --- Nous sommes du soleil we love when we play
okir@lst.de | / | \ sol.dhoop.naytheet.ah kin.ir.samse.qurax
next prev parent reply other threads:[~2007-07-12 13:54 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-04 12:16 Races in net_rx_action vs netpoll? Olaf Kirch
2007-07-09 22:27 ` David Miller
2007-07-10 10:44 ` Olaf Kirch
2007-07-11 5:44 ` David Miller
2007-07-11 7:41 ` Olaf Kirch
2007-07-12 2:33 ` David Miller
2007-07-19 15:19 ` Olaf Kirch
2007-07-19 16:27 ` Stephen Hemminger
2007-07-22 7:05 ` David Miller
2007-07-24 10:26 ` Jarek Poplawski
2007-07-12 12:59 ` Jarek Poplawski
2007-07-12 13:54 ` Olaf Kirch [this message]
2007-07-13 8:55 ` Jarek Poplawski
2007-07-16 8:06 ` 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=200707121554.33915.okir@lst.de \
--to=okir@lst.de \
--cc=davem@davemloft.net \
--cc=jarkao2@o2.pl \
--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 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.