[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen staging] x86/apic: do not initialize LDR and DFR for bigsmp



commit 71946aa528edaff5ea5e1a2ba6f4d462b9623efe
Author:     Bandan Das <bsd@xxxxxxxxxx>
AuthorDate: Fri Sep 6 17:07:55 2019 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Sep 6 17:07:55 2019 +0200

    x86/apic: do not initialize LDR and DFR for bigsmp
    
    Legacy apic init uses bigsmp for smp systems with 8 and more CPUs. The
    bigsmp APIC implementation uses physical destination mode, but it
    nevertheless initializes LDR and DFR. The LDR even ends up incorrectly with
    multiple bit being set.
    
    This does not cause a functional problem because LDR and DFR are ignored
    when physical destination mode is active, but it triggered a problem on a
    32-bit KVM guest which jumps into a kdump kernel.
    
    The multiple bits set unearthed a bug in the KVM APIC implementation. The
    code which creates the logical destination map for VCPUs ignores the
    disabled state of the APIC and ends up overwriting an existing valid entry
    and as a result, APIC calibration hangs in the guest during kdump
    initialization.
    
    Remove the bogus LDR/DFR initialization.
    
    This is not intended to work around the KVM APIC bug. The LDR/DFR
    ininitalization is wrong on its own.
    
    Suggested-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
    Signed-off-by: Bandan Das <bsd@xxxxxxxxxx>
    [Linux commit bae3a8d3308ee69a7dbdf145911b18dfda8ade0d]
    
    Drop init_apic_ldr_x2apic_phys() at the same time.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/genapic/delivery.c | 6 +-----
 xen/arch/x86/genapic/x2apic.c   | 6 +-----
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/genapic/delivery.c b/xen/arch/x86/genapic/delivery.c
index a86b8c9422..36ef033e65 100644
--- a/xen/arch/x86/genapic/delivery.c
+++ b/xen/arch/x86/genapic/delivery.c
@@ -40,11 +40,7 @@ unsigned int cpu_mask_to_apicid_flat(const cpumask_t 
*cpumask)
 
 void init_apic_ldr_phys(void)
 {
-       unsigned long val;
-       apic_write(APIC_DFR, APIC_DFR_FLAT);
-       /* A dummy logical ID should be fine. We only deliver in phys mode. */
-       val = apic_read(APIC_LDR) & ~APIC_LDR_MASK;
-       apic_write(APIC_LDR, val);
+       /* We only deliver in phys mode - no setup needed. */
 }
 
 void __init clustered_apic_check_phys(void)
diff --git a/xen/arch/x86/genapic/x2apic.c b/xen/arch/x86/genapic/x2apic.c
index 74907e6002..d5a17f10d5 100644
--- a/xen/arch/x86/genapic/x2apic.c
+++ b/xen/arch/x86/genapic/x2apic.c
@@ -38,10 +38,6 @@ static inline u32 x2apic_cluster(unsigned int cpu)
     return per_cpu(cpu_2_logical_apicid, cpu) >> 16;
 }
 
-static void init_apic_ldr_x2apic_phys(void)
-{
-}
-
 static void init_apic_ldr_x2apic_cluster(void)
 {
     unsigned int cpu, this_cpu = smp_processor_id();
@@ -167,7 +163,7 @@ static const struct genapic __initconstrel apic_x2apic_phys 
= {
     APIC_INIT("x2apic_phys", NULL),
     .int_delivery_mode = dest_Fixed,
     .int_dest_mode = 0 /* physical delivery */,
-    .init_apic_ldr = init_apic_ldr_x2apic_phys,
+    .init_apic_ldr = init_apic_ldr_phys,
     .clustered_apic_check = clustered_apic_check_x2apic,
     .vector_allocation_cpumask = vector_allocation_cpumask_phys,
     .cpu_mask_to_apicid = cpu_mask_to_apicid_phys,
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.