[RFC PATCH v6 27/29] x86/mm/pti: Implement a TLB flush immediately after a switch to kernel CR3
Frederic Weisbecker
frederic at kernel.org
Wed Oct 29 03:31:34 PDT 2025
Le Wed, Oct 29, 2025 at 11:16:23AM +0100, Valentin Schneider a écrit :
> On 28/10/25 16:59, Frederic Weisbecker wrote:
> > Le Fri, Oct 10, 2025 at 05:38:37PM +0200, Valentin Schneider a écrit :
> >> @@ -171,8 +172,27 @@ For 32-bit we have the following conventions - kernel is built with
> >> andq $(~PTI_USER_PGTABLE_AND_PCID_MASK), \reg
> >> .endm
> >>
> >> -.macro COALESCE_TLBI
> >> +.macro COALESCE_TLBI scratch_reg:req
> >> #ifdef CONFIG_COALESCE_TLBI
> >> + /* No point in doing this for housekeeping CPUs */
> >> + movslq PER_CPU_VAR(cpu_number), \scratch_reg
> >> + bt \scratch_reg, tick_nohz_full_mask(%rip)
> >> + jnc .Lend_tlbi_\@
> >
> > I assume it's not possible to have a static call/branch to
> > take care of all this ?
> >
>
> I think technically yes, but that would have to be a per-cpu patchable
> location, which would mean something like each CPU having its own copy of
> that text page... Unless there's some existing way to statically optimize
>
> if (cpumask_test_cpu(smp_processor_id(), mask))
>
> where @mask is a boot-time constant (i.e. the nohz_full mask).
Or just check housekeeping_overriden static key before everything. This one is
enabled only if either nohz_full, isolcpus or cpuset isolated partition (well,
it's on the way for the last one) are running, but those are all niche, which
means you spare 99.999% kernel usecases.
Thanks.
>
> > Thanks.
> >
> > --
> > Frederic Weisbecker
> > SUSE Labs
>
>
--
Frederic Weisbecker
SUSE Labs
More information about the linux-arm-kernel
mailing list