ia64/xen-unstable

changeset 16179:ecbda3783c85

[IA64] Don't share privregs with hvm domain

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.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Alex Williamson <alex.williamson@hp.com>
date Mon Oct 22 12:26:53 2007 -0600 (2007-10-22)
parents 7e69ca25c278
children 62a7a2f4d9c7
files docs/misc/dump-core-format.txt tools/libxc/xc_core.c tools/libxc/xc_core_ia64.c xen/arch/ia64/vmx/vmx_init.c xen/arch/ia64/xen/domain.c xen/include/asm-ia64/domain.h xen/include/public/arch-ia64.h
line diff
     1.1 --- a/docs/misc/dump-core-format.txt	Mon Oct 22 12:19:42 2007 -0600
     1.2 +++ b/docs/misc/dump-core-format.txt	Mon Oct 22 12:26:53 2007 -0600
     1.3 @@ -127,8 +127,10 @@ Currently the following sections are def
     1.4                  This section stores the array of mapped_regs_t.
     1.5                  The size of array is stored in xch_nr_vcpus member of header
     1.6                  note descriptor in .note.Xen note section.
     1.7 -                This section is ia64 specific and must exist for ia64 domain.
     1.8 -                This section must not exist for non-ia64 domain.
     1.9 +                This section is ia64 specific and must exist for ia64 PV 
    1.10 +                domain.
    1.11 +                This section must not exist for non-ia64 domain or ia64 HVM
    1.12 +                domain.
    1.13  
    1.14  
    1.15  note section
    1.16 @@ -237,3 +239,5 @@ Currently only (major, minor) = (0, 1) i
    1.17  - EI_CLASS member of elf header was changed to ELFCLASS64 independent of
    1.18    architecture. This is mainly for x86_32pae.
    1.19    The format version isn't bumped because analysis tools can distinguish it.
    1.20 +- .xen_ia64_mapped_regs section was made only for ia64 PV domain.
    1.21 +  In case of IA64 HVM domain, this section doesn't exist.
     2.1 --- a/tools/libxc/xc_core.c	Mon Oct 22 12:19:42 2007 -0600
     2.2 +++ b/tools/libxc/xc_core.c	Mon Oct 22 12:26:53 2007 -0600
     2.3 @@ -32,7 +32,7 @@
     2.4   *  |.xen_prstatus                                           |
     2.5   *  |       vcpu_guest_context_t[nr_vcpus]                   |
     2.6   *  +--------------------------------------------------------+
     2.7 - *  |.xen_ia64_mmapped_regs if ia64                          |
     2.8 + *  |.xen_ia64_mmapped_regs if ia64 pv                       |
     2.9   *  |       mmapped_regs_t[nr_vcpus]                         |
    2.10   *  +--------------------------------------------------------+
    2.11   *  |.xen_shared_info if possible                            |
     3.1 --- a/tools/libxc/xc_core_ia64.c	Mon Oct 22 12:19:42 2007 -0600
     3.2 +++ b/tools/libxc/xc_core_ia64.c	Mon Oct 22 12:26:53 2007 -0600
     3.3 @@ -312,6 +312,10 @@ xc_core_arch_context_get(struct xc_core_
     3.4                           int xc_handle, uint32_t domid)
     3.5  {
     3.6      mapped_regs_t* mapped_regs;
     3.7 +
     3.8 +    if ( ctxt->privregs_pfn == VGC_PRIVREGS_HVM )
     3.9 +        return 0;       /* VTi domain case */
    3.10 +
    3.11      if ( ctxt->privregs_pfn == INVALID_P2M_ENTRY )
    3.12      {
    3.13          PERROR("Could not get mmapped privregs gmfn");
    3.14 @@ -340,6 +344,13 @@ xc_core_arch_context_get_shdr(struct xc_
    3.15      int sts = -1;
    3.16      Elf64_Shdr *shdr;
    3.17  
    3.18 +    if ( arch_ctxt->nr_vcpus == 0 )
    3.19 +    {
    3.20 +        /* VTi domain case */
    3.21 +        *filesz = 0;
    3.22 +        return 0;       
    3.23 +    }
    3.24 +
    3.25      /* mmapped priv regs */
    3.26      shdr = xc_core_shdr_get(sheaders);
    3.27      if ( shdr == NULL )
     4.1 --- a/xen/arch/ia64/vmx/vmx_init.c	Mon Oct 22 12:19:42 2007 -0600
     4.2 +++ b/xen/arch/ia64/vmx/vmx_init.c	Mon Oct 22 12:26:53 2007 -0600
     4.3 @@ -309,7 +309,6 @@ vmx_final_setup_guest(struct vcpu *v)
     4.4  		return -ENOMEM;
     4.5  
     4.6  	v->arch.privregs = (mapped_regs_t *)vpd;
     4.7 -	vcpu_share_privregs_with_guest(v);
     4.8  	vpd->vpd_low.virt_env_vaddr = vm_buffer;
     4.9      
    4.10  	v->domain->arch.vmx_platform.gos_type = OS_UNKNOWN;
     5.1 --- a/xen/arch/ia64/xen/domain.c	Mon Oct 22 12:19:42 2007 -0600
     5.2 +++ b/xen/arch/ia64/xen/domain.c	Mon Oct 22 12:26:53 2007 -0600
     5.3 @@ -470,7 +470,7 @@ int vcpu_initialise(struct vcpu *v)
     5.4  	return 0;
     5.5  }
     5.6  
     5.7 -void vcpu_share_privregs_with_guest(struct vcpu *v)
     5.8 +static void vcpu_share_privregs_with_guest(struct vcpu *v)
     5.9  {
    5.10  	struct domain *d = v->domain;
    5.11  	int i, order = get_order_from_shift(XMAPPEDREGS_SHIFT); 
    5.12 @@ -939,8 +939,11 @@ void arch_get_info_guest(struct vcpu *v,
    5.13  		c.nat->regs.rbs_rnat &= ~((1UL << bottom_slot) - 1);
    5.14  	}
    5.15  
    5.16 - 	c.nat->privregs_pfn = get_gpfn_from_mfn
    5.17 -		(virt_to_maddr(v->arch.privregs) >> PAGE_SHIFT);
    5.18 +	if (VMX_DOMAIN(v))
    5.19 +		c.nat->privregs_pfn = VGC_PRIVREGS_HVM;
    5.20 +	else
    5.21 +		c.nat->privregs_pfn = get_gpfn_from_mfn(
    5.22 +			virt_to_maddr(v->arch.privregs) >> PAGE_SHIFT);
    5.23  
    5.24  	for (i = 0; i < IA64_NUM_DBG_REGS; i++) {
    5.25  		if (VMX_DOMAIN(v)) {
     6.1 --- a/xen/include/asm-ia64/domain.h	Mon Oct 22 12:19:42 2007 -0600
     6.2 +++ b/xen/include/asm-ia64/domain.h	Mon Oct 22 12:26:53 2007 -0600
     6.3 @@ -20,7 +20,6 @@ struct tlb_track;
     6.4  
     6.5  struct vcpu;
     6.6  extern void relinquish_vcpu_resources(struct vcpu *v);
     6.7 -extern void vcpu_share_privregs_with_guest(struct vcpu *v);
     6.8  extern int vcpu_late_initialise(struct vcpu *v);
     6.9  
    6.10  /* given a current domain metaphysical address, return the physical address */
     7.1 --- a/xen/include/public/arch-ia64.h	Mon Oct 22 12:19:42 2007 -0600
     7.2 +++ b/xen/include/public/arch-ia64.h	Mon Oct 22 12:26:53 2007 -0600
     7.3 @@ -427,6 +427,11 @@ struct vcpu_guest_context {
     7.4      struct vcpu_guest_context_regs regs;
     7.5  
     7.6      unsigned long event_callback_ip;
     7.7 +
     7.8 +    /* xen doesn't share privregs pages with hvm domain so that this member
     7.9 +     * doesn't make sense for hvm domain.
    7.10 +     * ~0UL is already used for INVALID_P2M_ENTRY. */
    7.11 +#define VGC_PRIVREGS_HVM       (~(-2UL))
    7.12      unsigned long privregs_pfn;
    7.13  };
    7.14  typedef struct vcpu_guest_context vcpu_guest_context_t;