[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b0f613ce-7aad-4b1d-b6a1-4acc1d6c489e@linux.intel.com>
Date: Tue, 26 Aug 2025 09:25:03 +0800
From: Baolu Lu <baolu.lu@...ux.intel.com>
To: Dave Hansen <dave.hansen@...el.com>, "Tian, Kevin"
<kevin.tian@...el.com>, Jason Gunthorpe <jgg@...dia.com>
Cc: Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org>,
Robin Murphy <robin.murphy@....com>, Jann Horn <jannh@...gle.com>,
Vasant Hegde <vasant.hegde@....com>, Alistair Popple <apopple@...dia.com>,
Peter Zijlstra <peterz@...radead.org>, Uladzislau Rezki <urezki@...il.com>,
Jean-Philippe Brucker <jean-philippe@...aro.org>,
Andy Lutomirski <luto@...nel.org>, "Lai, Yi1" <yi1.lai@...el.com>,
"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
"security@...nel.org" <security@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: Re: [PATCH v3 1/1] iommu/sva: Invalidate KVA range on kernel TLB
flush
On 8/26/25 06:36, Dave Hansen wrote:
> On 8/22/25 20:26, Baolu Lu wrote:
>> +static struct {
>> + /* list for pagetable_dtor_free() */
>> + struct list_head dtor;
>> + /* list for __free_page() */
>> + struct list_head page;
>> + /* list for free_pages() */
>> + struct list_head pages;
>> + /* protect all the ptdesc lists */
>> + spinlock_t lock;
>> + struct work_struct work;
>
> Could you explain a bit why this now needs three separate lists? Seems
> like pure overkill.
Yes, sure.
The three separate lists are needed because we're handling three
distinct types of page deallocation. Grouping the pages this way allows
the workqueue handler to free each type using the correct function.
- pagetable_dtor_free(): This is for freeing PTE pages, which require
specific cleanup of a ptdesc structure.
- __free_page(): This is for freeing a single page.
- free_pages(): This is for freeing a contiguous block of pages that
were allocated together.
Using separate lists for each type ensures that every page is handled
correctly without having to check the page's type at runtime.
This seems like overkill, it was chosen to ensure functional
correctness. Any better solution?
Thanks,
baolu
Powered by blists - more mailing lists