[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aUl-hngUuG3FWsR7@redhat.com>
Date: Mon, 22 Dec 2025 12:23:18 -0500
From: Brian Masney <bmasney@...hat.com>
To: "Peng Fan (OSS)" <peng.fan@....nxp.com>
Cc: Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>,
Thomas Weißschuh <thomas.weissschuh@...utronix.de>,
David Gow <davidgow@...gle.com>,
Johannes Berg <johannes@...solutions.net>,
Shuah Khan <skhan@...uxfoundation.org>, linux-clk@...r.kernel.org,
linux-kernel@...r.kernel.org, Peng Fan <peng.fan@....com>
Subject: Re: [PATCH v2] clk: Disable KUNIT_UML_PCI
Hi Peng,
On Mon, Dec 22, 2025 at 03:06:33PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@....com>
>
> commit 031cdd3bc3f3 ("kunit: Enable PCI on UML without triggering WARN()")
> enables KUNIT_UML_PCI, but clk driver could not work with it.
> 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 ]---
>
> Reviewed-by: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
> Signed-off-by: Peng Fan <peng.fan@....com>
> ---
> Changes in v2:
> - Drop fixes tag
> - Add R-b
> - Remove "CONFIG_UML_PCI_OVER_VIRTIO=n"
> ---
> drivers/clk/.kunitconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clk/.kunitconfig b/drivers/clk/.kunitconfig
> index 08e26137f3d9..8a0ea41934a2 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
> @@ -6,4 +7,3 @@ CONFIG_CLK_KUNIT_TEST=y
> CONFIG_CLK_FIXED_RATE_KUNIT_TEST=y
> CONFIG_CLK_GATE_KUNIT_TEST=y
> CONFIG_CLK_FD_KUNIT_TEST=y
> -CONFIG_UML_PCI_OVER_VIRTIO=n
I talked to Stephen at Linux Plumbers 1.5 weeks ago about this
particular issue. My recollection is that he felt that that the issue
ultimately should be fixed in UML / kunit. I'm not entirely sure how
to do that though. He said that the tests run properly when you run
them natively on arm64.
If I was going to take a stab at this, personally I would stub out
the writel as described at
Documentation/dev-tools/kunit/api/functionredirection.rst.
So, add a KUNIT_STATIC_STUB_REDIRECT to clk_gate_readl() and
clk_gate_writel() in drivers/clk/clk-gate.c. The clk gate tests can
then provide their own mock readl/writel.
I don't know if that'll get accepted.
Brian
Powered by blists - more mailing lists