On Mon, Jul 11, 2011 at 05:57:29PM +0100, Frank Hofmann wrote:
On Mon, 11 Jul 2011, Lorenzo Pieralisi wrote:
[ ... ]
The array of pointers is there to save pgdir on idle entry, one per-cpu.
If you're going through cpu_{do_}suspend/resume, the TTBRs are saved/restored anyway, what do you need to keep the virtual addresses around for ?
Because I switch mm before calling suspend, which is called with a cloned pgdir. I am not sure I can avoid that.
On resume, you'll be restoring the same thread as was previously running, right ? If so, all you do there is copying current->active_mm->pgd to some other place ?
You are right, I will remove that code unless I can use the saved value on resume and I cannot rely on current to be retrieved at that point.
Also, if you'd be using cpu_suspend(), would there still be a need for cpu_switch_mm() before ? It'd rather be a case of possibly calling that before the MMU-off sequence / cpu_resume() ?
Or is it that you use the new pgdir to make a memory region uncacheable ?
Yes, that's the reason why I switch mm (eg uncacheable memory used to save registers through cpu_do_suspend and mapped in the cloned pgdir at boot + some control variables used when MMU is off).
Thanks, Lorenzo