Bruce, Yocto kernel folks, Here is an extension to a lesser known feature - making it easier to use in the case of pre-canned kernels and rootfs as we'd typically find in tmp/deploy/images from Yocto.
Have you've ever looked at a WARN_ONCE() or a printk_once() and wondered "How would I know if that really just happened as a fluke, or happens every 3am when cron runs, but I just only hear about it once?" Well, the answer was added around v4.15 - in the form of a little known /sys/kernel/debug/clear_warn_once feature that lets you reset state to "freshly booted" for all the "once" type instances, in order to see if they happen again. The problem is, that you need debugfs enabled/mounted, and you need to be able to ssh onto the target to reset. Or you have to re-spin your rootfs to contain an rc.local to periodically reset for a rootfs that doesn't support interactive logins (as is fairly common for Yocto targets). Here, we add an in-kernel timer based reset, and provide access to arming it with a kernel boot arg, so that it doesn't require kernel rebuilds, or rootfs image alterations. In addition, the boot arg doesn't depend on debugfs, which is likely disabled to reduce the size and attack surface of embedded deployments. I should note that this was sent to the printk maintainer recently, but he declined to merge it. I won't try and summarize the reasons given here - but if people are at all interested in using this, I strongly suggest you go read the 0/3 thread and decide for yourself from the discussion on how many of the possible concerns floated are valid and worthy of consideration for your use case, or just in general. https://lore.kernel.org/r/[email protected]/ That said, I think it is still useful for the kinds of deployments we see in Yocto, and indeed the request for something like this came from users of Yocto, hence why I'm offering it for inclusion in the Yocto kernels regardless. There are two minor changes in the code here vs. that original posting. 1) Make the user facing timer value minute based, instead of seconds. 2) Make the boot arg use the same name as used in /sys/kernel/debug for consistency and ease of use. I've tested on standard/base + defconfig on v5.4.82 in linux-yocto, and the rolling v5.10 baseline of linux-yocto-dev. As it turns out, the git am of the v5.10 patches is hands free on the the v5.4 baseline, so there is no need to send two versions, and it also speaks to a minimal carrying cost going forward. Paul. --- Paul Gortmaker (3): clear_warn_once: expand debugfs to include read support clear_warn_once: bind a timer to written reset value clear_warn_once: add a clear_warn_once= boot parameter .../admin-guide/clearing-warn-once.rst | 9 +++ .../admin-guide/kernel-parameters.txt | 8 ++ kernel/panic.c | 78 +++++++++++++++++-- 3 files changed, 90 insertions(+), 5 deletions(-) -- 2.17.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#9275): https://lists.yoctoproject.org/g/linux-yocto/message/9275 Mute This Topic: https://lists.yoctoproject.org/mt/79006228/21656 Group Owner: [email protected] Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
