x86/mm: do not mark IO regions as Xen heap
PATCH 1/1 x86/mm: do not mark IO regions as Xen heap
arch_init_memory will treat all the gaps on the physical memory map between RAM regions as MMIO and use share_xen_page_with_guest in order to assign them to dom_io. This has the side effect of setting the Xen heap flag on such pages, and thus is_special_page would then return true which is an issue in epte_get_entry_emt because such pages will be forced to use write-back cache attributes.
Fix this by introducing a new helper to assign the MMIO regions to dom_io without setting the Xen heap flag on the pages, so that is_special_page will return false and the pages won't be forced to use write-back cache attributes.
---
Cc: Paul Durrant <[email protected]>
--- xen/arch/x86/mm.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
xen/arch/x86/mm.c +14 -2
@@ -271,6 +271,18 @@ static l4_pgentry_t __read_mostly split_l4e;#define root_pgt_pv_xen_slots ROOT_PAGETABLE_PV_XEN_SLOTS#endif +static void __init assign_io_page (struct page_info *page) +{ +set_gpfn_from_mfn (mfn_x (page_to_mfn (page)),INVALID_M2P_ENTRY ); + +/* The incremented type count pins as writable. */ + page->u.inuse.type_info = PGT_writable_page | PGT_validated |1 ; + +page_set_owner (page, dom_io); + + page->count_info |= PGC_allocated |1 ; +} +void __init arch_init_memory (void ) {unsigned long i, pfn, rstart_pfn, rend_pfn, iostart_pfn, ioend_pfn;
@@ -291,7 +303,7 @@ void __init arch_init_memory(void)*/ BUG_ON (pvh_boot && trampoline_phys !=0x1000 );for ( i =0 ; i <0x100 ; i++ ) -share_xen_page_with_guest (mfn_to_page (_mfn (i)), dom_io, SHARE_rw); +assign_io_page (mfn_to_page (_mfn (i)));/* Any areas not specified as RAM by the e820 map are considered I/O. */ for ( i =0 , pfn =0 ; pfn < max_page; i++ )
@@ -332,7 +344,7 @@ void __init arch_init_memory(void)if ( !mfn_valid (_mfn (pfn)) )continue ; -share_xen_page_with_guest (mfn_to_page (_mfn (pfn)), dom_io, SHARE_rw); +assign_io_page (mfn_to_page (_mfn (pfn))); }/* Skip the RAM region. */
Signature · 1 line
2.28.0
Quoted 62 lines
-----Original Message-----
From: Roger Pau Monne <[email protected]>
Sent: 10 September 2020 14:35
To: [email protected]
Cc: Roger Pau Monne <[email protected]>; Jan Beulich <[email protected]>; Andrew Cooper <[email protected]>; Wei Liu <[email protected]>; Paul Durrant <[email protected]>
Subject: [PATCH] x86/mm: do not mark IO regions as Xen heap
arch_init_memorywill treat all the gaps on the physical memory map between RAM regions as MMIO and useshare_xen_page_with_guestin order to assign them todom_io. This has the side effect of setting the Xen heap flag on such pages, and thusis_special_pagewould then return true which is an issue inepte_get_entry_emtbecause such pages will be forced to use write-back cache attributes.Fix this by introducing a new helper to assign the MMIO regions to
dom_iowithout setting the Xen heap flag on the pages, so thatis_special_pagewill return false and the pages won't be forced to use write-back cache attributes.Fixes 81fd0d3ca4b2cd ('x86/hvm: simplify 'mmio_direct' check in epte_get_entry_emt()')Suggested-by Jan Beulich <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>---
Cc: Paul Durrant <[email protected]>--- xen/arch/x86/mm.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)xen/arch/x86/mm.c +13
-1@@ -271,6 +271,18 @@ static l4_pgentry_t __read_mostly split_l4e;#define root_pgt_pv_xen_slots ROOT_PAGETABLE_PV_XEN_SLOTS#endif +static void __init assign_io_page (struct page_info *page) +{ +set_gpfn_from_mfn (mfn_x (page_to_mfn (page)),INVALID_M2P_ENTRY ); + +/* The incremented type count pins as writable. */ + page->u.inuse.type_info = PGT_writable_page | PGT_validated |1 ; + +page_set_owner (page, dom_io); + + page->count_info |= PGC_allocated |1 ; +} +void __init arch_init_memory (void ) {unsigned long i, pfn, rstart_pfn, rend_pfn, iostart_pfn, ioend_pfn;@@ -291,7 +303,7 @@ void __init arch_init_memory(void)*/ BUG_ON (pvh_boot && trampoline_phys !=0x1000 );for ( i =0 ; i <0x100 ; i++ ) -share_xen_page_with_guest (mfn_to_page (_mfn (i)), dom_io, SHARE_rw); +assign_io_page (mfn_to_page (_mfn (i)));/* Any areas not specified as RAM by the e820 map are considered I/O. */ for ( i =0 , pfn =0 ; pfn < max_page; i++ )
xen/arch/x86/mm.c void __init arch_init_memory(void) · line 347
Quoted 5 lines
xen/arch/x86/mm.c +1
-1@@ -332,7 +344,7 @@ void __init arch_init_memory(void)if ( !mfn_valid (_mfn (pfn)) )continue ; -share_xen_page_with_guest (mfn_to_page (_mfn (pfn)), dom_io, SHARE_rw); +assign_io_page (mfn_to_page (_mfn (pfn)));
Now these calls to share_xen_page_with_guest() are gone, can we change share_xen_page_with_guest() to ASSERT that PGC_xen_heap is already set, and avoid (needlessly) ORing it in?
Paul
Quoted 5 lines
xen/arch/x86/mm.c +0
-1}/* Skip the RAM region. */ --2.28.0
Quoted 16 lines · Paul Durrant
Quoted 16 lines
From: Roger Pau Monne <[email protected]>
Sent: 10 September 2020 14:35xen/arch/x86/mm.c +1
-1@@ -291,7 +303,7 @@ void __init arch_init_memory(void)*/ BUG_ON (pvh_boot && trampoline_phys !=0x1000 );for ( i =0 ; i <0x100 ; i++ ) -share_xen_page_with_guest (mfn_to_page (_mfn (i)), dom_io, SHARE_rw); +assign_io_page (mfn_to_page (_mfn (i)));/* Any areas not specified as RAM by the e820 map are considered I/O. */ for ( i =0 , pfn =0 ; pfn < max_page; i++ )@@ -332,7 +344,7 @@ void __init arch_init_memory(void)if ( !mfn_valid (_mfn (pfn)) )continue ;
Quoted 6 lines
xen/arch/x86/mm.c void __init arch_init_memory(void) · line 347
Quoted 2 lines
xen/arch/x86/mm.c +1
-1-share_xen_page_with_guest (mfn_to_page (_mfn (pfn)), dom_io, SHARE_rw); +assign_io_page (mfn_to_page (_mfn (pfn)));Now these calls to
share_xen_page_with_guest()are gone, can we changeshare_xen_page_with_guest()to ASSERT thatPGC_xen_heapis already set, and avoid (needlessly) ORing it in?
At least for the first use from pv_shim_setup_dom() I'm not sure this holds. I'm also uncertain we want to enforce this - it ought to be fine to hand a page allocated via alloc_domheap_page() to this function. The choice of alloc_xenheap_page() should be merely is an always mapped page is wanted (without extra effort to map).
Jan
Quoted 7 lines · Roger Pau Monne
arch_init_memorywill treat all the gaps on the physical memory map between RAM regions as MMIO and useshare_xen_page_with_guestin order to assign them todom_io. This has the side effect of setting the Xen heap flag on such pages, and thusis_special_pagewould then return true which is an issue inepte_get_entry_emtbecause such pages will be forced to use write-back cache attributes.
Quoted 8 lines
Fix this by introducing a new helper to assign the MMIO regions to
dom_iowithout setting the Xen heap flag on the pages, so thatis_special_pagewill return false and the pages won't be forced to use write-back cache attributes.Fixes 81fd0d3ca4b2cd ('x86/hvm: simplify 'mmio_direct' check in epte_get_entry_emt()')Suggested-by Jan Beulich <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>
albeit I'm inclined to add, while committing, a comment ...
Quoted 7 lines
xen/arch/x86/mm.c +1
-0@@ -271,6 +271,18 @@ static l4_pgentry_t __read_mostly split_l4e;#define root_pgt_pv_xen_slots ROOT_PAGETABLE_PV_XEN_SLOTS#endif +static void __init assign_io_page (struct page_info *page)
xen/arch/x86/mm.c static l4_pgentry_t __read_mostly split_l4e; · line 284
Quoted 10 lines
xen/arch/x86/mm.c +10
-0+{ +set_gpfn_from_mfn (mfn_x (page_to_mfn (page)),INVALID_M2P_ENTRY ); + +/* The incremented type count pins as writable. */ + page->u.inuse.type_info = PGT_writable_page | PGT_validated |1 ; + +page_set_owner (page, dom_io); + + page->count_info |= PGC_allocated |1 ; +}
... clarifying its relationship with share_xen_page_with_guest().
Jan
Quoted 26 lines · Jan Beulich
Quoted 7 lines · Roger Pau Monne
arch_init_memorywill treat all the gaps on the physical memory map between RAM regions as MMIO and useshare_xen_page_with_guestin order to assign them todom_io. This has the side effect of setting the Xen heap flag on such pages, and thusis_special_pagewould then return true which is an issue inepte_get_entry_emtbecause such pages will be forced to use write-back cache attributes.Quoted 8 lines
Fix this by introducing a new helper to assign the MMIO regions to
dom_iowithout setting the Xen heap flag on the pages, so thatis_special_pagewill return false and the pages won't be forced to use write-back cache attributes.Fixes 81fd0d3ca4b2cd ('x86/hvm: simplify 'mmio_direct' check in epte_get_entry_emt()')Suggested-by Jan Beulich <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>Reviewed-by Jan Beulich <[email protected]>albeit I'm inclined to add, while committing, a comment ...
Quoted 6 lines
xen/arch/x86/mm.c +0
-0@@ -271,6 +271,18 @@ static l4_pgentry_t __read_mostly split_l4e;#define root_pgt_pv_xen_slots ROOT_PAGETABLE_PV_XEN_SLOTS#endif
Quoted 13 lines
xen/arch/x86/mm.c static l4_pgentry_t __read_mostly split_l4e; · line 284
Quoted 11 lines
xen/arch/x86/mm.c +11
-0+static void __init assign_io_page (struct page_info *page) +{ +set_gpfn_from_mfn (mfn_x (page_to_mfn (page)),INVALID_M2P_ENTRY ); + +/* The incremented type count pins as writable. */ + page->u.inuse.type_info = PGT_writable_page | PGT_validated |1 ; + +page_set_owner (page, dom_io); + + page->count_info |= PGC_allocated |1 ; +}... clarifying its relationship with
share_xen_page_with_guest().
Sure, I think the relation is quite vague now, since this is no longer sharing the page (as it's not added to xenpage_list) but rather assigning it to dom_io.
In general I feel this is all quite confusing, and would benefit from having some clear rules about what flags and assigned domains non-RAM pages have, and how they should be added to the p2m.
Thanks, Roger.
Quoted 22 lines · Roger Pau Monné
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Roger Pau Monne
xen/arch/x86/mm.c +0
-0@@ -271,6 +271,18 @@ static l4_pgentry_t __read_mostly split_l4e;#define root_pgt_pv_xen_slots ROOT_PAGETABLE_PV_XEN_SLOTS#endif Quoted 13 lines
xen/arch/x86/mm.c static l4_pgentry_t __read_mostly split_l4e; · line 284
Quoted 11 lines
xen/arch/x86/mm.c +11
-0+static void __init assign_io_page (struct page_info *page) +{ +set_gpfn_from_mfn (mfn_x (page_to_mfn (page)),INVALID_M2P_ENTRY ); + +/* The incremented type count pins as writable. */ + page->u.inuse.type_info = PGT_writable_page | PGT_validated |1 ; + +page_set_owner (page, dom_io); + + page->count_info |= PGC_allocated |1 ; +}... clarifying its relationship with
share_xen_page_with_guest().
Quoted 7 lines
Sure, I think the relation is quite vague now, since this is no longer sharing the page (as it's not added to
xenpage_list) but rather assigning it todom_io.In general I feel this is all quite confusing, and would benefit from having some clear rules about what flags and assigned domains non-RAM pages have, and how they should be added to the p2m.
Some might call this "organically grown" ... ;-)
Jan
Quoted 26 lines · Jan Beulich
Quoted 7 lines · Roger Pau Monne
arch_init_memorywill treat all the gaps on the physical memory map between RAM regions as MMIO and useshare_xen_page_with_guestin order to assign them todom_io. This has the side effect of setting the Xen heap flag on such pages, and thusis_special_pagewould then return true which is an issue inepte_get_entry_emtbecause such pages will be forced to use write-back cache attributes.Quoted 8 lines
Fix this by introducing a new helper to assign the MMIO regions to
dom_iowithout setting the Xen heap flag on the pages, so thatis_special_pagewill return false and the pages won't be forced to use write-back cache attributes.Fixes 81fd0d3ca4b2cd ('x86/hvm: simplify 'mmio_direct' check in epte_get_entry_emt()')Suggested-by Jan Beulich <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>Reviewed-by Jan Beulich <[email protected]>albeit I'm inclined to add, while committing, a comment ...
Quoted 6 lines
xen/arch/x86/mm.c +0
-0@@ -271,6 +271,18 @@ static l4_pgentry_t __read_mostly split_l4e;#define root_pgt_pv_xen_slots ROOT_PAGETABLE_PV_XEN_SLOTS#endif
Quoted 13 lines
xen/arch/x86/mm.c static l4_pgentry_t __read_mostly split_l4e; · line 284
Quoted 11 lines
xen/arch/x86/mm.c +11
-0+static void __init assign_io_page (struct page_info *page) +{ +set_gpfn_from_mfn (mfn_x (page_to_mfn (page)),INVALID_M2P_ENTRY ); + +/* The incremented type count pins as writable. */ + page->u.inuse.type_info = PGT_writable_page | PGT_validated |1 ; + +page_set_owner (page, dom_io); + + page->count_info |= PGC_allocated |1 ; +}... clarifying its relationship with
share_xen_page_with_guest().
I'm also going to add an assertion to share_xen_page_with_guest() to document and make sure dom_io won't again be passed there.
Jan
Quoted 7 lines · Roger Pau Monne
arch_init_memorywill treat all the gaps on the physical memory map between RAM regions as MMIO and useshare_xen_page_with_guestin order to assign them todom_io. This has the side effect of setting the Xen heap flag on such pages, and thusis_special_pagewould then return true which is an issue inepte_get_entry_emtbecause such pages will be forced to use write-back cache attributes.
Quoted 8 lines
Fix this by introducing a new helper to assign the MMIO regions to
dom_iowithout setting the Xen heap flag on the pages, so thatis_special_pagewill return false and the pages won't be forced to use write-back cache attributes.Fixes 81fd0d3ca4b2cd ('x86/hvm: simplify 'mmio_direct' check in epte_get_entry_emt()')Suggested-by Jan Beulich <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>
I'm sorry for noticing this only now, but there is a place where we actually build on these pages being marked "special": In xenmem_add_to_physmap_one() we have
if ( mfn_valid(prev_mfn) )
{
if ( is_special_page(mfn_to_page(prev_mfn)) )
/* Special pages are simply unhooked from this phys slot. */
rc = guest_physmap_remove_page(d, gpfn, prev_mfn, PAGE_ORDER_4K);
else
/* Normal domain memory is freed, to avoid leaking memory. */
rc = guest_remove_page(d, gfn_x(gpfn));
}As you'll notice MMIO pages not satisfying mfn_valid() will simply bypass any updates here, but the subsequent guest_physmap_add_page() will have the P2M entry updated anyway. MMIO pages which satisfy mfn_valid(), however, would previously have been passed into guest_physmap_remove_page() (which generally would succeed) while now guest_remove_page() will (afaict) fail (get_page() there won't succeed).
I haven't come to a clear conclusion yet how best to address this.
Jan
Quoted 31 lines · Jan Beulich
Quoted 7 lines · Roger Pau Monne
arch_init_memorywill treat all the gaps on the physical memory map between RAM regions as MMIO and useshare_xen_page_with_guestin order to assign them todom_io. This has the side effect of setting the Xen heap flag on such pages, and thusis_special_pagewould then return true which is an issue inepte_get_entry_emtbecause such pages will be forced to use write-back cache attributes.Quoted 8 lines
Fix this by introducing a new helper to assign the MMIO regions to
dom_iowithout setting the Xen heap flag on the pages, so thatis_special_pagewill return false and the pages won't be forced to use write-back cache attributes.Fixes 81fd0d3ca4b2cd ('x86/hvm: simplify 'mmio_direct' check in epte_get_entry_emt()')Suggested-by Jan Beulich <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>I'm sorry for noticing this only now, but there is a place where we actually build on these pages being marked "special": In
xenmem_add_to_physmap_one()we haveif ( mfn_valid(prev_mfn) ) { if ( is_special_page(mfn_to_page(prev_mfn)) ) /* Special pages are simply unhooked from this phys slot. */ rc = guest_physmap_remove_page(d, gpfn, prev_mfn, PAGE_ORDER_4K); else /* Normal domain memory is freed, to avoid leaking memory. */ rc = guest_remove_page(d, gfn_x(gpfn)); }
Quoted 7 lines
As you'll notice MMIO pages not satisfying
mfn_valid()will simply bypass any updates here, but the subsequentguest_physmap_add_page()will have the P2M entry updated anyway. MMIO pages which satisfymfn_valid(), however, would previously have been passed intoguest_physmap_remove_page()(which generally would succeed) while nowguest_remove_page()will (afaict) fail (get_page()there won't succeed).
Would Xen even get to the get_page in guest_remove_page on that case?
There's a p2m_mmio_direct type check that will succeed for MMIO ranges, and that just clears the p2m entry and returns before doing any get_page.
Roger.
Quoted 40 lines · Roger Pau Monné
Quoted 31 lines · Jan Beulich
Quoted 7 lines · Roger Pau Monne
arch_init_memorywill treat all the gaps on the physical memory map between RAM regions as MMIO and useshare_xen_page_with_guestin order to assign them todom_io. This has the side effect of setting the Xen heap flag on such pages, and thusis_special_pagewould then return true which is an issue inepte_get_entry_emtbecause such pages will be forced to use write-back cache attributes.Quoted 8 lines
Fix this by introducing a new helper to assign the MMIO regions to
dom_iowithout setting the Xen heap flag on the pages, so thatis_special_pagewill return false and the pages won't be forced to use write-back cache attributes.Fixes 81fd0d3ca4b2cd ('x86/hvm: simplify 'mmio_direct' check in epte_get_entry_emt()')Suggested-by Jan Beulich <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>I'm sorry for noticing this only now, but there is a place where we actually build on these pages being marked "special": In
xenmem_add_to_physmap_one()we haveif ( mfn_valid(prev_mfn) ) { if ( is_special_page(mfn_to_page(prev_mfn)) ) /* Special pages are simply unhooked from this phys slot. */ rc = guest_physmap_remove_page(d, gpfn, prev_mfn, PAGE_ORDER_4K); else /* Normal domain memory is freed, to avoid leaking memory. */ rc = guest_remove_page(d, gfn_x(gpfn)); }Quoted 7 lines
As you'll notice MMIO pages not satisfying
mfn_valid()will simply bypass any updates here, but the subsequentguest_physmap_add_page()will have the P2M entry updated anyway. MMIO pages which satisfymfn_valid(), however, would previously have been passed intoguest_physmap_remove_page()(which generally would succeed) while nowguest_remove_page()will (afaict) fail (get_page()there won't succeed).
Quoted 5 lines
Would Xen even get to the
get_pageinguest_remove_pageon that case?There's a
p2m_mmio_directtype check that will succeed for MMIO ranges, and that just clears the p2m entry and returns before doing anyget_page.
Oh, I did overlook this indeed.
Jan
Quoted 7 lines · Roger Pau Monne
arch_init_memorywill treat all the gaps on the physical memory map between RAM regions as MMIO and useshare_xen_page_with_guestin order to assign them todom_io. This has the side effect of setting the Xen heap flag on such pages, and thusis_special_pagewould then return true which is an issue inepte_get_entry_emtbecause such pages will be forced to use write-back cache attributes.
Quoted 6 lines
Fix this by introducing a new helper to assign the MMIO regions to
dom_iowithout setting the Xen heap flag on the pages, so thatis_special_pagewill return false and the pages won't be forced to use write-back cache attributes.Fixes 81fd0d3ca4b2cd ('x86/hvm: simplify 'mmio_direct' check in epte_get_entry_emt()')
Is this really the correct commit? I had this queued for backport, and ended up discarding it from the queue based on this tag, just to then noticing that I remembered correctly that I did backport ca24b2ffdbd9 ("x86/hvm: set 'ipat' in EPT for special pages") to the stable trees already. Isn't it _this_ commit which the change here fixes?
Jan
Quoted 13 lines · Jan Beulich
Quoted 12 lines · Roger Pau Monne
arch_init_memorywill treat all the gaps on the physical memory map between RAM regions as MMIO and useshare_xen_page_with_guestin order to assign them todom_io. This has the side effect of setting the Xen heap flag on such pages, and thusis_special_pagewould then return true which is an issue inepte_get_entry_emtbecause such pages will be forced to use write-back cache attributes.Fix this by introducing a new helper to assign the MMIO regions to
dom_iowithout setting the Xen heap flag on the pages, so thatis_special_pagewill return false and the pages won't be forced to use write-back cache attributes.
Quoted 8 lines
Quoted 1 line
Fixes 81fd0d3ca4b2cd ('x86/hvm: simplify 'mmio_direct' check in epte_get_entry_emt()')Is this really the correct commit? I had this queued for backport, and ended up discarding it from the queue based on this tag, just to then noticing that I remembered correctly that I did backport
ca24b2ffdbd9("x86/hvm: set 'ipat' in EPT for special pages") to the stable trees already. Isn't it _this_ commit which the change here fixes?
My bisection pointed to that exact commit as the one that broke my PVH dom0 setup, so yes, I'm quite sure that's the commit at least on the box that I've bisected it.
ca24b2ffdbd9 was still fine because previous to the is_special_page check loop there was still the if ( direct_mmio ) ... handling, which made all MMIO regions except for the APIC access page forcefully have it's cache attributes set to UC.
Roger.
Quoted 23 lines · Roger Pau Monné
Quoted 13 lines · Jan Beulich
Quoted 12 lines · Roger Pau Monne
arch_init_memorywill treat all the gaps on the physical memory map between RAM regions as MMIO and useshare_xen_page_with_guestin order to assign them todom_io. This has the side effect of setting the Xen heap flag on such pages, and thusis_special_pagewould then return true which is an issue inepte_get_entry_emtbecause such pages will be forced to use write-back cache attributes.Fix this by introducing a new helper to assign the MMIO regions to
dom_iowithout setting the Xen heap flag on the pages, so thatis_special_pagewill return false and the pages won't be forced to use write-back cache attributes.Quoted 8 lines
Quoted 1 line
Fixes 81fd0d3ca4b2cd ('x86/hvm: simplify 'mmio_direct' check in epte_get_entry_emt()')Is this really the correct commit? I had this queued for backport, and ended up discarding it from the queue based on this tag, just to then noticing that I remembered correctly that I did backport
ca24b2ffdbd9("x86/hvm: set 'ipat' in EPT for special pages") to the stable trees already. Isn't it _this_ commit which the change here fixes?
Quoted 8 lines
My bisection pointed to that exact commit as the one that broke my PVH dom0 setup, so yes, I'm quite sure that's the commit at least on the box that I've bisected it.
ca24b2ffdbd9was still fine because previous to theis_special_pagecheck loop there was still theif ( direct_mmio ) ...handling, which made all MMIO regions except for the APIC access page forcefully have it's cache attributes set to UC.
Ah yes, I see - thanks. Makes me less sure whether the patch here really wants backporting. It's certainly an improvement in its own right to remove the difference between mfn_valid() and !mfn_valid() MMIO pages, leading e.g. to different treatment by _sh_propagate(). Will need to give this some more thought, and of course your and others thoughts would also be appreciated.
Jan
Quoted 28 lines · Jan Beulich
Quoted 27 lines · Roger Pau Monné
Quoted 13 lines · Jan Beulich
Quoted 12 lines · Roger Pau Monne
arch_init_memorywill treat all the gaps on the physical memory map between RAM regions as MMIO and useshare_xen_page_with_guestin order to assign them todom_io. This has the side effect of setting the Xen heap flag on such pages, and thusis_special_pagewould then return true which is an issue inepte_get_entry_emtbecause such pages will be forced to use write-back cache attributes.Fix this by introducing a new helper to assign the MMIO regions to
dom_iowithout setting the Xen heap flag on the pages, so thatis_special_pagewill return false and the pages won't be forced to use write-back cache attributes.Quoted 8 lines
Quoted 1 line
Fixes 81fd0d3ca4b2cd ('x86/hvm: simplify 'mmio_direct' check in epte_get_entry_emt()')Is this really the correct commit? I had this queued for backport, and ended up discarding it from the queue based on this tag, just to then noticing that I remembered correctly that I did backport
ca24b2ffdbd9("x86/hvm: set 'ipat' in EPT for special pages") to the stable trees already. Isn't it _this_ commit which the change here fixes?My bisection pointed to that exact commit as the one that broke my PVH dom0 setup, so yes, I'm quite sure that's the commit at least on the box that I've bisected it.
Quoted 7 lines
Quoted 4 lines
ca24b2ffdbd9was still fine because previous to theis_special_pagecheck loop there was still theif ( direct_mmio ) ...handling, which made all MMIO regions except for the APIC access page forcefully have it's cache attributes set to UC.Ah yes, I see - thanks. Makes me less sure whether the patch here really wants backporting.
As long as 81fd0d3ca4b2cd is not backported, then I would argue to not backport this either. I don't see much benefit in backporting this alone, and the risk of introducing a non intended functionality change as a result of not marking MMIO pages as Xen heap is possible.
Thanks, Roger.