aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir@xen.org>2011-01-05 09:57:15 +0000
committerKeir Fraser <keir@xen.org>2011-01-05 09:57:15 +0000
commitcc0854dd5708349ec27f640c3e6f7ba6269ea23b (patch)
treef40e7c40da0fb8fa041fc6887e2912ebe8083e06
parent866cfd2c229d58f7ba368af04359291aeb4ff436 (diff)
downloadxen-cc0854dd5708349ec27f640c3e6f7ba6269ea23b.tar.gz
xen-cc0854dd5708349ec27f640c3e6f7ba6269ea23b.tar.bz2
xen-cc0854dd5708349ec27f640c3e6f7ba6269ea23b.zip
relax vCPU pinned checks
Both writing of certain MSRs and VCPUOP_get_physid make sense also for dynamically (perhaps temporarily) pinned vcpus. Likely a couple of other MSR writes (MSR_K8_HWCR, MSR_AMD64_NB_CFG, MSR_FAM10H_MMIO_CONF_BASE) would make sense to be restricted by an is_pinned() check too, possibly also some MSR reads. Signed-off-by: Jan Beulich <jbeulich@novell.com>
-rw-r--r--xen/arch/x86/domain.c2
-rw-r--r--xen/arch/x86/traps.c2
-rw-r--r--xen/include/xen/sched.h2
3 files changed, 4 insertions, 2 deletions
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index f051df0ee3..df659dfd5d 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1036,7 +1036,7 @@ arch_do_vcpu_op(
struct vcpu_get_physid cpu_id;
rc = -EINVAL;
- if ( !v->domain->is_pinned )
+ if ( !is_pinned_vcpu(v) )
break;
cpu_id.phys_id =
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index ad4231cec4..3da6f8278c 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2336,7 +2336,7 @@ static int emulate_privileged_op(struct cpu_user_regs *regs)
case MSR_IA32_ENERGY_PERF_BIAS:
if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
goto fail;
- if ( (v->domain->domain_id != 0) || !v->domain->is_pinned )
+ if ( (v->domain->domain_id != 0) || !is_pinned_vcpu(v) )
break;
if ( wrmsr_safe(regs->ecx, msr_content) != 0 )
goto fail;
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 43c1b58c66..5087781710 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -634,6 +634,8 @@ void watchdog_domain_destroy(struct domain *d);
#define is_hvm_domain(d) ((d)->is_hvm)
#define is_hvm_vcpu(v) (is_hvm_domain(v->domain))
+#define is_pinned_vcpu(v) ((v)->domain->is_pinned || \
+ cpus_weight((v)->cpu_affinity) == 1)
#define need_iommu(d) ((d)->need_iommu)
void set_vcpu_migration_delay(unsigned int delay);