[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ec7247d0-0379-487d-a2d7-21b81dcd0c38@intel.com>
Date: Tue, 4 Mar 2025 07:10:13 -0800
From: Dave Hansen <dave.hansen@...el.com>
To: Borislav Petkov <bp@...en8.de>
Cc: Rik van Riel <riel@...riel.com>, x86@...nel.org,
linux-kernel@...r.kernel.org, peterz@...radead.org,
dave.hansen@...ux.intel.com, zhengqi.arch@...edance.com,
nadav.amit@...il.com, thomas.lendacky@....com, kernel-team@...a.com,
linux-mm@...ck.org, akpm@...ux-foundation.org, jackmanb@...gle.com,
jannh@...gle.com, mhklinux@...look.com, andrew.cooper3@...rix.com,
Manali.Shukla@....com, mingo@...nel.org
Subject: Re: [PATCH v14 03/13] x86/mm: add INVLPGB support code
On 3/4/25 03:00, Borislav Petkov wrote:
> On Mon, Mar 03, 2025 at 11:23:58AM -0800, Dave Hansen wrote:
>> Here's a plain diff if you just want to squish it in.
>
>> diff --git a/arch/x86/include/asm/tlb.h b/arch/x86/include/asm/tlb.h
>> index 5375145eb9596..3bd617c204346 100644
>> --- a/arch/x86/include/asm/tlb.h
>> +++ b/arch/x86/include/asm/tlb.h
>> @@ -28,6 +28,11 @@ static inline void invlpg(unsigned long addr)
>> asm volatile("invlpg (%0)" ::"r" (addr) : "memory");
>> }
>>
>> +enum invlpgb_stride {
>
> Right, this is an address stride, as the text calls it.
>
>> + NO_STRIDE = 0,
>> + PTE_STRIDE = 0,
>
> Ok, so those are confusing. No stride is PTE stride so let's just zap
> NO_STRIDE.
Passing "PTE_STRIDE" to an operation that doesn't have a stride is
pretty confusing too.
...
> /* Flush all mappings, including globals, for all PCIDs. */
> @@ -117,21 +126,21 @@ static inline void invlpgb_flush_all(void)
> * as it is cheaper.
> */
> guard(preempt)();
> - __invlpgb(0, 0, 0, 1, 0, INVLPGB_INCLUDE_GLOBAL);
> + __invlpgb(0, 0, 0, 1, PTE_STRIDE, INVLPGB_FLAG_INCLUDE_GLOBAL);
> __tlbsync();
> }
This one, for example. It's not flushing PTEs an doesn't have a start
address or nr>0.
So, we could have the enum be totally divorced from the hardware type:
NO_STRIDE,
PTE_STRIDE,
PMD_STRIDE
and decode it at the end:
if (stride == PMD_STRIDE)
foo | PMD_STRIDE_BIT;
Powered by blists - more mailing lists