pit clocksource broken under Xenomai
Hi,
just checked on real hardware (found in qemu originally):
When Linux uses the pit clocksource AND Xenomai is attached, the system time no longer makes progress. Observed under 2.6.20 with 1.7-03 and newer patches, Xenomai trunk.
I guess not many people will be affected by this and I'm lacking time to debug, so I'm just dumping the report and running away...
Jan
Quoted 10 lines · Jan Kiszka
Hi,
just checked on real hardware (found in qemu originally):
When Linux uses the pit clocksource AND Xenomai is attached, the system time no longer makes progress. Observed under 2.6.20 with 1.7-03 and newer patches, Xenomai trunk.
I guess not many people will be affected by this and I'm lacking time to debug, so I'm just dumping the report and running away...
Somehow I hate open issues...
I recalled some private thread with you, Philippe, about this particular line in pid_read(). A look at it again revealed the reason for this bug.
Jan
PS: pending_patches++ ;)
--- arch/i386/kernel/i8253.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/i386/kernel/i8253.c +2 -1
@@ -47,7 +47,8 @@ static cycle_t pit_read(void)#ifdef CONFIG_IPIPE if (!__ipipe_pipeline_head_p (ipipe_root_domain)) -return 0 ;/* We don't really own the PIT. */ +/* We don't own the PIT, fall back to jiffies. */ +return (cycle_t)(jiffies *LATCH );#endif /* CONFIG_IPIPE */ spin_lock_irqsave (&i8253_lock, flags);
Quoted 31 lines · Jan Kiszka
Quoted 10 lines · Jan Kiszka
Hi,
just checked on real hardware (found in qemu originally):
When Linux uses the pit clocksource AND Xenomai is attached, the system time no longer makes progress. Observed under 2.6.20 with 1.7-03 and newer patches, Xenomai trunk.
I guess not many people will be affected by this and I'm lacking time to debug, so I'm just dumping the report and running away...
Somehow I hate open issues...
I recalled some private thread with you, Philippe, about this particular line in
pid_read(). A look at it again revealed the reason for this bug.Jan
PS: pending_patches++ ;)
--- arch/i386/kernel/i8253.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)Index:
linux-2.6.20/arch/i386/kernel/i8253.c
===================================================================
arch/i386/kernel/i8253.c static cycle_t pit_read(void) · line 51
Quoted 6 lines
arch/i386/kernel/i8253.c +2
-1@@ -47,7 +47,8 @@ static cycle_t pit_read(void)#ifdef CONFIG_IPIPE if (!__ipipe_pipeline_head_p (ipipe_root_domain)) -return 0 ;/* We don't really own the PIT. */ +/* We don't own the PIT, fall back to jiffies. */ +return (cycle_t)(jiffies *LATCH );
I think even more correct would be
return (cycle_t)(jiffies * LATCH) + (LATCH - 1) - old_count;
Should avoid the theoretical chance of a clock backward jump when Xenomai attaches. I leave it up to the maintainer to decide. :)
Jan
Quoted 41 lines · Jan Kiszka
Quoted 31 lines · Jan Kiszka
Quoted 10 lines · Jan Kiszka
Hi,
just checked on real hardware (found in qemu originally):
When Linux uses the pit clocksource AND Xenomai is attached, the system time no longer makes progress. Observed under 2.6.20 with 1.7-03 and newer patches, Xenomai trunk.
I guess not many people will be affected by this and I'm lacking time to debug, so I'm just dumping the report and running away...
Somehow I hate open issues...
I recalled some private thread with you, Philippe, about this particular line in
pid_read(). A look at it again revealed the reason for this bug.Jan
PS: pending_patches++ ;)
--- arch/i386/kernel/i8253.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)Index:
linux-2.6.20/arch/i386/kernel/i8253.c
===================================================================arch/i386/kernel/i8253.c static cycle_t pit_read(void) · line 51
Quoted 6 lines
arch/i386/kernel/i8253.c +2
-1@@ -47,7 +47,8 @@ static cycle_t pit_read(void)#ifdef CONFIG_IPIPE if (!__ipipe_pipeline_head_p (ipipe_root_domain)) -return 0 ;/* We don't really own the PIT. */ +/* We don't own the PIT, fall back to jiffies. */ +return (cycle_t)(jiffies *LATCH );I think even more correct would be
Quoted 5 lines
return (cycle_t)(jiffies * LATCH) + (LATCH - 1) - old_count;Should avoid the theoretical chance of a clock backward jump when Xenomai attaches. I leave it up to the maintainer to decide. :)
Merged this one, thanks.
Quoted 2 lines
Jan
Signature · 1 line
Philippe.