[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <addfdff2-d62c-49b3-b528-77071d34b872@huawei.com>
Date: Thu, 7 Nov 2024 19:10:55 +0800
From: Yunsheng Lin <linyunsheng@...wei.com>
To: Alexander Duyck <alexander.duyck@...il.com>, Jesper Dangaard Brouer
<hawk@...nel.org>
CC: Toke Høiland-Jørgensen <toke@...hat.com>,
<davem@...emloft.net>, <kuba@...nel.org>, <pabeni@...hat.com>,
<zhangkun09@...wei.com>, <fanghaiqing@...wei.com>, <liuyonglong@...wei.com>,
Robin Murphy <robin.murphy@....com>, IOMMU <iommu@...ts.linux.dev>, Andrew
Morton <akpm@...ux-foundation.org>, Eric Dumazet <edumazet@...gle.com>, Ilias
Apalodimas <ilias.apalodimas@...aro.org>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>, <netdev@...r.kernel.org>, kernel-team
<kernel-team@...udflare.com>, Viktor Malik <vmalik@...hat.com>
Subject: Re: [PATCH net-next v3 3/3] page_pool: fix IOMMU crash when driver
has already unbound
On 2024/11/7 3:55, Alexander Duyck wrote:
|
...
>
> Is there any specific reason for why we need to store the pages
> instead of just scanning the page tables to look for them? We should
> already know how many we need to look for and free. If we were to just
> scan the page structs and identify the page pool pages that are
> pointing to our pool we should be able to go through and clean them
> up. It won't be the fastest approach, but this should be an
> exceptional case to handle things like a hot plug removal of a device
> where we can essentially run this in the background before we free the
> device.
Does 'scanning the page tables' mean scaning the array of 'struct page *',
like vmemmap/memmap?
I am not sure if there is any existing pattern or API to scan that array?
Does it fall under the catalog of poking into the internals of mm subsystem?
For exmaple, there seems to be different implemenation for that array depending
on CONFIG_SPARSEMEM* config.
Also, I am not sure how much time it may take if we have to scan the array
of 'struct page *' for all the memory in the system.
>
> Then it would just be a matter of modifying the pool so that it will
> drop support for doing DMA unmapping and essentially just become a
> place for the freed pages to go to die.
>
If I understand it correctly, the above seems to be what this patch is
trying to do by clearing pool->dma_map after doing the dma unmapping for
the inflight pages.
Powered by blists - more mailing lists