# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1277813782 -3600
# Node ID f47f869c5182d7bbeaf200a544a507c1faae9647
# Parent 7b00193bd0334606b6f6779c3f14a1667a952fe4
x86: send_IPI_mask() ignores offline CPUs in given cpumask.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
xen/arch/x86/genapic/x2apic.c | 42 ++++++++++++++++++------------------------
xen/arch/x86/smp.c | 3 ++-
2 files changed, 20 insertions(+), 25 deletions(-)
diff -r 7b00193bd033 -r f47f869c5182 xen/arch/x86/genapic/x2apic.c
--- a/xen/arch/x86/genapic/x2apic.c Mon Jun 28 17:40:16 2010 +0100
+++ b/xen/arch/x86/genapic/x2apic.c Tue Jun 29 13:16:22 2010 +0100
@@ -77,7 +77,7 @@ cpumask_t target_cpus_x2apic(void)
cpumask_t vector_allocation_domain_x2apic(int cpu)
{
- return cpumask_of_cpu(cpu);
+ return cpumask_of_cpu(cpu);
}
unsigned int cpu_mask_to_apicid_x2apic_phys(cpumask_t cpumask)
@@ -90,9 +90,10 @@ unsigned int cpu_mask_to_apicid_x2apic_c
return cpu_2_logical_apicid[first_cpu(cpumask)];
}
-void send_IPI_mask_x2apic_phys(const cpumask_t *cpumask, int vector)
+static void __send_IPI_mask_x2apic(
+ const cpumask_t *cpumask, int vector, unsigned int dest_mode)
{
- unsigned int cpu, cfg;
+ unsigned int cpu;
unsigned long flags;
uint64_t msr_content;
@@ -110,32 +111,25 @@ void send_IPI_mask_x2apic_phys(const cpu
local_irq_save(flags);
- cfg = APIC_DM_FIXED | 0 /* no shorthand */ | APIC_DEST_PHYSICAL | vector;
for_each_cpu_mask ( cpu, *cpumask )
- if ( cpu != smp_processor_id() ) {
- msr_content = cfg | ((uint64_t)cpu_physical_id(cpu) << 32);
- apic_wrmsr(APIC_ICR, msr_content);
- }
+ {
+ if ( !cpu_online(cpu) || (cpu == smp_processor_id()) )
+ continue;
+ msr_content = (dest_mode == APIC_DEST_PHYSICAL)
+ ? cpu_physical_id(cpu) : cpu_2_logical_apicid[cpu];
+ msr_content = (msr_content << 32) | APIC_DM_FIXED | dest_mode | vector;
+ apic_wrmsr(APIC_ICR, msr_content);
+ }
local_irq_restore(flags);
}
+void send_IPI_mask_x2apic_phys(const cpumask_t *cpumask, int vector)
+{
+ __send_IPI_mask_x2apic(cpumask, vector, APIC_DEST_PHYSICAL);
+}
+
void send_IPI_mask_x2apic_cluster(const cpumask_t *cpumask, int vector)
{
- unsigned int cpu, cfg;
- unsigned long flags;
- uint64_t msr_content;
-
- mb(); /* see the comment in send_IPI_mask_x2apic_phys() */
-
- local_irq_save(flags);
-
- cfg = APIC_DM_FIXED | 0 /* no shorthand */ | APIC_DEST_LOGICAL | vector;
- for_each_cpu_mask ( cpu, *cpumask )
- if ( cpu != smp_processor_id() ) {
- msr_content = cfg | ((uint64_t)cpu_2_logical_apicid[cpu] << 32);
- apic_wrmsr(APIC_ICR, msr_content);
- }
-
- local_irq_restore(flags);
+ __send_IPI_mask_x2apic(cpumask, vector, APIC_DEST_LOGICAL);
}
diff -r 7b00193bd033 -r f47f869c5182 xen/arch/x86/smp.c
--- a/xen/arch/x86/smp.c Mon Jun 28 17:40:16 2010 +0100
+++ b/xen/arch/x86/smp.c Tue Jun 29 13:16:22 2010 +0100
@@ -144,6 +144,7 @@ void send_IPI_mask_flat(const cpumask_t
unsigned long cfg;
unsigned long flags;
+ mask &= cpus_addr(cpu_online_map)[0];
mask &= ~(1UL << smp_processor_id());
if ( mask == 0 )
return;
@@ -183,7 +184,7 @@ void send_IPI_mask_phys(const cpumask_t
for_each_cpu_mask ( query_cpu, *mask )
{
- if ( query_cpu == smp_processor_id() )
+ if ( !cpu_online(query_cpu) || (query_cpu == smp_processor_id()) )
continue;
/*
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|