relax vCPU pinned checks
authorKeir Fraser <keir@xen.org>
Wed, 5 Jan 2011 09:57:15 +0000 (09:57 +0000)
committerKeir Fraser <keir@xen.org>
Wed, 5 Jan 2011 09:57:15 +0000 (09:57 +0000)
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>
xen/arch/x86/domain.c
xen/arch/x86/traps.c
xen/include/xen/sched.h

index f051df0ee3def810dfc2bbaf35fbf53e9db0e519..df659dfd5df59dcabf1262047805bed5536d90f1 100644 (file)
@@ -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 =
index ad4231cec4bb5854be3376716a0b801122905a2e..3da6f8278c56dc63e48b8475c468216a422946a7 100644 (file)
@@ -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;
index 43c1b58c6678f628fe94b921bbcf78443a8348bf..5087781710a3ef783c6c02d8d2b9c6e09e6bbae1 100644 (file)
@@ -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);