debuggers.hg
changeset 16452:b444678b94ea
[IA64] vti save-restore: fix opt_feature hypercall
- Fix XEN_IA64_OPTF_IDENT_MAP_REG[457] definitions.
- SMP fix. writing to domain->arch.opt_feature is racy.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
- Fix XEN_IA64_OPTF_IDENT_MAP_REG[457] definitions.
- SMP fix. writing to domain->arch.opt_feature is racy.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author | Alex Williamson <alex.williamson@hp.com> |
---|---|
date | Tue Nov 20 09:11:15 2007 -0700 (2007-11-20) |
parents | 428679ca60d8 |
children | 6fc79cb7934d |
files | xen/arch/ia64/xen/domain.c xen/include/asm-ia64/domain.h xen/include/public/arch-ia64.h |
line diff
1.1 --- a/xen/arch/ia64/xen/domain.c Tue Nov 20 08:46:24 2007 -0700 1.2 +++ b/xen/arch/ia64/xen/domain.c Tue Nov 20 09:11:15 2007 -0700 1.3 @@ -2285,13 +2285,23 @@ optf_set_identity_mapping(unsigned long* 1.4 } 1.5 } 1.6 1.7 -/* Switch a optimization feature on/off. */ 1.8 +/* 1.9 + * Switch an optimization feature on/off. 1.10 + * The vcpu must be paused to avoid racy access to opt_feature. 1.11 + */ 1.12 int 1.13 domain_opt_feature(struct xen_ia64_opt_feature* f) 1.14 { 1.15 - struct opt_feature* optf = &(current->domain->arch.opt_feature); 1.16 + struct domain *d = current->domain; 1.17 + struct opt_feature* optf = &d->arch.opt_feature; 1.18 + struct vcpu *v; 1.19 long rc = 0; 1.20 1.21 + for_each_vcpu(d, v) { 1.22 + if (v != current) 1.23 + vcpu_pause(v); 1.24 + } 1.25 + 1.26 switch (f->cmd) { 1.27 case XEN_IA64_OPTF_IDENT_MAP_REG4: 1.28 optf_set_identity_mapping(&optf->mask, &optf->im_reg4, f); 1.29 @@ -2307,6 +2317,12 @@ domain_opt_feature(struct xen_ia64_opt_f 1.30 rc = -ENOSYS; 1.31 break; 1.32 } 1.33 + 1.34 + for_each_vcpu(d, v) { 1.35 + if (v != current) 1.36 + vcpu_unpause(v); 1.37 + } 1.38 + 1.39 return rc; 1.40 } 1.41
2.1 --- a/xen/include/asm-ia64/domain.h Tue Nov 20 08:46:24 2007 -0700 2.2 +++ b/xen/include/asm-ia64/domain.h Tue Nov 20 09:11:15 2007 -0700 2.3 @@ -105,9 +105,15 @@ struct opt_feature { 2.4 * The base XEN_IA64_OPTF_IDENT_MAP_REG7 is defined in public/arch-ia64.h. 2.5 * Identity mapping of region 4 addresses in HVM. 2.6 */ 2.7 -#define XEN_IA64_OPTF_IDENT_MAP_REG4 (XEN_IA64_OPTF_IDENT_MAP_REG7 + 1) 2.8 +#define XEN_IA64_OPTF_IDENT_MAP_REG4_BIT \ 2.9 + (XEN_IA64_OPTF_IDENT_MAP_REG7_BIT + 1) 2.10 +#define XEN_IA64_OPTF_IDENT_MAP_REG4 \ 2.11 + (1UL << XEN_IA64_OPTF_IDENT_MAP_REG4_BIT) 2.12 /* Identity mapping of region 5 addresses in HVM. */ 2.13 -#define XEN_IA64_OPTF_IDENT_MAP_REG5 (XEN_IA64_OPTF_IDENT_MAP_REG4 + 1) 2.14 +#define XEN_IA64_OPTF_IDENT_MAP_REG5_BIT \ 2.15 + (XEN_IA64_OPTF_IDENT_MAP_REG7_BIT + 2) 2.16 +#define XEN_IA64_OPTF_IDENT_MAP_REG5 \ 2.17 + (1UL << XEN_IA64_OPTF_IDENT_MAP_REG5_BIT) 2.18 2.19 /* Set an optimization feature in the struct arch_domain. */ 2.20 extern int domain_opt_feature(struct xen_ia64_opt_feature*);
3.1 --- a/xen/include/public/arch-ia64.h Tue Nov 20 08:46:24 2007 -0700 3.2 +++ b/xen/include/public/arch-ia64.h Tue Nov 20 09:11:15 2007 -0700 3.3 @@ -674,7 +674,9 @@ DEFINE_XEN_GUEST_HANDLE(xen_ia64_debug_o 3.4 * This is useful in guests using region 7 for identity mapping 3.5 * like the linux kernel does. 3.6 */ 3.7 -#define XEN_IA64_OPTF_IDENT_MAP_REG7 0x1UL 3.8 +#define XEN_IA64_OPTF_IDENT_MAP_REG7_BIT 0 3.9 +#define XEN_IA64_OPTF_IDENT_MAP_REG7 \ 3.10 + (1UL << XEN_IA64_OPTF_IDENT_MAP_REG7_BIT) 3.11 3.12 struct xen_ia64_opt_feature { 3.13 unsigned long cmd; /* Which feature */