Re: [PATCH] hangcheck-timer: use pr_crit and fix coding style

David Hunter
2025-10-22T12:24:48Z

On 10/18/25 12:00, Clint George wrote:
> Testing:
> - Verified timer firing and margin detection using "hangtest" module that i created (I will paste the code below for reference) and checked dmesg logs for expected output: "Hangcheck: hangcheck value past margin!".
> - Used Static Analysis tools
> - Ensured module builds and inserts cleanly after changes.
>
> Let me know if you want me to do more testing on this module.
>
> [] hangtest.c (testing module i created to test hangcheck-timer module):
>
> MODULE_LICENSE("GPL");
> MODULE_AUTHOR("Clint George");
> MODULE_DESCRIPTION("Hang test for testing hangcheck-timer");
>
> static int hang_duration = 20;
> module_param(hang_duration, int, 0644);
>
> static int __init hangtest_init(void) {
> unsigned long timeout;
>
> printk(KERN_INFO "hangtest: Disabling interrupts for %d seconds...\n", hang_duration);
>
> local_irq_disable();
> preempt_disable();
>
> timeout = jiffies + (hang_duration * HZ);
> while (time_before(jiffies, timeout)) {
> cpu_relax();
> barrier();
> }
>
> preempt_enable();
> local_irq_enable();
>
> printk(KERN_INFO "hangtest: Interrupts re-enabled\n");
> // return 0;
> return -EINVAL; // Return error so module doesn't stay loaded
> }
>
> static void __exit hangtest_exit(void) {
> printk(KERN_INFO "hangtest: Exit\n");
> }
>
> module_init(hangtest_init);
> module_exit(hangtest_exit);

Well done for describing the testing you did, but try to put it in the
change log. As of now, it is in the commit message, which means that if
your patch is committed, people using git log, would be able to see all
of this, but this is something that is only needed for the maintainers,
not for future code viewers.

Plus, they can always recreate your patch if they need to.

Thanks,
David Hunter