From: Andrew Morton <akpm@linux-foundation.org>
To: Yuehong Wu <wuyuehong@cmss.chinamobile.com>
Cc: linux-kernel@vger.kernel.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>,
Andy Shevchenko <andriy.shevchenko@intel.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Dmitry Antipov <dmantipov@yandex.ru>,
Thomas Maarseveen <maarseveent@gmail.com>,
Nickolai Zeldovich <nickolai@csail.mit.edu>,
Thomas Gleixner <tglx@kernel.org>,
Adam Harshbarger <handyhandyman.adam@gmail.com>
Subject: Re: [PATCH v3] lib/tests: add KUnit tests for the priority sorted list (plist)
Date: Fri, 6 Nov 2026 23:06:58 -0800 [thread overview]
Message-ID: <20261106230658.69acd5b571d1ee361cc2c849@linux-foundation.org> (raw)
In-Reply-To: <20261107-plist-kunit-v3-1-yuehongwu@cmss.chinamobile.com>
On Sat, 07 Nov 2026 12:45:00 +0800 Yuehong Wu <wuyuehong@cmss.chinamobile.com> 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
> ordering-sensitive code paths have been changed three times 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 first two are performance optimizations; the third one fixes a real
> ordering bug. A deterministic case for that wrap-around now lives in the
> CONFIG_DEBUG_PLIST self-test, which only runs when that debug option is
> enabled by hand and stops at the first BUG_ON().
> plist_kunit_requeue_last_bucket() covers the same shape here, and the
> other cases pin down the ordering invariants the two optimizations rely
> on. KUnit coverage makes such regressions visible wherever KUnit is
> enabled, which CONFIG_DEBUG_PLIST is not.
>
> 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:
Thanks, let's get this into the pipeline for testing.
How does this play with CONFIG_TRIM_UNUSED_KSYMS=y, btw?
That darn thing removes symbols which no in-tree modules are using. So
the 20-odd selftests/ which build and load modules can break in
interesting ways.
Although they're shipped with the tree, such modules are out-of-tree
for kbuild purposes. If they work, it's by sheer luck - all the
exports they want happen to already be used by some in-tree module.
I assume that kunit-loaded modules suffer from the same issue.
prev parent reply other threads:[~2026-11-07 7:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-07 4:45 Yuehong Wu
2026-11-07 7:06 ` Andrew Morton [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=20261106230658.69acd5b571d1ee361cc2c849@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=409411716@gms.tku.edu.tw \
--cc=andriy.shevchenko@intel.com \
--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=handyhandyman.adam@gmail.com \
--cc=kmehltretter@gmail.com \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ljs@kernel.org \
--cc=maarseveent@gmail.com \
--cc=nickolai@csail.mit.edu \
--cc=note351@hotmail.com \
--cc=pasha.tatashin@soleen.com \
--cc=peterz@infradead.org \
--cc=pmladek@suse.com \
--cc=sakamo.ryota@gmail.com \
--cc=tglx@kernel.org \
--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®