Re: [PATCH v2 02/12] x86: pgtable: Always use pte_free_kernel()

2025-04-10 Thread Matthew Wilcox
On Tue, Apr 08, 2025 at 08:22:47AM -0700, Dave Hansen wrote: > Are there any tests for folio_test_pgtable() at free_page() time? If we > had that, it would make it less likely that another free_page() user > could sneak in without calling the destructor. It's hidden, but yes: static inline bool p

Re: [PATCH v2 02/12] x86: pgtable: Always use pte_free_kernel()

2025-04-09 Thread Kevin Brodsky
On 08/04/2025 19:40, Matthew Wilcox wrote: > On Tue, Apr 08, 2025 at 09:54:42AM -0700, Dave Hansen wrote: >> On 4/8/25 09:37, Matthew Wilcox wrote: >>> On Tue, Apr 08, 2025 at 08:22:47AM -0700, Dave Hansen wrote: Are there any tests for folio_test_pgtable() at free_page() time? If we had

Re: [PATCH v2 02/12] x86: pgtable: Always use pte_free_kernel()

2025-04-08 Thread Dave Hansen
On 4/8/25 10:40, Matthew Wilcox wrote: > I think at this point in Kevin's series, we don't call the ctor for > these pages, so we never set PageTable() on them. I could be wrong; > as Kevin says, this is all very twisty and confusing with exceptions and > exceptions to exceptions. This series sho

Re: [PATCH v2 02/12] x86: pgtable: Always use pte_free_kernel()

2025-04-08 Thread Matthew Wilcox
On Tue, Apr 08, 2025 at 09:54:42AM -0700, Dave Hansen wrote: > On 4/8/25 09:37, Matthew Wilcox wrote: > > On Tue, Apr 08, 2025 at 08:22:47AM -0700, Dave Hansen wrote: > >> Are there any tests for folio_test_pgtable() at free_page() time? If we > >> had that, it would make it less likely that anothe

Re: [PATCH v2 02/12] x86: pgtable: Always use pte_free_kernel()

2025-04-08 Thread Dave Hansen
On 4/8/25 09:37, Matthew Wilcox wrote: > On Tue, Apr 08, 2025 at 08:22:47AM -0700, Dave Hansen wrote: >> Are there any tests for folio_test_pgtable() at free_page() time? If we >> had that, it would make it less likely that another free_page() user >> could sneak in without calling the destructor.

Re: [PATCH v2 02/12] x86: pgtable: Always use pte_free_kernel()

2025-04-08 Thread Dave Hansen
On 4/8/25 02:52, Kevin Brodsky wrote: > Page table pages are normally freed using the appropriate helper for > the given page table level. On x86, pud_free_pmd_page() and > pmd_free_pte_page() are an exception to the rule: they call > free_page() directly. > > Constructor/destructor calls are abou

[PATCH v2 02/12] x86: pgtable: Always use pte_free_kernel()

2025-04-08 Thread Kevin Brodsky
Page table pages are normally freed using the appropriate helper for the given page table level. On x86, pud_free_pmd_page() and pmd_free_pte_page() are an exception to the rule: they call free_page() directly. Constructor/destructor calls are about to be introduced for kernel PTEs. To avoid missi