Re: [PATCH bluetooth-next 04/16] mac802154: rx: warn if ieee80211_rx call from irq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Marc,

On Mon, Oct 27, 2014 at 01:10:54PM +0100, Marc Kleine-Budde wrote:
> On 10/27/2014 12:42 PM, Alexander Aring wrote:
> > This patch adds a warning if the ieee80211_rx function is called from an
> > irq context which should never happen.
> 
> do you mean hard and/or softirq here?
> 

Comment for in_softirq() is "in_softirq - Are we currently processing
softirq or have bh disabled?"

Then we checking is (softirq_count() == 0) if true then print warning.

in_softirq is declared as:

#define in_softirq()            (softirq_count())

So (softirq_count() == 0) is identically with (!in_softirq()).

Translating the "deMorgan law" to the above sentence:

We print a warning when we are not in a softirq context and have bh
enabled.

So we need to be in a softirq context or bh enabled.

> > 
> > Signed-off-by: Alexander Aring <alex.aring@xxxxxxxxx>
> > ---
> >  net/mac802154/rx.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c
> > index 2851a3f..c4df321 100644
> > --- a/net/mac802154/rx.c
> > +++ b/net/mac802154/rx.c
> > @@ -61,6 +61,8 @@ fail:
> >  
> >  void ieee802154_rx(struct ieee802154_hw *hw, struct sk_buff *skb)
> >  {
> > +	WARN_ON_ONCE(softirq_count() == 0);
> > +
> 
> better use in_irq() or in_softirq(), see:
> 
> http://lxr.free-electrons.com/source/include/linux/preempt_mask.h#L64
> 

Okay, maybe want to fix that also in:

http://lxr.free-electrons.com/source/net/mac80211/rx.c#L3347



btw. I will also fix in this patch s/80211/802154/ at several places. I
should do a grep before.

Are you sure we can use in_irq here? I would change it to:

WARN_ON_ONCE(!in_softirq());

- Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-wpan" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux