All of lore.kernel.org
 help / color / mirror / Atom feed
* a quick question about _PAGE_GLOBAL flag in para virt mode
@ 2009-02-15  1:40 weiming
  2009-02-15  9:37 ` Jeremy Fitzhardinge
  0 siblings, 1 reply; 7+ messages in thread
From: weiming @ 2009-02-15  1:40 UTC (permalink / raw)
  To: xen-devel@lists.xensource.com


[-- Attachment #1.1: Type: text/plain, Size: 4107 bytes --]

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 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L876>
#define adjust_guest_l1e
<http://lxr.xensource.com/lxr/ident?a=x86_64;i=adjust_guest_l1e>(pl1e,
d)                                            \
877 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L877>
    do {
      \
878 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L878>
        if ( likely
<http://lxr.xensource.com/lxr/ident?a=x86_64;i=likely>(l1e_get_flags
<http://lxr.xensource.com/lxr/ident?a=x86_64;i=l1e_get_flags>((pl1e))
& _PAGE_PRESENT
<http://lxr.xensource.com/lxr/ident?a=x86_64;i=_PAGE_PRESENT>) &&
          \
879 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L879>
             likely
<http://lxr.xensource.com/lxr/ident?a=x86_64;i=likely>(!is_pv_32on64_domain
<http://lxr.xensource.com/lxr/ident?a=x86_64;i=is_pv_32on64_domain>(d))
)                               \
880 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L880>
        {
      \
881 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L881>
            */* _PAGE_GUEST_KERNEL page cannot have the Global bit
set. */*    \
882 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L882>
            if ( (l1e_get_flags
<http://lxr.xensource.com/lxr/ident?a=x86_64;i=l1e_get_flags>((pl1e))
& (_PAGE_GUEST_KERNEL
<http://lxr.xensource.com/lxr/ident?a=x86_64;i=_PAGE_GUEST_KERNEL>|_PAGE_GLOBAL
<http://lxr.xensource.com/lxr/ident?a=x86_64;i=_PAGE_GLOBAL>)) \
883 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L883>
                 == (_PAGE_GUEST_KERNEL
<http://lxr.xensource.com/lxr/ident?a=x86_64;i=_PAGE_GUEST_KERNEL>|_PAGE_GLOBAL
<http://lxr.xensource.com/lxr/ident?a=x86_64;i=_PAGE_GLOBAL>) )
              \
884 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L884>
                MEM_LOG
<http://lxr.xensource.com/lxr/ident?a=x86_64;i=MEM_LOG>(*"Global bit
is set to kernel page %lx"*,              \
885 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L885>
                        l1e_get_pfn
<http://lxr.xensource.com/lxr/ident?a=x86_64;i=l1e_get_pfn>((pl1e)));
                              \
886 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L886>
            if ( !(l1e_get_flags
<http://lxr.xensource.com/lxr/ident?a=x86_64;i=l1e_get_flags>((pl1e))
& _PAGE_USER <http://lxr.xensource.com/lxr/ident?a=x86_64;i=_PAGE_USER>)
)                     \
887 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L887>
                l1e_add_flags
<http://lxr.xensource.com/lxr/ident?a=x86_64;i=l1e_add_flags>((pl1e),
(_PAGE_GUEST_KERNEL
<http://lxr.xensource.com/lxr/ident?a=x86_64;i=_PAGE_GUEST_KERNEL>|_PAGE_USER
<http://lxr.xensource.com/lxr/ident?a=x86_64;i=_PAGE_USER>));      \
888 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L888>
            if ( !(l1e_get_flags
<http://lxr.xensource.com/lxr/ident?a=x86_64;i=l1e_get_flags>((pl1e))
& _PAGE_GUEST_KERNEL
<http://lxr.xensource.com/lxr/ident?a=x86_64;i=_PAGE_GUEST_KERNEL>) )
           \
889 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L889>
                l1e_add_flags
<http://lxr.xensource.com/lxr/ident?a=x86_64;i=l1e_add_flags>((pl1e),
(_PAGE_GLOBAL <http://lxr.xensource.com/lxr/ident?a=x86_64;i=_PAGE_GLOBAL>|_PAGE_USER
<http://lxr.xensource.com/lxr/ident?a=x86_64;i=_PAGE_USER>));
  \
890 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L890>
        }
      \
891 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L891>
    } while ( 0 )
 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L892>



Thanks
weiming

[-- Attachment #1.2: Type: text/html, Size: 5191 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-02-16  2:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-15  1:40 a quick question about _PAGE_GLOBAL flag in para virt mode weiming
2009-02-15  9:37 ` Jeremy Fitzhardinge
2009-02-15 17:30   ` weiming
2009-02-15 22:26     ` Jeremy Fitzhardinge
2009-02-15 23:06       ` John Levon
2009-02-16  0:47       ` weiming
2009-02-16  2:35         ` How to disconnect a network card in the Virtual machine? ANNIE LI

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.