Skip to contentSkip to conversation

2.6.16-rc6-mm1 : Setting clocksource results in error

DISCUSSION Alexander Gran 2 participants 6 messages Mar 14, 2006 – Mar 15, 2006 Timekeeping, clocksource core, NTP, alarmtimer

lore
Share & tools
lore
#0 lore raw

Hi,

I'm still fiddeling with my way to slow netbeans debugger. I just tried to change the clocksource. That resulted in an error, but apparently worked. Is that expected behaviour:

root@t40:/sys/devices/system/clocksource/clocksource0# l
insgesamt 0
-rw------- 1 root root 4,0K 2006-03-14 09:31 available_clocksource
-rw------- 1 root root    0 2006-03-14 09:31 current_clocksource
root@t40:/sys/devices/system/clocksource/clocksource0# cat 
available_clocksource
acpi_pm jiffies tsc pit
root@t40:/sys/devices/system/clocksource/clocksource0# echo acpi_pm > 
current_clocksource
-su: echo: write error: Das Argument ist ungültig
root@t40:/sys/devices/system/clocksource/clocksource0# cat current_clocksource
acpi_pm
root@t40:/sys/devices/system/clocksource/clocksource0# echo tsc > 
current_clocksource
-su: echo: write error: Das Argument ist ungültig
root@t40:/sys/devices/system/clocksource/clocksource0# cat current_clocksource
tsc
Das Argument ist ungültig = Argument is invalid.
dmesg says:
Time: acpi_pm clocksource has been installed.
Time: tsc clocksource has been installed.

regards
Alex

Signature · 2 lines
Encrypted Mails welcome.
PGP-Key at http://zodiac.dnsalias.org/misc/pgpkey.asc | Key-ID: 0x6D7DD291
#1 lore raw
Quoted 7 lines · Alexander Gran

I'm still fiddeling with my way to slow netbeans debugger. I just tried to change the clocksource. That resulted in an error, but apparently worked. Is that expected behaviour:

root@t40:/sys/devices/system/clocksource/clocksource0# l
insgesamt 0
(quoted diff) +0 -2
-rw------- 1 root root 4,0K 2006-03-14 09:31 available_clocksource
-rw------- 1 root root    0 2006-03-14 09:31 current_clocksource
Quoted 8 lines
root@t40:/sys/devices/system/clocksource/clocksource0# cat 
available_clocksource
acpi_pm jiffies tsc pit
root@t40:/sys/devices/system/clocksource/clocksource0# echo acpi_pm > 
current_clocksource
-su: echo: write error: Das Argument ist ungültig
root@t40:/sys/devices/system/clocksource/clocksource0# cat current_clocksource
acpi_pm

Huh. Interesting.

Oh! I see it, we're stripping the \n from the name and returning a count value one less then what was given.

You can verify it by noticing "echo -n tsc > current_clocksource" does not give the error.

This small fix should resolve it.

Thanks for the bug report!
-john

kernel/time/clocksource.c +2 -1
index d2ce2c3..fe22f64 100644
@@ -220,6 +220,7 @@ sysfs_show_current_clocksources(struct s
 static ssize_t sysfs_override_clocksource(struct sys_device *dev,
 					  const char *buf, size_t count)
 {
+	size_t ret = count;
 	/* strings from sysfs write are not 0 terminated! */
 	if (count >= sizeof(override_name))
 		return -EINVAL;
@@ -241,7 +242,7 @@ static ssize_t sysfs_override_clocksourc
 
 	spin_unlock_irq(&clocksource_lock);
 
-	return count;
+	return ret;
 }
 
 /**
#2 lore raw

Hi,

applied patch. Didn't work?! Same error as before..

regards
Alex

Am Dienstag, 14. März 2006 20:11 schrieb john stultz:

Quoted 53 lines · Alexander Gran
Quoted 7 lines

I'm still fiddeling with my way to slow netbeans debugger. I just tried to change the clocksource. That resulted in an error, but apparently worked. Is that expected behaviour:

root@t40:/sys/devices/system/clocksource/clocksource0# l
insgesamt 0
(quoted diff) +0 -2
-rw------- 1 root root 4,0K 2006-03-14 09:31 available_clocksource
-rw------- 1 root root    0 2006-03-14 09:31 current_clocksource
Quoted 8 lines
root@t40:/sys/devices/system/clocksource/clocksource0# cat
available_clocksource
acpi_pm jiffies tsc pit
root@t40:/sys/devices/system/clocksource/clocksource0# echo acpi_pm >
current_clocksource
-su: echo: write error: Das Argument ist ungültig
root@t40:/sys/devices/system/clocksource/clocksource0# cat
current_clocksource acpi_pm

Huh. Interesting.

Oh! I see it, we're stripping the \n from the name and returning a count value one less then what was given.

You can verify it by noticing "echo -n tsc > current_clocksource" does not give the error.

This small fix should resolve it.

Thanks for the bug report!
-john

kernel/time/clocksource.c +2 -1
index d2ce2c3..fe22f64 100644
@@ -220,6 +220,7 @@ sysfs_show_current_clocksources(struct s
 static ssize_t sysfs_override_clocksource(struct sys_device *dev,
 					  const char *buf, size_t count)
 {
+	size_t ret = count;
 	/* strings from sysfs write are not 0 terminated! */
 	if (count >= sizeof(override_name))
 		return -EINVAL;
@@ -241,7 +242,7 @@ static ssize_t sysfs_override_clocksourc
 
 	spin_unlock_irq(&clocksource_lock);
 
-	return count;
+	return ret;
 }
 
 /**
Signature · 2 lines
Encrypted Mails welcome.
PGP-Key at http://zodiac.dnsalias.org/misc/pgpkey.asc | Key-ID: 0x6D7DD291
#3 lore raw
Quoted 1 line · Alexander Gran

applied patch. Didn't work?! Same error as before..

Huh. Now I'm quite confused. And using the -n option w/ echo doesn't change the behavior?

thanks
-john

#4 lore raw

Oh sorry. Lilo got mad my automated kernel-install-script, so I was using the unpatched kernel again. Works as expected!

Am Mittwoch, 15. März 2006 18:16 schrieb john stultz:

Quoted 8 lines · Alexander Gran
Quoted 1 line

applied patch. Didn't work?! Same error as before..

Huh. Now I'm quite confused. And using the -n option w/ echo doesn't change the behavior?

thanks
-john

Signature · 2 lines
Encrypted Mails welcome.
PGP-Key at http://zodiac.dnsalias.org/misc/pgpkey.asc | Key-ID: 0x6D7DD291
#5 lore raw
Quoted 2 lines · Alexander Gran

Oh sorry. Lilo got mad my automated kernel-install-script, so I was using the unpatched kernel again. Works as expected!

Great to hear! Thanks for the testing!
-john