From: "HuYanyan" Subject: relationship of the auto_translated_physmap feature and the shadow_mode_translate mode of domain Date: Fri, 30 May 2008 22:45:36 +0800 Message-ID: <005601c8c263$d307e540$7917afc0$@buaa.edu.cn> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1356888438==" Return-path: Content-Language: zh-cn List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Mime-version: 1.0 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 这是一封 MIME 格式的多部分邮件。 --===============1356888438== Content-Type: multipart/alternative; boundary="----=_NextPart_000_0057_01C8C2A6.E12B2540" Content-Language: zh-cn 这是一封 MIME 格式的多部分邮件。 ------=_NextPart_000_0057_01C8C2A6.E12B2540 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Hi All, I'm studing the memory management of Xen, I noticed the Domain0 kernel(Linux) declared its features in the .section __xen_guest, just like this: /*linux-2.6-xen-sparse/arch/i386/kernel/head-xen.S*/ .ascii ",FEATURES=writable_page_tables" .ascii "|writable_descriptor_tables" .ascii "|auto_translated_physmap" .ascii "|pae_pgdir_above_4gb" .ascii "|supervisor_mode_kernel" All these features information will be parsed by xen before the domain0 kernel image was loaded, and I noticed when the hypervisor responded to the HYPERVISOR_xen_version(XENVER_get_features, &fi) hypercall of domain0, it will check the PG_translate and PG_SH_enable flags of d->arch.paging.mode of the calling domain to determine how to fill the output parameter fi, just like this: /*xen/common/kernel.c*/ if ( shadow_mode_translate(current->domain) ) fi.submap |= (1U << XENFEAT_writable_page_tables) | (1U << XENFEAT_auto_translated_physmap); and domain0 kernel will use this information to determine how to set its own feature flags, and whether to do the p2m and m2p translation between pfn and mfn, the following is an example: /*linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/maddr.h */ static inline unsigned long pfn_to_mfn(unsigned long pfn) { if (xen_feature(XENFEAT_auto_translated_physmap)) return pfn; BUG_ON(max_mapnr && pfn >= max_mapnr); return phys_to_machine_mapping[pfn] & ~FOREIGN_FRAME_BIT; } What I want to know is whether there are some relationship between the auto_translated_physmap feature and the shadow_mode_translate mode of domain, do they have the same meaning? I think this feature will work(Guest kernel do the p2m and m2p translation) only when the shadow mode of domain is enabled, but this is not true for domain0 because it's a paravirtualized domain, why did it still declare this feature? I am looking forward to your response, thank you very much. Regards, HUYanyan ------=_NextPart_000_0057_01C8C2A6.E12B2540 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable

Hi All,

    I'm studing the memory management of Xen, I noticed the Domain0 = kernel(Linux) declared its features in the .section __xen_guest, just like = this:

 

/*linux-2.6-xen-sparse/arch/i386/kernel/head-xen.= S*/

         = .ascii  ",FEATURES=3Dwritable_page_tables"

         = .ascii         =          "|writable_descriptor_tables"

         = .ascii         =          "|auto_translated_physmap"

         = .ascii         =          "|pae_pgdir_above_4gb"

         = .ascii         =          "|supervisor_mode_kernel"

 

   All these = features information will be parsed by xen before the domain0 kernel image was loaded, and I = noticed when the hypervisor responded to the HYPERVISOR_xen_version(XENVER_get_features, = &fi) hypercall of domain0, it will check the PG_translate and PG_SH_enable flags of = d->arch.paging.mode of the = calling domain to determine how to fill the output parameter fi, just like this:

 

/*xen/common/kernel.c*/

if ( shadow_mode_translate(current->domain) )

          =       fi.submap |=3D

          =           (1U << XENFEAT_writable_page_tables) |

          =           (1U << XENFEAT_auto_translated_physmap);

 

    and domain0 kernel will use this information to determine how to set its = own feature flags, and whether to do the p2m and m2p translation between pfn = and mfn, the following is an example:

 

/*linux-2.6-xen-sparse/include/asm-i386/mach-xen/= asm/maddr.h */

static inline unsigned long pfn_to_mfn(unsigned long pfn)

{

         if (xen_feature(XENFEAT_auto_translated_physma= p))

          =          return pfn;

         = BUG_ON(max_mapnr && pfn >=3D max_mapnr);

         return phys_to_machine_mapping[pfn] & = ~FOREIGN_FRAME_BIT;

}

 

    What I = want to know is whether there are some relationship between the auto_translated_physmap feature and the shadow_mode_translate mode of domain, do they have the same meaning? I think this = feature will work(Guest kernel do the p2m and m2p translation) only when the shadow = mode of domain is enabled, but this is not true for domain0 because it's a paravirtualized domain, why did it still declare this feature? I am = looking forward to your response, thank you very much.

 

 

Regards,

HUYanyan

 

------=_NextPart_000_0057_01C8C2A6.E12B2540-- --===============1356888438== 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 --===============1356888438==--