From: Sander Vanheule <sander@svanheule.net>
To: "David Gow" <davidgow@google.com>, "Maíra Canal" <mairacanal@riseup.net>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
bp@alien8.de, dave.hansen@linux.intel.com,
Marco Elver <elver@google.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
hpa@zytor.com,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
tglx@linutronix.de, vschneid@redhat.com, x86@kernel.org,
yury.norov@gmail.com, Brendan Higgins <brendanhiggins@google.com>
Subject: Re: [PATCH v4 3/5] lib/test: Introduce cpumask KUnit test suite
Date: Wed, 20 Jul 2022 14:43:49 +0200 [thread overview]
Message-ID: <9b4e181abab0bec20dae93d35fe962b8167c73c9.camel@svanheule.net> (raw)
In-Reply-To: <CABVgOSkPXBc-PWk1zBZRQ_Tt+Sz1ruFHBj3ixojymZF=Vi4tpQ@mail.gmail.com>
Hi David, Maíra,
On Wed, 2022-07-20 at 13:24 +0800, David Gow wrote:
> On Wed, Jul 20, 2022 at 5:31 AM Maíra Canal <mairacanal@riseup.net> wrote:
> >
> > > Add a basic suite of tests for cpumask, providing some tests for empty
> > > and completely filled cpumasks.
> > >
> > > Signed-off-by: Sander Vanheule <sander@svanheule.net>
> > > Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> >
> > The tests test_cpumask_weight and test_cpumask_last are failing on all
> > architectures, as can be seen on [1]. Also this test doesn't follow the
> > standard style for KUnit tests [2].
> >
> > [1]
> > https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20220718/testrun/10865066/suite/kunit/tests/
> > [2] https://docs.kernel.org/dev-tools/kunit/style.html
> >
> > CC: Brendan Higgins <brendanhiggins@google.com>
> > CC: David Gow <davidgow@google.com>
> >
> > Best Regards,
> > - Maíra Canal
> >
>
> Hmm... this test passes on the default kunit_tool configs for UML and
> x86_64, which are all without SMP.
>
> It looks like the flaw is that, if CONFIG_NR_CPUS is greater than the
> actual number of CPUs present, then the cpu_possible_mask (correctly)
> won't be full.
>
> I'm not sure what the right fix is: but removing the checks for
> cpu_possible_mask being full is probably the way to go. Unless we want
> to plumb through some actual detail about the underlying system and
> check against that, it doesn't make sense. (Or, we could generate an
> artificial "possilbe_mask" which is always full, and test the cpu
> against that. But we sort-of already do that with mask_all anyway.)
The description of cpu_possible_mask does indeed allow for it to not be filled
completely.
>
> So, my recommendation for a fix would be:
> - Get rid of "KUNIT_EXPECT_TRUE(test, cpumask_full(cpu_possible_mask));"
As per the above, I'll remove this (faulty) check.
> - Replace "KUNIT_EXPECT_EQ(test, nr_cpumask_bits - 1,
> cpumask_last(cpu_possible_mask));" with a KUNIT_EXPECT_GE()
I think we can actually use KUNIT_EXPECT_EQ(test, nr_cpu_ids - 1, ...) here.
Since cpumask_first() on the same mask must return at most nr_cpu_ids - 1 for a
valid result, cpumask_last() cannot return anything larger than this value.
This implies that cpu_possible_mask cannot contain gaps if its weight equals
nr_cpu_ids (which is checked in test_cpumask_weight).
> - _Maybe_ add some debug logging with the cpumask value being checked,
> as it's a pain to tell from the expectation failure messages. e.g.,
> kunit_info(test, "cpu_possible_mask = '%*pb[l]'\n",
> cpumask_pr_args(cpu_possible_mask));
That would be a useful addition, I'll see where I can add it.
Best,
Sander
>
next prev parent reply other threads:[~2022-07-20 12:43 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-02 16:08 [PATCH v4 0/5] cpumask: Fix invalid uniprocessor assumptions Sander Vanheule
2022-07-02 16:08 ` [PATCH v4 1/5] x86/cacheinfo: move shared cache map definitions Sander Vanheule
2022-07-02 16:08 ` [PATCH v4 2/5] cpumask: Fix invalid uniprocessor mask assumption Sander Vanheule
2022-07-02 21:42 ` Yury Norov
2022-07-03 14:17 ` Sander Vanheule
2022-07-02 16:08 ` [PATCH v4 3/5] lib/test: Introduce cpumask KUnit test suite Sander Vanheule
2022-07-02 21:45 ` Yury Norov
2022-07-03 7:26 ` Sander Vanheule
2022-07-19 21:31 ` Maíra Canal
2022-07-20 5:24 ` David Gow
2022-07-20 12:43 ` Sander Vanheule [this message]
2022-07-20 12:47 ` Sander Vanheule
2022-07-02 16:08 ` [PATCH v4 4/5] cpumask: Add UP optimised for_each_*_cpu versions Sander Vanheule
2022-07-02 21:47 ` Yury Norov
2022-07-02 21:50 ` Yury Norov
2022-07-03 7:37 ` Sander Vanheule
2022-07-02 16:08 ` [PATCH v4 5/5] cpumask: Update cpumask_next_wrap() signature Sander Vanheule
2022-07-02 20:38 ` [PATCH v4 0/5] cpumask: Fix invalid uniprocessor assumptions Andrew Morton
2022-07-03 7:50 ` Sander Vanheule
2022-07-03 20:39 ` Andrew Morton
2022-07-10 6:51 ` Sander Vanheule
2022-07-11 20:22 ` Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9b4e181abab0bec20dae93d35fe962b8167c73c9.camel@svanheule.net \
--to=sander@svanheule.net \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bp@alien8.de \
--cc=brendanhiggins@google.com \
--cc=dave.hansen@linux.intel.com \
--cc=davidgow@google.com \
--cc=elver@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mairacanal@riseup.net \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=vschneid@redhat.com \
--cc=x86@kernel.org \
--cc=yury.norov@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®