mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yunsheng Lin <linyunsheng@huawei.com>
To: Liang Chen <liangchen.linux@gmail.com>, <hawk@kernel.org>,
	<ilias.apalodimas@linaro.org>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<pabeni@redhat.com>
Subject: Re: [PATCH net-next] page pool: not return page to alloc cache during pool destruction
Date: Thu, 15 Jun 2023 17:06:41 +0800	[thread overview]
Message-ID: <468d3200-159c-f4ad-5907-48331cd7edd8@huawei.com> (raw)
In-Reply-To: <5296508e-5008-b5bb-ac2e-a0a69b720954@huawei.com>

On 2023/6/15 17:01, Yunsheng Lin wrote:
> On 2023/6/15 9:36, Liang Chen wrote:
>> When destroying a page pool, the alloc cache and recycle ring are emptied.
>> If there are inflight pages, the retry process will periodically check the
>> recycle ring for recently returned pages, but not the alloc cache (alloc
>> cache is only emptied once). As a result, any pages returned to the alloc
>> cache after the page pool destruction will be stuck there and cause the
>> retry process to continuously look for inflight pages and report warnings.
> 
> It seems there is still page_pool_put[_full]_page() called with
> allow_direct being true after page_pool_destroy() is call, which
> is not allowed.
> 
> Normally the driver will call napi_disable() before
> page_pool_destroy() to ensure there is no such page_pool_destroy()

no such page_pool_put[_full]_page()

> calling with allow_direct being true after page_pool_destroy() is
> called.
> 
>>
>> To safeguard against this situation, any pages returning to the alloc cache
>> after pool destruction should be prevented.
>>
>> Signed-off-by: Liang Chen <liangchen.linux@gmail.com>
>> ---
>>  net/core/page_pool.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/core/page_pool.c b/net/core/page_pool.c
>> index a3e12a61d456..76255313d349 100644
>> --- a/net/core/page_pool.c
>> +++ b/net/core/page_pool.c
>> @@ -595,7 +595,7 @@ __page_pool_put_page(struct page_pool *pool, struct page *page,
>>  			page_pool_dma_sync_for_device(pool, page,
>>  						      dma_sync_size);
>>  
>> -		if (allow_direct && in_softirq() &&
>> +		if (allow_direct && in_softirq() && !pool->destroy_cnt &&
> 
> The checking seems racy when  __page_pool_put_page() and
> page_pool_destroy() are called concurently.
> 
>>  		    page_pool_recycle_in_cache(page, pool))
>>  			return NULL;
>>  
>>
> 
> 
> .
> 

      reply	other threads:[~2023-06-15  9:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-15  1:36 Liang Chen
2023-06-15  4:20 ` Jakub Kicinski
2023-06-15 10:49   ` Ilias Apalodimas
2023-06-15 14:00   ` Jesper Dangaard Brouer
2023-06-16  2:45     ` Jakub Kicinski
2023-06-16  3:07     ` Liang Chen
2023-06-15  9:01 ` Yunsheng Lin
2023-06-15  9:06   ` Yunsheng Lin [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=468d3200-159c-f4ad-5907-48331cd7edd8@huawei.com \
    --to=linyunsheng@huawei.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=kuba@kernel.org \
    --cc=liangchen.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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

all inboxes | Powered by JetHome®