Skip to contentSkip to conversation

x86: Make x2APIC support depend on interrupt remapping or guest support

PATCH In review Jan Kiszka 3 participants 7 messages Jul 5, 2014 – Jul 6, 2014

Subsystems (2)
lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 x86: Make x2APIC support depend on interrupt remapping or guest support

From: Jan Kiszka <[email protected]>

We are able to use x2APIC mode in the absence of interrupt remapping on certain hypervisors. So it if fine to disable IRQ_REMAP without having to give up x2APIC support.

---
 arch/x86/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/Kconfig +1 -1
index a8f749e..30a9987 100644
@@ -310,7 +310,7 @@ config SMP
 
 config X86_X2APIC
 	bool "Support x2apic"
-	depends on X86_LOCAL_APIC && X86_64 && IRQ_REMAP
+	depends on X86_LOCAL_APIC && X86_64 && (IRQ_REMAP || HYPERVISOR_GUEST)
 	---help---
 	  This enables x2apic support on CPUs that have this feature.
 
maintainer Acked-by on v1 1/1
#1 lore raw

Il 05/07/2014 09:47, Jan Kiszka ha scritto:

Quoted 18 lines

From: Jan Kiszka <[email protected]>

We are able to use x2APIC mode in the absence of interrupt remapping on certain hypervisors. So it if fine to disable IRQ_REMAP without having to give up x2APIC support.

---
 arch/x86/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/Kconfig +0 -0
index a8f749e..30a9987 100644

arch/x86/Kconfig config SMP · line 316

Quoted 8 lines
arch/x86/Kconfig +1 -1
@@ -310,7 +310,7 @@ config SMP
 
 config X86_X2APIC
 	bool "Support x2apic"
-	depends on X86_LOCAL_APIC && X86_64 && IRQ_REMAP
+	depends on X86_LOCAL_APIC && X86_64 && (IRQ_REMAP || HYPERVISOR_GUEST)
 	---help---
 	  This enables x2apic support on CPUs that have this feature.
 

Makes sense.

#2 lore raw
In reply to Jan Kiszka
Quoted 5 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

We are able to use x2APIC mode in the absence of interrupt remapping on certain hypervisors. So it if fine to disable IRQ_REMAP without having to give up x2APIC support.

FWIW I did similar thing back when I added x2apic to KVM:
http://linux.derkeiler.com/Mailing-Lists/Kernel/2009-06/msg14579.html
But was advised against it.

Quoted 13 lines
---
 arch/x86/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/Kconfig +0 -0
index a8f749e..30a9987 100644

arch/x86/Kconfig config SMP · line 316

Quoted 8 lines
arch/x86/Kconfig +1 -1
@@ -310,7 +310,7 @@ config SMP
 
 config X86_X2APIC
 	bool "Support x2apic"
-	depends on X86_LOCAL_APIC && X86_64 && IRQ_REMAP
+	depends on X86_LOCAL_APIC && X86_64 && (IRQ_REMAP || HYPERVISOR_GUEST)
 	---help---
 	  This enables x2apic support on CPUs that have this feature.
 

--
Gleb.

author
#3 lore raw
Quoted 9 lines · Gleb Natapov
Quoted 5 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

We are able to use x2APIC mode in the absence of interrupt remapping on certain hypervisors. So it if fine to disable IRQ_REMAP without having to give up x2APIC support.

FWIW I did similar thing back when I added x2apic to KVM:
http://linux.derkeiler.com/Mailing-Lists/Kernel/2009-06/msg14579.html
But was advised against it.

I don't get the point from that thread.

However, this change is just formalizing a configuration that is already being used: there is no interrupt remapping available with KVM (yet), but we do run our guests in x2APIC mode most of the time. Interrupt remapping code in kernels tailored as KVM guest is dead code, right now.

Jan

Quoted 28 lines
Quoted 14 lines
---
 arch/x86/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/Kconfig +0 -0
index a8f749e..30a9987 100644

arch/x86/Kconfig config SMP · line 316

Quoted 8 lines
arch/x86/Kconfig +1 -1
@@ -310,7 +310,7 @@ config SMP
 
 config X86_X2APIC
 	bool "Support x2apic"
-	depends on X86_LOCAL_APIC && X86_64 && IRQ_REMAP
+	depends on X86_LOCAL_APIC && X86_64 && (IRQ_REMAP || HYPERVISOR_GUEST)
 	---help---
 	  This enables x2apic support on CPUs that have this feature.
 

--
Gleb.

#4 lore raw
Quoted 4 lines · Jan Kiszka
Quoted 3 lines · Gleb Natapov
Quoted 2 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

We are able to use x2APIC mode in the absence of interrupt remapping on certain hypervisors. So it if fine to disable IRQ_REMAP without having to give up x2APIC support.

FWIW I did similar thing back when I added x2apic to KVM:
http://linux.derkeiler.com/Mailing-Lists/Kernel/2009-06/msg14579.html
But was advised against it.

I don't get the point from that thread.

It is not architectural to use x2apic without irq remapping, so Suresh from Intel felt that it should not be allowed to create a kernel that can run on real HW and has non architectural configuration compiled in, though only when running on a VM x2apic will ever be enabled without irq remapping. I didn't argue about it to much back then. If HYPERVISOR_GUEST guaranties that resulting kernel can run only on a VM (does it?) this objection does not hold any more.

Quoted 5 lines

However, this change is just formalizing a configuration that is already being used: there is no interrupt remapping available with KVM (yet), but we do run our guests in x2APIC mode most of the time. Interrupt remapping code in kernels tailored as KVM guest is dead code, right now.

Yes. I am just saying why things are the way they are.

Quoted 33 lines

Jan

Quoted 28 lines
Quoted 14 lines
---
 arch/x86/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/Kconfig +0 -0
index a8f749e..30a9987 100644

arch/x86/Kconfig config SMP · line 316

Quoted 8 lines
arch/x86/Kconfig +1 -1
@@ -310,7 +310,7 @@ config SMP
 
 config X86_X2APIC
 	bool "Support x2apic"
-	depends on X86_LOCAL_APIC && X86_64 && IRQ_REMAP
+	depends on X86_LOCAL_APIC && X86_64 && (IRQ_REMAP || HYPERVISOR_GUEST)
 	---help---
 	  This enables x2apic support on CPUs that have this feature.
 

--
Gleb.

--
Gleb.

author
#5 lore raw
Quoted 8 lines · Gleb Natapov
Quoted 7 lines · Jan Kiszka
Quoted 6 lines · Gleb Natapov
Quoted 5 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

We are able to use x2APIC mode in the absence of interrupt remapping on certain hypervisors. So it if fine to disable IRQ_REMAP without having to give up x2APIC support.

Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

FWIW I did similar thing back when I added x2apic to KVM:
http://linux.derkeiler.com/Mailing-Lists/Kernel/2009-06/msg14579.html
But was advised against it.

I don't get the point from that thread.

It is not architectural to use x2apic without irq remapping, so Suresh

Slightly off-topic for this patch: Is this dependency documented somewhere? I guess there are broken systems where it can fail, but none of the (Intel) boxes I tried so far had problems with x2APIC mode on (given APIC IDs < 255) and IRQ remapping disabled.

Quoted 6 lines

from Intel felt that it should not be allowed to create a kernel that can run on real HW and has non architectural configuration compiled in, though only when running on a VM x2apic will ever be enabled without irq remapping. I didn't argue about it to much back then. If HYPERVISOR_GUEST guaranties that resulting kernel can run only on a VM (does it?) this objection does not hold any more.

Yes, indeed. Your patch suggested to remove the dependency, this one preserves it. There will still be no real hardware able to turn on x2APIC without IRQ remapping enabled as well (though I'm hoping to overcome this for Jailhouse scenarios until we can hand over DMAR units from Linux to the hypervisor).

Jan

#6 lore raw
Quoted 13 lines · Jan Kiszka
Quoted 12 lines · Gleb Natapov
Quoted 11 lines · Jan Kiszka
Quoted 9 lines · Gleb Natapov
Quoted 5 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

We are able to use x2APIC mode in the absence of interrupt remapping on certain hypervisors. So it if fine to disable IRQ_REMAP without having to give up x2APIC support.

FWIW I did similar thing back when I added x2apic to KVM:
http://linux.derkeiler.com/Mailing-Lists/Kernel/2009-06/msg14579.html
But was advised against it.

Quoted 7 lines
Quoted 2 lines
Quoted 1 line

I don't get the point from that thread.

It is not architectural to use x2apic without irq remapping, so Suresh

Slightly off-topic for this patch: Is this dependency documented somewhere? I guess there are broken systems where it can fail, but none of the (Intel) boxes I tried so far had problems with x2APIC mode on (given APIC IDs < 255) and IRQ remapping disabled.

Not sure I saw that written, but I was told many times that this is so.

--
Gleb.