Skip to contentSkip to conversation

x86: drop setup_idle_pagetable()

PATCH In review Jan Beulich 4 participants 5 messages Jun 12, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: drop setup_idle_pagetable()

With vcpu->domain->arch.perdomain_l3_pg no longer getting set up for the idle domain, this creates an invalid L4 entry (due to translating a NULL struct page_info pointer to a physical address).

xen/arch/x86/setup.c +0 -1
@@ -185,7 +185,6 @@ static void __init init_idle_domain(void
     scheduler_init();
     set_current(idle_vcpu[0]);
     this_cpu(curr_vcpu) = current;
-    setup_idle_pagetable();
 }
 
 void __devinit srat_detect_node(int cpu)
xen/arch/x86/x86_64/mm.c +0 -8
@@ -810,14 +810,6 @@ void __init paging_init(void)
     panic("Not enough memory for m2p table\n");    
 }
 
-void __init setup_idle_pagetable(void)
-{
-    /* Install per-domain mappings for idle domain. */
-    l4e_write(&idle_pg_table[l4_table_offset(PERDOMAIN_VIRT_START)],
-              l4e_from_page(idle_vcpu[0]->domain->arch.perdomain_l3_pg,
-                            __PAGE_HYPERVISOR));
-}
-
 void __init zap_low_mappings(void)
 {
     BUG_ON(num_online_cpus() != 1);
xen/include/asm-x86/page.h +0 -1
@@ -286,7 +286,6 @@ extern l2_pgentry_t l2_identmap[4*L2_PAG
 extern l1_pgentry_t l1_identmap[L1_PAGETABLE_ENTRIES],
     l1_fixmap[L1_PAGETABLE_ENTRIES];
 void paging_init(void);
-void setup_idle_pagetable(void);
 #endif /* !defined(__ASSEMBLY__) */
 
 #define _PAGE_PRESENT  _AC(0x001,U)

x86: drop setup_idle_pagetable()

With vcpu->domain->arch.perdomain_l3_pg no longer getting set up for the idle domain, this creates an invalid L4 entry (due to translating a NULL struct page_info pointer to a physical address).

xen/arch/x86/setup.c +0 -1
@@ -185,7 +185,6 @@ static void __init init_idle_domain(void
     scheduler_init();
     set_current(idle_vcpu[0]);
     this_cpu(curr_vcpu) = current;
-    setup_idle_pagetable();
 }
 
 void __devinit srat_detect_node(int cpu)
xen/arch/x86/x86_64/mm.c +0 -8
@@ -810,14 +810,6 @@ void __init paging_init(void)
     panic("Not enough memory for m2p table\n");    
 }
 
-void __init setup_idle_pagetable(void)
-{
-    /* Install per-domain mappings for idle domain. */
-    l4e_write(&idle_pg_table[l4_table_offset(PERDOMAIN_VIRT_START)],
-              l4e_from_page(idle_vcpu[0]->domain->arch.perdomain_l3_pg,
-                            __PAGE_HYPERVISOR));
-}
-
 void __init zap_low_mappings(void)
 {
     BUG_ON(num_online_cpus() != 1);
xen/include/asm-x86/page.h +0 -1
@@ -286,7 +286,6 @@ extern l2_pgentry_t l2_identmap[4*L2_PAG
 extern l1_pgentry_t l1_identmap[L1_PAGETABLE_ENTRIES],
     l1_fixmap[L1_PAGETABLE_ENTRIES];
 void paging_init(void);
-void setup_idle_pagetable(void);
 #endif /* !defined(__ASSEMBLY__) */
 
 #define _PAGE_PRESENT  _AC(0x001,U)

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

Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Jan Beulich

With vcpu->domain->arch.perdomain_l3_pg no longer getting set up for the idle domain, this creates an invalid L4 entry (due to translating a NULL struct page_info pointer to a physical address).

Is it perhaps prudent to extend some of the $FOO_from_page() macros to guard against NULL pointers in debug builds?

~Andrew

Quoted 41 lines
xen/arch/x86/setup.c +0 -1
@@ -185,7 +185,6 @@ static void __init init_idle_domain(void
     scheduler_init();
     set_current(idle_vcpu[0]);
     this_cpu(curr_vcpu) = current;
-    setup_idle_pagetable();
 }
 
 void __devinit srat_detect_node(int cpu)
xen/arch/x86/x86_64/mm.c +0 -8
@@ -810,14 +810,6 @@ void __init paging_init(void)
     panic("Not enough memory for m2p table\n");    
 }
 
-void __init setup_idle_pagetable(void)
-{
-    /* Install per-domain mappings for idle domain. */
-    l4e_write(&idle_pg_table[l4_table_offset(PERDOMAIN_VIRT_START)],
-              l4e_from_page(idle_vcpu[0]->domain->arch.perdomain_l3_pg,
-                            __PAGE_HYPERVISOR));
-}
-
 void __init zap_low_mappings(void)
 {
     BUG_ON(num_online_cpus() != 1);
xen/include/asm-x86/page.h +0 -1
@@ -286,7 +286,6 @@ extern l2_pgentry_t l2_identmap[4*L2_PAG
 extern l1_pgentry_t l1_identmap[L1_PAGETABLE_ENTRIES],
     l1_fixmap[L1_PAGETABLE_ENTRIES];
 void paging_init(void);
-void setup_idle_pagetable(void);
 #endif /* !defined(__ASSEMBLY__) */
 
 #define _PAGE_PRESENT  _AC(0x001,U)
Acked-by on v1 1/1
#2 lore raw
In reply to Jan Beulich
Quoted 5 lines · Jan Beulich

With vcpu->domain->arch.perdomain_l3_pg no longer getting set up for the idle domain, this creates an invalid L4 entry (due to translating a NULL struct page_info pointer to a physical address).

Quoted 40 lines
xen/arch/x86/setup.c +0 -1
@@ -185,7 +185,6 @@ static void __init init_idle_domain(void
     scheduler_init();
     set_current(idle_vcpu[0]);
     this_cpu(curr_vcpu) = current;
-    setup_idle_pagetable();
 }
 
 void __devinit srat_detect_node(int cpu)
xen/arch/x86/x86_64/mm.c +0 -8
@@ -810,14 +810,6 @@ void __init paging_init(void)
     panic("Not enough memory for m2p table\n");
 }
 
-void __init setup_idle_pagetable(void)
-{
-    /* Install per-domain mappings for idle domain. */
-    l4e_write(&idle_pg_table[l4_table_offset(PERDOMAIN_VIRT_START)],
-              l4e_from_page(idle_vcpu[0]->domain->arch.perdomain_l3_pg,
-                            __PAGE_HYPERVISOR));
-}
-
 void __init zap_low_mappings(void)
 {
     BUG_ON(num_online_cpus() != 1);
xen/include/asm-x86/page.h +0 -1
@@ -286,7 +286,6 @@ extern l2_pgentry_t l2_identmap[4*L2_PAG
 extern l1_pgentry_t l1_identmap[L1_PAGETABLE_ENTRIES],
     l1_fixmap[L1_PAGETABLE_ENTRIES];
 void paging_init(void);
-void setup_idle_pagetable(void);
 #endif /* !defined(__ASSEMBLY__) */
 
 #define _PAGE_PRESENT  _AC(0x001,U)
#4 lore raw
Quoted 11 lines · George Dunlap
Quoted 5 lines · Jan Beulich

With vcpu->domain->arch.perdomain_l3_pg no longer getting set up for the idle domain, this creates an invalid L4 entry (due to translating a NULL struct page_info pointer to a physical address).

I don't think it buys very much awesomeness, but it should certainly be pretty low risk.

Pagetable entries pointing into the wilderness are actively dangerous. At the very least they can cause cache-attribute collisions. This is a real bug fix.

-- Keir