Skip to content

hangcheck-timer: coding style improvements

Clint George linux-kernel-mentees lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest3 patches 0 repliesNew

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3hangcheck-timer: replace printk(KERN_CRIT) with pr_critdrivers/char/hangcheck-timer.c+6 -60 replies
2/3hangcheck-timer: Replace %Ld with %llddrivers/char/hangcheck-timer.c+1 -10 replies
3/3hangcheck-timer: fix coding style spacingdrivers/char/hangcheck-timer.c+9 -50 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/3] hangcheck-timer: coding style improvements

This series improves coding style in hangcheck-timer:

Clint George (3):
hangcheck-timer: replace printk(KERN_CRIT) with pr_crit
hangcheck-timer: Replace %Ld with %lld
hangcheck-timer: fix coding style spacing

No functional changes were made to hangcheck logic.

---

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 any more tests need to be done 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);

 drivers/char/hangcheck-timer.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)
Signature · 1 line
2.43.0