kunit: Enable PCI on UML without triggering WARN()
Subsystems (3)
PATCH RESEND v2 1/1 kunit: Enable PCI on UML without triggering WARN()
Various KUnit tests require PCI infrastructure to work. All normal platforms enable PCI by default, but UML does not. Enabling PCI from .kunitconfig files is problematic as it would not be portable. So in commit 6fc3a8636a7b ("kunit: tool: Enable virtio/PCI by default on UML") PCI was enabled by way of CONFIG_UML_PCI_OVER_VIRTIO=y. However CONFIG_UML_PCI_OVER_VIRTIO requires additional configuration of CONFIG_UML_PCI_OVER_VIRTIO_DEVICE_ID or will otherwise trigger a WARN() in virtio_pcidev_init(). However there is no one correct value for UML_PCI_OVER_VIRTIO_DEVICE_ID which could be used by default.
This warning is confusing when debugging test failures.
On the other hand, the functionality of CONFIG_UML_PCI_OVER_VIRTIO is not used at all, given that it is completely non-functional as indicated by the WARN() in question. Instead it is only used as a way to enable CONFIG_UML_PCI which itself is not directly configurable.
Instead of going through CONFIG_UML_PCI_OVER_VIRTIO, introduce a custom configuration option which enables CONFIG_UML_PCI without triggering warnings or building dead code.
---
Changes in v2:
- Rebase onto v6.17-rc1
- Pick up review from Johannes
- Link to v1: https://lore.kernel.org/r/[email protected]
--- lib/kunit/Kconfig | 7 +++++++ tools/testing/kunit/configs/arch_uml.config | 5 ++--- 2 files changed, 9 insertions(+), 3 deletions(-)
lib/kunit/Kconfig +7 -0
@@ -106,4 +106,11 @@ config KUNIT_DEFAULT_TIMEOUT If unsure, the default timeout of 300 seconds is suitable for most cases. +config KUNIT_UML_PCI + bool "KUnit UML PCI Support" + depends on UML + select UML_PCI + help + Enables the PCI subsystem on UML for use by KUnit tests. + endif # KUNIT
tools/testing/kunit/configs/arch_uml.config +2 -3
@@ -1,8 +1,7 @@ # Config options which are added to UML builds by default -# Enable virtio/pci, as a lot of tests require it. -CONFIG_VIRTIO_UML=y -CONFIG_UML_PCI_OVER_VIRTIO=y +# Enable pci, as a lot of tests require it. +CONFIG_KUNIT_UML_PCI=y # Enable FORTIFY_SOURCE for wider checking. CONFIG_FORTIFY_SOURCE=y
---
base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
change-id: 20250626-kunit-uml-pci-a2b687553746
Best regards,
Signature · 1 line
Thomas Weißschuh <[email protected]>
Hi Thomas,
Quoted 17 lines · Thomas Weißschuh
Various KUnit tests require PCI infrastructure to work. All normal platforms enable PCI by default, but UML does not. Enabling PCI from .kunitconfig files is problematic as it would not be portable. So in commit
6fc3a8636a7b("kunit: tool: Enable virtio/PCI by default on UML") PCI was enabled by way ofCONFIG_UML_PCI_OVER_VIRTIO=y. HoweverCONFIG_UML_PCI_OVER_VIRTIOrequires additional configuration ofCONFIG_UML_PCI_OVER_VIRTIO_DEVICE_IDor will otherwise trigger aWARN()invirtio_pcidev_init(). However there is no one correct value forUML_PCI_OVER_VIRTIO_DEVICE_IDwhich could be used by default.This warning is confusing when debugging test failures.
On the other hand, the functionality of
CONFIG_UML_PCI_OVER_VIRTIOis not used at all, given that it is completely non-functional as indicated by theWARN()in question. Instead it is only used as a way to enableCONFIG_UML_PCIwhich itself is not directly configurable.
Quoted 6 lines
Instead of going through
CONFIG_UML_PCI_OVER_VIRTIO, introduce a custom configuration option which enablesCONFIG_UML_PCIwithout triggering warnings or building dead code.Signed-off-by Thomas Weißschuh <[email protected]>Reviewed-by Johannes Berg <[email protected]>
Thanks for your patch!
lib/kunit/Kconfig config KUNIT_DEFAULT_TIMEOUT · line 109
Quoted 7 lines
lib/kunit/Kconfig +1
-0@@ -106,4 +106,11 @@ config KUNIT_DEFAULT_TIMEOUT If unsure, the default timeout of 300 seconds is suitable for most cases. +config KUNIT_UML_PCI
Where is the consumer of this symbol?
Quoted 12 lines
lib/kunit/Kconfig +6
-0+ bool "KUnit UML PCI Support" + depends on UML + select UML_PCI + help + Enables the PCI subsystem on UML for use by KUnit tests. + endif # KUNITtools/testing/kunit/configs/arch_uml.config +0
-0
tools/testing/kunit/configs/arch_uml.config line 7
Quoted 10 lines
tools/testing/kunit/configs/arch_uml.config +2
-3@@ -1,8 +1,7 @@ # Config options which are added to UML builds by default -# Enable virtio/pci, as a lot of tests require it. -CONFIG_VIRTIO_UML=y -CONFIG_UML_PCI_OVER_VIRTIO=y +# Enable pci, as a lot of tests require it. +CONFIG_KUNIT_UML_PCI=y # Enable FORTIFY_SOURCE for wider checking. CONFIG_FORTIFY_SOURCE=y
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Hi Geert,
Quoted 34 lines · Geert Uytterhoeven
Quoted 17 lines · Thomas Weißschuh
Various KUnit tests require PCI infrastructure to work. All normal platforms enable PCI by default, but UML does not. Enabling PCI from .kunitconfig files is problematic as it would not be portable. So in commit
6fc3a8636a7b("kunit: tool: Enable virtio/PCI by default on UML") PCI was enabled by way ofCONFIG_UML_PCI_OVER_VIRTIO=y. HoweverCONFIG_UML_PCI_OVER_VIRTIOrequires additional configuration ofCONFIG_UML_PCI_OVER_VIRTIO_DEVICE_IDor will otherwise trigger aWARN()invirtio_pcidev_init(). However there is no one correct value forUML_PCI_OVER_VIRTIO_DEVICE_IDwhich could be used by default.This warning is confusing when debugging test failures.
On the other hand, the functionality of
CONFIG_UML_PCI_OVER_VIRTIOis not used at all, given that it is completely non-functional as indicated by theWARN()in question. Instead it is only used as a way to enableCONFIG_UML_PCIwhich itself is not directly configurable.Quoted 6 lines
Instead of going through
CONFIG_UML_PCI_OVER_VIRTIO, introduce a custom configuration option which enablesCONFIG_UML_PCIwithout triggering warnings or building dead code.Signed-off-by Thomas Weißschuh <[email protected]>Reviewed-by Johannes Berg <[email protected]>Thanks for your patch!
Quoted 6 lines
lib/kunit/Kconfig +0
-0@@ -106,4 +106,11 @@ config KUNIT_DEFAULT_TIMEOUT If unsure, the default timeout of 300 seconds is suitable for most cases.
Quoted 3 lines
lib/kunit/Kconfig config KUNIT_DEFAULT_TIMEOUT · line 109
Quoted 1 line
lib/kunit/Kconfig +1
-0+config KUNIT_UML_PCIWhere is the consumer of this symbol?
There is none. The relevant part is that it selects UML_PCI which on its own is not user-visible. Directly enabling UML_PCI wihtout any drivers only makes sense in the context of KUnit.
Quoted 22 lines
Quoted 22 lines
lib/kunit/Kconfig +6
-0+ bool "KUnit UML PCI Support" + depends on UML + select UML_PCI + help + Enables the PCI subsystem on UML for use by KUnit tests. + endif # KUNITtools/testing/kunit/configs/arch_uml.config +2
-3@@ -1,8 +1,7 @@ # Config options which are added to UML builds by default -# Enable virtio/pci, as a lot of tests require it. -CONFIG_VIRTIO_UML=y -CONFIG_UML_PCI_OVER_VIRTIO=y +# Enable pci, as a lot of tests require it. +CONFIG_KUNIT_UML_PCI=y # Enable FORTIFY_SOURCE for wider checking. CONFIG_FORTIFY_SOURCE=y
Quoted 18 lines · Thomas Weißschuh
Various KUnit tests require PCI infrastructure to work. All normal platforms enable PCI by default, but UML does not. Enabling PCI from .kunitconfig files is problematic as it would not be portable. So in commit
6fc3a8636a7b("kunit: tool: Enable virtio/PCI by default on UML") PCI was enabled by way ofCONFIG_UML_PCI_OVER_VIRTIO=y. HoweverCONFIG_UML_PCI_OVER_VIRTIOrequires additional configuration ofCONFIG_UML_PCI_OVER_VIRTIO_DEVICE_IDor will otherwise trigger aWARN()invirtio_pcidev_init(). However there is no one correct value forUML_PCI_OVER_VIRTIO_DEVICE_IDwhich could be used by default.This warning is confusing when debugging test failures.
On the other hand, the functionality of
CONFIG_UML_PCI_OVER_VIRTIOis not used at all, given that it is completely non-functional as indicated by theWARN()in question. Instead it is only used as a way to enableCONFIG_UML_PCIwhich itself is not directly configurable.
Quoted 7 lines
Instead of going through
CONFIG_UML_PCI_OVER_VIRTIO, introduce a custom configuration option which enablesCONFIG_UML_PCIwithout triggering warnings or building dead code.Signed-off-by Thomas Weißschuh <[email protected]>Reviewed-by Johannes Berg <[email protected]>---
Cheers,
-- David
Quoted 49 lines
Changes in v2:
- Rebase onto v6.17-rc1
- Pick up review from Johannes
- Link to v1: https://lore.kernel.org/r/[email protected]--- lib/kunit/Kconfig | 7 +++++++ tools/testing/kunit/configs/arch_uml.config | 5 ++--- 2 files changed, 9 insertions(+), 3 deletions(-)lib/kunit/Kconfig +7
-0@@ -106,4 +106,11 @@ config KUNIT_DEFAULT_TIMEOUT If unsure, the default timeout of 300 seconds is suitable for most cases. +config KUNIT_UML_PCI + bool "KUnit UML PCI Support" + depends on UML + select UML_PCI + help + Enables the PCI subsystem on UML for use by KUnit tests. + endif # KUNITtools/testing/kunit/configs/arch_uml.config +2
-4@@ -1,8 +1,7 @@ # Config options which are added to UML builds by default -# Enable virtio/pci, as a lot of tests require it. -CONFIG_VIRTIO_UML=y -CONFIG_UML_PCI_OVER_VIRTIO=y +# Enable pci, as a lot of tests require it. +CONFIG_KUNIT_UML_PCI=y # Enable FORTIFY_SOURCE for wider checking. CONFIG_FORTIFY_SOURCE=y ---base-commit:
8f5ae30d69d7543eee0d70083daf4de8fe15d585
change-id: 20250626-kunit-uml-pci-a2b687553746Best regards,
--
Thomas Weißschuh <[email protected]>
Shuah Khan
maintainerQuoted 38 lines · Thomas Weißschuh
Various KUnit tests require PCI infrastructure to work. All normal platforms enable PCI by default, but UML does not. Enabling PCI from .kunitconfig files is problematic as it would not be portable. So in commit
6fc3a8636a7b("kunit: tool: Enable virtio/PCI by default on UML") PCI was enabled by way ofCONFIG_UML_PCI_OVER_VIRTIO=y. HoweverCONFIG_UML_PCI_OVER_VIRTIOrequires additional configuration ofCONFIG_UML_PCI_OVER_VIRTIO_DEVICE_IDor will otherwise trigger aWARN()invirtio_pcidev_init(). However there is no one correct value forUML_PCI_OVER_VIRTIO_DEVICE_IDwhich could be used by default.This warning is confusing when debugging test failures.
On the other hand, the functionality of
CONFIG_UML_PCI_OVER_VIRTIOis not used at all, given that it is completely non-functional as indicated by theWARN()in question. Instead it is only used as a way to enableCONFIG_UML_PCIwhich itself is not directly configurable.Instead of going through
CONFIG_UML_PCI_OVER_VIRTIO, introduce a custom configuration option which enablesCONFIG_UML_PCIwithout triggering warnings or building dead code.Signed-off-by Thomas Weißschuh <[email protected]>Reviewed-by Johannes Berg <[email protected]>---
Changes in v2:
- Rebase onto v6.17-rc1
- Pick up review from Johannes
- Link to v1: https://lore.kernel.org/r/[email protected]--- lib/kunit/Kconfig | 7 +++++++ tools/testing/kunit/configs/arch_uml.config | 5 ++--- 2 files changed, 9 insertions(+), 3 deletions(-)lib/kunit/Kconfig +0
-0
lib/kunit/Kconfig config KUNIT_DEFAULT_TIMEOUT · line 114
Quoted 9 lines
lib/kunit/Kconfig +6
-0@@ -106,4 +106,11 @@ config KUNIT_DEFAULT_TIMEOUT If unsure, the default timeout of 300 seconds is suitable for most cases. +config KUNIT_UML_PCI + bool "KUnit UML PCI Support" + depends on UML + select UML_PCI + help + Enables the PCI subsystem on UML for use by KUnit tests.
I am applying this patch for 6.18-rc1.
Please send a patch to fix the following warning on top of this one based on
https://web.git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/log/?h=kunit
WARNING: please write a help paragraph that fully describes the config symbol with at least 4 lines #136: FILE: lib/kunit/Kconfig:109:
+config KUNIT_UML_PCI
+ bool "KUnit UML PCI Support"
+ depends on UML
+ select UML_PCI
+ help
+ Enables the PCI subsystem on UML for use by KUnit tests.
thanks,
-- Shuah