Re: [PATCH v3] kunit: tool: Enable virtio/PCI by default on UML

From: Maxime Ripard
Date: Mon Jul 11 2022 - 11:50:16 EST


On Mon, Jul 11, 2022 at 08:10:36AM -0700, Daniel Latypov wrote:
> On Mon, Jul 11, 2022 at 7:46 AM Maxime Ripard <maxime@xxxxxxxxxx> wrote:
> >
> > Unfortunately, this breaks the clock tests in next-20220711:
> > $ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/clk/.kunitconfig --raw_output
>
> Thanks, this is indeed an issue.
>
> I remember noticing this in early April.
> I incorrectly remembered that a fix had been sent.
>
> A more minimal reproducer:
> $ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/clk
> 'clk-gate-test.clk_gate_test_enable'
>
> The part of the test that becomes problematic with this patch (i.e.
> enabling logic iomem) is the cast on line 143.
>
> 130 struct clk_gate_test_context {
> 131 void __iomem *fake_mem;
> 132 struct clk_hw *hw;
> 133 struct clk_hw *parent;
> 134 u32 fake_reg; /* Keep at end, KASAN can detect out of bounds */
> 135 };
> 136
> 137 static struct clk_gate_test_context
> *clk_gate_test_alloc_ctx(struct kunit *test)
> 138 {
> 139 struct clk_gate_test_context *ctx;
> 140
> 141 test->priv = ctx = kunit_kzalloc(test, sizeof(*ctx),
> GFP_KERNEL);
> 142 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
> 143 ctx->fake_mem = (void __force __iomem *)&ctx->fake_reg;
> 144
> 145 return ctx;
> 146 }
>
> A simple fix we could carry in the KUnit branch is this:
>
> diff --git a/drivers/clk/.kunitconfig b/drivers/clk/.kunitconfig
> index cdbc7d7deba9..2fbeb71316f8 100644
> --- a/drivers/clk/.kunitconfig
> +++ b/drivers/clk/.kunitconfig
> @@ -2,3 +2,4 @@ CONFIG_KUNIT=y
> CONFIG_COMMON_CLK=y
> CONFIG_CLK_KUNIT_TEST=y
> CONFIG_CLK_GATE_KUNIT_TEST=y
> +CONFIG_UML_PCI_OVER_VIRTIO=n

It works for me now thanks

Feel free to add my Tested-by

Maxime

Attachment: signature.asc
Description: PGP signature