Re: [PATCH v14 05/13] x86/mm: use INVLPGB in flush_tlb_all
From: Dave Hansen
Date: Fri Feb 28 2025 - 14:18:04 EST
On 2/25/25 19:00, Rik van Riel wrote:
> void flush_tlb_all(void)
> {
> count_vm_tlb_event(NR_TLB_REMOTE_FLUSH);
> +
> + /* First try (faster) hardware-assisted TLB invalidation. */
> + if (cpu_feature_enabled(X86_FEATURE_INVLPGB)) {
> + guard(preempt)();
> + invlpgb_flush_all();
> + return;
> + }
We haven't talked at all about the locking rules for
invlpgb_flush_all(). It was used once in this series without any
explicit preempt twiddling. I assume that was because it was used in a
path where preempt is disabled.
If it does need a universal rule about preempt, can we please add an:
lockdep_assert_preemption_disabled()
along with a comment about why it needs preempt disabled?
Also, the previous code did:
if (cpu_feature_enabled(X86_FEATURE_INVLPGB))
invlpgb_foo();
else
old_foo();
Is there a reason to break with that pattern? It would be nice to be
consistent.