netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Yunsheng Lin <linyunsheng@huawei.com>
Cc: <davem@davemloft.net>, <netdev@vger.kernel.org>,
	<edumazet@google.com>, <pabeni@redhat.com>,
	<peterz@infradead.org>, <mingo@redhat.com>, <will@kernel.org>,
	<longman@redhat.com>, <boqun.feng@gmail.com>, <hawk@kernel.org>,
	<ilias.apalodimas@linaro.org>
Subject: Re: [PATCH net-next] page_pool: add a lockdep check for recycling in hardirq
Date: Fri, 21 Jul 2023 08:02:15 -0700	[thread overview]
Message-ID: <20230721080215.01b29a5a@kernel.org> (raw)
In-Reply-To: <382d00e5-87af-6a6b-17e2-6640fdd01db5@huawei.com>

On Fri, 21 Jul 2023 19:53:30 +0800 Yunsheng Lin wrote:
> > diff --git a/net/core/page_pool.c b/net/core/page_pool.c
> > index a3e12a61d456..3ac760fcdc22 100644
> > --- a/net/core/page_pool.c
> > +++ b/net/core/page_pool.c
> > @@ -536,6 +536,8 @@ static void page_pool_return_page(struct page_pool *pool, struct page *page)
> >  static bool page_pool_recycle_in_ring(struct page_pool *pool, struct page *page)
> >  {
> >  	int ret;
> > +
> > +	lockdep_assert_no_hardirq();  
> 
> Is there any reason not to put it in page_pool_put_defragged_page() to
> catch the case with allow_direct being true when page_pool_recycle_in_ring()
> may not be called?

I was trying to stick it into places which make an assumption about
the calling context, rather than cover the full API.
I don't have a strong preference either way, but I hope it's good
enough. The benefit I see is that it should be fairly obvious to
a seasoned kernel code reader why this warning is here.
A warning that fires from page_pool_put_defragged_page() would need
a comment to explain the reason and may go stale.

> >  	/* BH protection not needed if current is softirq */
> >  	if (in_softirq())

  reply	other threads:[~2023-07-21 15:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-20 17:37 [PATCH net-next] page_pool: add a lockdep check for recycling in hardirq Jakub Kicinski
2023-07-21 11:53 ` Yunsheng Lin
2023-07-21 15:02   ` Jakub Kicinski [this message]
2023-07-21 15:48 ` Alexander Lobakin
2023-07-21 16:05   ` Jakub Kicinski
2023-07-21 16:33     ` Alexander Lobakin
2023-07-22  1:45       ` Jakub Kicinski

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=20230721080215.01b29a5a@kernel.org \
    --to=kuba@kernel.org \
    --cc=boqun.feng@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=linyunsheng@huawei.com \
    --cc=longman@redhat.com \
    --cc=mingo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=peterz@infradead.org \
    --cc=will@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 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).