Netdev Archive on
help / color / mirror / Atom feed
From: Jussi Kivilinna <>
To: Antonio Quartulli <>,
	The list for a Better Approach To Mobile Ad-hoc Networking
Subject: Is netif_rx_ni safe from interrupt context? (Re: [PATCH] batman-adv: bla: use netif_rx_ni when not in interrupt context)
Date: Wed, 19 Aug 2020 10:39:52 +0300	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>


+CC netdev mailing-list

On 18.8.2020 23.12, Antonio Quartulli wrote:
> Hi,
> On 18/08/2020 16:46, Jussi Kivilinna wrote:
>> batadv_bla_send_claim() gets called from worker thread context through
>> batadv_bla_periodic_work(), thus netif_rx_ni needs to be used in that
>> case. This fixes "NOHZ: local_softirq_pending 08" log messages seen
>> when batman-adv is enabled.
>> Signed-off-by: Jussi Kivilinna <>
>> ---
>>  net/batman-adv/bridge_loop_avoidance.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>> diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
>> index 5c41cc52bc53..ab6cec3c7586 100644
>> --- a/net/batman-adv/bridge_loop_avoidance.c
>> +++ b/net/batman-adv/bridge_loop_avoidance.c
>> @@ -437,7 +437,10 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, u8 *mac,
>>  	batadv_add_counter(bat_priv, BATADV_CNT_RX_BYTES,
>>  			   skb->len + ETH_HLEN);
>> -	netif_rx(skb);
>> +	if (in_interrupt())
>> +		netif_rx(skb);
>> +	else
>> +		netif_rx_ni(skb);
> What's the downside in calling netif_rx_ni() all the times?
> Is there any possible side effect?
> (consider this call is not along the fast path)

Good question. I tried to find answer for this but found documentation being lacking 
on the issue, so I looked for examples and used 'in_interrupt/netif_rx/netif_rx_ni' 
bit that appears in few other places:

Maybe someone on netdev mailing-list could give hint on this matter - should 
'in_interrupt()?netif_rx(skb):netif_rx_ni(skb)' be used if context is not known or 
is just using 'netif_rx_ni(skb)' ok? 

> On top of that, I just checked the definition of in_interrupt() and I
> got this comment:
>  * Note: due to the BH disabled confusion: in_softirq(),in_interrupt()
> really
>  *       should not be used in new code.
> Check
> Is that something we should consider or is the comment bogus?

It very well be that the existing code that I looked at may not be the best 
for reuse today.


           reply	other threads:[~2020-08-19  7:40 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <>]

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \
    --subject='Is netif_rx_ni safe from interrupt context? (Re: [PATCH] batman-adv: bla: use netif_rx_ni when not in interrupt context)' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).