From: weiming Subject: Re: a quick question about _PAGE_GLOBAL flag in para virt mode Date: Sun, 15 Feb 2009 12:30:55 -0500 Message-ID: References: <4997E249.1050407@goop.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0986506105==" Return-path: In-Reply-To: <4997E249.1050407@goop.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Jeremy Fitzhardinge Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org --===============0986506105== Content-Type: multipart/alternative; boundary=0016e645a3dcb5cf9b0462f86e78 --0016e645a3dcb5cf9b0462f86e78 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Thanks, Jeremy 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? 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? Thanks Weiming On Sun, Feb 15, 2009 at 4:37 AM, Jeremy Fitzhardinge wrote: > weiming wrote: > >> Hi, >> >> I noticed that in adjust_guest_l1e() in arch/x86/mm.c, _PAGE_GLOBAL flag >> is set for guest's non-kernel pages. Meanwhile, _PAGE_GUEST_KERNEL page >> cannot have the Global bit set. >> >> What's the purpose of setting Global bit for guest's user pages? AFAIK, >> when the Global bit is set, it prevents those entries be flushed from TLB. >> So it makes more sense to set it for guest's kernel pages. >> > > In 64-bit, syscalls must go via Xen, which entails a cr3 reload. This > would normally flush the tlb, but since the usermode pages are global, they > remain in the tlb during the user->xen->kernel->xen->user transition. > > J > --0016e645a3dcb5cf9b0462f86e78 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks, Jeremy

When a normal context switch happens (like process sw= itch), those tlb entries will still be flushed no matter if global bit is s= et or not, is it correct?

why not set global bit for user kernel pag= es? 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 underst= anding right?

Thanks
Weiming




On Sun,= Feb 15, 2009 at 4:37 AM, Jeremy Fitzhardinge <jeremy@goop.org> wrote:
weiming wrote:
Hi,

I noticed that in adjust_guest_l1e()  in arch/x86/mm.c, _PAGE_GLOBAL f= lag is set for guest's non-kernel pages. Meanwhile, _PAGE_GUEST_KERNEL = page cannot have the Global bit set.

What's the purpose of setting Global bit for guest's user pages? AF= AIK, when the Global bit is set, it prevents those entries be flushed from = TLB. So it makes more sense to set it for guest's kernel pages.

In 64-bit, syscalls must go via Xen, which entails a cr3 reload.  This= would normally flush the tlb, but since the usermode pages are global, the= y remain in the tlb during the user->xen->kernel->xen->user tra= nsition.

  J

--0016e645a3dcb5cf9b0462f86e78-- --===============0986506105== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============0986506105==--