mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Kunit test failures with cpumask tests on parisc
@ 2024-02-05  6:53 Guenter Roeck
  2024-02-05  9:28 ` Helge Deller
  0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2024-02-05  6:53 UTC (permalink / raw)
  To: Yury Norov
  Cc: James.Bottomley, Helge Deller, linux-parisc, Andy Shevchenko,
	Rasmus Villemoes, linux-kernel

Hi,

when running cpumask Kunit tests on parisc/parisc64 in qemu,
I get the following errors.

      KTAP version 1
      # Subtest: cpumask
      # module: cpumask_kunit
      1..6
      # test_cpumask_weight: EXPECTATION FAILED at lib/cpumask_kunit.c:68
      Expected nr_cpu_ids == cpumask_weight(((const struct cpumask *)&__cpu_possible_mask)), but
          nr_cpu_ids == 16 (0x10)
          cpumask_weight(((const struct cpumask *)&__cpu_possible_mask)) == 1 (0x1)
  cpu_possible_mask contains CPUs 0
      not ok 1 test_cpumask_weight
      # test_cpumask_first: EXPECTATION FAILED at lib/cpumask_kunit.c:79
      Expected nr_cpu_ids <= cpumask_first_zero(((const struct cpumask *)&__cpu_possible_mask)), but
          nr_cpu_ids == 16 (0x10)
          cpumask_first_zero(((const struct cpumask *)&__cpu_possible_mask)) == 1 (0x1)
  cpu_possible_mask contains CPUs 0
      not ok 2 test_cpumask_first
      # test_cpumask_last: EXPECTATION FAILED at lib/cpumask_kunit.c:87
      Expected nr_cpu_ids - 1 == cpumask_last(((const struct cpumask *)&__cpu_possible_mask)), but
          nr_cpu_ids - 1 == 15 (0xf)
          cpumask_last(((const struct cpumask *)&__cpu_possible_mask)) == 0 (0x0)
  cpu_possible_mask contains CPUs 0
      not ok 3 test_cpumask_last
      # test_cpumask_next: EXPECTATION FAILED at lib/cpumask_kunit.c:94
      Expected nr_cpu_ids <= cpumask_next_zero(-1, ((const struct cpumask *)&__cpu_possible_mask)), but
          nr_cpu_ids == 16 (0x10)
          cpumask_next_zero(-1, ((const struct cpumask *)&__cpu_possible_mask)) == 1 (0x1)
  cpu_possible_mask contains CPUs 0
      not ok 4 test_cpumask_next
      ok 5 test_cpumask_iterators
      ok 6 test_cpumask_iterators_builtin
  # cpumask: pass:2 fail:4 skip:0 total:6
  # Totals: pass:2 fail:4 skip:0 total:6
  not ok 5 cpumask

It appears that parisc sets __cpu_possible_mask to the number of online CPUs,
which is limited in qemu and doesn't match CONFIG_NR_CPUS. Is this a problem
with the unit test or with the parisc architecture, or does the unit test
simply not apply for parisc ?

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Kunit test failures with cpumask tests on parisc
  2024-02-05  6:53 Kunit test failures with cpumask tests on parisc Guenter Roeck
@ 2024-02-05  9:28 ` Helge Deller
  2024-02-05 16:06   ` Guenter Roeck
  0 siblings, 1 reply; 3+ messages in thread
From: Helge Deller @ 2024-02-05  9:28 UTC (permalink / raw)
  To: Guenter Roeck, Yury Norov
  Cc: James.Bottomley, linux-parisc, Andy Shevchenko, Rasmus Villemoes,
	linux-kernel

On 2/5/24 07:53, Guenter Roeck wrote:
> when running cpumask Kunit tests on parisc/parisc64 in qemu,
> I get the following errors.
>
>        KTAP version 1
>        # Subtest: cpumask
>        # module: cpumask_kunit
>        1..6
>        # test_cpumask_weight: EXPECTATION FAILED at lib/cpumask_kunit.c:68
>        Expected nr_cpu_ids == cpumask_weight(((const struct cpumask *)&__cpu_possible_mask)), but
>            nr_cpu_ids == 16 (0x10)
>            cpumask_weight(((const struct cpumask *)&__cpu_possible_mask)) == 1 (0x1)
>    cpu_possible_mask contains CPUs 0
>        not ok 1 test_cpumask_weight
>        # test_cpumask_first: EXPECTATION FAILED at lib/cpumask_kunit.c:79
>        Expected nr_cpu_ids <= cpumask_first_zero(((const struct cpumask *)&__cpu_possible_mask)), but
>            nr_cpu_ids == 16 (0x10)
>            cpumask_first_zero(((const struct cpumask *)&__cpu_possible_mask)) == 1 (0x1)
>    cpu_possible_mask contains CPUs 0
>        not ok 2 test_cpumask_first
>        # test_cpumask_last: EXPECTATION FAILED at lib/cpumask_kunit.c:87
>        Expected nr_cpu_ids - 1 == cpumask_last(((const struct cpumask *)&__cpu_possible_mask)), but
>            nr_cpu_ids - 1 == 15 (0xf)
>            cpumask_last(((const struct cpumask *)&__cpu_possible_mask)) == 0 (0x0)
>    cpu_possible_mask contains CPUs 0
>        not ok 3 test_cpumask_last
>        # test_cpumask_next: EXPECTATION FAILED at lib/cpumask_kunit.c:94
>        Expected nr_cpu_ids <= cpumask_next_zero(-1, ((const struct cpumask *)&__cpu_possible_mask)), but
>            nr_cpu_ids == 16 (0x10)
>            cpumask_next_zero(-1, ((const struct cpumask *)&__cpu_possible_mask)) == 1 (0x1)
>    cpu_possible_mask contains CPUs 0
>        not ok 4 test_cpumask_next
>        ok 5 test_cpumask_iterators
>        ok 6 test_cpumask_iterators_builtin
>    # cpumask: pass:2 fail:4 skip:0 total:6
>    # Totals: pass:2 fail:4 skip:0 total:6
>    not ok 5 cpumask
>
> It appears that parisc sets __cpu_possible_mask to the number of online CPUs,
> which is limited in qemu and doesn't match CONFIG_NR_CPUS. Is this a problem
> with the unit test or with the parisc architecture, or does the unit test
> simply not apply for parisc ?

Thank you for finding and reporting this!
It's a bug (or a misunderstanding) in the parisc kernel.
Reverting commit 0921244f6f4f ("parisc: Only list existing CPUs in cpu_possible_mask")
fixes the KUnit test.

Furthermore the revert fixes the issue that CPU hot-unplugging doesn't
work and which I just was starting to debug:
https://lore.kernel.org/lkml/Zb0mbHlIud_bqftx@slm.duckdns.org/t/

Helge

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Kunit test failures with cpumask tests on parisc
  2024-02-05  9:28 ` Helge Deller
@ 2024-02-05 16:06   ` Guenter Roeck
  0 siblings, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2024-02-05 16:06 UTC (permalink / raw)
  To: Helge Deller, Yury Norov
  Cc: James.Bottomley, linux-parisc, Andy Shevchenko, Rasmus Villemoes,
	linux-kernel

On 2/5/24 01:28, Helge Deller wrote:
> On 2/5/24 07:53, Guenter Roeck wrote:
>> when running cpumask Kunit tests on parisc/parisc64 in qemu,
>> I get the following errors.
>>
>>        KTAP version 1
>>        # Subtest: cpumask
>>        # module: cpumask_kunit
>>        1..6
>>        # test_cpumask_weight: EXPECTATION FAILED at lib/cpumask_kunit.c:68
>>        Expected nr_cpu_ids == cpumask_weight(((const struct cpumask *)&__cpu_possible_mask)), but
>>            nr_cpu_ids == 16 (0x10)
>>            cpumask_weight(((const struct cpumask *)&__cpu_possible_mask)) == 1 (0x1)
>>    cpu_possible_mask contains CPUs 0
>>        not ok 1 test_cpumask_weight
>>        # test_cpumask_first: EXPECTATION FAILED at lib/cpumask_kunit.c:79
>>        Expected nr_cpu_ids <= cpumask_first_zero(((const struct cpumask *)&__cpu_possible_mask)), but
>>            nr_cpu_ids == 16 (0x10)
>>            cpumask_first_zero(((const struct cpumask *)&__cpu_possible_mask)) == 1 (0x1)
>>    cpu_possible_mask contains CPUs 0
>>        not ok 2 test_cpumask_first
>>        # test_cpumask_last: EXPECTATION FAILED at lib/cpumask_kunit.c:87
>>        Expected nr_cpu_ids - 1 == cpumask_last(((const struct cpumask *)&__cpu_possible_mask)), but
>>            nr_cpu_ids - 1 == 15 (0xf)
>>            cpumask_last(((const struct cpumask *)&__cpu_possible_mask)) == 0 (0x0)
>>    cpu_possible_mask contains CPUs 0
>>        not ok 3 test_cpumask_last
>>        # test_cpumask_next: EXPECTATION FAILED at lib/cpumask_kunit.c:94
>>        Expected nr_cpu_ids <= cpumask_next_zero(-1, ((const struct cpumask *)&__cpu_possible_mask)), but
>>            nr_cpu_ids == 16 (0x10)
>>            cpumask_next_zero(-1, ((const struct cpumask *)&__cpu_possible_mask)) == 1 (0x1)
>>    cpu_possible_mask contains CPUs 0
>>        not ok 4 test_cpumask_next
>>        ok 5 test_cpumask_iterators
>>        ok 6 test_cpumask_iterators_builtin
>>    # cpumask: pass:2 fail:4 skip:0 total:6
>>    # Totals: pass:2 fail:4 skip:0 total:6
>>    not ok 5 cpumask
>>
>> It appears that parisc sets __cpu_possible_mask to the number of online CPUs,
>> which is limited in qemu and doesn't match CONFIG_NR_CPUS. Is this a problem
>> with the unit test or with the parisc architecture, or does the unit test
>> simply not apply for parisc ?
> 
> Thank you for finding and reporting this!
> It's a bug (or a misunderstanding) in the parisc kernel.
> Reverting commit 0921244f6f4f ("parisc: Only list existing CPUs in cpu_possible_mask")
> fixes the KUnit test.
> 
> Furthermore the revert fixes the issue that CPU hot-unplugging doesn't
> work and which I just was starting to debug:
> https://lore.kernel.org/lkml/Zb0mbHlIud_bqftx@slm.duckdns.org/t/
> 

Glad to help, and thanks for the update.

Guenter


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-05 16:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-05  6:53 Kunit test failures with cpumask tests on parisc Guenter Roeck
2024-02-05  9:28 ` Helge Deller
2024-02-05 16:06   ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®