# HG changeset patch # User yamahata@xxxxxxxxxxxxx # Date 1192590371 -32400 # Node ID c9d84a67b09ca25c5a7465ab84fa40c314a6d0b2 # Parent ceee54c9f9f0a43b3b13b972c49a15ef32f7fc73 Don't share privregs with hvm domain and twist IA64 xen dump core format slightly. Xen shares privregs pages with IA64 HVM domain for xm dump-core to dump the pages. However sharing the page allows hvm guest domain peek/destroy the page contents that might cause xen crash. And the xen dump core file doesn't need privregs page because cpu context should be obtained from vcpu context in case of IA64 HVM domain. Although this patch modify xen dump core format, current crash utility (at least crash 4.0-4.7) doesn't look into .xen_ia64_mmapped_regs section and I don't know any other tools to understand xen dump core file. So this format modification doesn't cause incompatibility issue. PATCHNAME: dont_shared_privregs_with_vti_domain Signed-off-by: Isaku Yamahata diff -r ceee54c9f9f0 -r c9d84a67b09c docs/misc/dump-core-format.txt --- a/docs/misc/dump-core-format.txt Mon Oct 22 12:44:34 2007 +0900 +++ b/docs/misc/dump-core-format.txt Wed Oct 17 12:06:11 2007 +0900 @@ -127,8 +127,10 @@ Currently the following sections are def This section stores the array of mapped_regs_t. The size of array is stored in xch_nr_vcpus member of header note descriptor in .note.Xen note section. - This section is ia64 specific and must exist for ia64 domain. - This section must not exist for non-ia64 domain. + This section is ia64 specific and must exist for ia64 PV + domain. + This section must not exist for non-ia64 domain or ia64 HVM + domain. note section @@ -237,3 +239,5 @@ Currently only (major, minor) = (0, 1) i - EI_CLASS member of elf header was changed to ELFCLASS64 independent of architecture. This is mainly for x86_32pae. The format version isn't bumped because analysis tools can distinguish it. +- .xen_ia64_mapped_regs section was made only for ia64 PV domain. + In case of IA64 HVM domain, this section doesn't exist. diff -r ceee54c9f9f0 -r c9d84a67b09c tools/libxc/xc_core.c --- a/tools/libxc/xc_core.c Mon Oct 22 12:44:34 2007 +0900 +++ b/tools/libxc/xc_core.c Wed Oct 17 12:06:11 2007 +0900 @@ -32,7 +32,7 @@ * |.xen_prstatus | * | vcpu_guest_context_t[nr_vcpus] | * +--------------------------------------------------------+ - * |.xen_ia64_mmapped_regs if ia64 | + * |.xen_ia64_mmapped_regs if ia64 pv | * | mmapped_regs_t[nr_vcpus] | * +--------------------------------------------------------+ * |.xen_shared_info if possible | diff -r ceee54c9f9f0 -r c9d84a67b09c tools/libxc/xc_core_ia64.c --- a/tools/libxc/xc_core_ia64.c Mon Oct 22 12:44:34 2007 +0900 +++ b/tools/libxc/xc_core_ia64.c Wed Oct 17 12:06:11 2007 +0900 @@ -312,6 +312,10 @@ xc_core_arch_context_get(struct xc_core_ int xc_handle, uint32_t domid) { mapped_regs_t* mapped_regs; + + if ( ctxt->privregs_pfn == VGC_PRIVREGS_HVM ) + return 0; /* VTi domain case */ + if ( ctxt->privregs_pfn == INVALID_P2M_ENTRY ) { PERROR("Could not get mmapped privregs gmfn"); @@ -339,6 +343,13 @@ xc_core_arch_context_get_shdr(struct xc_ { int sts = -1; Elf64_Shdr *shdr; + + if ( arch_ctxt->nr_vcpus == 0 ) + { + /* VTi domain case */ + *filesz = 0; + return 0; + } /* mmapped priv regs */ shdr = xc_core_shdr_get(sheaders); diff -r ceee54c9f9f0 -r c9d84a67b09c xen/arch/ia64/vmx/vmx_init.c --- a/xen/arch/ia64/vmx/vmx_init.c Mon Oct 22 12:44:34 2007 +0900 +++ b/xen/arch/ia64/vmx/vmx_init.c Wed Oct 17 12:06:11 2007 +0900 @@ -391,7 +391,6 @@ vmx_final_setup_guest(struct vcpu *v) return -ENOMEM; v->arch.privregs = (mapped_regs_t *)vpd; - vcpu_share_privregs_with_guest(v); vpd->vpd_low.virt_env_vaddr = vm_buffer; v->domain->arch.vmx_platform.gos_type = OS_UNKNOWN; diff -r ceee54c9f9f0 -r c9d84a67b09c xen/arch/ia64/xen/domain.c --- a/xen/arch/ia64/xen/domain.c Mon Oct 22 12:44:34 2007 +0900 +++ b/xen/arch/ia64/xen/domain.c Wed Oct 17 12:06:11 2007 +0900 @@ -468,7 +468,7 @@ int vcpu_initialise(struct vcpu *v) return 0; } -void vcpu_share_privregs_with_guest(struct vcpu *v) +static void vcpu_share_privregs_with_guest(struct vcpu *v) { struct domain *d = v->domain; int i, order = get_order_from_shift(XMAPPEDREGS_SHIFT); @@ -941,8 +941,11 @@ void arch_get_info_guest(struct vcpu *v, c.nat->regs.num_phys_stacked = num_phys_stacked; - c.nat->privregs_pfn = get_gpfn_from_mfn - (virt_to_maddr(v->arch.privregs) >> PAGE_SHIFT); + if (VMX_DOMAIN(v)) + c.nat->privregs_pfn = VGC_PRIVREGS_HVM; + else + c.nat->privregs_pfn = get_gpfn_from_mfn( + virt_to_maddr(v->arch.privregs) >> PAGE_SHIFT); for (i = 0; i < IA64_NUM_DBG_REGS; i++) { if (VMX_DOMAIN(v)) { diff -r ceee54c9f9f0 -r c9d84a67b09c xen/include/asm-ia64/domain.h --- a/xen/include/asm-ia64/domain.h Mon Oct 22 12:44:34 2007 +0900 +++ b/xen/include/asm-ia64/domain.h Wed Oct 17 12:06:11 2007 +0900 @@ -20,7 +20,6 @@ struct tlb_track; struct vcpu; extern void relinquish_vcpu_resources(struct vcpu *v); -extern void vcpu_share_privregs_with_guest(struct vcpu *v); extern int vcpu_late_initialise(struct vcpu *v); /* given a current domain metaphysical address, return the physical address */ diff -r ceee54c9f9f0 -r c9d84a67b09c xen/include/public/arch-ia64.h --- a/xen/include/public/arch-ia64.h Mon Oct 22 12:44:34 2007 +0900 +++ b/xen/include/public/arch-ia64.h Wed Oct 17 12:06:11 2007 +0900 @@ -433,6 +433,11 @@ struct vcpu_guest_context { struct vcpu_guest_context_regs regs; unsigned long event_callback_ip; + + /* xen doesn't share privregs pages with hvm domain so that this member + * doesn't make sense for hvm domain. + * ~0UL is already used for INVALID_P2M_ENTRY. */ +#define VGC_PRIVREGS_HVM (~(-2UL)) unsigned long privregs_pfn; }; typedef struct vcpu_guest_context vcpu_guest_context_t;