linux-wpan.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@gmail.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: linux-wpan@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH bluetooth-next 04/16] mac802154: rx: warn if ieee80211_rx call from irq
Date: Mon, 27 Oct 2014 13:29:35 +0100	[thread overview]
Message-ID: <20141027122932.GA24691@omega> (raw)
In-Reply-To: <544E364E.5090702@pengutronix.de>

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@gmail.com>
> > ---
> >  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

  reply	other threads:[~2014-10-27 12:29 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-27 11:42 [PATCH bluetooth-next 00/16] ieee802154: rework receive handling Alexander Aring
2014-10-27 11:42 ` [PATCH bluetooth-next 01/16] mac802154: tx: use put_unaligned_le16 for copy crc Alexander Aring
2014-10-27 11:42 ` [PATCH bluetooth-next 02/16] ieee802154: drivers: use dev_alloc_skb Alexander Aring
2014-10-27 11:42 ` [PATCH bluetooth-next 03/16] mac802154: rx: use tasklet instead workqueue Alexander Aring
2014-10-27 11:42 ` [PATCH bluetooth-next 04/16] mac802154: rx: warn if ieee80211_rx call from irq Alexander Aring
2014-10-27 12:10   ` Marc Kleine-Budde
2014-10-27 12:29     ` Alexander Aring [this message]
2014-10-27 11:42 ` [PATCH bluetooth-next 05/16] mac802154: rx: move receive handling into rx.c Alexander Aring
2014-10-27 11:42 ` [PATCH bluetooth-next 06/16] mac802154: tx: remove monitor receive while xmit Alexander Aring
2014-10-27 11:43 ` [PATCH bluetooth-next 07/16] mac802154: rx: rename remove mac802154_subif_rx Alexander Aring
2014-10-27 11:43 ` [PATCH bluetooth-next 08/16] mac802154: rx: move skb->protocol setting Alexander Aring
2014-10-27 11:43 ` [PATCH bluetooth-next 09/16] mac802154: rx: add CHECKSUM_UNNECESSARY Alexander Aring
2014-10-27 11:43 ` [PATCH bluetooth-next 10/16] mac802154: rx: add monitor pkt_type information Alexander Aring
2014-10-27 11:43 ` [PATCH bluetooth-next 11/16] mac802154: rx: move skb_reset_mac_header Alexander Aring
2014-10-27 11:43 ` [PATCH bluetooth-next 12/16] mac802154: rx: move rcu locking Alexander Aring
2014-10-27 11:43 ` [PATCH bluetooth-next 13/16] ieee802154: add valid psdu length helper Alexander Aring
2014-10-27 11:43 ` [PATCH bluetooth-next 14/16] at86rf230: use ieee802154_is_valid_psdu_len helper Alexander Aring
2014-10-27 11:43 ` [PATCH bluetooth-next 15/16] at86rf230: improve receive handling Alexander Aring
2014-10-27 11:43 ` [PATCH bluetooth-next 16/16] mac802154: rx: change naming convention Alexander Aring

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=20141027122932.GA24691@omega \
    --to=alex.aring@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-wpan@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    /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 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).