Re: [PATCH] selftests: livepatch: filter kobject debug messages in check_result()
Petr Mladek <[email protected]>
| Newsgroups | org.kernel.vger.live-patching |
|---|---|
| Message-ID | <[email protected]> |
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