Re: [PATCH v10 00/10] x86: Quiesce text_poke() IPIs
From: Andy Lutomirski
Date: Tue Dec 01 2026 - 16:28:55 EST
On Tue, Dec 1, 2026, at 4:55 AM, Peter Zijlstra wrote:
> On Tue, Dec 01, 2026 at 12:10:26PM +0100, Valentin Schneider wrote:
>
>> The real problem is those (kernel) TLB flushes. I found no way to
>> check/validate when/where exactly vmalloc accesses can happen in the kernel
>> entry, so the only sane approach was to have the catch-up sequence (TLB
>> flush) happen exactly when any vmalloc becomes possible: at the kPTI CR3
>> switch.
>
> Right, so the task stacks are vmalloc. So since you didn't qualify what
> vmalloc accesses are problematic, it is pretty much the very first thing
> you touch.
I spent like thirty seconds contemplating exactly how nasty it would be to try to implement all this cleanly without touching the vmapped stack.
And then I decided this was a nonissue. Consider how we actually reach the enter-the-kernel code: we start in the kernel *on the task stack*, then we run the exit-the-kernel code, then we maybe go to userspace and come back, then we run the enter-the-kernel code.
There had better not be anything in the kernel that changes the task stack mapping and relies on an IPI that runs in the interim! If there was, it would surely crash us just as crashily if we were just executing normal kernel code, expecially with IRQs off :)
IOW, the task stack is just about the only vmapped thing that we *can* rely on to be coherent wrt the TLB.