Skip to contentSkip to conversation

x86/mm: remove the linear mapping of the p2m tables

PATCH In review Tim Deegan 5 participants 13 messages Sep 13, 2012 – Sep 14, 2012

lore
Share & tools
lore

Tim Deegan

author
#0 lore raw

PATCH 1/1 x86/mm: remove the linear mapping of the p2m tables

# HG changeset patch
# User Tim Deegan <[email protected]>
# Date 1347544824 -3600
# Node ID a770d1c8448d73ccf2ec36a5322532c2e3c14641 # Parent 5691e4cc17da7fe8664a67f1d07c3755c0ca34ed x86/mm: remove the linear mapping of the p2m tables.

Mapping the p2m into the monitor tables was an important optimization on 32-bit builds, where it avoided mapping and unmapping p2m pages during a walk. On 64-bit it makes no difference -- see
http://old-list-archives.xen.org/archives/html/xen-devel/2010-04/msg00981.html
Get rid of it, and use the explicit walk for all lookups.

xen/arch/x86/mm/hap/hap.c +0 -5
diff -r 5691e4cc17da -r a770d1c8448d xen/arch/x86/mm/hap/hap.c
@@ -405,11 +405,6 @@ static void hap_install_xen_entries_in_l
     l4e[l4_table_offset(LINEAR_PT_VIRT_START)] =
         l4e_from_pfn(mfn_x(l4mfn), __PAGE_HYPERVISOR);
 
-    /* Install the domain-specific P2M table */
-    l4e[l4_table_offset(RO_MPT_VIRT_START)] =
-        l4e_from_pfn(mfn_x(pagetable_get_mfn(p2m_get_pagetable(p2m_get_hostp2m(d)))),
-                     __PAGE_HYPERVISOR);
-
     hap_unmap_domain_page(l4e);
 }
 
xen/arch/x86/mm/p2m-pt.c +0 -191

213 lines not on this page · raw message

xen/arch/x86/mm/shadow/multi.c +0 -8
diff -r 5691e4cc17da -r a770d1c8448d xen/arch/x86/mm/shadow/multi.c
@@ -1472,14 +1472,6 @@ void sh_install_xen_entries_in_l4(struct
             shadow_l4e_from_mfn(gl4mfn, __PAGE_HYPERVISOR);
     }
 
-    if ( shadow_mode_translate(v->domain) )
-    {
-        /* install domain-specific P2M table */
-        sl4e[shadow_l4_table_offset(RO_MPT_VIRT_START)] =
-            shadow_l4e_from_mfn(pagetable_get_mfn(p2m_get_pagetable(p2m_get_hostp2m(d))),
-                                __PAGE_HYPERVISOR);
-    }
-
     sh_unmap_domain_page(sl4e);    
 }
 #endif
xen/include/asm-x86/p2m.h +0 -16
diff -r 5691e4cc17da -r a770d1c8448d xen/include/asm-x86/p2m.h
@@ -35,22 +35,6 @@
 extern bool_t opt_hap_1gb, opt_hap_2mb;
 
 /*
- * The phys_to_machine_mapping maps guest physical frame numbers 
- * to machine frame numbers.  It only exists for paging_mode_translate 
- * guests. It is organised in page-table format, which:
- *
- * (1) allows us to use it directly as the second pagetable in hardware-
- *     assisted paging and (hopefully) iommu support; and 
- * (2) lets us map it directly into the guest vcpus' virtual address space 
- *     as a linear pagetable, so we can read and write it easily.
- *
- * For (2) we steal the address space that would have normally been used
- * by the read-only MPT map in a non-translated guest.  (For 
- * paging_mode_external() guests this mapping is in the monitor table.)
- */
-#define phys_to_machine_mapping ((l1_pgentry_t *)RO_MPT_VIRT_START)
-
-/*
  * The upper levels of the p2m pagetable always contain full rights; all 
  * variation in the access control bits is made in the level-1 PTEs.
  * 
#1 lore raw
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Tim Deegan

# HG changeset patch
# User Tim Deegan <[email protected]>
# Date 1347544824 -3600
# Node ID a770d1c8448d73ccf2ec36a5322532c2e3c14641 # Parent 5691e4cc17da7fe8664a67f1d07c3755c0ca34ed x86/mm: remove the linear mapping of the p2m tables.

Quoted 4 lines

Mapping the p2m into the monitor tables was an important optimization on 32-bit builds, where it avoided mapping and unmapping p2m pages during a walk. On 64-bit it makes no difference -- see
http://old-list-archives.xen.org/archives/html/xen-devel/2010-04/msg00981.html

Is that also going to remain true when we won't be able to 1:1- map all of the memory anymore once we break the current 5Tb barrier? If not, it would probably be worthwhile keeping that code.

Jan

author
#2 lore raw
Quoted 13 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Tim Deegan

# HG changeset patch
# User Tim Deegan <[email protected]>
# Date 1347544824 -3600
# Node ID a770d1c8448d73ccf2ec36a5322532c2e3c14641 # Parent 5691e4cc17da7fe8664a67f1d07c3755c0ca34ed x86/mm: remove the linear mapping of the p2m tables.

Quoted 4 lines

Mapping the p2m into the monitor tables was an important optimization on 32-bit builds, where it avoided mapping and unmapping p2m pages during a walk. On 64-bit it makes no difference -- see
http://old-list-archives.xen.org/archives/html/xen-devel/2010-04/msg00981.html

Quoted 4 lines

Is that also going to remain true when we won't be able to 1:1- map all of the memory anymore once we break the current 5Tb barrier? If not, it would probably be worthwhile keeping that code.

Ah, 5TB is a smaller limit than I thought we had. Yes, better leave it alone, so. Though TBH finding some way to use a bit more virtual address space for Xen seems like a good idea anyway, since this won't be the only place we'll want to avoid TLB flushes.

Tim.

#3 lore raw
Quoted 9 lines · Tim Deegan
Quoted 4 lines

Is that also going to remain true when we won't be able to 1:1- map all of the memory anymore once we break the current 5Tb barrier? If not, it would probably be worthwhile keeping that code.

Ah, 5TB is a smaller limit than I thought we had. Yes, better leave it alone, so. Though TBH finding some way to use a bit more virtual address space for Xen seems like a good idea anyway, since this won't be the only place we'll want to avoid TLB flushes.

For HVM or PVH guests, where this HAP code would be used, clearly Xen can use all the virtual address space it wants. It will almost certainly make sense for Xen to have a 1:1 physical mapping of all memory when running such a guest, and only do mapcache type tricks when running legacy PV guests.

-- Keir

#4 lore raw
Quoted 13 lines
Quoted 1 line
Quoted 1 line · Keir Fraser
Quoted 9 lines · Tim Deegan
Quoted 4 lines

Is that also going to remain true when we won't be able to 1:1- map all of the memory anymore once we break the current 5Tb barrier? If not, it would probably be worthwhile keeping that code.

Ah, 5TB is a smaller limit than I thought we had. Yes, better leave it alone, so. Though TBH finding some way to use a bit more virtual address space for Xen seems like a good idea anyway, since this won't be the only place we'll want to avoid TLB flushes.

Quoted 4 lines

For HVM or PVH guests, where this HAP code would be used, clearly Xen can use all the virtual address space it wants. It will almost certainly make sense for Xen to have a 1:1 physical mapping of all memory when running such a guest, and only do mapcache type tricks when running legacy PV guests.

Yes, that's the mode I indeed wanted to get to. Just that it's not really clear to me (without having started at least the work of bumping the boundary) how intrusive those changes are going to be.

Jan

#5 lore raw
Quoted 18 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · Keir Fraser
Quoted 9 lines · Tim Deegan
Quoted 4 lines

Is that also going to remain true when we won't be able to 1:1- map all of the memory anymore once we break the current 5Tb barrier? If not, it would probably be worthwhile keeping that code.

Ah, 5TB is a smaller limit than I thought we had. Yes, better leave it alone, so. Though TBH finding some way to use a bit more virtual address space for Xen seems like a good idea anyway, since this won't be the only place we'll want to avoid TLB flushes.

Quoted 4 lines

For HVM or PVH guests, where this HAP code would be used, clearly Xen can use all the virtual address space it wants. It will almost certainly make sense for Xen to have a 1:1 physical mapping of all memory when running such a guest, and only do mapcache type tricks when running legacy PV guests.

Quoted 4 lines

Yes, that's the mode I indeed wanted to get to. Just that it's not really clear to me (without having started at least the work of bumping the boundary) how intrusive those changes are going to be.

Well, this is true. But almost regardless of the complexity, this is how we're going to want to do it, and it does mean we won't need the linear map. :)

-- Keir

Quoted 2 lines

Jan

#6 lore raw
Quoted 21 lines
Quoted 1 line
Quoted 1 line · Keir Fraser
Quoted 18 lines · Jan Beulich
Quoted 17 lines
Quoted 1 line
Quoted 1 line · Keir Fraser
Quoted 9 lines · Tim Deegan
Quoted 4 lines

Is that also going to remain true when we won't be able to 1:1- map all of the memory anymore once we break the current 5Tb barrier? If not, it would probably be worthwhile keeping that code.

Ah, 5TB is a smaller limit than I thought we had. Yes, better leave it alone, so. Though TBH finding some way to use a bit more virtual address space for Xen seems like a good idea anyway, since this won't be the only place we'll want to avoid TLB flushes.

For HVM or PVH guests, where this HAP code would be used, clearly Xen can use all the virtual address space it wants. It will almost certainly make sense for Xen to have a 1:1 physical mapping of all memory when running such a guest, and only do mapcache type tricks when running legacy PV guests.

Quoted 8 lines
Quoted 4 lines

Yes, that's the mode I indeed wanted to get to. Just that it's not really clear to me (without having started at least the work of bumping the boundary) how intrusive those changes are going to be.

Well, this is true. But almost regardless of the complexity, this is how we're going to want to do it, and it does mean we won't need the linear map. :)

Agreed.

Jan

author
#7 lore raw
In reply to Keir Fraser
Quoted 12 lines · Keir Fraser
Quoted 9 lines · Tim Deegan
Quoted 4 lines

Is that also going to remain true when we won't be able to 1:1- map all of the memory anymore once we break the current 5Tb barrier? If not, it would probably be worthwhile keeping that code.

Ah, 5TB is a smaller limit than I thought we had. Yes, better leave it alone, so. Though TBH finding some way to use a bit more virtual address space for Xen seems like a good idea anyway, since this won't be the only place we'll want to avoid TLB flushes.

Quoted 4 lines

For HVM or PVH guests, where this HAP code would be used, clearly Xen can use all the virtual address space it wants. It will almost certainly make sense for Xen to have a 1:1 physical mapping of all memory when running such a guest, and only do mapcache type tricks when running legacy PV guests.

This is also used for shadowed guests, including autotranslated PV guests, if anyone cares about them any more. I got the impression that they're superseded by the pvh stuff; is that right?

If that's the case, then let's commit to having a bigger 1-1 map on HVM guetst when the time comes to extend past 5TB, and remove this linear map after all.

Tim.

#8 lore raw
Quoted 13 lines · Tim Deegan
Quoted 12 lines · Keir Fraser
Quoted 9 lines · Tim Deegan
Quoted 4 lines

Is that also going to remain true when we won't be able to 1:1- map all of the memory anymore once we break the current 5Tb barrier? If not, it would probably be worthwhile keeping that code.

Ah, 5TB is a smaller limit than I thought we had. Yes, better leave it alone, so. Though TBH finding some way to use a bit more virtual address space for Xen seems like a good idea anyway, since this won't be the only place we'll want to avoid TLB flushes.

Quoted 8 lines
Quoted 4 lines

For HVM or PVH guests, where this HAP code would be used, clearly Xen can use all the virtual address space it wants. It will almost certainly make sense for Xen to have a 1:1 physical mapping of all memory when running such a guest, and only do mapcache type tricks when running legacy PV guests.

This is also used for shadowed guests, including autotranslated PV guests, if anyone cares about them any more. I got the impression that they're superseded by the pvh stuff; is that right?

Auto-translated PV seems to be one of those unsupported things that never quite dies. With PVH just round the corner, let's definitively call it dead. :)

Quoted 3 lines

If that's the case, then let's commit to having a bigger 1-1 map on HVM guetst when the time comes to extend past 5TB, and remove this linear map after all.

I agree.

-- Keir

Quoted 1 line

Tim.

#9 lore raw
Quoted 20 lines · Keir Fraser
Quoted 18 lines · Tim Deegan
Quoted 16 lines · Keir Fraser
Quoted 9 lines · Tim Deegan
Quoted 4 lines

Is that also going to remain true when we won't be able to 1:1- map all of the memory anymore once we break the current 5Tb barrier? If not, it would probably be worthwhile keeping that code.

Ah, 5TB is a smaller limit than I thought we had. Yes, better leave it alone, so. Though TBH finding some way to use a bit more virtual address space for Xen seems like a good idea anyway, since this won't be the only place we'll want to avoid TLB flushes.

For HVM or PVH guests, where this HAP code would be used, clearly Xen can use all the virtual address space it wants. It will almost certainly make sense for Xen to have a 1:1 physical mapping of all memory when running such a guest, and only do mapcache type tricks when running legacy PV guests.

Quoted 7 lines
Quoted 3 lines

This is also used for shadowed guests, including autotranslated PV guests, if anyone cares about them any more. I got the impression that they're superseded by the pvh stuff; is that right?

Auto-translated PV seems to be one of those unsupported things that never quite dies. With PVH just round the corner, let's definitively call it dead. :)

I thought we discussed that we need this as backup for running older guests? BTW, the auto-xlat is what PVH is advertising to the PV guest.

CC-ing Mukesh here

Quoted 20 lines
Quoted 4 lines

If that's the case, then let's commit to having a bigger 1-1 map on HVM guetst when the time comes to extend past 5TB, and remove this linear map after all.

I agree.

-- Keir

Quoted 1 line

Tim.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#10 lore raw
Quoted 5 lines · Konrad Rzeszutek Wilk
Quoted 3 lines

Auto-translated PV seems to be one of those unsupported things that never quite dies. With PVH just round the corner, let's definitively call it dead. :)

I thought we discussed that we need this as backup for running older guests?

Don't think so, since we'll continue to run old guests as pure PV.

There was a backup for running on older CPUs, and that was to allow PVH guests to run on shadow page tables. That's a totally separate compatibility concern however.

Quoted 1 line

BTW, the auto-xlat is what PVH is advertising to the PV guest.

Yes, but it's auto-xlat in an HVM container. Pure PV auto-xlat is what we're looking to kill here.

-- Keir

Quoted 1 line

CC-ing Mukesh here

#11 lore raw
Quoted 6 lines · Keir Fraser
Quoted 4 lines · Konrad Rzeszutek Wilk
Quoted 3 lines

Auto-translated PV seems to be one of those unsupported things that never quite dies. With PVH just round the corner, let's definitively call it dead. :)

Quoted 7 lines
Quoted 1 line

I thought we discussed that we need this as backup for running older guests?

Don't think so, since we'll continue to run old guests as pure PV.

There was a backup for running on older CPUs, and that was to allow PVH guests to run on shadow page tables. That's a totally separate compatibility concern however.

I am talking about the inverse. Running the "new" PV guests which do not have PV MMU
enabled in them (since the PV MMU calls would not be necessary anymore) and running
on non-NPT hardware.

For that PV auto-xlat would be necessary.

Quoted 17 lines
Quoted 2 lines

BTW, the auto-xlat is what PVH is advertising to the PV guest.

Yes, but it's auto-xlat in an HVM container. Pure PV auto-xlat is what we're looking to kill here.

-- Keir

Quoted 1 line

CC-ing Mukesh here

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#12 lore raw
Quoted 6 lines · Konrad Rzeszutek Wilk
Quoted 5 lines

Don't think so, since we'll continue to run old guests as pure PV.

There was a backup for running on older CPUs, and that was to allow PVH guests to run on shadow page tables. That's a totally separate compatibility concern however.

Quoted 7 lines

I am talking about the inverse. Running the "new" PV guests which do not have PV MMU
enabled in them (since the PV MMU calls would not be necessary anymore) and running
on non-NPT hardware.

For that PV auto-xlat would be necessary.

These 'new' PV guests are PVH guests. We're talking about removing PV auto-xlat, not disallowing PVH auto-xlat. Subtle difference, but PVH will always run in an HVM container.

-- Keir