aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2017-12-28 05:33:33 -0500
committerThomas Gleixner <tglx@linutronix.de>2017-12-29 08:20:48 -0500
commita31e58e129f73ab5b04016330b13ed51fde7a961 (patch)
tree4fd2d50430834799dd56bc284a0ad4e8f0a61344
parent64e05d118e357bb52a084b609436acf292ce7944 (diff)
x86/apic: Switch all APICs to Fixed delivery mode
Some of the APIC incarnations are operating in lowest priority delivery mode. This worked as long as the vector management code allocated the same vector on all possible CPUs for each interrupt. Lowest priority delivery mode does not necessarily respect the affinity setting and may redirect to some other online CPU. This was documented somewhere in the old code and the conversion to single target delivery missed to update the delivery mode of the affected APIC drivers which results in spurious interrupts on some of the affected CPU/Chipset combinations. Switch the APIC drivers over to Fixed delivery mode and remove all leftovers of lowest priority delivery mode. Switching to Fixed delivery mode is not a problem on these CPUs because the kernel already uses Fixed delivery mode for IPIs. The reason for this is that th SDM explicitely forbids lowest prio mode for IPIs. The reason is obvious: If the irq routing does not honor destination targets in lowest prio mode then an IPI targeted at CPU1 might end up on CPU0, which would be a fatal problem in many cases. As a consequence of this change, the apic::irq_delivery_mode field is now pointless, but this needs to be cleaned up in a separate patch. Fixes: fdba46ffb4c2 ("x86/apic: Get rid of multi CPU affinity") Reported-by: vcaputo@pengaru.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: vcaputo@pengaru.com Cc: Pavel Machek <pavel@ucw.cz> Link: https://lkml.kernel.org/r/alpine.DEB.2.20.1712281140440.1688@nanos
-rw-r--r--arch/x86/kernel/apic/apic_flat_64.c2
-rw-r--r--arch/x86/kernel/apic/apic_noop.c2
-rw-r--r--arch/x86/kernel/apic/msi.c8
-rw-r--r--arch/x86/kernel/apic/probe_32.c2
-rw-r--r--arch/x86/kernel/apic/x2apic_cluster.c2
-rw-r--r--drivers/pci/host/pci-hyperv.c8
6 files changed, 8 insertions, 16 deletions
diff --git a/arch/x86/kernel/apic/apic_flat_64.c b/arch/x86/kernel/apic/apic_flat_64.c
index aa85690e9b64..25a87028cb3f 100644
--- a/arch/x86/kernel/apic/apic_flat_64.c
+++ b/arch/x86/kernel/apic/apic_flat_64.c
@@ -151,7 +151,7 @@ static struct apic apic_flat __ro_after_init = {
151 .apic_id_valid = default_apic_id_valid, 151 .apic_id_valid = default_apic_id_valid,
152 .apic_id_registered = flat_apic_id_registered, 152 .apic_id_registered = flat_apic_id_registered,
153 153
154 .irq_delivery_mode = dest_LowestPrio, 154 .irq_delivery_mode = dest_Fixed,
155 .irq_dest_mode = 1, /* logical */ 155 .irq_dest_mode = 1, /* logical */
156 156
157 .disable_esr = 0, 157 .disable_esr = 0,
diff --git a/arch/x86/kernel/apic/apic_noop.c b/arch/x86/kernel/apic/apic_noop.c
index 7b659c4480c9..5078b5ce63a7 100644
--- a/arch/x86/kernel/apic/apic_noop.c
+++ b/arch/x86/kernel/apic/apic_noop.c
@@ -110,7 +110,7 @@ struct apic apic_noop __ro_after_init = {
110 .apic_id_valid = default_apic_id_valid, 110 .apic_id_valid = default_apic_id_valid,
111 .apic_id_registered = noop_apic_id_registered, 111 .apic_id_registered = noop_apic_id_registered,
112 112
113 .irq_delivery_mode = dest_LowestPrio, 113 .irq_delivery_mode = dest_Fixed,
114 /* logical delivery broadcast to all CPUs: */ 114 /* logical delivery broadcast to all CPUs: */
115 .irq_dest_mode = 1, 115 .irq_dest_mode = 1,
116 116
diff --git a/arch/x86/kernel/apic/msi.c b/arch/x86/kernel/apic/msi.c
index 9b18be764422..ce503c99f5c4 100644
--- a/arch/x86/kernel/apic/msi.c
+++ b/arch/x86/kernel/apic/msi.c
@@ -39,17 +39,13 @@ static void irq_msi_compose_msg(struct irq_data *data, struct msi_msg *msg)
39 ((apic->irq_dest_mode == 0) ? 39 ((apic->irq_dest_mode == 0) ?
40 MSI_ADDR_DEST_MODE_PHYSICAL : 40 MSI_ADDR_DEST_MODE_PHYSICAL :
41 MSI_ADDR_DEST_MODE_LOGICAL) | 41 MSI_ADDR_DEST_MODE_LOGICAL) |
42 ((apic->irq_delivery_mode != dest_LowestPrio) ? 42 MSI_ADDR_REDIRECTION_CPU |
43 MSI_ADDR_REDIRECTION_CPU :
44 MSI_ADDR_REDIRECTION_LOWPRI) |
45 MSI_ADDR_DEST_ID(cfg->dest_apicid); 43 MSI_ADDR_DEST_ID(cfg->dest_apicid);
46 44
47 msg->data = 45 msg->data =
48 MSI_DATA_TRIGGER_EDGE | 46 MSI_DATA_TRIGGER_EDGE |
49 MSI_DATA_LEVEL_ASSERT | 47 MSI_DATA_LEVEL_ASSERT |
50 ((apic->irq_delivery_mode != dest_LowestPrio) ? 48 MSI_DATA_DELIVERY_FIXED |
51 MSI_DATA_DELIVERY_FIXED :
52 MSI_DATA_DELIVERY_LOWPRI) |
53 MSI_DATA_VECTOR(cfg->vector); 49 MSI_DATA_VECTOR(cfg->vector);
54} 50}
55 51
diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c
index fa22017de806..02e8acb134f8 100644
--- a/arch/x86/kernel/apic/probe_32.c
+++ b/arch/x86/kernel/apic/probe_32.c
@@ -105,7 +105,7 @@ static struct apic apic_default __ro_after_init = {
105 .apic_id_valid = default_apic_id_valid, 105 .apic_id_valid = default_apic_id_valid,
106 .apic_id_registered = default_apic_id_registered, 106 .apic_id_registered = default_apic_id_registered,
107 107
108 .irq_delivery_mode = dest_LowestPrio, 108 .irq_delivery_mode = dest_Fixed,
109 /* logical delivery broadcast to all CPUs: */ 109 /* logical delivery broadcast to all CPUs: */
110 .irq_dest_mode = 1, 110 .irq_dest_mode = 1,
111 111
diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c
index 622f13ca8a94..8b04234e010b 100644
--- a/arch/x86/kernel/apic/x2apic_cluster.c
+++ b/arch/x86/kernel/apic/x2apic_cluster.c
@@ -184,7 +184,7 @@ static struct apic apic_x2apic_cluster __ro_after_init = {
184 .apic_id_valid = x2apic_apic_id_valid, 184 .apic_id_valid = x2apic_apic_id_valid,
185 .apic_id_registered = x2apic_apic_id_registered, 185 .apic_id_registered = x2apic_apic_id_registered,
186 186
187 .irq_delivery_mode = dest_LowestPrio, 187 .irq_delivery_mode = dest_Fixed,
188 .irq_dest_mode = 1, /* logical */ 188 .irq_dest_mode = 1, /* logical */
189 189
190 .disable_esr = 0, 190 .disable_esr = 0,
diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
index 0fe3ea164ee5..e7d94473aedd 100644
--- a/drivers/pci/host/pci-hyperv.c
+++ b/drivers/pci/host/pci-hyperv.c
@@ -985,9 +985,7 @@ static u32 hv_compose_msi_req_v1(
985 int_pkt->wslot.slot = slot; 985 int_pkt->wslot.slot = slot;
986 int_pkt->int_desc.vector = vector; 986 int_pkt->int_desc.vector = vector;
987 int_pkt->int_desc.vector_count = 1; 987 int_pkt->int_desc.vector_count = 1;
988 int_pkt->int_desc.delivery_mode = 988 int_pkt->int_desc.delivery_mode = dest_Fixed;
989 (apic->irq_delivery_mode == dest_LowestPrio) ?
990 dest_LowestPrio : dest_Fixed;
991 989
992 /* 990 /*
993 * Create MSI w/ dummy vCPU set, overwritten by subsequent retarget in 991 * Create MSI w/ dummy vCPU set, overwritten by subsequent retarget in
@@ -1008,9 +1006,7 @@ static u32 hv_compose_msi_req_v2(
1008 int_pkt->wslot.slot = slot; 1006 int_pkt->wslot.slot = slot;
1009 int_pkt->int_desc.vector = vector; 1007 int_pkt->int_desc.vector = vector;
1010 int_pkt->int_desc.vector_count = 1; 1008 int_pkt->int_desc.vector_count = 1;
1011 int_pkt->int_desc.delivery_mode = 1009 int_pkt->int_desc.delivery_mode = dest_Fixed;
1012 (apic->irq_delivery_mode == dest_LowestPrio) ?
1013 dest_LowestPrio : dest_Fixed;
1014 1010
1015 /* 1011 /*
1016 * Create MSI w/ dummy vCPU set targeting just one vCPU, overwritten 1012 * Create MSI w/ dummy vCPU set targeting just one vCPU, overwritten