[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250103124431.GBZ3fbr-eRbl83G_Fm@fat_crate.local>
Date: Fri, 3 Jan 2025 13:44:31 +0100
From: Borislav Petkov <bp@...en8.de>
To: Rik van Riel <riel@...riel.com>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org, kernel-team@...a.com,
dave.hansen@...ux.intel.com, luto@...nel.org, peterz@...radead.org,
tglx@...utronix.de, mingo@...hat.com, hpa@...or.com,
akpm@...ux-foundation.org, nadav.amit@...il.com,
zhengqi.arch@...edance.com, linux-mm@...ck.org
Subject: Re: [PATCH 05/12] x86/mm: add INVLPGB support code
On Mon, Dec 30, 2024 at 12:53:06PM -0500, Rik van Riel wrote:
> +static inline void __invlpgb(unsigned long asid, unsigned long pcid, unsigned long addr,
> + int extra_count, bool pmd_stride, unsigned long flags)
That pmd_stride thing - the callers should supply a bool: true/false instead
of 0/1 for more clarity at the call sites.
> +{
> + u64 rax = addr | flags;
> + u32 ecx = (pmd_stride << 31) | extra_count;
You need to handle the case where extra_count becomes negative because callers
supply nr=0 and you do "nr - 1" below and then you'll end up flushing
0b1111_1111_1111_1111 TLB entries.
"ECX[15:0] contains a count of the number of sequential pages to invalidate in
addition to the original virtual address, starting from the virtual address
specified in rAX."
> + u32 edx = (pcid << 16) | asid;
> +
> + asm volatile("invlpgb" : : "a" (rax), "c" (ecx), "d" (edx));
> +}
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists