Click to See Complete Forum and Search --> : How to check the affection of jiffies overflow in kernel 2.4.18.


shiner_chen
07-14-2008, 11:23 PM
Backgound:
Because the jiffies is 32bit variable in kernel 2.4.18, it can overflow after about 497 days. Our customer want to know if the system will reboot or not when the jiffies overflow.

Current status:

In order to check the problem, I have written a module and installed it into the system. The module will change the jiffies value to very big value after it was loaded, then after some minutes the jiffies will overflow.



Code:

#include <linux/module.h>
#include <linux/init.h>
#include <linux/config.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <asm/io.h>
#include <asm/uaccess.h>

static unsigned long jiffies_now;

int init_jiffies_module(void)
{
unsigned long jiffies_after, jiffies_before;
jiffies_after = jiffies_before = 0;
jiffies_before = jiffies_now = jiffies;

printk ("Jiffies: Installing jiffies test module!\n");
printk ("Jiffies: jiffies value is %lu \n", jiffies_before);
jiffies = 0xFFFFE380;
printk ("Jiffies: Installed jiffies test module!\n");
jiffies_after = jiffies;

printk ("Jiffies: Jiffies value has been modified and jiffies value is %lu \n", jiffies_after);

return 0;
}



void cleanup_jiffies_module(void)

{
jiffies += jiffies_now + 7296;
printk ("Jiffies: Uninstalled jiffies test module!\n");
}



module_init(init_jiffies_module);
module_exit( cleanup_jiffies_module);

MODULE_LICENSE("GPL");

MODULE_AUTHOR("Shiner Chen, Continuous Computing.");



I have tried some jiffies value, but I got different result.

1. When I changed jiffies to 0xFFFFE380, the system hanged, then the watchdog reboot system.

2. When I changed jiffies to 0xE380, the jiffies can be modified successfully. But it was so little, so it was not effective for the problem.

3. When I changed jiffies to 0x0, the system hanged too, then the watchdog reboot system.



So, I can not get the conclusion from above method and I don’t know why I get difference result.

Could you give me some suggestion about this? Or do you have another best method to check it?


Thank you very much.


Shiner

cybertron
07-15-2008, 05:50 PM
I think you should be careful about making any conclusions from that testing. As I understand it jiffies are handled so that rollover doesn't cause problems (in general) and changing the value arbitrarily could very well have been the reason you had problems.

This thread (http://marc.info/?l=linux-kernel&m=101406885521792) is a little old, but it sounds like you should be fine. People were rolling over Linux 2.2 servers and happily continuing on so I would expect it to be fine on a more modern kernel too.