1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 15:07:45 +00:00

Kernel: Ignore TLB flush requests for user addresses of other processes

If a TLB flush request is broadcast to other processors and the addresses
to flush are user mode addresses, we can ignore such a request on the
target processor if the page directory currently in use doesn't match
the addresses to be flushed. We still need to broadcast to all processors
in that case because the other processors may switch to that same page
directory at any time.
This commit is contained in:
Tom 2021-01-02 12:27:38 -07:00 committed by Andreas Kling
parent c630669304
commit 0d44ee6f2b
5 changed files with 25 additions and 12 deletions

View file

@ -666,6 +666,7 @@ struct ProcessorMessage {
void (*free)(void*);
} callback_with_data;
struct {
const PageDirectory* page_directory;
u8* ptr;
size_t page_count;
} flush_tlb;
@ -787,7 +788,7 @@ public:
}
static void flush_tlb_local(VirtualAddress vaddr, size_t page_count);
static void flush_tlb(VirtualAddress vaddr, size_t page_count);
static void flush_tlb(const PageDirectory*, VirtualAddress, size_t);
Descriptor& get_gdt_entry(u16 selector);
void flush_gdt();
@ -991,7 +992,7 @@ public:
}
static void smp_unicast(u32 cpu, void (*callback)(), bool async);
static void smp_unicast(u32 cpu, void (*callback)(void*), void* data, void (*free_data)(void*), bool async);
static void smp_broadcast_flush_tlb(VirtualAddress vaddr, size_t page_count);
static void smp_broadcast_flush_tlb(const PageDirectory*, VirtualAddress, size_t);
template<typename Callback>
static void deferred_call_queue(Callback callback)