[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] a quick question about _PAGE_GLOBAL flag in para virt mode



weiming wrote:
When a normal context switch happens (like process switch), those tlb entries will still be flushed no matter if global bit is set or not, is it correct?

Things would go very wrong if it didn't... I haven't checked in detail, but presumably when the kernel does a user cr3 reload, Xen will do a global tlb flush (or at least make sure one happens when needed).

why not set global bit for user kernel pages? I guess this is because when domain switchs, all tlb entries will still be flushed, so it's not necessary for user kernel pages. Is my understanding right?

64-bit Xen uses paging to protect the guest kernel from guest usermode, and protect Xen from the guest kernel, and as a result has to do a cr3 reload for any user->kernel switch (which is why it has to go via Xen). We don't want kernel mappings to be visible to usermode, so they have to only be in tlb while we're actually running in guest kernel mode; setting global on the kernel mappings wouldn't be useful because we always need to flush them anyway when returning to usermode.

Or to put it another way, it makes sense to set global on user mappings because they're always mapped, regardless of what context we're in; the only time they need to be flushed is either doing a user process context switch, or a vcpu context switch.

   J

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.