linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Fixes for nforce2 hard lockup, apic, io-apic, udma133 covered
@ 2003-12-07 19:58 Ian Kumlien
  2003-12-07 20:59 ` Jesse Allen
  2003-12-08  2:07 ` Ross Dickson
  0 siblings, 2 replies; 58+ messages in thread
From: Ian Kumlien @ 2003-12-07 19:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: ross

[-- Attachment #1: Type: text/plain, Size: 1985 bytes --]

> I have monitored list and know my nforce2 experiences have been
> common.

Hell yeah =)

> When I enabled either apic or io-apic in kern config, lockups came 
> hard and fast. Particularly bad under hard disk load. Heaps of lost 
> ints on irq7 in apic and ioapic mode. Lockups disappeared when I 
> lowered the ide hda udma speed to mode 3 with hdparm so I went looking
> for answers which now follow.

Good job =)

> There are three parts to this email.
> a) apic mods.
> Lockups are due to too fast an apic acknowledge of apic timer int.
> Apic hard locked up the system - no nmi debug available.
> Fixed it by introducing a delay of at least 500ns into 
> smp_apic_timer_interrupt() just prior to ack_APIC_irq().

I find this really odd... It works just fine... 
As did disabling whats now active ie:
'Halt Disconnect and Stop Grant Disconnect' bit is enabled.

So it seems like these are the two most important factors, at least from
where i stand. Both enabled me to actually use my machine with IO-APIC.
(1, disabling Halt Disconnect and Stop Grand Disconnect bit or 2, Add a
delay on the irq ack.)
Anyone that has any clues?

> b) io-apic mods
> So I have fixed it too (tested on both my epox and albatron MOBOs).
> Firstly I found 8254 connected directly to pin 0 not pin 2 of io-apic.
> I have modified check_timer() in io_apic.c to trial connect pin and 
> test for it after the existing test for connection to io-apic.

Good job, i wonder if it could be more generalized and integrated with
the rest of the code (i haven't even checked the rest of the code, but
this seemed separated).

One thing though, I get a lot more NMI's now than with nmi_watchdog=2...
NMI:      85520
LOC:      85477

I usually had a 3 figure number by now... but.. =)

> c) ide driver mods

Cool.. 

I applied all patches and it survived my grep test so i think it works.

-- 
Ian Kumlien <pomac () vapor ! com> -- http://pomac.netswarm.net

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 58+ messages in thread
[parent not found: <BF1FE1855350A0479097B3A0D2A80EE0023ED17F@hdsmsx402.hd.intel.com>]
* Re: Fixes for nforce2 hard lockup, apic, io-apic, udma133 covered
@ 2003-12-15 13:54 Ross Dickson
  2003-12-16  1:40 ` Josh McKinney
  0 siblings, 1 reply; 58+ messages in thread
From: Ross Dickson @ 2003-12-15 13:54 UTC (permalink / raw)
  To: recbo; +Cc: linux-kernel

<snip>
> I stayed with 600UL 100ndelay just to see if anything 
> breaks with amd XP3000+ and patches with a bios 
> that doesn't crash with nforce2 but needs help from 
> patches on other points(to get edge timer on and 
> to use nmi_watchdog=1 rather than =2). Also hope 
> we get a clue about what Award bios update does 
> that Phoenix does not do so far. 
 
>/usr/src/kernel-source-2.6.0/include/asm-i386/apic.h 
> #define APIC_DEBUG 1 

>...but I don't see any 

>calibrating APIC timer ... 
> ..... CPU clock speed is 2079.0146 MHz. 
> ..... host bus clock speed is 332.0663 MHz. 
> NET: Registered protocol family 16 
> ..APIC TIMER ack delay, reload:20791, safe:20779 
> ..APIC TIMER ack delay, predelay count: 20769 

>etc 

Hi bob, if the award bios has completely stabilised your system then that is
great news and it should make the apic delay patch unnecessary for your system.

The second patch, the io-apic patch is a workaround to enable the 8254 
connection to the io-apic INTIN0 because that is where it appears to be
wired to on nforce2 mobos.

According to Maciej Rozycki it looks like bios lies and says it is wired
to INTIN2 so nothing happens when that is tested first.

Out of curiosity of the 10 lines with predelay count like follows

..APIC TIMER ack delay, predelay count: 20769 

Do any of them exceed your safe count of 20779? and any really close
in value to the reload count of 20791?

On our pheonix bios's we regularly see 2 or 3 of them exceed the safe count
(indication of potential lockup without the patch) often with one of them 
within 4 counts of the reload value (really quick).

Can you also advise if your bios setting of the  "C1 disconnect" is set to on, off,
or auto? - trying to gain a clue as to how award can have disconnect running
and avoid lockups.

Also are you running with DDR333 or DDR400 ram and how many sticks?

I have heard lockups are not supposed to happen at all if the fsb (host bus
clock speed) matches the ddr speed. One of my systems went about 4 hours
(xp2500 333fsb, DDR333) without the apic delay patch on a pheonix bios
before lockup.

So far it appears to be safe with a barton core cpu to read the local apic
timer count register as the v2 apic delay patch does. 

So far I cannot use my v2 apic delay patch for long periods with my throughbred
core XP2200 without hard lockups (pheonix bios, fsb266, DDR400 ram).

Regards
Ross.


^ permalink raw reply	[flat|nested] 58+ messages in thread
* Re: Fixes for nforce2 hard lockup, apic, io-apic, udma133 covered
@ 2003-12-15 10:57 ross.alexander
  2003-12-15 12:49 ` Maciej W. Rozycki
  0 siblings, 1 reply; 58+ messages in thread
From: ross.alexander @ 2003-12-15 10:57 UTC (permalink / raw)
  To: linux-kernel

Hi all,

Just a quick note saying I've been running my nforce2 for nearly four
days with considerable I/O and no trouble.

Processor: AMD Athlon XP 2700+
MB: ASUS A7N8X Deluxe
APCI: Turned off in kernel config
Boot params: acpi=off noapic
Kernel: 2.6.0-test11-bk7 + disconnect quirk patch

I still have a considerable number of spurious IRQs (but < 1%
compared to IRQ0 / LINT).  I'm not running the timer patch
at all.

I will try with latest bk kernel + disconnect  + acpi compiled in.

Questions.

1) Does anybody know the state of play ala 2.6.0 release and which
patches we can get in?

2) If the local apic is running is it necessary to use the 8254 as a 
timer?

3) Does anybody, anywhere, have any nvidia documentation and
is it worth trying to bully them into releasing some?

Cheers,

Ross

---------------------------------------------------------------------------------
Ross Alexander                           "We demand clearly defined
MIS - NEC Europe Limited            boundaries of uncertainty and
Work ph: +44 20 8752 3394         doubt."

^ permalink raw reply	[flat|nested] 58+ messages in thread
* Re: Fixes for nforce2 hard lockup, apic, io-apic, udma133 covered
@ 2003-12-13 18:07 Ross Dickson
  2003-12-13 20:22 ` Josh McKinney
                   ` (3 more replies)
  0 siblings, 4 replies; 58+ messages in thread
From: Ross Dickson @ 2003-12-13 18:07 UTC (permalink / raw)
  To: Jesse Allen, Ian Kumlien; +Cc: linux-kernel, AMartin

[-- Attachment #1: Type: text/plain, Size: 2849 bytes --]

Greetings,
I have updated the apic timer ack delay patch and the io-apic edge patch
although I do not think anyone had any problems with the first release.

These patches may not be required if your bios is sorted out - mine are
not yet.

The apic ack delay no longer adds a small delay to every timer int so I 
believe its performance hit is barely detectable. 

In fact the busier the system gets with irqs- the more likelyhood 
of the delay time expiring naturally and the less the impact of the patch.

It now only delays the ones that would be too quick and most likely
cause a hard lockup. It also reports its existence on boot if used. e.g.

..APIC TIMER ack delay, reload:16701, safe:16691

And if  

#define APIC_DEBUG 0

is set to 1 in 

/usr/src/linux-2.4.23-rd2/include/asm-i386/apic.h

Then you can report at boot ten pre delay apic timer times as well to get a 
feel as to whether the delay had to kick in or not. Note that ten is a very
small sample size but it gives an idea of the timing numbers.

The apic timer counts down from the reload value and interrupts at zero.
The reload value corresponds to the time between HZ at the rate the 
counter counts. Nothing new so far.
e.g. My system is running 1000Hz so the time is 1ms.
The reload value is 16701 so that represents 1ms.

The safe count it calculates for my system is 16691 so any number smaller
than that is expected to be when it is safe to ack the local apic after an apic
timer interrupt. If you want to experiment with the delay time in nano seconds
just change the 600UL. If I set mine to 400UL then my hard lockups return.
Interestingly I can read the local apic timer safely right after the interrupt - 
I just can't safely ack it then. It is as if the C1 disconnect logic within the
processor only screws with the ACK irq cancellation logic and then only for
a short time after an irq.



The io-apic edge patch has been cleaned up a little. If the above debug is on
then it will display the 8259a xtpic interrupt mask. I get hex fb and hex ff 
indicating that the only int enabled on the 8259A xtpic which handles irq 0-7
is the cascade irq 2 which is OK because on the other 8259A irq 8-15 are masked.
This masked xtpic should always be the case. We want the 8259A off during
our test to see if the 8254 timer is connected directly to pin 0 of the ioapic.
The other messages are as per previous version.


Lastly I need sleep (4 am) so they are not yet done as patch files. I have
put them into two text files and bzipped them as an attachment. Anyhow they
are small and insert in the same places as their previous versions.

Thanks Jesse for rediffing the original patches for 2.6 would you like to repeat
the favour with these please?

Again they are still experimental.... so I am hoping Ian, Jesse and others will
put them to the test.

Thanks
Ross Dickson.


[-- Attachment #2: rossfixes-ver2.tar.bz2 --]
[-- Type: application/x-tbz, Size: 1443 bytes --]

^ permalink raw reply	[flat|nested] 58+ messages in thread
[parent not found: <106Zu-1sD-3@gated-at.bofh.it>]
* Re: Fixes for nforce2 hard lockup, apic, io-apic, udma133 covered
@ 2003-12-11  2:50 Ross Dickson
  0 siblings, 0 replies; 58+ messages in thread
From: Ross Dickson @ 2003-12-11  2:50 UTC (permalink / raw)
  To: asia.support; +Cc: linux-kernel, AMartin

I am trying to draw AMD into the picture using their ask AMD web form
but I think it is broken.

Could asia support please take this seriously and forward it to the appropriate
AMD technical personel. I believe the issue is not restricted to linux but
to any code which executes the same way.

The ask AMD submission follows:

Subject Details:
Possible CPU ERRATA: re: bus disconnect and apic timer interrupt

Greetings:
I and many others have been tracking down a hard lockup problem on linux and 
nforce2 chipset.

Please find continuing discussion including a copy of this submission here:

http://linux.derkeiler.com/Mailing-Lists/Kernel/2003-12/1528.html

My current level of knowledge (best estimate) on the problem is that if a cpu 
disconnect cycle is in progress or has occurred and the local apic timer interrupt
is the trigger to return to a connected state then an undocumented timing
constraint exists. The constraint is that the local apic acknowledge will not be
correctly received by the local apic if it occurs earlier than about 500us 
after the processor continues execution. That is if the processor issues
the ack earlier than 500us after resuming execution then an unrecoverable
hard lockup of the system occurs.

Possible causes include a slow start to the local system bus in relation to
the reconnection of the cpu to the local apic as per earlier model athlon CPU's?
Or system bus connect disconnect signal timing problems with the nforce2 northbridge?

What I would like to know is:

a) Can you please isolate- verify cause assuming you have hardware testing facilities.

b) Does this problem affect all local apic interrupt sources including those which
 have come from an io-apic.

c) Is there is a chipset independent way of finding out if we are coming out of
 a disconnect state prior to issuing the local apic acknowledge. 
 i.e. is there a readable status bit within the processor that we can use to see
 if it is safe to immediately ACK the local apic or if we should wait for 500ns or so.

I have experienced this problem on XP2500 barton and XP2200 thoroughbred cores.
Others have experienced it on other model barton cores. At least 4 makes of
motherboard are involved.

So far it appears to affect all current and pending linux releases for the nforce2 chipsets. 
One could say this relates to a good quantity of potential AMD athlon cpu sales
and bugs with nforce2 and AMD may sour uptake of nforce3 and x64.........

Regards
Ross Dickson.
Director.
Dat's Creative Pty Ltd
Gold Coast
Australia


I don't know if it got through, I received this after the submit button

The page cannot be displayed
There is a problem with the page you are trying to reach and it cannot be displayed.
Please try the following:
Click the Refresh button, or try again later; it does not normally take a long time for an application to restart.
Open the 139.95.253.214 home page, and then look for links to the information you want.
HTTP Error 500-12 Application Restarting
 Internet Information Services
Technical Information (for support personnel)

Background:
 The request cannot be processed while the Web site is restarting. 

More information:
 Microsoft Support 


^ permalink raw reply	[flat|nested] 58+ messages in thread
* Fixes for nforce2 hard lockup, apic, io-apic, udma133 covered
@ 2003-12-07 13:12 Ross Dickson
  2003-12-09 15:20 ` Maciej W. Rozycki
  2003-12-10  3:39 ` Jesse Allen
  0 siblings, 2 replies; 58+ messages in thread
From: Ross Dickson @ 2003-12-07 13:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: AMartin, ross, andre, kernel

[-- Attachment #1: Type: text/plain, Size: 5471 bytes --]

Greetings,
I am not subscribed so please cc responses.
I have monitored list and know my nforce2 experiences have been common.
Attached patches are in a single bzip tar ball.

I have Albatron KM18G Pro & Epox 8RGA+ MOBOs both using nforce2 chipsets.
I made up a kernel as follows.
Get std 2.4.22 src
apply patch-2.4.23
apply 2.4.22-low-latency.patch
apply preempt-kernel-rml-2.4.23-pre5-1.patch
apply vhz-j64-2.4.22.patch

One patch fails on inode.c, dispose_list() so I placed conditional_schedule() as follows
=static void dispose_list(struct list_head *head)
={
=	int nr_disposed = 0;
=
=	while (!list_empty(head)) {
=		struct inode *inode;
=		conditional_schedule();

Config for athlon with 1000hz tics, preempt & low-lat on.
Compiled and installed nvnet & nvidia video driver.

Disclaimer: The following information and code patches are not fully tested and may be 
dangerous, also these are the first patches I have made for public consumption so I hope
that their format works.

Note also that the patches are against 2.4.22 even though they were developed
against the heavily patched 2.4.23 mentioned above. The patch code is the same for both
kernels but at different line numbers.

When I enabled either apic or io-apic in kern config, lockups came hard and fast.
Particularly bad under hard disk load. Heaps of lost ints on irq7 in apic and ioapic mode. 
Lockups disappeared when I lowered the ide hda udma speed to mode 3 with hdparm so
I went looking for answers which now follow.

There are three parts to this email.
a) apic mods.
b) io-apic mods
c) ide driver mods

a) Lockups are due to too fast an apic acknowledge of apic timer int.
Apic hard locked up the system - no nmi debug available.
Fixed it by introducing a delay of at least 500ns into smp_apic_timer_interrupt() 
just prior to ack_APIC_irq().
See attached diff file "nforce2-apic.c-2.4.22.patch" for details. 
I have guessed at a suitable cpu speed dependent delay.
Perhaps someone with AMD cpu docs (apic timing specs)  & analyser tools could refine it.

Maybe nforce2 chipset really is very quick accessing ram in dual dimm mode? 
Or AMD 2200XP has a really slow APIC?

--- linux-2.4.22/arch/i386/kernel/apic.c	2003-06-14 00:51:29.000000000 +1000
+++ linux-2.4.22-rd/arch/i386/kernel/apic.c	2003-12-07 18:27:32.000000000 +1000
@@ -1078,6 +1078,15 @@
 	 */
 	apic_timer_irqs[cpu]++;

+#ifdef CONFIG_MK7 && CONFIG_BLK_DEV_AMD74XX
+	/*
+	 * on 2200XP & nforce2 chipset we need at least 500ns delay here
+	 * to stop lockups with udma100 drive. try to scale delay time
+	 * with cpu speed. Ross Dickson.
+	 */
+	ndelay((cpu_khz >> 12)+200 ); /* don't ack too soon or hard lockup */
+#endif
+
 	/*
 	 * NOTE! We'd better ACK the irq immediately,
 	 * because timer handling can be slow.


b) I was also disappointed to see I could not have irq0 timer IO-APIC-edge. 
So I have fixed it too (tested on both my epox and albatron MOBOs).
Firstly I found 8254 connected directly to pin 0 not pin 2 of io-apic.
I have modified check_timer() in io_apic.c to trial connect pin and test for it
after the existing test for connection to io-apic.
See attached diff file nforce2-io-apic.c-2.4.22 for details.

--- linux-2.4.22/arch/i386/kernel/io_apic.c	2003-08-25 21:44:39.000000000 +1000
+++ linux-2.4.22-rd/arch/i386/kernel/io_apic.c	2003-12-07 18:40:40.000000000 +1000
@@ -1614,9 +1614,44 @@
 			return;
 		}
 		clear_IO_APIC_pin(0, pin1);
-		printk(KERN_ERR "..MP-BIOS bug: 8254 timer not connected to IO-APIC\n");
+		printk(KERN_ERR "..MP-BIOS bug: 8254 timer not connected to IO-APIC pin%d\n",pin1);
 	}

+#ifdef CONFIG_ACPI_BOOT && CONFIG_X86_UP_IOAPIC
+	/* for nforce2 try vector 0 on pin0
+	 * Note the io_apic_set_pci_routing call disables the 8259 irq 0
+	 * so we must be connected directly to the 8254 timer if this works
+	 * Note2: this violates the above comment re Subtle but works!
+	 */
+	printk(KERN_INFO "..TIMER: Is timer irq0 connected to IOAPIC Pin0? ...\n");
+	if ( pin1 != -1 && nr_ioapics ) {
+		int saved_timer_ack = timer_ack;
+		/* next call also disables 8259 irq0 */
+		int result = io_apic_set_pci_routing ( 0, 0, 0, 0, 0);
+		/*
+		 * Ok, does IRQ0 through the IOAPIC work?
+		 */
+		unmask_IO_APIC_irq(0);
+		timer_ack = 0 ;
+		if (timer_irq_works()) {
+			if (nmi_watchdog == NMI_IO_APIC) {
+				disable_8259A_irq(0);
+				setup_nmi();
+				enable_8259A_irq(0);
+				check_nmi_watchdog();
+			}
+			printk(KERN_INFO "..TIMER: works OK on apic pin0 irq0\n" );
+			return;
+		}
+		/* failed */
+		timer_ack = saved_timer_ack;
+		clear_IO_APIC_pin(0, 0);
+		result = io_apic_set_pci_routing ( 0, pin1, 0, 0, 0);
+		printk(KERN_ERR "..MP-BIOS bug: 8254 timer not connected to IO-APIC Pin 0\n");
+	}
+#endif
+/* end new stuff for nforce2 */
+
 	printk(KERN_INFO "...trying to set up timer (IRQ0) through the 8259A ... ");
 	if (pin2 != -1) {
 		printk("\n..... (found pin %d) ...", pin2);

c) Finally during my fault finding I merged A.Martins patches for the nforce2 IDE driver.
I note that the nforce2 address setup timing bits are different to the AMD ones.
I have assumed the nforce2 address timings apply to nforce and nforce3 chipsets.
I could be wrong so if someone with the nvidia docs could check it please.
I have also not tested it with anything but a WDC ata100 hard drive.
For info see attached patch files (I think pci ids are already in 2.4.23)
nforce2-amd74xx.c-2.4.22.patch, nforce2-amd74xx.h-2.4.22.patch, nforce2-pci_ids.h-2.4.22.patch

Thanks
Ross Dickson

[-- Attachment #2: ross-diffs.tar.bz2 --]
[-- Type: application/x-tbz, Size: 4375 bytes --]

^ permalink raw reply	[flat|nested] 58+ messages in thread

end of thread, other threads:[~2004-02-07 16:25 UTC | newest]

Thread overview: 58+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-07 19:58 Fixes for nforce2 hard lockup, apic, io-apic, udma133 covered Ian Kumlien
2003-12-07 20:59 ` Jesse Allen
2003-12-07 20:56   ` Ian Kumlien
2003-12-08  2:07 ` Ross Dickson
2003-12-08  2:23   ` Ian Kumlien
2003-12-09 18:12   ` Catching NForce2 lockup with NMI watchdog Ian Kumlien
2003-12-09 22:04     ` Craig Bradney
2003-12-09 23:13       ` Ian Kumlien
2003-12-10  1:20       ` NForce2 and AMD, disconnect Ian Kumlien
2003-12-10  6:14       ` Catching NForce2 lockup with NMI watchdog Bob
2003-12-10  7:51         ` Craig Bradney
     [not found] <BF1FE1855350A0479097B3A0D2A80EE0023ED17F@hdsmsx402.hd.intel.com>
2004-02-07 11:46 ` Fixes for nforce2 hard lockup, apic, io-apic, udma133 covered Len Brown
2004-02-07 12:41   ` Maciej W. Rozycki
2004-02-07 15:13     ` Len Brown
2004-02-07 16:24       ` Maciej W. Rozycki
  -- strict thread matches above, loose matches on Subject: below --
2003-12-15 13:54 Ross Dickson
2003-12-16  1:40 ` Josh McKinney
2003-12-15 10:57 ross.alexander
2003-12-15 12:49 ` Maciej W. Rozycki
2003-12-13 18:07 Ross Dickson
2003-12-13 20:22 ` Josh McKinney
2003-12-13 21:38 ` Ian Kumlien
2003-12-14  4:50   ` Josh McKinney
2003-12-13 22:28 ` Ian Kumlien
2003-12-13 23:16   ` Ross Dickson
2003-12-13 23:21     ` Ian Kumlien
2003-12-13 23:49       ` Ross Dickson
2003-12-14  4:27         ` Jamie Lokier
2003-12-14 11:24           ` Ross Dickson
2003-12-14 13:11             ` Ross Dickson
2003-12-14 13:44               ` Ian Kumlien
2003-12-14 17:26             ` Jamie Lokier
2003-12-13 23:31     ` Ian Kumlien
2003-12-15 11:41 ` Bob
     [not found] <106Zu-1sD-3@gated-at.bofh.it>
     [not found] ` <1198P-3v0-1@gated-at.bofh.it>
     [not found]   ` <11gah-33u-1@gated-at.bofh.it>
     [not found]     ` <11wIo-4T4-7@gated-at.bofh.it>
     [not found]       ` <11xuB-6k3-11@gated-at.bofh.it>
     [not found]         ` <11AC6-3Sf-3@gated-at.bofh.it>
2003-12-11 17:11           ` Lenar Lõhmus
2003-12-11  2:50 Ross Dickson
2003-12-07 13:12 Ross Dickson
2003-12-09 15:20 ` Maciej W. Rozycki
2003-12-10  5:43   ` Ross Dickson
2003-12-10 16:06     ` Maciej W. Rozycki
2003-12-11  6:55       ` Ross Dickson
2003-12-11 11:47         ` Ian Kumlien
2003-12-11  9:12           ` Ross Dickson
2003-12-11 17:52             ` Ian Kumlien
2003-12-11 18:21               ` Jesse Allen
2003-12-12  9:27                 ` Bob
2003-12-11 14:58           ` Jesse Allen
2003-12-11 15:20             ` Craig Bradney
2003-12-11 16:05               ` Jesse Allen
2003-12-11 15:15         ` Maciej W. Rozycki
2003-12-11 16:23           ` Josh McKinney
2003-12-11 17:04             ` Maciej W. Rozycki
2003-12-11 17:25               ` Jesse Allen
2003-12-10  3:39 ` Jesse Allen
2003-12-10  9:22   ` Ross Dickson
2003-12-10 10:00   ` Mikael Pettersson
2003-12-10  8:40     ` Ross Dickson
2003-12-11 14:32     ` Jesse Allen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).