Fix compilation of shadow mode debugging code
PATCH 1/1 Fix compilation of shadow mode debugging code
The merge of PAE support introduced the intpte_t type and PRIpte format specifier. Most of the shadow mode code was fixed, but debugging printks were not; this broke the compile if shadow mode debugging was enabled.
The attached patch should fix the problem. Not tested with PAE enabled, but it shouldn't make anything worse than it already is.
xen/arch/x86/shadow.c +16 -15
@@ -1222,8 +1222,8 @@ASSERT (shadow_lock_is_acquired (d));SH_VLOG ("shadow mode table op %lx %lx count %d" , -pagetable_val (d->exec_domain[0 ]->arch.guest_table),/* XXX SMP */ -pagetable_val (d->exec_domain[0 ]->arch.shadow_table),/* XXX SMP */ + (unsigned long )pagetable_get_pfn (d->exec_domain[0 ]->arch.guest_table),/* XXX SMP */ + (unsigned long )pagetable_get_pfn (d->exec_domain[0 ]->arch.shadow_table),/* XXX SMP */ d->arch.shadow_page_count);shadow_audit (d,1 );
@@ -2594,7 +2594,7 @@ orig_gpte = gpte = linear_pg_table[l1_linear_offset (va)];if (unlikely (!(l1e_get_flags (gpte) & _PAGE_PRESENT)) ) { -SH_VVLOG ("shadow_fault - EXIT: gpte not present (%lx)" , +SH_VVLOG ("shadow_fault - EXIT: gpte not present (%" PRIpte")" ,l1e_get_value (gpte));perfc_incrc (shadow_fault_bail_pte_not_present); goto fail;
@@ -2615,7 +2615,7 @@else {/* Write fault on a read-only mapping. */ -SH_VVLOG ("shadow_fault - EXIT: wr fault on RO page (%lx)" , +SH_VVLOG ("shadow_fault - EXIT: wr fault on RO page (%" PRIpte")" ,l1e_get_value (gpte));perfc_incrc (shadow_fault_bail_ro_mapping); goto fail;
@@ -2692,7 +2692,7 @@ sl1mfn =__shadow_status (current->domain, pa >>PAGE_SHIFT , PGT_l1_shadow);if ( sl1mfn ) { -SH_VVLOG ("shadow_l1_normal_pt_update pa=%p, gpte=%08lx" , +SH_VVLOG ("shadow_l1_normal_pt_update pa=%p, gpte=%" PRIpte, (void *)pa,l1e_get_value (gpte));l1pte_propagate_from_guest (current->domain, gpte, &spte);
@@ -2717,7 +2717,7 @@ sl2mfn =__shadow_status (current->domain, pa >>PAGE_SHIFT , PGT_l2_shadow);if ( sl2mfn ) { -SH_VVLOG ("shadow_l2_normal_pt_update pa=%p, gpde=%08lx" , +SH_VVLOG ("shadow_l2_normal_pt_update pa=%p, gpde=%" PRIpte, (void *)pa,l2e_get_value (gpde)); spl2e =map_domain_mem_with_cache (sl2mfn <<PAGE_SHIFT , cache); validate_pde_change(d, gpde,
@@ -2946,7 +2946,7 @@ { l2e =map_domain_mem (smfn <<PAGE_SHIFT );for ( i =0 ; i <L2_PAGETABLE_ENTRIES ; i++ ) -if (is_guest_l2_slot (i) && +if (is_guest_l2_slot (0 , i) && (l2e_get_flags (l2e[i]) & _PAGE_PRESENT) )l2e_add_flags (&l2e[i],SHADOW_REFLECTS_SNAPSHOT );unmap_domain_mem (l2e);
@@ -2978,9 +2978,10 @@printk ("XXX %s-FAIL (%d,%d,%d) " _f" at %s(%d)\n" , \ sh_check_name, level, l2_idx, l1_idx, ## _a, \ __FILE__, __LINE__); \ - printk("guest_pte=%lx eff_guest_pte=%lx shadow_pte=%lx " \ - "snapshot_pte=%lx &guest=%p &shadow=%p &snap=%p " \ - "v2m(&guest)=%p v2m(&shadow)=%p v2m(&snap)=%p ea=%08x\n", \ + printk("guest_pte=%" PRIpte " eff_guest_pte=%" PRIpte \ + " shadow_pte=%" PRIpte " snapshot_pte=%" PRIpte \ + " &guest=%p &shadow=%p &snap=%p v2m(&guest)=%p" \ + " v2m(&shadow)=%p v2m(&snap)=%p ea=%08x\n", \ l1e_get_value(guest_pte), l1e_get_value(eff_guest_pte), \ l1e_get_value(shadow_pte), l1e_get_value(snapshot_pte), \ p_guest_pte, p_shadow_pte, p_snapshot_pte, \
@@ -3048,8 +3049,8 @@ shadow_mfn =l1e_get_pfn (shadow_pte);if ( !VALID_MFN (eff_guest_mfn) && !shadow_mode_refcounts (d) ) -FAIL ("%s: invalid eff_guest_pfn=%lx eff_guest_pte=%lx\n" , __func__, eff_guest_pfn, -l1e_get_value (eff_guest_pte)); +FAIL ("%s: invalid eff_guest_pfn=%lx eff_guest_pte=%" PRIpte"\n" , + __func__, eff_guest_pfn,l1e_get_value (eff_guest_pte)); page_table_page =mfn_is_page_table (eff_guest_mfn);
@@ -3184,7 +3185,7 @@ l2e_has_changed(&spl2e[SH_LINEAR_PT_VIRT_START >> L2_PAGETABLE_SHIFT], &match, PAGE_FLAG_MASK)) { -FAILPT ("hypervisor shadow linear map inconsistent %lx %lx" , +FAILPT ("hypervisor shadow linear map inconsistent %" PRIpte" %" PRIpte,l2e_get_value (spl2e[SH_LINEAR_PT_VIRT_START >>L2_PAGETABLE_SHIFT ]),l2e_get_value (match));
@@ -3195,7 +3196,7 @@ l2e_has_changed(&spl2e[PERDOMAIN_VIRT_START >> L2_PAGETABLE_SHIFT], &match, PAGE_FLAG_MASK)) { -FAILPT ("hypervisor per-domain map inconsistent saw %lx, expected (va=%p) %lx" , +FAILPT ("hypervisor per-domain map inconsistent saw %" PRIpte", expected (va=%p) %" PRIpte,l2e_get_value (spl2e[PERDOMAIN_VIRT_START >>L2_PAGETABLE_SHIFT ]), d->arch.mm_perdomain_pt,l2e_get_value (match));
@@ -3234,7 +3235,7 @@ {struct domain *d = ed->domain;pagetable_t pt = ed->arch.guest_table; -unsigned long gptbase =pagetable_val (pt); +unsigned long gptbase =pagetable_get_phys (pt);unsigned long ptbase_pfn, smfn;unsigned long i;l2_pgentry_t *gpl2e, *spl2e;
xen/include/asm-x86/shadow.h +6 -6
@@ -397,7 +397,7 @@if (unlikely (!res) ) {perfc_incrc (shadow_get_page_fail); -FSH_LOG ("%s failed to get ref l1e=%lx\n" , +FSH_LOG ("%s failed to get ref l1e=%" PRIpte"\n" , __func__,l1e_get_value (l1e)); }
@@ -738,7 +738,7 @@l1e_add_flags (&gpte, _PAGE_DIRTY | _PAGE_ACCESSED); spte =l1e_create_pfn (gmfn,l1e_get_flags (gpte) & ~_PAGE_GLOBAL); -SH_VVLOG ("l1pte_write_fault: updating spte=0x%lx gpte=0x%lx" , +SH_VVLOG ("l1pte_write_fault: updating spte=0x%" PRIpte" gpte=0x%" PRIpte,l1e_get_value (spte),l1e_get_value (gpte));if (shadow_mode_log_dirty (d) )
@@ -777,7 +777,7 @@l1e_remove_flags (&spte, _PAGE_RW); } -SH_VVLOG ("l1pte_read_fault: updating spte=0x%lx gpte=0x%lx" , +SH_VVLOG ("l1pte_read_fault: updating spte=0x%" PRIpte" gpte=0x%" PRIpte,l1e_get_value (spte),l1e_get_value (gpte)); *gpte_p = gpte; *spte_p = spte;
@@ -810,7 +810,7 @@ }if (l1e_get_value (spte) ||l1e_get_value (gpte) ) -SH_VVVLOG ("%s: gpte=%lx, new spte=%lx" , +SH_VVVLOG ("%s: gpte=%" PRIpte", new spte=%" PRIpte, __func__,l1e_get_value (gpte),l1e_get_value (spte)); *spte_p = spte;
@@ -844,7 +844,7 @@ }if (l1e_get_value (hl2e) ||l2e_get_value (gpde) ) -SH_VVLOG ("%s: gpde=%lx hl2e=%lx" , __func__, +SH_VVLOG ("%s: gpde=%" PRIpte" hl2e=%" PRIpte, __func__,l2e_get_value (gpde),l1e_get_value (hl2e)); *hl2e_p = hl2e;
@@ -873,7 +873,7 @@ }if (l2e_get_value (spde) ||l2e_get_value (gpde) ) -SH_VVLOG ("%s: gpde=%lx, new spde=%lx" , __func__, +SH_VVLOG ("%s: gpde=%" PRIpte", new spde=%" PRIpte, __func__,l2e_get_value (gpde),l2e_get_value (spde)); *spde_p = spde;
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 7 lines
The merge of PAE support introduced the
intpte_ttype and PRIpte format specifier. Most of the shadow mode code was fixed, but debugging printks were not; this broke the compile if shadow mode debugging was enabled.The attached patch should fix the problem. Not tested with PAE enabled, but it shouldn't make anything worse than it already is.
Unfortunately it doesn't apply to the current repository, even with patch fuzz enabled.
-- Keir
Quoted 2 lines · Keir Fraser
Unfortunately it doesn't apply to the current repository, even with patch fuzz enabled.
I've updated the patch for the most recent nightly snapshot; I hope this will get it to apply to the current repository. New patch is attached.
--Michael Vrable
The merge of PAE support introduced the intpte_t type and PRIpte format specifier. Most of the shadow mode code was fixed, but debugging printks were not; this broke the compile if shadow mode debugging was enabled.
The attached patch should fix the problem. Not tested with PAE enabled, but it shouldn't make anything worse than it already is.
xen/arch/x86/shadow.c +16 -15
@@ -1222,8 +1222,8 @@ASSERT (shadow_lock_is_acquired (d));SH_VLOG ("shadow mode table op %lx %lx count %d" , -pagetable_val (d->exec_domain[0 ]->arch.guest_table),/* XXX SMP */ -pagetable_val (d->exec_domain[0 ]->arch.shadow_table),/* XXX SMP */ + (unsigned long )pagetable_get_pfn (d->exec_domain[0 ]->arch.guest_table),/* XXX SMP */ + (unsigned long )pagetable_get_pfn (d->exec_domain[0 ]->arch.shadow_table),/* XXX SMP */ d->arch.shadow_page_count);shadow_audit (d,1 );
@@ -2594,7 +2594,7 @@ orig_gpte = gpte = linear_pg_table[l1_linear_offset (va)];if (unlikely (!(l1e_get_flags (gpte) & _PAGE_PRESENT)) ) { -SH_VVLOG ("shadow_fault - EXIT: gpte not present (%lx)" , +SH_VVLOG ("shadow_fault - EXIT: gpte not present (%" PRIpte")" ,l1e_get_intpte (gpte));perfc_incrc (shadow_fault_bail_pte_not_present); goto fail;
@@ -2615,7 +2615,7 @@else {/* Write fault on a read-only mapping. */ -SH_VVLOG ("shadow_fault - EXIT: wr fault on RO page (%lx)" , +SH_VVLOG ("shadow_fault - EXIT: wr fault on RO page (%" PRIpte")" ,l1e_get_intpte (gpte));perfc_incrc (shadow_fault_bail_ro_mapping); goto fail;
@@ -2692,7 +2692,7 @@ sl1mfn =__shadow_status (current->domain, pa >>PAGE_SHIFT , PGT_l1_shadow);if ( sl1mfn ) { -SH_VVLOG ("shadow_l1_normal_pt_update pa=%p, gpte=%08lx" , +SH_VVLOG ("shadow_l1_normal_pt_update pa=%p, gpte=%" PRIpte, (void *)pa,l1e_get_intpte (gpte));l1pte_propagate_from_guest (current->domain, gpte, &spte);
@@ -2717,7 +2717,7 @@ sl2mfn =__shadow_status (current->domain, pa >>PAGE_SHIFT , PGT_l2_shadow);if ( sl2mfn ) { -SH_VVLOG ("shadow_l2_normal_pt_update pa=%p, gpde=%08lx" , +SH_VVLOG ("shadow_l2_normal_pt_update pa=%p, gpde=%" PRIpte, (void *)pa,l2e_get_intpte (gpde)); spl2e =map_domain_mem_with_cache (sl2mfn <<PAGE_SHIFT , cache); validate_pde_change(d, gpde,
@@ -2946,7 +2946,7 @@ { l2e =map_domain_mem (smfn <<PAGE_SHIFT );for ( i =0 ; i <L2_PAGETABLE_ENTRIES ; i++ ) -if (is_guest_l2_slot (i) && +if (is_guest_l2_slot (0 , i) && (l2e_get_flags (l2e[i]) & _PAGE_PRESENT) )l2e_add_flags (l2e[i],SHADOW_REFLECTS_SNAPSHOT );unmap_domain_mem (l2e);
@@ -2978,9 +2978,10 @@printk ("XXX %s-FAIL (%d,%d,%d) " _f" at %s(%d)\n" , \ sh_check_name, level, l2_idx, l1_idx, ## _a, \ __FILE__, __LINE__); \ - printk("guest_pte=%lx eff_guest_pte=%lx shadow_pte=%lx " \ - "snapshot_pte=%lx &guest=%p &shadow=%p &snap=%p " \ - "v2m(&guest)=%p v2m(&shadow)=%p v2m(&snap)=%p ea=%08x\n", \ + printk("guest_pte=%" PRIpte " eff_guest_pte=%" PRIpte \ + " shadow_pte=%" PRIpte " snapshot_pte=%" PRIpte \ + " &guest=%p &shadow=%p &snap=%p v2m(&guest)=%p" \ + " v2m(&shadow)=%p v2m(&snap)=%p ea=%08x\n", \ l1e_get_intpte(guest_pte), l1e_get_intpte(eff_guest_pte), \ l1e_get_intpte(shadow_pte), l1e_get_intpte(snapshot_pte), \ p_guest_pte, p_shadow_pte, p_snapshot_pte, \
@@ -3048,8 +3049,8 @@ shadow_mfn =l1e_get_pfn (shadow_pte);if ( !VALID_MFN (eff_guest_mfn) && !shadow_mode_refcounts (d) ) -FAIL ("%s: invalid eff_guest_pfn=%lx eff_guest_pte=%lx\n" , __func__, eff_guest_pfn, -l1e_get_intpte (eff_guest_pte)); +FAIL ("%s: invalid eff_guest_pfn=%lx eff_guest_pte=%" PRIpte"\n" , + __func__, eff_guest_pfn,l1e_get_intpte (eff_guest_pte)); page_table_page =mfn_is_page_table (eff_guest_mfn);
@@ -3184,7 +3185,7 @@ l2e_has_changed(spl2e[SH_LINEAR_PT_VIRT_START >> L2_PAGETABLE_SHIFT], match, PAGE_FLAG_MASK)) { -FAILPT ("hypervisor shadow linear map inconsistent %lx %lx" , +FAILPT ("hypervisor shadow linear map inconsistent %" PRIpte" %" PRIpte,l2e_get_intpte (spl2e[SH_LINEAR_PT_VIRT_START >>L2_PAGETABLE_SHIFT ]),l2e_get_intpte (match));
@@ -3195,7 +3196,7 @@ l2e_has_changed(spl2e[PERDOMAIN_VIRT_START >> L2_PAGETABLE_SHIFT], match, PAGE_FLAG_MASK)) { -FAILPT ("hypervisor per-domain map inconsistent saw %lx, expected (va=%p) %lx" , +FAILPT ("hypervisor per-domain map inconsistent saw %" PRIpte", expected (va=%p) %" PRIpte,l2e_get_intpte (spl2e[PERDOMAIN_VIRT_START >>L2_PAGETABLE_SHIFT ]), d->arch.mm_perdomain_pt,l2e_get_intpte (match));
@@ -3234,7 +3235,7 @@ {struct domain *d = ed->domain;pagetable_t pt = ed->arch.guest_table; -unsigned long gptbase =pagetable_val (pt); +unsigned long gptbase =pagetable_get_paddr (pt);unsigned long ptbase_pfn, smfn;unsigned long i;l2_pgentry_t *gpl2e, *spl2e;
xen/include/asm-x86/shadow.h +6 -6
@@ -397,7 +397,7 @@if (unlikely (!res) ) {perfc_incrc (shadow_get_page_fail); -FSH_LOG ("%s failed to get ref l1e=%lx\n" , +FSH_LOG ("%s failed to get ref l1e=%" PRIpte"\n" , __func__,l1e_get_intpte (l1e)); }
@@ -738,7 +738,7 @@l1e_add_flags (gpte, _PAGE_DIRTY | _PAGE_ACCESSED); spte =l1e_from_pfn (gmfn,l1e_get_flags (gpte) & ~_PAGE_GLOBAL); -SH_VVLOG ("l1pte_write_fault: updating spte=0x%lx gpte=0x%lx" , +SH_VVLOG ("l1pte_write_fault: updating spte=0x%" PRIpte" gpte=0x%" PRIpte,l1e_get_intpte (spte),l1e_get_intpte (gpte));if (shadow_mode_log_dirty (d) )
@@ -777,7 +777,7 @@l1e_remove_flags (spte, _PAGE_RW); } -SH_VVLOG ("l1pte_read_fault: updating spte=0x%lx gpte=0x%lx" , +SH_VVLOG ("l1pte_read_fault: updating spte=0x%" PRIpte" gpte=0x%" PRIpte,l1e_get_intpte (spte),l1e_get_intpte (gpte)); *gpte_p = gpte; *spte_p = spte;
@@ -809,7 +809,7 @@ }if (l1e_get_intpte (spte) ||l1e_get_intpte (gpte) ) -SH_VVVLOG ("%s: gpte=%lx, new spte=%lx" , +SH_VVVLOG ("%s: gpte=%" PRIpte", new spte=%" PRIpte, __func__,l1e_get_intpte (gpte),l1e_get_intpte (spte)); *spte_p = spte;
@@ -843,7 +843,7 @@ }if (l1e_get_intpte (hl2e) ||l2e_get_intpte (gpde) ) -SH_VVLOG ("%s: gpde=%lx hl2e=%lx" , __func__, +SH_VVLOG ("%s: gpde=%" PRIpte" hl2e=%" PRIpte, __func__,l2e_get_intpte (gpde),l1e_get_intpte (hl2e)); *hl2e_p = hl2e;
@@ -872,7 +872,7 @@ }if (l2e_get_intpte (spde) ||l2e_get_intpte (gpde) ) -SH_VVLOG ("%s: gpde=%lx, new spde=%lx" , __func__, +SH_VVLOG ("%s: gpde=%" PRIpte", new spde=%" PRIpte, __func__,l2e_get_intpte (gpde),l2e_get_intpte (spde)); *spde_p = spde;
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel