Skip to contentSkip to conversation

relax vCPU pinned checks

PATCH New Jan Beulich 1 participant 1 message Jan 5, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

xen/arch/x86/domain.c +1 -1
@@ -1036,7 +1036,7 @@ arch_do_vcpu_op(
         struct vcpu_get_physid cpu_id;
 
         rc = -EINVAL;
-        if ( !v->domain->is_pinned )
+        if ( !is_pinned(v) )
             break;
 
         cpu_id.phys_id =
xen/arch/x86/traps.c +1 -1
@@ -2335,7 +2335,7 @@ static int emulate_privileged_op(struct 
         case MSR_IA32_THERM_CONTROL:
             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(v) )
                 break;
             if ( wrmsr_safe(regs->ecx, msr_content) != 0 )
                 goto fail;
xen/include/xen/sched.h +2 -0
@@ -634,6 +634,8 @@ void watchdog_domain_destroy(struct doma
 
 #define is_hvm_domain(d) ((d)->is_hvm)
 #define is_hvm_vcpu(v)   (is_hvm_domain(v->domain))
+#define is_pinned(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);

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.

xen/arch/x86/domain.c +1 -1
@@ -1036,7 +1036,7 @@ arch_do_vcpu_op(
         struct vcpu_get_physid cpu_id;
 
         rc = -EINVAL;
-        if ( !v->domain->is_pinned )
+        if ( !is_pinned(v) )
             break;
 
         cpu_id.phys_id =
xen/arch/x86/traps.c +1 -1
@@ -2335,7 +2335,7 @@ static int emulate_privileged_op(struct 
         case MSR_IA32_THERM_CONTROL:
             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(v) )
                 break;
             if ( wrmsr_safe(regs->ecx, msr_content) != 0 )
                 goto fail;
xen/include/xen/sched.h +2 -0
@@ -634,6 +634,8 @@ void watchdog_domain_destroy(struct doma
 
 #define is_hvm_domain(d) ((d)->is_hvm)
 #define is_hvm_vcpu(v)   (is_hvm_domain(v->domain))
+#define is_pinned(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);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel