From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Yuehong Wu <wuyuehong@cmss.chinamobile.com>
Cc: linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>,
Breno Leitao <leitao@debian.org>, David Gow <david@davidgow.net>,
Tejun Heo <tj@kernel.org>,
Ryota Sakamoto <sakamo.ryota@gmail.com>,
Karl Mehltretter <kmehltretter@gmail.com>,
Marco Elver <elver@google.com>,
Pasha Tatashin <pasha.tatashin@soleen.com>,
Kir Chou <note351@hotmail.com>, Lorenzo Stoakes <ljs@kernel.org>,
Borislav Petkov <bp@alien8.de>,
Kuan-Wei Chiu <visitorckw@gmail.com>,
Petr Mladek <pmladek@suse.com>,
Eric Biggers <ebiggers@kernel.org>,
Guan-Chun Wu <409411716@gms.tku.edu.tw>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Dmitry Antipov <dmantipov@yandex.ru>,
Thomas Maarseveen <maarseveent@gmail.com>
Subject: Re: [PATCH v2] lib/tests: add KUnit tests for the priority sorted list (plist)
Date: Mon, 9 Nov 2026 14:29:02 +0200 [thread overview]
Message-ID: <avG8jvXXkVSA4wkG@ashevche-desk.local> (raw)
In-Reply-To: <20261106-plist-kunit-v2-1-yuehongwu@cmss.chinamobile.com>
On Fri, Nov 06, 2026 at 10:18:34AM +0800, Yuehong Wu wrote:
> lib/plist.c has no KUnit coverage; its only test is the in-module
> plist_test() under CONFIG_DEBUG_PLIST, which BUG_ON()s on the first
> violation and does not report results in KTAP format. The code has seen
> three regression-class changes since mid-2024:
>
> commit c8dab79f9eef ("lib/plist.c: avoid worst case scenario in
> plist_add")
> commit 95d4b3450ebe ("lib/plist.c: add shortcut for plist_requeue()")
> commit 43c91b152243 ("lib/plist: fix plist_requeue() corrupting order
> in the last bucket")
>
> The last one has no regression test: plist_kunit_requeue_last_bucket()
> covers exactly that wrap-around, and the other cases pin down the ordering
> invariants the previous two changes rely on. KUnit coverage makes such
> ordering regressions visible in CI, where CONFIG_DEBUG_PLIST is not
> normally enabled.
>
> Add lib/tests/plist_kunit.c, a KUnit suite that exercises plist_add(),
> plist_del() and plist_requeue() and validates the invariants documented
> in include/linux/plist.h after every operation:
>
> - node_list stays sorted by ascending numeric priority (descending
> priority order) with FIFO order inside a priority bucket;
>
> - exactly the first node of each bucket is linked on prio_list, and
> the headless prio_list ring visits the bucket heads in node_list
> order before wrapping back to the first bucket (a single bucket
> degenerates to a self loop on the first node).
>
> The fixed cases cover bucket head handover on delete (first, middle and
> last bucket), the plist_requeue() shortcut with and without a following
> bucket, requeueing the head of the first and of the last bucket where the
> ring wraps around, the INT_MIN/INT_MAX extremes, and plist_first_entry()/
> plist_last_entry(). A deterministic pseudo-random add/del/requeue churn
> test mirrors the in-module test but draws priorities from a small range
> so that multi-node buckets actually occur, and every requeue in the loop
> moves a node (a requeue without a same-priority successor is a no-op).
>
> The suite is wired up as CONFIG_PLIST_KUNIT_TEST next to the other
> library KUnit tests and is enabled by default with KUNIT_ALL_TESTS.
> lib/plist.c is built into the kernel and exports none of plist_add(),
> plist_del() or plist_requeue(), so the test cannot be built as a module:
> make it built-in only (bool, depends on KUNIT=y), like the other KUnit
> tests that use non-exported symbols.
>
> The tests were built into an x86_64 kernel and run under QEMU/KVM with
> kunit.enable=1 kunit.filter_glob=plist*: 17 of 17 tests pass.
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202611052109.GqbzRkv1-lkp@intel.com/
New code may not be reported as a regression. There was never the module
present, nothing to report, nothing to fix.
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2026-11-09 12:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 2:18 Yuehong Wu
2026-11-06 8:12 ` Geert Uytterhoeven
2026-11-09 12:29 ` Andy Shevchenko [this message]
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=avG8jvXXkVSA4wkG@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=409411716@gms.tku.edu.tw \
--cc=akpm@linux-foundation.org \
--cc=bp@alien8.de \
--cc=david@davidgow.net \
--cc=dmantipov@yandex.ru \
--cc=ebiggers@kernel.org \
--cc=elver@google.com \
--cc=geert@linux-m68k.org \
--cc=kmehltretter@gmail.com \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ljs@kernel.org \
--cc=maarseveent@gmail.com \
--cc=note351@hotmail.com \
--cc=pasha.tatashin@soleen.com \
--cc=peterz@infradead.org \
--cc=pmladek@suse.com \
--cc=sakamo.ryota@gmail.com \
--cc=tj@kernel.org \
--cc=visitorckw@gmail.com \
--cc=wuyuehong@cmss.chinamobile.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®