From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Michael Buesch <mb@bu3sch.de>
Cc: Kalle Valo <kalle.valo@iki.fi>,
linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
Johannes Berg <johannes@sipsolutions.net>,
"John W. Linville" <linville@tuxdriver.com>
Subject: Re: mac80211: NOHZ: local_softirq_pending 08
Date: Sat, 12 Sep 2009 20:07:09 +0200 [thread overview]
Message-ID: <4AABE34D.30401@hartkopp.net> (raw)
In-Reply-To: <200909121851.46002.mb@bu3sch.de>
Michael Buesch wrote:
> On Saturday 12 September 2009 18:41:12 Oliver Hartkopp wrote:
>> Michael Buesch wrote:
>>
>>>> As there are several users in the kernel do exact this test and call the
>>>> appropriate netif_rx() function, i would suggest to create a static inline
>>>> function:
>>>>
>>>> static inline int netif_rx_ti(struct sk_buff *skb)
>>>> {
>>>> if (in_interrupt())
>>>> return netif_rx(skb);
>>>> return netif_rx_ni(skb);
>>>> }
>>>>
>>>> ('ti' for test in_interrupt())
>>>>
>>>> in include/linux/netdevice.h
>>>>
>>>> What do you think about that?
>>> Yeah, I'm fine with that.
>>>
>> Hi Michael,
>>
>> i cooked a patch that introduces netif_rx_ti() and fixes up the problems in
>> mac80211 and the CAN subsystem.
>>
>> Currently i'm pondering whether netif_rx_ti() is needed in all cases or if
>> there are code sections that'll never be executed from irq-context.
>>
>> In theses cases netif_rx_ni() should be prefered to netif_rx_ti() to prevent
>> the obsolete check ...
>>
>> Is there any of your changes that should better use netif_rx_ni() ?
>>
>> Regards,
>> Oliver
>>
>
> Well, I'd say this check does not cost much at all.
> If I were the net maintainer, I'd get rid of netif_rx_ni() _and_ netif_rx_ti() and
> do the check internally in netif_rx().
> But as I don't have to decide that, I just want the mac80211 issue fixed.
>
Like this?
int netif_rx(struct sk_buff *skb)
{
int err;
if (likely(in_interrupt()))
err = __netif_rx(skb);
else {
preempt_disable();
err = __netif_rx(skb);
if (local_softirq_pending())
do_softirq();
preempt_enable();
}
return err;
}
I don't know how expensive in_interrupt() is ... checking the code does not
give any answers to *me* ;-)
But i found
356 netif_rx()
but only
18 netif_rx_ni()
in the kernel tree.
And three of them check for in_interrupt() before using netif_rx() or
netif_rx_ni() ...
Finally i would tend to introduce netif_rx_ti() in include/linux/netdevice.h
as described above, for the rare code that can be used inside and outside the
irq context.
I assume the affected code in the CAN stuff has to use netif_rx_ni() - but i
will doublecheck that (and prepare a separate CAN patch).
For the mac80211 i would suggest to check whether you really need
netif_rx()/netif_rx_ni()/netif_rx_ti() in all the regarded cases.
I assume always using netif_rx_ti() (as you proposed in the original patch) is
not the most efficient approach.
Best regards,
Oliver
next prev parent reply other threads:[~2009-09-12 18:07 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-11 14:48 mac80211: NOHZ: local_softirq_pending 08 Michael Buesch
2009-09-11 14:57 ` Kalle Valo
2009-09-11 15:07 ` Michael Buesch
2009-09-11 16:07 ` Kalle Valo
2009-09-11 16:07 ` Oliver Hartkopp
2009-09-11 16:13 ` Michael Buesch
2009-09-12 16:41 ` Oliver Hartkopp
2009-09-12 16:51 ` Michael Buesch
2009-09-12 18:07 ` Oliver Hartkopp [this message]
2009-09-29 19:29 ` John W. Linville
2009-09-30 11:56 ` Oliver Hartkopp
2009-09-30 14:33 ` Michael Buesch
2009-09-30 14:47 ` Kalle Valo
2009-09-30 14:54 ` Johannes Berg
2009-09-30 15:10 ` Michael Buesch
2009-09-30 15:21 ` Johannes Berg
2009-09-30 17:51 ` Oliver Hartkopp
2009-09-30 18:18 ` [PATCH] net: fix " Oliver Hartkopp
2009-09-30 18:47 ` John W. Linville
2009-09-30 23:33 ` David Miller
2009-10-01 7:08 ` Oliver Hartkopp
2009-10-01 14:04 ` Michael Buesch
2009-10-01 14:24 ` Kalle Valo
2009-10-01 18:42 ` Johannes Berg
2009-10-01 19:10 ` Michael Buesch
2009-10-01 19:26 ` Johannes Berg
2009-10-01 19:32 ` David Miller
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=4AABE34D.30401@hartkopp.net \
--to=socketcan@hartkopp.net \
--cc=johannes@sipsolutions.net \
--cc=kalle.valo@iki.fi \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=mb@bu3sch.de \
--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.