WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Subject: Re: [Xen-devel] a quick question about _PAGE_GLOBAL flag in para virt mode
From: weiming <zephyr.zhao@xxxxxxxxx>
Date: Sun, 15 Feb 2009 19:47:15 -0500
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Sun, 15 Feb 2009 16:48:33 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=yJEvXT0FCMVWf0iMed+eMJ1lZ6rVMCXoHj4u+hXc6TY=; b=oCbqfzVoGNLeNm0/BITj7HaAC15sYUI5XMYnimj/CkwXp8iVKoxcMF/5C8VlmfgTzt XIVc/zfEw5NGwY0ZYJLG5P3ASy7/Uzq6Kxxo8dMfWMz6rd31jCurTfsINSI9aHzTypvG KakihzwfLZC27xbEjvTtmZ/tEHZT4rbg50Kwo=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=W1nYuhZ5kSZ0l46ouMIHMrsufgwGymA2E8fPIaDVQPuFkO5QySXGLRiBJSNM5mEY0f 0jGKJ8l9ww2QOuhgaMyK5eGZ3LPeaWX4rMhSpFEfM0X9ATmjJ43yqacZYfcTPF9ZKhfD T7pMwAqPY8rNN5OemO8GM5X+7r8ltvIL5HpSw=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <49989685.6020004@xxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <add59a3f0902141740j58f0223eu4d04a169885b6f54@xxxxxxxxxxxxxx> <4997E249.1050407@xxxxxxxx> <add59a3f0902150930m57ab843bi5bcdb90b6a4859a8@xxxxxxxxxxxxxx> <49989685.6020004@xxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Oh, right!  In 64-bit mode, both guest kernel and user processes are both in ring 3, so we can't pin the mapping of user kernel in TLB, otherwise, user code would have access to kernels. Thanks!



On Sun, Feb 15, 2009 at 5:26 PM, Jeremy Fitzhardinge <jeremy@xxxxxxxx> wrote:
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