Skip to contentSkip to conversation

of: Allow overlay kunit tests to run CONFIG_OF_OVERLAY=n

PATCH In review Stephen Boyd 3 participants 6 messages Oct 16, 2024 – Nov 12, 2024 Device tree

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 of: Allow overlay kunit tests to run CONFIG_OF_OVERLAY=n

Some configurations want to enable CONFIG_KUNIT without enabling CONFIG_OF_OVERLAY. The kunit overlay code already skips if CONFIG_OF_OVERLAY isn't enabled, so this select here isn't really doing anything besides making it easier to run the tests without them skipping. Remove the select and move the config setting to the drivers/of/.kunitconfig file so that the overlay tests can be run with or without CONFIG_OF_OVERLAY set to test either behavior.

Fixes 5c9dd72d8385 ("of: Add a KUnit test for overlays and test managed APIs")
---
 drivers/of/.kunitconfig   | 1 +
 drivers/of/Kconfig        | 1 -
 drivers/of/overlay_test.c | 2 ++
 3 files changed, 3 insertions(+), 1 deletion(-)
drivers/of/.kunitconfig +1 -0
index 4c53d2c7a275..7d570cb922a1 100644
@@ -1,4 +1,5 @@
 CONFIG_KUNIT=y
 CONFIG_OF=y
 CONFIG_OF_KUNIT_TEST=y
+CONFIG_OF_OVERLAY=y
 CONFIG_OF_OVERLAY_KUNIT_TEST=y
drivers/of/Kconfig +0 -1
index 0e2d608c3e20..0efa2d1b687a 100644
@@ -111,7 +111,6 @@ config OF_OVERLAY_KUNIT_TEST
 	tristate "Device Tree overlay KUnit tests" if !KUNIT_ALL_TESTS
 	depends on KUNIT
 	default KUNIT_ALL_TESTS
-	select OF_OVERLAY
 	help
 	  This option builds KUnit unit tests for the device tree overlay code.
 
drivers/of/overlay_test.c +2 -0
index 1f76d50fb16a..c787524c5a88 100644
@@ -65,6 +65,8 @@ static void of_overlay_apply_kunit_cleanup(struct kunit *test)
 	struct device_node *np;
 
 	of_root_kunit_skip(test);
+	if (!IS_ENABLED(CONFIG_OF_OVERLAY))
+		kunit_skip(test, "requires CONFIG_OF_OVERLAY to apply overlay");
 	if (!IS_ENABLED(CONFIG_OF_EARLY_FLATTREE))
 		kunit_skip(test, "requires CONFIG_OF_EARLY_FLATTREE for root node");
 

base-commit: 6e0391e48cf9fb8b1b5e27c0cbbaf2e4639f2c33

Signature · 2 lines
https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git/
https://git.kernel.org/pub/scm/linux/kernel/git/sboyd/spmi.git
maintainer
#1 lore raw
Quoted 9 lines · Stephen Boyd

Some configurations want to enable CONFIG_KUNIT without enabling CONFIG_OF_OVERLAY. The kunit overlay code already skips if CONFIG_OF_OVERLAY isn't enabled, so this select here isn't really doing anything besides making it easier to run the tests without them skipping. Remove the select and move the config setting to the drivers/of/.kunitconfig file so that the overlay tests can be run with or without CONFIG_OF_OVERLAY set to test either behavior.

Fixes 5c9dd72d8385 ("of: Add a KUnit test for overlays and test managed APIs")

Doesn't really seem like a fix. Does this need to go into 6.12?

Quoted 6 lines
---
 drivers/of/.kunitconfig   | 1 +
 drivers/of/Kconfig        | 1 -
 drivers/of/overlay_test.c | 2 ++
 3 files changed, 3 insertions(+), 1 deletion(-)
#2 lore raw

Quoting Rob Herring (2024-10-17 13:38:10)

Quoted 9 lines · Stephen Boyd
Quoted 8 lines

Some configurations want to enable CONFIG_KUNIT without enabling CONFIG_OF_OVERLAY. The kunit overlay code already skips if CONFIG_OF_OVERLAY isn't enabled, so this select here isn't really doing anything besides making it easier to run the tests without them skipping. Remove the select and move the config setting to the drivers/of/.kunitconfig file so that the overlay tests can be run with or without CONFIG_OF_OVERLAY set to test either behavior.

Quoted 3 lines
Quoted 1 line
Fixes 5c9dd72d8385 ("of: Add a KUnit test for overlays and test managed APIs")

Doesn't really seem like a fix.

Ok. Feel free to drop the tag.

Quoted 1 line

Does this need to go into 6.12?

It's only important for 6.12 if kernel configurators want to build the kernel with OF_OVERLAY_KUNIT_TEST enabled and not be forced to enable CONFIG_OF_OVERLAY. I don't mind if it waits a while.

#3 lore raw

Hi Stephen,

Quoted 9 lines · Stephen Boyd

Quoting Rob Herring (2024-10-17 13:38:10)

Quoted 8 lines · Stephen Boyd
Quoted 7 lines

Some configurations want to enable CONFIG_KUNIT without enabling CONFIG_OF_OVERLAY. The kunit overlay code already skips if CONFIG_OF_OVERLAY isn't enabled, so this select here isn't really doing anything besides making it easier to run the tests without them skipping. Remove the select and move the config setting to the drivers/of/.kunitconfig file so that the overlay tests can be run with or without CONFIG_OF_OVERLAY set to test either behavior.

Thanks for your patch, which is now commit 027af8c26fdc0642 ("of: Allow overlay kunit tests to run CONFIG_OF_OVERLAY=n") in dt-rh/for-next.

Quoted 11 lines
Quoted 3 lines
Quoted 1 line
Fixes 5c9dd72d8385 ("of: Add a KUnit test for overlays and test managed APIs")

Doesn't really seem like a fix.

Ok. Feel free to drop the tag.

Quoted 1 line

Does this need to go into 6.12?

It's only important for 6.12 if kernel configurators want to build the kernel with OF_OVERLAY_KUNIT_TEST enabled and not be forced to enable CONFIG_OF_OVERLAY. I don't mind if it waits a while.

I'd say it's a fix, so please keep at last the Fixes tag. Merely enabling kunit tests (which can be modular) should not increase the possible attack vector on a product by enabling extra unneeded code.

So

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
maintainer
#4 lore raw
Quoted 24 lines · Geert Uytterhoeven

Hi Stephen,

Quoted 9 lines · Stephen Boyd

Quoting Rob Herring (2024-10-17 13:38:10)

Quoted 8 lines · Stephen Boyd
Quoted 7 lines

Some configurations want to enable CONFIG_KUNIT without enabling CONFIG_OF_OVERLAY. The kunit overlay code already skips if CONFIG_OF_OVERLAY isn't enabled, so this select here isn't really doing anything besides making it easier to run the tests without them skipping. Remove the select and move the config setting to the drivers/of/.kunitconfig file so that the overlay tests can be run with or without CONFIG_OF_OVERLAY set to test either behavior.

Thanks for your patch, which is now commit 027af8c26fdc0642 ("of: Allow overlay kunit tests to run CONFIG_OF_OVERLAY=n") in dt-rh/for-next.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Fixes 5c9dd72d8385 ("of: Add a KUnit test for overlays and test managed APIs")

Doesn't really seem like a fix.

Ok. Feel free to drop the tag.

Quoted 1 line

Does this need to go into 6.12?

Quoted 7 lines
Quoted 3 lines

It's only important for 6.12 if kernel configurators want to build the kernel with OF_OVERLAY_KUNIT_TEST enabled and not be forced to enable CONFIG_OF_OVERLAY. I don't mind if it waits a while.

I'd say it's a fix, so please keep at last the Fixes tag. Merely enabling kunit tests (which can be modular) should not increase the possible attack vector on a product by enabling extra unneeded code.

Not sure I buy that that is an actual problem. However, not worth arguing over. I only really care because if there's a Fixes, then this really should go to Linus for 6.12 rather than eventually get auto-selected from 6.13 to go to stable. So I moved it to send to Linus, but I found that CONFIG_OF_OVERLAY is still selected with this patch. That's because the clock kunit tests also select CONFIG_OF_OVERLAY. That's fixed in next, but it's not queued up for 6.12.

Rob

#5 lore raw

Quoting Rob Herring (2024-11-08 08:55:32)

Quoted 17 lines · Geert Uytterhoeven
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Fixes 5c9dd72d8385 ("of: Add a KUnit test for overlays and test managed APIs")

Doesn't really seem like a fix.

Ok. Feel free to drop the tag.

Quoted 1 line

Does this need to go into 6.12?

Quoted 7 lines
Quoted 3 lines

It's only important for 6.12 if kernel configurators want to build the kernel with OF_OVERLAY_KUNIT_TEST enabled and not be forced to enable CONFIG_OF_OVERLAY. I don't mind if it waits a while.

I'd say it's a fix, so please keep at last the Fixes tag. Merely enabling kunit tests (which can be modular) should not increase the possible attack vector on a product by enabling extra unneeded code.

Quoted 8 lines

Not sure I buy that that is an actual problem. However, not worth arguing over. I only really care because if there's a Fixes, then this really should go to Linus for 6.12 rather than eventually get auto-selected from 6.13 to go to stable. So I moved it to send to Linus, but I found that CONFIG_OF_OVERLAY is still selected with this patch. That's because the clock kunit tests also select CONFIG_OF_OVERLAY. That's fixed in next, but it's not queued up for 6.12.

I was planning to send the clk patch in the next merge window. Are you sending the fix now? If you want you can also send the clk side patch and I can drop it from the clk tree.