• Yury Polyanskiy's avatar
    hangcheck-timer: fix x86_32 bugs · 940370fc
    Yury Polyanskiy authored
    drivers/char/hangcheck-timer.c is doubly broken.  When the overflown value
    of TIMER_FREQ is abnormally low, it spams the syslog with KERN_CRIT
    messages "Hangcheck: hangcheck value past margin!" But whether it happens
    or not depends on HZ and lpj in a complex way.  People have hit it
    occasionally as far as google search can tell.
    
    First, the following line overflows unsigned long:
    
    # define TIMER_FREQ (HZ*loops_per_jiffy)
    
    Second, and more importantly, loops_per_jiffy has little to do with the
    con= version from the the time scale of get_cycles() (aka rdtsc) to the
    time scale of jiffies.
    
    The attached patch resolves both of the problems.
    Acked-by: default avatarJoel Becker <joel.becker@oracle.com>
    Cc: john stultz <johnstul@us.ibm.com>
    Cc: Jan Glauber <jan.glauber@de.ibm.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    940370fc
hangcheck-timer.c 6.2 KB