Skip to contentSkip to conversation

x86/Kconfig: Allow CONFIG_X86_MPPARSE disable for OF platforms

PATCH In review Saurabh Sengar 4 participants 13 messages May 11, 2023 – Jun 2, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 x86/Kconfig: Allow CONFIG_X86_MPPARSE disable for OF platforms

X86_MPPARSE is only selectable when ACPI is enabled. However, on Devicetree platforms where ACPI is disabled, it is always enabled. Allow X86_MPPARSE to be selected by OF platforms as well.

---
 arch/x86/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/Kconfig +1 -1
index 53bab123a8ee..e60315397399 100644
@@ -469,7 +469,7 @@ config X86_X2APIC
 	  If you don't know what to do here, say N.
 
 config X86_MPPARSE
-	bool "Enable MPS table" if ACPI
+	bool "Enable MPS table" if ACPI || OF
 	default y
 	depends on X86_LOCAL_APIC
 	help
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 Drivers: hv: Kconfig: Add HYPERV_VTL_MODE dependencies

MTRRs are not per-VTL and are controlled by VTL0, make sure it is disabled for all other VTLs.

X86_MPPARSE scans low memory for MP tables, which is not required for Hyper-V VTL platforms.

---
 drivers/hv/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
drivers/hv/Kconfig +2 -0
index 00242107d62e..c8d443886b9d 100644
@@ -16,6 +16,8 @@ config HYPERV
 config HYPERV_VTL_MODE
 	bool "Enable Linux to boot in VTL context"
 	depends on X86_64 && HYPERV
+	depends on !MTRR
+	depends on !X86_MPPARSE
 	default n
 	help
 	  Virtual Secure Mode (VSM) is a set of hypervisor capabilities and
Signature · 1 line
2.34.1
#2 lore raw

RE: [PATCH 2/2] Drivers: hv: Kconfig: Add HYPERV_VTL_MODE dependencies

From: Saurabh Sengar <[email protected]>

Quoted 3 lines

MTRRs are not per-VTL and are controlled by VTL0, make sure it is disabled for all other VTLs.

Clarifying the wording a bit:

MTRRs are not per-VTL, but are always controlled by VTL0. Allow
building for VTLs other than VTL0 only when MTRR functionality is disabled.

Quoted 3 lines

X86_MPPARSE scans low memory for MP tables, which is not required for Hyper-V VTL platforms.

Is the above statement saying that MP tables aren't required, so remove the code to save space? Or is there a problem/failure if MP table code
runs and scans low memory? *Requiring* that it be disabled, and the
reference to scanning low memory makes me think it might be the latter, in which case I'd suggest this more forceful wording:

The MP table code scans low memory, which causes failures in VTLs
other than VTL0. Allow building for VTLs other than VTL0 only when
MP table functionality is disabled.

If you can give slightly more detail about "causes failures" (a panic? some other problem?) that would be good too.

Michael

Quoted 21 lines
---
 drivers/hv/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
drivers/hv/Kconfig +2 -1
index 00242107d62e..c8d443886b9d 100644
@@ -16,6 +16,8 @@ config HYPERV
 config HYPERV_VTL_MODE
 	bool "Enable Linux to boot in VTL context"
 	depends on X86_64 && HYPERV
+	depends on !MTRR
+	depends on !X86_MPPARSE
 	default n
 	help
 	  Virtual Secure Mode (VSM) is a set of hypervisor capabilities and
--

2.34.1

#3 lore raw

RE: [PATCH 2/2] Drivers: hv: Kconfig: Add HYPERV_VTL_MODE dependencies

Quoted 17 lines

-----Original Message-----
From: Michael Kelley (LINUX) <[email protected]>
Sent: Saturday, May 20, 2023 10:20 PM
To: Saurabh Sengar <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; KY Srinivasan <[email protected]>; Haiyang Zhang <[email protected]>; [email protected]; Dexuan Cui <[email protected]>; [email protected]; linux- [email protected]
Cc: Saurabh Singh Sengar <[email protected]>
Subject: [EXTERNAL] RE: [PATCH 2/2] Drivers: hv: Kconfig: Add HYPERV_VTL_MODE dependencies

From: Saurabh Sengar <[email protected]>

Quoted 1 line
Quoted 7 lines
Quoted 2 lines

MTRRs are not per-VTL and are controlled by VTL0, make sure it is disabled for all other VTLs.

Clarifying the wording a bit:

MTRRs are not per-VTL, but are always controlled by VTL0. Allow
building for VTLs other than VTL0 only when MTRR functionality is disabled.

Ok

Quoted 11 lines
Quoted 4 lines

X86_MPPARSE scans low memory for MP tables, which is not required for Hyper-V VTL platforms.

Is the above statement saying that MP tables aren't required, so remove the code to save space? Or is there a problem/failure if MP table code
runs and scans low memory? *Requiring* that it be disabled, and the
reference to scanning low memory makes me think it might be the latter, in which case I'd suggest this more forceful wording:

Quoted 3 lines

The MP table code scans low memory, which causes failures in VTLs
other than VTL0. Allow building for VTLs other than VTL0 only when
MP table functionality is disabled.

Ok

Quoted 3 lines

If you can give slightly more detail about "causes failures" (a panic? some other problem?) that would be good too.

When CONFIG_X86_MPPARSE is enabled, the kernel will scan low memory, looking for MP tables. In Hyper-V VBS setup, lower memory is assigned to VTL0. This lower memory may contain the actual MPPARSE table for VTL0, which can confuse the VTLx kernel and cause issues. (x > 0)

Quoted 24 lines

Michael

Quoted 21 lines
---
 drivers/hv/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
drivers/hv/Kconfig index renamed from drivers/hv/Kconfig +0 -0

00242107d62e..c8d443886b9d 100644

drivers/hv/Kconfig +2 -1
@@ -16,6 +16,8 @@ config HYPERV
 config HYPERV_VTL_MODE
 	bool "Enable Linux to boot in VTL context"
 	depends on X86_64 && HYPERV
+	depends on !MTRR
+	depends on !X86_MPPARSE
 	default n
 	help
 	  Virtual Secure Mode (VSM) is a set of hypervisor capabilities and
--

2.34.1

Reviewed-by on v1 1/2
#4 lore raw
In reply to Saurabh Sengar

From: Saurabh Sengar <[email protected]> Sent: Thursday, May 11, 2023 7:55 AM

Quoted 25 lines

X86_MPPARSE is only selectable when ACPI is enabled. However, on Devicetree platforms where ACPI is disabled, it is always enabled. Allow X86_MPPARSE to be selected by OF platforms as well.

---
 arch/x86/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/Kconfig +1 -2
index 53bab123a8ee..e60315397399 100644
@@ -469,7 +469,7 @@ config X86_X2APIC
 	  If you don't know what to do here, say N.
 
 config X86_MPPARSE
-	bool "Enable MPS table" if ACPI
+	bool "Enable MPS table" if ACPI || OF
 	default y
 	depends on X86_LOCAL_APIC
 	help
--
Quoted 1 line

2.34.1

#5 lore raw
In reply to Saurabh Sengar
Quoted 4 lines · Saurabh Sengar

X86_MPPARSE is only selectable when ACPI is enabled. However, on Devicetree platforms where ACPI is disabled, it is always enabled. Allow X86_MPPARSE to be selected by OF platforms as well.

I'm finding this changelog really hard to read.

In Kconfig, you can "select FOO". But in this changelog, it means something different. I think "selectable" here means that there's a user prompt for the option.

Could you please rephrase this to be less confusing?

This is also one of those patches where I wonder: Why do _you_ care about this? Are you just trying to be nice? Is this intended as some kind of cleanup?

#6 lore raw
Quoted 20 lines

-----Original Message-----
From: Dave Hansen <[email protected]>
Sent: Tuesday, May 23, 2023 11:23 PM
To: Saurabh Sengar <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; KY Srinivasan <[email protected]>; Haiyang Zhang <[email protected]>; [email protected]; Dexuan Cui <[email protected]>; Michael Kelley (LINUX) <[email protected]>; [email protected]; [email protected]
Cc: Saurabh Singh Sengar <[email protected]>
Subject: [EXTERNAL] Re: [PATCH 1/2] x86/Kconfig: Allow CONFIG_X86_MPPARSE disable for OF platforms

Quoted 3 lines · Saurabh Sengar

X86_MPPARSE is only selectable when ACPI is enabled. However, on Devicetree platforms where ACPI is disabled, it is always enabled. Allow X86_MPPARSE to be selected by OF platforms as well.

Quoted 7 lines

I'm finding this changelog really hard to read.

In Kconfig, you can "select FOO". But in this changelog, it means something different. I think "selectable" here means that there's a user prompt for the option.

Could you please rephrase this to be less confusing?

Thanks for your review. Currently, in the absence of ACPI, it is impossible to disable X86_MPPARSE. In the case of ACPI being enabled, one has the option to either enable or disable X86_MPARSE. My intention is to permit X86_MPPARSE=n for OF platforms where ACPI=n. To describe the capability of choosing any desired value for MPPARSE, I used the term 'selectable.' Perhaps 'configurable' would be a more appropriate word in this context? I can fix this and include it in V2.

Quoted 3 lines

This is also one of those patches where I wonder: Why do _you_ care about this? Are you just trying to be nice? Is this intended as some kind of cleanup?

It solves an issue for Hyper-V VBS setup, please refer to the 2/2 of this patch series.

Regards,
Saurabh

#7 lore raw
Quoted 9 lines · Saurabh Singh Sengar
Quoted 1 line

Could you please rephrase this to be less confusing?

Thanks for your review. Currently, in the absence of ACPI, it is impossible to disable X86_MPPARSE. In the case of ACPI being enabled, one has the option to either enable or disable X86_MPARSE. My intention is to permit X86_MPPARSE=n for OF platforms where ACPI=n. To describe the capability of choosing any desired value for MPPARSE, I used the term 'selectable.' Perhaps 'configurable' would be a more appropriate word in this context? I can fix this and include it in V2.

OK, so this particular Hyper-V setup doesn't run normal normal distro kernels? It requires a very specialized kernel? Or it's just _better_ that the kernel is configured this way?

Quoted 5 lines
Quoted 2 lines

This is also one of those patches where I wonder: Why do _you_ care about this? Are you just trying to be nice? Is this intended as some kind of cleanup?

It solves an issue for Hyper-V VBS setup, please refer to the 2/2 of this patch series.

Heh, that changelog is even more confusing than _this_ one. It doesn't say that there's a problem, only that it removes "not required" code.

I'm still confused by this whole thing.

#8 lore raw
Quoted 23 lines

-----Original Message-----
From: Dave Hansen <[email protected]>
Sent: Wednesday, May 24, 2023 11:33 PM
To: Saurabh Singh Sengar <[email protected]>; Saurabh Sengar <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; KY Srinivasan <[email protected]>; Haiyang Zhang <[email protected]>; [email protected]; Dexuan Cui <[email protected]>; Michael Kelley (LINUX) <[email protected]>; [email protected]; [email protected]
Subject: Re: [EXTERNAL] Re: [PATCH 1/2] x86/Kconfig: Allow CONFIG_X86_MPPARSE disable for OF platforms

Quoted 7 lines · Saurabh Singh Sengar
Quoted 1 line

Could you please rephrase this to be less confusing?

Thanks for your review. Currently, in the absence of ACPI, it is impossible to disable X86_MPPARSE. In the case of ACPI being enabled, one has the option to either enable or disable X86_MPARSE. My intention is to permit X86_MPPARSE=n for OF platforms where ACPI=n. To describe the capability of choosing any desired value for MPPARSE, I used

Quoted 7 lines

the term 'selectable.'

Quoted 2 lines

Perhaps 'configurable' would be a more appropriate word in this context? I can fix this and include it in V2.

OK, so this particular Hyper-V setup doesn't run normal normal distro kernels? It requires a very specialized kernel? Or it's just _better_ that the kernel is configured this way?

This is a system where we provide isolation through VTL. More information
About VTL is here: https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/tlfs/vsm#virtual-trust-level-vtl

In the context of VTL0, the system runs the normal kernel. However, for higher VTLs, we enable the kernel with HYPERV_VTL_MODE. It's important to note that the lower memory of the system is not included in the higher VTLs

It runs the normal kernel as part of VTL0 but for higher VTLs we run the kernel with HYPERV_VTL_MODE enable. VTL0 is assigned to lower memory of system, the lower memory not part of higher VTLs. However, MPARSE option disregard this and try to scan VTL0 memory which causes issue. This will enable any system which doesn't want lower memory to be scanned for MPPARSE for whatever reason.

Quoted 5 lines
Quoted 3 lines
Quoted 3 lines

This is also one of those patches where I wonder: Why do _you_ care about this? Are you just trying to be nice? Is this intended as some kind of

cleanup?

Quoted 1 line
Quoted 7 lines
Quoted 2 lines

It solves an issue for Hyper-V VBS setup, please refer to the 2/2 of this patch series.

Heh, that changelog is even more confusing than _this_ one. It doesn't say that there's a problem, only that it removes "not required" code.

I'm still confused by this whole thing.

I agree the commit message could be better. And I commented below in that thread to clarify. Hope it clarifies, please let me know if any more information is required:

When CONFIG_X86_MPPARSE is enabled, the kernel will scan low memory, looking for MP tables. In Hyper-V VBS setup, lower memory is assigned to VTL0. This lower memory may contain the actual MPPARSE table for VTL0, which can confuse the VTLx kernel and cause issues. (x > 0)

#9 lore raw
Quoted 4 lines · Saurabh Singh Sengar

When CONFIG_X86_MPPARSE is enabled, the kernel will scan low memory, looking for MP tables. In Hyper-V VBS setup, lower memory is assigned to VTL0. This lower memory may contain the actual MPPARSE table for VTL0, which can confuse the VTLx kernel and cause issues. (x > 0)

This still just seems wrong.

If an action crashes the kernel because of changes, we don't just compile it out and move on. We add enumeration for the new feature that's causing it and turn off the action at runtime.

#10 lore raw
Quoted 19 lines

-----Original Message-----
From: Dave Hansen <[email protected]>
Sent: Thursday, May 25, 2023 7:26 PM
To: Saurabh Singh Sengar <[email protected]>; Saurabh Sengar <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; KY Srinivasan <[email protected]>; Haiyang Zhang <[email protected]>; [email protected]; Dexuan Cui <[email protected]>; Michael Kelley (LINUX) <[email protected]>; [email protected]; [email protected]
Subject: Re: [EXTERNAL] Re: [PATCH 1/2] x86/Kconfig: Allow CONFIG_X86_MPPARSE disable for OF platforms

Quoted 2 lines · Saurabh Singh Sengar

When CONFIG_X86_MPPARSE is enabled, the kernel will scan low memory, looking for MP tables. In Hyper-V VBS setup, lower memory is assigned to

VTL0.

Quoted 9 lines
Quoted 2 lines

This lower memory may contain the actual MPPARSE table for VTL0, which can confuse the VTLx kernel and cause issues. (x > 0)

This still just seems wrong.

If an action crashes the kernel because of changes, we don't just compile it out and move on. We add enumeration for the new feature that's causing it and turn off the action at runtime.

Thanks, I greatly appreciate your suggestion and wanted to let you know that I am actively working on upstreaming the new fix for the VTL driver to bypass the need for the MP table scan.

Furthermore, I would like to learn about the rationale behind disallowing the disablement of CONFIG_X86_MPPARSE when MP tables are not in use. Considering that we compile out the features we don't support, wouldn't it be acceptable to allow users to customize their configurations in this manner? Allowing the disablement of CONFIG_X86_MPPARSE would provide greater flexibility and efficiency for those who do not utilize MP tables.

#11 lore raw
Quoted 6 lines · Saurabh Singh Sengar

Furthermore, I would like to learn about the rationale behind disallowing the disablement of CONFIG_X86_MPPARSE when MP tables are not in use. Considering that we compile out the features we don't support, wouldn't it be acceptable to allow users to customize their configurations in this manner? Allowing the disablement of CONFIG_X86_MPPARSE would provide greater flexibility and efficiency for those who do not utilize MP tables.

If someone sent a patch, I'd certainly look and figure out what "flexibility" and "efficiency" it would provide. But, honestly, it would just just be noise if it doesn't solve an _actual_ problem.

Would anyone care or notice the "flexibility" and "efficiency" it would provide?

#12 lore raw
Quoted 22 lines

-----Original Message-----
From: Dave Hansen <[email protected]>
Sent: Friday, June 2, 2023 7:54 PM
To: Saurabh Singh Sengar <[email protected]>; Saurabh Sengar <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; KY Srinivasan <[email protected]>; Haiyang Zhang <[email protected]>; [email protected]; Dexuan Cui <[email protected]>; Michael Kelley (LINUX) <[email protected]>; [email protected]; [email protected]
Subject: [EXTERNAL] Re: [PATCH 1/2] x86/Kconfig: Allow CONFIG_X86_MPPARSE disable for OF platforms

Quoted 6 lines · Saurabh Singh Sengar

Furthermore, I would like to learn about the rationale behind disallowing the disablement of CONFIG_X86_MPPARSE when MP tables are not in use. Considering that we compile out the features we don't support, wouldn't it be acceptable to allow users to customize their configurations in this manner? Allowing the disablement of CONFIG_X86_MPPARSE would provide greater flexibility and efficiency for

Quoted 8 lines

those who do not utilize MP tables.

If someone sent a patch, I'd certainly look and figure out what "flexibility" and "efficiency" it would provide. But, honestly, it would just just be noise if it doesn't solve an _actual_ problem.

Would anyone care or notice the "flexibility" and "efficiency" it would provide?

After the new approach we have opted, I agree it's not blocking us from any functional problem. Although one of the things we are trying to achieve is the minimal kernel where we want to remove all the unnecessary options. Our system is not dependent MPPARSE and we just don't want this code in our minimal kernel, and this config option is preventing us from removing it.

Also, in past kernel has provided this flexibility for other options, which made me think it is fine do it for OF as well.
https://lkml.indiana.edu/hypermail/linux/kernel/1210.3/01987.html

Happy to know your opinion and learn.