Re: [PATCH] resource, kunit: add dependency on SPARSEMEM

From: Geert Uytterhoeven
Date: Mon Sep 23 2024 - 09:00:13 EST


Hi Günter,

On Mon, Sep 23, 2024 at 12:50 AM Guenter Roeck <linux@xxxxxxxxxxxx> wrote:
> Building allmodconfig images on systems with SPARSEMEM=n results in
> the following message.
>
> WARNING: unmet direct dependencies detected for GET_FREE_REGION
> Depends on [n]: SPARSEMEM [=n]
> Selected by [m]:
> - RESOURCE_KUNIT_TEST [=m] && RUNTIME_TESTING_MENU [=y] && KUNIT [=m]
>
> and the build ultimately fails.

Really? What's the build error?
It does build for me on m68k, after fixing:

--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -101,7 +101,7 @@ extern int mmap_rnd_compat_bits __read_mostly;
# ifdef MAX_PHYSMEM_BITS
# define PHYSMEM_END ((1ULL << MAX_PHYSMEM_BITS) - 1)
# else
-# define PHYSMEM_END (-1ULL)
+# define PHYSMEM_END ((phys_addr_t)-1)
# endif
#endif

> GET_FREE_REGION depends on SPARSEMEM, so any configuration selecting it
> also depends on SPARSEMEM. Add the missing dependency.
>
> Effectively that means that RESOURCE_KUNIT_TEST is now restricted to
> systems with SPARSEMEM=y, but that can not be helped.

Perhaps the individual test(s) that do depend on GET_FREE_REGION should
be protected by #ifdef CONFIG_GET_FREE_REGION instead? However,
I have no idea which parts depend on that, as apparently all tests
succeed on m68k/ARAnyM, with CONFIG_SPARSEMEM=n:

KTAP version 1
1..1
KTAP version 1
# Subtest: resource
# module: resource_kunit
1..3
ok 1 resource_test_union
ok 2 resource_test_intersection
ok 3 resource_test_region_intersects
# resource: pass:3 fail:0 skip:0 total:3
# Totals: pass:3 fail:0 skip:0 total:3
ok 1 resource

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

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