adjust x86-64 watchdog tick calculation
PATCH 1/1 adjust x86-64 watchdog tick calculation
(Note: Patch also attached because the inline version is certain to get line wrapped.)
Get the x86-64 watchdog tick calculation into a state where it can also be used with nmi_hz other than 1Hz. Also do not turn on the watchdog by default (as is already done on i386).
arch/x86_64/kernel/nmi.c +3 -3
@@ -57,7 +57,7 @@ static unsigned int lapic_nmi_owner;int nmi_active;/* oprofile uses this */ int panic_on_timeout; -unsigned int nmi_watchdog =NMI_DEFAULT ; +unsigned int nmi_watchdog =NMI_NONE ;static unsigned int nmi_hz =HZ ;unsigned int nmi_perfctr_msr;/* the MSR to reset in NMI handler */
@@ -325,7 +325,7 @@ static void setup_k7_watchdog(void) | K7_NMI_EVENT;wrmsr (MSR_K7_EVNTSEL0 , evntsel,0 ); -wrmsrl (MSR_K7_PERFCTR0 , -((u64 )cpu_khz*1000 ) / nmi_hz); +wrmsrl (MSR_K7_PERFCTR0 , -((u64 )cpu_khz *1000 / nmi_hz));apic_write (APIC_LVTPC ,APIC_DM_NMI ); evntsel |=K7_EVNTSEL_ENABLE ;wrmsr (MSR_K7_EVNTSEL0 , evntsel,0 );
@@ -404,7 +404,7 @@ void nmi_watchdog_tick (struct pt_regs * alert_counter[cpu] =0 ; }if (nmi_perfctr_msr) -wrmsr (nmi_perfctr_msr, -(cpu_khz/nmi_hz*1000 ),-1 ); +wrmsrl (nmi_perfctr_msr, -((u64 )cpu_khz *1000 / nmi_hz)); }static int dummy_nmi_callback (struct pt_regs * regs,int cpu)
(Note: Patch also attached because the inline version is certain to get line wrapped.)
Get the x86-64 watchdog tick calculation into a state where it can also be used with nmi_hz other than 1Hz. Also do not turn on the watchdog by default (as is already done on i386).
arch/x86_64/kernel/nmi.c +3 -3
@@ -57,7 +57,7 @@ static unsigned int lapic_nmi_owner;int nmi_active;/* oprofile uses this */ int panic_on_timeout; -unsigned int nmi_watchdog =NMI_DEFAULT ; +unsigned int nmi_watchdog =NMI_NONE ;static unsigned int nmi_hz =HZ ;unsigned int nmi_perfctr_msr;/* the MSR to reset in NMI handler */
@@ -325,7 +325,7 @@ static void setup_k7_watchdog(void) | K7_NMI_EVENT;wrmsr (MSR_K7_EVNTSEL0 , evntsel,0 ); -wrmsrl (MSR_K7_PERFCTR0 , -((u64 )cpu_khz*1000 ) / nmi_hz); +wrmsrl (MSR_K7_PERFCTR0 , -((u64 )cpu_khz *1000 / nmi_hz));apic_write (APIC_LVTPC ,APIC_DM_NMI ); evntsel |=K7_EVNTSEL_ENABLE ;wrmsr (MSR_K7_EVNTSEL0 , evntsel,0 );
@@ -404,7 +404,7 @@ void nmi_watchdog_tick (struct pt_regs * alert_counter[cpu] =0 ; }if (nmi_perfctr_msr) -wrmsr (nmi_perfctr_msr, -(cpu_khz/nmi_hz*1000 ),-1 ); +wrmsrl (nmi_perfctr_msr, -((u64 )cpu_khz *1000 / nmi_hz)); }static int dummy_nmi_callback (struct pt_regs * regs,int cpu)
tor 2005-05-12 klockan 10:27 +0200 skrev Jan Beulich:
Quoted 7 lines
(Note: Patch also attached because the inline version is certain to get line wrapped.)
Get the x86-64 watchdog tick calculation into a state where it can also be used with
nmi_hzother than 1Hz. Also do not turn on the watchdog by default (as is already done on i386).
Why shouldn't the watchdog be turned on by default? It's an extremely useful debugging aid and it's not like it fires NMIs often (the nmi_hz is far from reality).
Quoted 34 lines
Signed-off-by Jan Beulich <[email protected]>diff -Npru
linux-2.6.12-rc4.base/arch/x86_64/kernel/nmi.clinux-2.6.12-rc4/arch/x86_64/kernel/nmi.carch/x86_64/kernel/nmi.c +3
-3@@ -57,7 +57,7 @@ static unsigned int lapic_nmi_owner;int nmi_active;/* oprofile uses this */ int panic_on_timeout; -unsigned int nmi_watchdog =NMI_DEFAULT ; +unsigned int nmi_watchdog =NMI_NONE ;static unsigned int nmi_hz =HZ ;unsigned int nmi_perfctr_msr;/* the MSR to reset in NMI handler */ @@ -325,7 +325,7 @@ static void setup_k7_watchdog(void) | K7_NMI_EVENT;wrmsr (MSR_K7_EVNTSEL0 , evntsel,0 ); -wrmsrl (MSR_K7_PERFCTR0 , -((u64 )cpu_khz*1000 ) / nmi_hz); +wrmsrl (MSR_K7_PERFCTR0 , -((u64 )cpu_khz *1000 / nmi_hz));apic_write (APIC_LVTPC ,APIC_DM_NMI ); evntsel |=K7_EVNTSEL_ENABLE ;wrmsr (MSR_K7_EVNTSEL0 , evntsel,0 );@@ -404,7 +404,7 @@ void nmi_watchdog_tick (struct pt_regs * alert_counter[cpu] =0 ; }if (nmi_perfctr_msr) -wrmsr (nmi_perfctr_msr, -(cpu_khz/nmi_hz*1000 ),-1 ); +wrmsrl (nmi_perfctr_msr, -((u64 )cpu_khz *1000 / nmi_hz)); }static int dummy_nmi_callback (struct pt_regs * regs,int cpu)
Quoted 4 lines · Alexander Nyberg
tor 2005-05-12 klockan 10:27 +0200 skrev Jan Beulich:
Quoted 3 lines
(Note: Patch also attached because the inline version is certain to get line wrapped.)
Quoted 8 lines
Quoted 4 lines
Get the x86-64 watchdog tick calculation into a state where it can also be used with
nmi_hzother than 1Hz. Also do not turn on the watchdog by default (as is already done on i386).Why shouldn't the watchdog be turned on by default? It's an extremely useful debugging aid and it's not like it fires NMIs often (the
nmi_hzis far from reality).
I agree, I definitely want to keep the watchdog enabled by default. It is a invaluable debugging aid.
The only reason i386 has it turned off by default is that it did not always work on some oudated hardware. Needs to be probably revisited at some point too.
-Andi
Hi!
Quoted 11 lines
Quoted 7 lines
(Note: Patch also attached because the inline version is certain to get line wrapped.)
Get the x86-64 watchdog tick calculation into a state where it can also be used with
nmi_hzother than 1Hz. Also do not turn on the watchdog by default (as is already done on i386).Why shouldn't the watchdog be turned on by default? It's an extremely useful debugging aid and it's not like it fires NMIs often (the
nmi_hzis far from reality).
Because it kills machine when interrupt latency gets too high? Like reading battery status using i2c...
Pavel
Signature · 1 line
64 bytes from 195.113.31.123: icmp_seq=28 ttl=51 time=448769.1 ms
Quoted 2 lines
Because it kills machine when interrupt latency gets too high? Like reading battery status using i2c...
That's a bug in the I2C reader then. Don't shot the messenger for bad news.
-Andi
Quoted 4 lines · Andi Kleen
Quoted 2 lines
Because it kills machine when interrupt latency gets too high? Like reading battery status using i2c...
That's a bug in the I2C reader then. Don't shot the messenger for bad news.
Disagreed.
Linux is not real time OS. Perhaps some real-time constraints "may not spend > 100msec with interrupts disabled" would be healthy, but it certainly needs more discussion than "lets enable NMI watchdog.". It needs to be written somewhere in big bold letters, too.
Pavel
Signature · 1 line
Boycott Kodak -- for their patent abuse against Java.
Quoted 10 lines · Pavel Machek
Quoted 4 lines · Andi Kleen
Quoted 2 lines
Because it kills machine when interrupt latency gets too high? Like reading battery status using i2c...
That's a bug in the I2C reader then. Don't shot the messenger for bad news.
Disagreed.
Linux is not real time OS. Perhaps some real-time constraints "may not spend > 100msec with interrupts disabled" would be healthy
^^^^
You mean "microseconds", right? 100ms will be perceived by the user as, well, their machine freezing for 100ms...
Lee
Hi!
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines
Because it kills machine when interrupt latency gets too high? Like reading battery status using i2c...
That's a bug in the I2C reader then. Don't shot the messenger for bad news.
Quoted 7 lines
Quoted 4 lines
Disagreed.
Linux is not real time OS. Perhaps some real-time constraints "may not spend > 100msec with interrupts disabled" would be healthy
^^^^You mean "microseconds", right? 100ms will be perceived by the user as, well, their machine freezing for 100ms...
I did mean miliseconds. IIRC current watchdog is at one second and it still triggers even in cases when operation just takes too long.
Pavel
Signature · 1 line
Boycott Kodak -- for their patent abuse against Java.
Quoted 9 lines · Pavel Machek
Hi!
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Because it kills machine when interrupt latency gets too high? Like reading battery status using i2c...
That's a bug in the I2C reader then. Don't shot the messenger for bad news.
Disagreed.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Linux is not real time OS. Perhaps some real-time constraints "may not spend > 100msec with interrupts disabled" would be healthy
^^^^You mean "microseconds", right? 100ms will be perceived by the user as, well, their machine freezing for 100ms...
I did mean miliseconds. IIRC current watchdog is at one second and it still triggers even in cases when operation just takes too long.
I thought there was an understanding that 1 ms would be the target for desktop responsiveness. So yes, disabling interrupts for more than 1ms is considered a bug.
Why do you need to disable interrupts for 100ms to read the battery status exactly?
Lee
Hi!
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
Because it kills machine when interrupt latency gets too high? Like reading battery status using i2c...
That's a bug in the I2C reader then. Don't shot the messenger for bad news.
Disagreed.
Linux is not real time OS. Perhaps some real-time constraints "may not spend > 100msec with interrupts disabled" would be healthy
^^^^You mean "microseconds", right? 100ms will be perceived by the user as, well, their machine freezing for 100ms...
Quoted 6 lines
Quoted 2 lines
I did mean miliseconds. IIRC current watchdog is at one second and it still triggers even in cases when operation just takes too long.
I thought there was an understanding that 1 ms would be the target for desktop responsiveness. So yes, disabling interrupts for more than 1ms is considered a bug.
I do not think so.
In may be "worth fixing", but no, that does not mean you should stick "if ints_disabled > 1msec panic()" into code. That would make most systems unusable.
Think pio-only disks, for example. Think serial console.
Pavel
Signature · 1 line
Boycott Kodak -- for their patent abuse against Java.
Quoted 19 lines · Lee Revell
Quoted 9 lines · Pavel Machek
Hi!
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Because it kills machine when interrupt latency gets too high? Like reading battery status using i2c...
That's a bug in the I2C reader then. Don't shot the messenger for bad news.
Disagreed.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Linux is not real time OS. Perhaps some real-time constraints "may not spend > 100msec with interrupts disabled" would be healthy
^^^^You mean "microseconds", right? 100ms will be perceived by the user as, well, their machine freezing for 100ms...
I did mean miliseconds. IIRC current watchdog is at one second and it still triggers even in cases when operation just takes too long.
Quoted 6 lines
I thought there was an understanding that 1 ms would be the target for desktop responsiveness. So yes, disabling interrupts for more than 1ms is considered a bug.
Why do you need to disable interrupts for 100ms to read the battery status exactly?
On some unfortunate hardware, we can go away even longer whilst the BIOS does various SMI voodoo. It got so bad in some situations that the maintainers of the gnome battery app lowered the frequency at which the poll the acpi interface.
Dave
Quoted 16 lines · Lee Revell
Quoted 15 lines · Pavel Machek
Hi!
Quoted 12 lines
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
Because it kills machine when interrupt latency gets too high? Like reading battery status using i2c...
That's a bug in the I2C reader then. Don't shot the messenger for bad news.
Disagreed.
Linux is not real time OS. Perhaps some real-time constraints "may not spend > 100msec with interrupts disabled" would be healthy
^^^^You mean "microseconds", right? 100ms will be perceived by the user as, well, their machine freezing for 100ms...
Quoted 6 lines
Quoted 2 lines
I did mean miliseconds. IIRC current watchdog is at one second and it still triggers even in cases when operation just takes too long.
I thought there was an understanding that 1 ms would be the target for desktop responsiveness. So yes, disabling interrupts for more than 1ms is considered a bug.
No, it's a bit different. Let's say disabling interrupts after boot even for considerable fractions of 1ms is a bug. But then there are exceptional circumstances where you have no other choice. In that case you need to use touch_nmi_watchdog yourself. But these things should be rare, e.g. only in unlikely error handling situations.
Quoted 3 lines
Why do you need to disable interrupts for 100ms to read the battery status exactly?
I guess because he's too lazy to rewrite the code use semaphores and schedule_timeout(). He just needs to get over that.
-Andi
Quoted 4 lines · Pavel Machek
Quoted 3 lines · Andi Kleen
Quoted 2 lines
Because it kills machine when interrupt latency gets too high? Like reading battery status using i2c...
Quoted 8 lines
Quoted 1 line
That's a bug in the I2C reader then. Don't shot the messenger for bad news.
Disagreed.
Linux is not real time OS. Perhaps some real-time constraints "may not spend > 100msec with interrupts disabled" would be healthy, but it certainly needs more discussion than "lets enable NMI watchdog.". It needs to be written somewhere in big bold letters, too.
While linux is not a real time OS it has been always known that turning off interrupts for a long time is extremly rude.
If you really want you can use touch_nmi_watchdog in the delay loop then. But note you have to compile it in, because touch_nmi_watchdog is not exported (Linus vetoed that for good reasons).
But again do you really need to disable interrupts during this i2c access? Can't you just use a schedule_timeout() and a semaphore? Why would other interrupts cause a problem during such a long delay?
-Andi
Hi!
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Because it kills machine when interrupt latency gets too high? Like reading battery status using i2c...
That's a bug in the I2C reader then. Don't shot the messenger for bad news.
Disagreed.
Quoted 7 lines
Quoted 4 lines
Linux is not real time OS. Perhaps some real-time constraints "may not spend > 100msec with interrupts disabled" would be healthy, but it certainly needs more discussion than "lets enable NMI watchdog.". It needs to be written somewhere in big bold letters, too.
While linux is not a real time OS it has been always known that turning off interrupts for a long time is extremly rude.
Yes, it is rude, but it should not panic machines.
Quoted 7 lines
If you really want you can use
touch_nmi_watchdogin the delay loop then. But note you have to compile it in, becausetouch_nmi_watchdogis not exported (Linus vetoed that for good reasons).But again do you really need to disable interrupts during this i2c access? Can't you just use a
schedule_timeout()and a semaphore? Why would other interrupts cause a problem during such a long delay?
In this case it is "AML code told you to disable interrupts, and do this kind of bitbang". AML interpretter has no idea of what that code does... Perhaps we could sprinkle touch_nmi_watchdog all over the interpretter, but that's just ugly.
Pavel
Signature · 1 line
Boycott Kodak -- for their patent abuse against Java.
Quoted 14 lines · Pavel Machek
Hi!
Quoted 12 lines
Quoted 11 lines
Quoted 4 lines
Quoted 2 lines
Because it kills machine when interrupt latency gets too high? Like reading battery status using i2c...
That's a bug in the I2C reader then. Don't shot the messenger for bad news.
Disagreed.
Linux is not real time OS. Perhaps some real-time constraints "may not spend > 100msec with interrupts disabled" would be healthy, but it certainly needs more discussion than "lets enable NMI watchdog.". It needs to be written somewhere in big bold letters, too.
Quoted 4 lines
Quoted 2 lines
While linux is not a real time OS it has been always known that turning off interrupts for a long time is extremly rude.
Yes, it is rude, but it should not panic machines.
Disagreed. It is a bug and needs to panic machines.
Quoted 5 lines
Quoted 5 lines
If you really want you can use
touch_nmi_watchdogin the delay loop then. But note you have to compile it in, becausetouch_nmi_watchdogis not exported (Linus vetoed that for good reasons).
Quoted 8 lines
Quoted 3 lines
But again do you really need to disable interrupts during this i2c access? Can't you just use a
schedule_timeout()and a semaphore? Why would other interrupts cause a problem during such a long delay?In this case it is "AML code told you to disable interrupts, and do this kind of bitbang". AML interpretter has no idea of what that code does... Perhaps we could sprinkle
touch_nmi_watchdogall over the interpretter, but that's just ugly.
Actually that's wrong. Because I fixed that code long ago if you mean the access in battery.c
(if you search the ACPI mailing list for my name you should find it) And there was no AML code involved here.
For some reason the ACPI guys didn't merge my patch though, but that just needs to be revisited.
-Andi