From: weiming Subject: a quick question about _PAGE_GLOBAL flag in para virt mode Date: Sat, 14 Feb 2009 20:40:55 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1819297858==" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org --===============1819297858== Content-Type: multipart/alternative; boundary=0016e645b764374c110462eb2997 --0016e645b764374c110462eb2997 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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. Below are the codes: 876 #define adjust_guest_l1e (pl1e, d) \ 877 do { \ 878 if ( likely (l1e_get_flags ((pl1e)) & _PAGE_PRESENT ) && \ 879 likely (!is_pv_32on64_domain (d)) ) \ 880 { \ 881 */* _PAGE_GUEST_KERNEL page cannot have the Global bit set. */* \ 882 if ( (l1e_get_flags ((pl1e)) & (_PAGE_GUEST_KERNEL |_PAGE_GLOBAL )) \ 883 == (_PAGE_GUEST_KERNEL |_PAGE_GLOBAL ) ) \ 884 MEM_LOG (*"Global bit is set to kernel page %lx"*, \ 885 l1e_get_pfn ((pl1e))); \ 886 if ( !(l1e_get_flags ((pl1e)) & _PAGE_USER ) ) \ 887 l1e_add_flags ((pl1e), (_PAGE_GUEST_KERNEL |_PAGE_USER )); \ 888 if ( !(l1e_get_flags ((pl1e)) & _PAGE_GUEST_KERNEL ) ) \ 889 l1e_add_flags ((pl1e), (_PAGE_GLOBAL |_PAGE_USER )); \ 890 } \ 891 } while ( 0 ) Thanks weiming --0016e645b764374c110462eb2997 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi,

I noticed that in adjust_guest_l1e()  in arch/x86/mm.c, _PA= GE_GLOBAL flag is set for guest's non-kernel pages. Meanwhile, _PAGE_GU= EST_KERNEL page cannot have the Global bit set.

What's the purp= ose of setting Global bit for guest's user pages? AFAIK, when the Globa= l bit is set, it prevents those entries be flushed from TLB. So it makes mo= re sense to set it for guest's kernel pages.

Below are the codes:
876 #define a=
djust_guest_l1e(pl1e, d)                                            \
877     do {                                      =
                               \
878 if= ( lik= ely(l1e_get_flags((pl1e)) & _PAGE_PRESENT) && = \
879 likely(!is_pv_32on64_domain<= /a>(d)) ) \
880 { = \
881 = /* _PAGE_GUEST_KERNEL page cannot have the Global bit set. */ \
882 if ( (l1e_get_flags((pl1e)) &= amp; (_PAGE_GUEST_KERNEL|_PAGE_GLOBAL)) \
883 =3D=3D (_PAGE_GUEST_KER= NEL|_PAGE_GLOBAL) ) \
884 MEM_LOG("Global bit is = set to kernel page %lx", \
885 l1e_get_pfn((pl1e))= ); \
886 if ( !(l1e_get_flags((pl1e)) = & _PAGE_USER) ) \
887 l1e_add_flags((pl1e), (_PAGE_GUEST_KERNEL|_PAGE_USER)); \
888 if ( !(l1e_get_flags((pl1e)) = & _PAGE_GUEST_KERNEL) ) \
889 l1e_add_flags((pl1e), (_P= AGE_GLOBAL|_PAGE_USER)); \
890 } = \
891 } whil= e ( 0 )


Thanks
weiming
--0016e645b764374c110462eb2997-- --===============1819297858== 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 --===============1819297858==--