From: Ruan Jinjie <ruanjinjie@huawei.com>
To: Dan Carpenter <dan.carpenter@linaro.org>, <netdev@vger.kernel.org>
Cc: <gregkh@linuxfoundation.org>, <philipp.g.hortmann@gmail.com>,
<straube.linux@gmail.com>, <Larry.Finger@lwfinger.net>,
<wlanfae@realtek.com>, <mikem@ring3k.org>, <seanm@seanm.ca>,
<linux-staging@lists.linux.dev>
Subject: Re: [PATCH -next v2 0/3] staging: rtl8192e: Do not call kfree_skb() under spin_lock_irqsave()
Date: Thu, 14 Sep 2023 10:01:18 +0800 [thread overview]
Message-ID: <1e4d321f-8252-f191-2011-043abd79a408@huawei.com> (raw)
In-Reply-To: <d7326392-56e4-4ccb-a878-0a03c91d0d85@kadam.mountain>
On 2023/9/5 19:59, Dan Carpenter wrote:
> Added netdev because they're really the experts.
>
> On Fri, Aug 25, 2023 at 09:52:10AM +0800, Jinjie Ruan wrote:
>> It is not allowed to call kfree_skb() from hardware interrupt
>> context or with interrupts being disabled.
>
> There are no comments which say that this is not allowed. I have
> reviewed the code to see why it's not allowed. The only thing I can
> see is that maybe the skb->destructor(skb); in skb_release_head_state()
> sleeps? Or possibly the uarg->callback() in skb_zcopy_clear()?
The commit e6247027e517 ("net: introduce dev_consume_skb_any()") has the
below comment:
3830 /*
3831 * It is not allowed to call kfree_skb() or consume_skb() from hardware
3832 * interrupt context or with hardware interrupts being disabled.
3833 * (in_hardirq() || irqs_disabled())
3834 *
3835 * We provide four helpers that can be used in following contexts :
3836 *
3837 * dev_kfree_skb_irq(skb) when caller drops a packet from irq context,
3838 * replacing kfree_skb(skb)
3839 *
3840 * dev_consume_skb_irq(skb) when caller consumes a packet from irq
context.
3841 * Typically used in place of consume_skb(skb) in TX completion path
3842 *
3843 * dev_kfree_skb_any(skb) when caller doesn't know its current irq
context,
3844 * replacing kfree_skb(skb)
3845 *
3846 * dev_consume_skb_any(skb) when caller doesn't know its current
irq context,
3847 * and consumed a packet. Used in place of consume_skb(skb)
3848 */
>
> Can you comment more on why this isn't allowed? Was this detected at
> runtime? Do you have a stack trace?
>
> Once I know more I can add this to Smatch so that it is detected
> automatically using static analysis.
>
> regards,
> dan carpenter
>
>
prev parent reply other threads:[~2023-09-14 2:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-25 1:52 [PATCH -next v2 0/3] staging: rtl8192e: Do not call kfree_skb() under spin_lock_irqsave() Jinjie Ruan
2023-08-25 1:52 ` [PATCH -next v2 1/3] staging: rtl8192e: rtl_core: Call dev_kfree_skb_irq() instead of " Jinjie Ruan
2023-09-13 8:34 ` Greg KH
2023-09-14 2:00 ` Ruan Jinjie
2023-08-25 1:52 ` [PATCH -next v2 2/3] staging: rtl8192e: rtl_core: Do not call kfree_skb() under spin_lock_irqsave() for _rtl92e_irq() Jinjie Ruan
2023-08-25 1:52 ` [PATCH -next v2 3/3] Staging: rtl8192e: rtllib_softmac: Do not call kfree_skb() under spin_lock_irqsave() Jinjie Ruan
2023-08-25 5:47 ` [PATCH -next v2 0/3] staging: rtl8192e: " Philipp Hortmann
2023-09-05 12:16 ` Dan Carpenter
2023-09-05 11:59 ` Dan Carpenter
2023-09-14 2:01 ` Ruan Jinjie [this message]
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=1e4d321f-8252-f191-2011-043abd79a408@huawei.com \
--to=ruanjinjie@huawei.com \
--cc=Larry.Finger@lwfinger.net \
--cc=dan.carpenter@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-staging@lists.linux.dev \
--cc=mikem@ring3k.org \
--cc=netdev@vger.kernel.org \
--cc=philipp.g.hortmann@gmail.com \
--cc=seanm@seanm.ca \
--cc=straube.linux@gmail.com \
--cc=wlanfae@realtek.com \
/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