[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250304115343.GGZ8bpxwAZo9tksg17@fat_crate.local>
Date: Tue, 4 Mar 2025 12:53:43 +0100
From: Borislav Petkov <bp@...en8.de>
To: Dave Hansen <dave.hansen@...el.com>
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 13/13] x86/mm: only invalidate final translations
with INVLPGB
On Mon, Mar 03, 2025 at 02:40:49PM -0800, Dave Hansen wrote:
> On 2/25/25 19:00, Rik van Riel wrote:
> > static inline void __invlpgb_flush_user_nr_nosync(unsigned long pcid,
> > unsigned long addr,
> > u16 nr,
> > - bool pmd_stride)
> > + bool pmd_stride,
> > + bool freed_tables)
> > {
> > - __invlpgb(0, pcid, addr, nr, pmd_stride, INVLPGB_PCID | INVLPGB_VA);
> > + u8 flags = INVLPGB_PCID | INVLPGB_VA;
> > +
> > + if (!freed_tables)
> > + flags |= INVLPGB_FINAL_ONLY;
> > +
> > + __invlpgb(0, pcid, addr, nr, pmd_stride, flags);
> > }
>
> I'm not sure this is OK.
>
> Think of a hugetlbfs mapping with shared page tables. Say you had a
> 1GB-sized and 1GB-aligned mapping. It might zap the one PUD that it
> needs, set tlb->cleared_puds=1 but it never sets ->freed_tables because
> it didn't actually free the shared page table page.
>
> I'd honestly just throw this patch out of the series for now. All of the
> other TLB invalidation that the kernel does implicitly toss out the
> mid-level paging structure caches.
Right, I guess we can revisit this later, once the dust settles.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists