SMP - fixed usage of stale TLB entries
- when kernel copies from userspace, it must be sure that the TLB entries are not stale and thus the referenced memory is correct - everytime we change a process' address space we set p_stale_tlb bits for all CPUs. - Whenever a cpu finds its bit set when it wants to access the process' memory, it refreshes the TLB - it is more conservative than it needs to be but it has low overhead than checking precisely
This commit is contained in:
@@ -127,6 +127,11 @@ PUBLIC int do_update(struct proc * caller, message * m_ptr)
|
||||
printf("do_update: curr ptproc %d\n", get_cpulocal_var(ptproc)->p_endpoint);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
bits_fill(src_rp->p_stale_tlb, CONFIG_MAX_CPUS);
|
||||
bits_fill(dst_rp->p_stale_tlb, CONFIG_MAX_CPUS);
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -159,6 +159,16 @@ PUBLIC int do_vmctl(struct proc * caller, message * m_ptr)
|
||||
* cpu
|
||||
*/
|
||||
RTS_UNSET(p, RTS_VMINHIBIT);
|
||||
#ifdef CONFIG_SMP
|
||||
/*
|
||||
* We don't know whether kernel has the changed mapping
|
||||
* installed to access userspace memory. And if so, on what CPU.
|
||||
* More over we don't know what mapping has changed and how and
|
||||
* therefore we must invalidate all mappings we have anywhere.
|
||||
* Next time we map memory, we map it fresh.
|
||||
*/
|
||||
bits_fill(p->p_stale_tlb, CONFIG_MAX_CPUS);
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user