Skip to contentSkip to conversation

can't switch to jiffies clocksource

PATCH New Luming Yu 1 participant 1 message May 21, 2009 Timekeeping, clocksource core, NTP, alarmtimer

lore
Share & tools
lore

Luming Yu

author
#0 lore raw

PATCH 1/1 can't switch to jiffies clocksource

Hello,

As this bug https://bugzilla.redhat.com/show_bug.cgi?id=496028,
echo jiffies > clocksource0/current_clocksource make system crash. I reproduced the problem with upstream kernel.
The root cause is that jiffies is just a variable in memory, it relies on other clock source to tick , and it never ticks on itself.

Please review, and apply.

**The patch is enclosed in text attachment* **Using web client to send the patch* * **below is for review, please apply attached patch*/

Thanks,
Luming

 clocksource.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

iff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index ecfd7b5..bdffe43 100644

kernel/time/clocksource.c +0 -0
@@ -507,8 +507,9 @@ static ssize_t sysfs_override_clocksource(struct

sys_device *dev,
/* try to select it: */ list_for_each_entry(cs, &clocksource_list, list) {
if (strlen(cs->name) == len &&
- !strcmp(cs->name, override_name))
- ovr = cs;
+ !strcmp(cs->name, override_name) &&
+ cs != &clocksource_jiffies)
+ ovr = cs;
}
}

kernel/time/clocksource.c +3 -2
index ecfd7b5..bdffe43 100644
@@ -507,8 +507,9 @@ static ssize_t sysfs_override_clocksource(struct sys_device *dev,
 		/* try to select it: */
 		list_for_each_entry(cs, &clocksource_list, list) {
 			if (strlen(cs->name) == len &&
-			    !strcmp(cs->name, override_name))
-				ovr = cs;
+			    !strcmp(cs->name, override_name) &&
+				cs != &clocksource_jiffies)
+					ovr = cs;
 		}
 	}