* [PATCH] selftests: livepatch: filter kobject debug messages in check_result()
@ 2026-08-18 5:46 Yafang Shao
2026-08-19 13:28 ` Petr Mladek
0 siblings, 1 reply; 2+ messages in thread
From: Yafang Shao @ 2026-08-18 5:46 UTC (permalink / raw)
To: jpoimboe, jikos, mbenes, pmladek, joe.lawrence, song
Cc: live-patching, Yafang Shao
CONFIG_DEBUG_KOBJECT makes kobject_add_internal(), kobject_uevent_env(),
fill_kobj_path() and friends emit pr_debug() messages, and
CONFIG_DEBUG_KOBJECT_RELEASE makes kobject_release() emit a pr_info()
for every delayed kobject free. All of these carry the "kobject:"
prefix via pr_fmt(), e.g.:
kobject: 'test_klp_livepatch' (ffff...): kobject_release, parent ... (delayed N)
kobject: 'test_klp_livepatch' (ffff...): kobject_add_internal: parent: 'module', set: 'module'
The livepatch test modules' kobjects are named "test_klp_*", so these
lines match the check_result() grep for "test_klp" and leak into the
result. The extra lines no longer match the expected output, so the
selftests fail when either debug config is enabled.
Filter out the "kobject:" lines from the result and note in the README
that both configs are safe to keep enabled.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
tools/testing/selftests/livepatch/README | 3 +++
tools/testing/selftests/livepatch/functions.sh | 1 +
2 files changed, 4 insertions(+)
diff --git a/tools/testing/selftests/livepatch/README b/tools/testing/selftests/livepatch/README
index d2035dd64a2b..d03461bd45bb 100644
--- a/tools/testing/selftests/livepatch/README
+++ b/tools/testing/selftests/livepatch/README
@@ -15,6 +15,9 @@ Config
Set CONFIG_LIVEPATCH=y option and it's prerequisites.
+Note: CONFIG_DEBUG_KOBJECT and CONFIG_DEBUG_KOBJECT_RELEASE emit "kobject:"
+debug messages to the kernel log. The tests filter these out, so they are safe
+to keep enabled.
Building the tests
------------------
diff --git a/tools/testing/selftests/livepatch/functions.sh b/tools/testing/selftests/livepatch/functions.sh
index 17810521d069..3dae2ad20f1e 100644
--- a/tools/testing/selftests/livepatch/functions.sh
+++ b/tools/testing/selftests/livepatch/functions.sh
@@ -327,6 +327,7 @@ function check_result {
result=$(dmesg | awk -v last_dmesg="$LAST_DMESG" 'p; $0 == last_dmesg { p=1 }' | \
grep -e 'livepatch:' -e 'test_klp' | \
grep -v '\(tainting\|taints\) kernel' | \
+ grep -v 'kobject:' | \
sed 's/^\[[ 0-9.]*\] //' | \
sed 's/^\[[ ]*[CT][0-9]*\] //')
--
2.52.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] selftests: livepatch: filter kobject debug messages in check_result()
2026-08-18 5:46 [PATCH] selftests: livepatch: filter kobject debug messages in check_result() Yafang Shao
@ 2026-08-19 13:28 ` Petr Mladek
0 siblings, 0 replies; 2+ messages in thread
From: Petr Mladek @ 2026-08-19 13:28 UTC (permalink / raw)
To: Yafang Shao; +Cc: jpoimboe, jikos, mbenes, joe.lawrence, song, live-patching
On Tue 2026-08-18 13:46:29, Yafang Shao wrote:
> CONFIG_DEBUG_KOBJECT makes kobject_add_internal(), kobject_uevent_env(),
> fill_kobj_path() and friends emit pr_debug() messages, and
> CONFIG_DEBUG_KOBJECT_RELEASE makes kobject_release() emit a pr_info()
> for every delayed kobject free. All of these carry the "kobject:"
> prefix via pr_fmt(), e.g.:
>
> kobject: 'test_klp_livepatch' (ffff...): kobject_release, parent ... (delayed N)
Yeah, this is pr_info() printed only when CONFIG_DEBUG_KOBJECT_RELEASE enabled.
> kobject: 'test_klp_livepatch' (ffff...): kobject_add_internal: parent: 'module', set: 'module'
This one seems to be printed by pr_debug(). It is printed
with CONFIG_DEBUG_KOBJECT but only when CONFIG_DYNAMIC_DEBUG
is not enabled.
> The livepatch test modules' kobjects are named "test_klp_*", so these
> lines match the check_result() grep for "test_klp" and leak into the
> result. The extra lines no longer match the expected output, so the
> selftests fail when either debug config is enabled.
>
> Filter out the "kobject:" lines from the result and note in the README
> that both configs are safe to keep enabled.
Honestly, I do not feel comfortable with this ignore-all-kobject-messages
approach. We might miss real problems reported by the kobject API.
It seems acceptable to ignore the quite specific "kobject: .*parent.*
(delayed" pattern.
But I would prefer to ignore the other debug messages by detecting
the KERN_DEBUG loglevel. It seems that dmesg even allows to filter
the output on its own. It is a bit ugly because we want all
other loglevels but:
dmesg --level=info,notice,warn,err,crit,alert,emerg
might do the job.
Best Regards,
Petr
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-19 13:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18 5:46 [PATCH] selftests: livepatch: filter kobject debug messages in check_result() Yafang Shao
2026-08-19 13:28 ` Petr Mladek
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.