Skip to content
Snippets Groups Projects
Commit 9dc7cc25 authored by Glauber Costa's avatar Glauber Costa Committed by Pekka Enberg
Browse files

mmu: allow early tlb flushes


TLB flushes cannot happen early, because we will try to send IPIs around before
they are ready to go. Now, the funny thing is *why* that happen:

We test for the size of the cpu vector to be 1. But before the cpus are
initialized, that vector is empty. Because there is a limit on how soon we can
initialize a cpu(), let's change the test to also acount for an empty vector.
It should be obvious and clear that when we have an empty vector, only one cpu
is present.

I have triggered this in the context of my last patchset for threads. My test
script was set to -c1 (sorry about that), and as soon as I tested it with SMP
it exploded here.

Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
parent 63216e85
No related branches found
No related tags found
No related merge requests found
......@@ -330,7 +330,7 @@ inter_processor_interrupt tlb_flush_ipi{[] {
void tlb_flush()
{
tlb_flush_this_processor();
if (sched::cpus.size() == 1)
if (sched::cpus.size() <= 1)
return;
std::lock_guard<mutex> guard(tlb_flush_mutex);
tlb_flush_waiter = sched::thread::current();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment