* [PATCH] clk: Disable KUNIT_UML_PCI
@ 2025-11-28 4:14 Peng Fan (OSS)
2025-11-28 7:44 ` Johannes Berg
2025-11-28 8:13 ` Thomas Weißschuh
0 siblings, 2 replies; 5+ messages in thread
From: Peng Fan (OSS) @ 2025-11-28 4:14 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, Thomas Weißschuh, David Gow,
Johannes Berg, Shuah Khan, Brian Masney
Cc: linux-clk, linux-kernel, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
commit 031cdd3bc3f3 ("kunit: Enable PCI on UML without triggering WARN()")
causes clk gate test fail. Deselect KUNIT_UML_PCI to avoid the failure.
Dump as below:
WARNING: CPU: 0 PID: 227 at lib/logic_iomem.c:141 __raw_readl+0xac/0xe0
CPU: 0 UID: 0 PID: 227 Comm: kunit_try_catch Tainted: G
Tainted: [N]=TEST
Stack:
a0883d00 00000001 00000000 ffffff00
603ef142 60044832 6002598b 00000000
00000000 600211b3 00000001 00000000
Call Trace:
[<6032534c>] ? __raw_readl+0xac/0xe0
[<60044832>] ? dump_stack_lvl+0x57/0x73
[<6002598b>] ? _printk+0x0/0x61
[<600211b3>] ? __warn.cold+0x61/0xeb
[<600212cc>] ? warn_slowpath_fmt+0x8f/0x9c
[<6002123d>] ? warn_slowpath_fmt+0x0/0x9c
[<6032534c>] ? __raw_readl+0xac/0xe0
[<6002123d>] ? warn_slowpath_fmt+0x0/0x9c
[<6029e2ad>] ? clk_gate_endisable+0xcd/0x110
[<6029e315>] ? clk_gate_enable+0x15/0x20
[<6028795e>] ? clk_core_enable+0x6e/0xf0
[<60289f1f>] ? clk_enable+0x4f/0xa0
[<602a06af>] ? clk_gate_test_enable+0xbf/0x360
[<60053df9>] ? os_nsecs+0x29/0x40
[<600cd300>] ? ktime_get_ts64+0x0/0x130
[<600816c0>] ? to_kthread+0x0/0x50
[<602507bb>] ? kunit_try_run_case+0x7b/0x100
[<600816c0>] ? to_kthread+0x0/0x50
[<60252aa0>] ? kunit_generic_run_threadfn_adapter+0x0/0x30
[<60252ab2>] ? kunit_generic_run_threadfn_adapter+0x12/0x30
[<60082091>] ? kthread+0xf1/0x270
[<60047591>] ? new_thread_handler+0x41/0x60
---[ end trace 0000000000000000 ]---
Fixes: 031cdd3bc3f3 ("kunit: Enable PCI on UML without triggering WARN()")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/clk/.kunitconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/clk/.kunitconfig b/drivers/clk/.kunitconfig
index 08e26137f3d9..4697bf9fb949 100644
--- a/drivers/clk/.kunitconfig
+++ b/drivers/clk/.kunitconfig
@@ -1,4 +1,5 @@
CONFIG_KUNIT=y
+CONFIG_KUNIT_UML_PCI=n
CONFIG_OF=y
CONFIG_OF_OVERLAY=y
CONFIG_COMMON_CLK=y
---
base-commit: 765e56e41a5af2d456ddda6cbd617b9d3295ab4e
change-id: 20251128-clk-03ac129ce08a
Best regards,
--
Peng Fan <peng.fan@nxp.com>
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] clk: Disable KUNIT_UML_PCI
2025-11-28 4:14 [PATCH] clk: Disable KUNIT_UML_PCI Peng Fan (OSS)
@ 2025-11-28 7:44 ` Johannes Berg
2025-11-28 8:46 ` David Gow
2025-11-28 8:13 ` Thomas Weißschuh
1 sibling, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2025-11-28 7:44 UTC (permalink / raw)
To: Peng Fan (OSS), Michael Turquette, Stephen Boyd,
Thomas Weißschuh, David Gow, Shuah Khan, Brian Masney
Cc: linux-clk, linux-kernel, Peng Fan
>
> commit 031cdd3bc3f3 ("kunit: Enable PCI on UML without triggering WARN()")
> causes clk gate test fail. Deselect KUNIT_UML_PCI to avoid the failure.
While probably _true_ that this "caused" it, it also seems a bit
dishonest to blame it on that without giving any information as to why
the clk tests trigger some edge case or so?
FTR, the warning only happens when you pass an address to ioread(),
iowrite() or similar that wasn't obtained from ioremap(). Which ought to
not be valid, and I'm pretty convinced that a unit test should never
even end up here.
So no, I don't think this is a valid change, I think the clk unit tests
that end up doing readl() in the gate code for a non-existing device are
broken.
johannes
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] clk: Disable KUNIT_UML_PCI
2025-11-28 4:14 [PATCH] clk: Disable KUNIT_UML_PCI Peng Fan (OSS)
2025-11-28 7:44 ` Johannes Berg
@ 2025-11-28 8:13 ` Thomas Weißschuh
1 sibling, 0 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2025-11-28 8:13 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Michael Turquette, Stephen Boyd, David Gow, Johannes Berg,
Shuah Khan, Brian Masney, linux-clk, linux-kernel, Peng Fan
On Fri, Nov 28, 2025 at 12:14:48PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> commit 031cdd3bc3f3 ("kunit: Enable PCI on UML without triggering WARN()")
> causes clk gate test fail. Deselect KUNIT_UML_PCI to avoid the failure.
One relevant bit for the commit message is that CONFIG_UML_PCI_OVER_VIRTIO is
also disabled in this .kunitconfig for the same reason. See commit f84a9e965833
("clk: explicitly disable CONFIG_UML_PCI_OVER_VIRTIO in .kunitconfig"). The
commit itself declares itself to be a "short-term fix". But it is from 2022.
Maybe we can fix this properly at some point instead of papering over it.
> Dump as below:
> WARNING: CPU: 0 PID: 227 at lib/logic_iomem.c:141 __raw_readl+0xac/0xe0
> CPU: 0 UID: 0 PID: 227 Comm: kunit_try_catch Tainted: G
> Tainted: [N]=TEST
> Stack:
> a0883d00 00000001 00000000 ffffff00
> 603ef142 60044832 6002598b 00000000
> 00000000 600211b3 00000001 00000000
> Call Trace:
> [<6032534c>] ? __raw_readl+0xac/0xe0
> [<60044832>] ? dump_stack_lvl+0x57/0x73
> [<6002598b>] ? _printk+0x0/0x61
> [<600211b3>] ? __warn.cold+0x61/0xeb
> [<600212cc>] ? warn_slowpath_fmt+0x8f/0x9c
> [<6002123d>] ? warn_slowpath_fmt+0x0/0x9c
> [<6032534c>] ? __raw_readl+0xac/0xe0
> [<6002123d>] ? warn_slowpath_fmt+0x0/0x9c
> [<6029e2ad>] ? clk_gate_endisable+0xcd/0x110
> [<6029e315>] ? clk_gate_enable+0x15/0x20
> [<6028795e>] ? clk_core_enable+0x6e/0xf0
> [<60289f1f>] ? clk_enable+0x4f/0xa0
> [<602a06af>] ? clk_gate_test_enable+0xbf/0x360
> [<60053df9>] ? os_nsecs+0x29/0x40
> [<600cd300>] ? ktime_get_ts64+0x0/0x130
> [<600816c0>] ? to_kthread+0x0/0x50
> [<602507bb>] ? kunit_try_run_case+0x7b/0x100
> [<600816c0>] ? to_kthread+0x0/0x50
> [<60252aa0>] ? kunit_generic_run_threadfn_adapter+0x0/0x30
> [<60252ab2>] ? kunit_generic_run_threadfn_adapter+0x12/0x30
> [<60082091>] ? kthread+0xf1/0x270
> [<60047591>] ? new_thread_handler+0x41/0x60
> ---[ end trace 0000000000000000 ]---
>
> Fixes: 031cdd3bc3f3 ("kunit: Enable PCI on UML without triggering WARN()")
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> ---
> drivers/clk/.kunitconfig | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/clk/.kunitconfig b/drivers/clk/.kunitconfig
> index 08e26137f3d9..4697bf9fb949 100644
> --- a/drivers/clk/.kunitconfig
> +++ b/drivers/clk/.kunitconfig
> @@ -1,4 +1,5 @@
> CONFIG_KUNIT=y
> +CONFIG_KUNIT_UML_PCI=n
> CONFIG_OF=y
> CONFIG_OF_OVERLAY=y
> CONFIG_COMMON_CLK=y
Maybe drop CONFIG_UML_PCI_OVER_VIRTIO=n from the same file?
Thomas
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] clk: Disable KUNIT_UML_PCI
2025-11-28 7:44 ` Johannes Berg
@ 2025-11-28 8:46 ` David Gow
2025-12-16 8:44 ` Peng Fan
0 siblings, 1 reply; 5+ messages in thread
From: David Gow @ 2025-11-28 8:46 UTC (permalink / raw)
To: Johannes Berg
Cc: Peng Fan (OSS), Michael Turquette, Stephen Boyd,
Thomas Weißschuh, Shuah Khan, Brian Masney, linux-clk,
linux-kernel, Peng Fan
[-- Attachment #1: Type: text/plain, Size: 1479 bytes --]
On Fri, 28 Nov 2025 at 15:44, Johannes Berg <johannes@sipsolutions.net> wrote:
>
> >
> > commit 031cdd3bc3f3 ("kunit: Enable PCI on UML without triggering WARN()")
> > causes clk gate test fail. Deselect KUNIT_UML_PCI to avoid the failure.
>
> While probably _true_ that this "caused" it, it also seems a bit
> dishonest to blame it on that without giving any information as to why
> the clk tests trigger some edge case or so?
>
> FTR, the warning only happens when you pass an address to ioread(),
> iowrite() or similar that wasn't obtained from ioremap(). Which ought to
> not be valid, and I'm pretty convinced that a unit test should never
> even end up here.
>
> So no, I don't think this is a valid change, I think the clk unit tests
> that end up doing readl() in the gate code for a non-existing device are
> broken.
Yeah, the correct solution here is definitely to rework the test to not do this.
Unfortunately, I don't think there's a really pleasant way of faking
these in KUnit tests, but a path forward might involve logic_iomem
(possibly with some changes). Otherwise, reworking the test to put
these writes behind a function which can be mocked would be nice.
Ultimately, I don't have a problem with us disabling this in the
meantime for clk tests -- ultimately it's up to clk folks what their
test config is, and having tests which always fail isn't great -- but
it'd be nice to eliminate the cast-a-random-pointer-to-iomem hacks in
tests.
Cheers,
-- David
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5281 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] clk: Disable KUNIT_UML_PCI
2025-11-28 8:46 ` David Gow
@ 2025-12-16 8:44 ` Peng Fan
0 siblings, 0 replies; 5+ messages in thread
From: Peng Fan @ 2025-12-16 8:44 UTC (permalink / raw)
To: David Gow, Johannes Berg
Cc: Johannes Berg, Michael Turquette, Stephen Boyd,
Thomas Weißschuh, Shuah Khan, Brian Masney, linux-clk,
linux-kernel, Peng Fan
Hi David, Johannes
On Fri, Nov 28, 2025 at 04:46:39PM +0800, David Gow wrote:
>On Fri, 28 Nov 2025 at 15:44, Johannes Berg <johannes@sipsolutions.net> wrote:
>>
>> >
>> > commit 031cdd3bc3f3 ("kunit: Enable PCI on UML without triggering WARN()")
>> > causes clk gate test fail. Deselect KUNIT_UML_PCI to avoid the failure.
>>
>> While probably _true_ that this "caused" it, it also seems a bit
>> dishonest to blame it on that without giving any information as to why
>> the clk tests trigger some edge case or so?
>>
>> FTR, the warning only happens when you pass an address to ioread(),
>> iowrite() or similar that wasn't obtained from ioremap(). Which ought to
>> not be valid, and I'm pretty convinced that a unit test should never
>> even end up here.
>>
>> So no, I don't think this is a valid change, I think the clk unit tests
>> that end up doing readl() in the gate code for a non-existing device are
>> broken.
>
>Yeah, the correct solution here is definitely to rework the test to not do this.
>
>Unfortunately, I don't think there's a really pleasant way of faking
>these in KUnit tests, but a path forward might involve logic_iomem
>(possibly with some changes). Otherwise, reworking the test to put
>these writes behind a function which can be mocked would be nice.
>
>Ultimately, I don't have a problem with us disabling this in the
>meantime for clk tests -- ultimately it's up to clk folks what their
>test config is, and having tests which always fail isn't great -- but
>it'd be nice to eliminate the cast-a-random-pointer-to-iomem hacks in
>tests.
Sorry for late reply. Is it an acceptable short term fix for you if I drop the
fixes tag?
Thanks,
Peng
>
>Cheers,
>-- David
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-12-16 8:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-28 4:14 [PATCH] clk: Disable KUNIT_UML_PCI Peng Fan (OSS)
2025-11-28 7:44 ` Johannes Berg
2025-11-28 8:46 ` David Gow
2025-12-16 8:44 ` Peng Fan
2025-11-28 8:13 ` Thomas Weißschuh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).