Messages in this thread | | | From | Pasha Tatashin <> | Date | Mon, 18 Mar 2024 12:57:32 -0400 | Subject | Re: [RFC 00/14] Dynamic Kernel Stacks |
| |
> I think you'll need to broadcast an invalidate. > Consider: > CPU A: task allocates extra pages and adds something to some list. > CPU B: accesses that data and maybe modifies it. > Some page-table walk setup ut the TLB. > CPU A: task detects the modify, removes the item from the list, > collapses back the stack and sleeps. > Stack pages freed. > CPU A: task wakes up (on the same cpu for simplicity). > Goes down a deep stack and puts an item on a list. > Different physical pages are allocated. > CPU B: accesses the associated KVA. > It better not have a cached TLB. > > Doesn't that need an IPI?
Yes, this is annoying. If we share a stack with another CPU, then get a new stack, and share it again with another CPU we get in trouble. Yet, IPI during context switch would kill the performance :-\
I wonder if there is a way to optimize this scenario like doing IPI invalidation only after stack sharing?
Pasha
| |