mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ross Dickson <ross@datscreative.com.au>
To: Len Brown <len.brown@intel.com>
Cc: christian.kroener@tu-harburg.de, linux-kernel@vger.kernel.org,
	"Maciej W. Rozycki" <macro@ds2.pg.gda.pl>,
	Jamie Lokier <jamie@shareable.org>,
	"Prakash K. Cheemplavam" <PrakashKC@gmx.de>,
	Craig Bradney <cbradney@zip.com.au>,
	Daniel Drake <dan@reactivated.net>, Ian Kumlien <pomac@vapor.com>,
	Jesse Allen <the3dfxdude@hotmail.com>,
	a.verweij@student.tudelft.nl
Subject: Re: IO-APIC on nforce2 [PATCH] + [PATCH] for nmi_debug=1 + [PATCH] for idle=C1halt, 2.6.5
Date: Fri, 16 Apr 2004 01:10:37 +1000	[thread overview]
Message-ID: <200404160110.37573.ross@datscreative.com.au> (raw)
In-Reply-To: <1081893978.2251.653.camel@dhcppc4>

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

On Wednesday 14 April 2004 11:02, Len Brown wrote:
> Re: IRQ0 XT-PIC timer issue
> 
> Since the hardware is connected to APIC pin0, it is a BIOS bug
> that an ACPI interrupt source override from pin2 to IRQ0 exists.
> 
> With this simple 2.6.5 patch you can specify "acpi_skip_timer_override"
> to ignore that bogus BIOS directive.  The result is with your
> ACPI-enabled APIC-enabled kernel, you'll get IRQ0 IO-APIC-edge timer.
> 
> Probably there is a more clever way to trigger this workaround
> automatcially instead of via boot parameter.
> 
> cheers,
> -Len
> 
> ===== Documentation/kernel-parameters.txt 1.44 vs edited =====
> --- 1.44/Documentation/kernel-parameters.txt	Mon Mar 22 16:03:22 2004
> +++ edited/Documentation/kernel-parameters.txt	Tue Apr 13 17:47:11 2004
> @@ -122,6 +122,10 @@
>  
>  	acpi_serialize	[HW,ACPI] force serialization of AML methods
>  
> +	acpi_skip_timer_override [HW,ACPI]]
> +			Recognize IRQ0/pin2 Interrupt Source Override
> +			and ignore it -- for broken nForce2 BIOS.
> +
>  	ad1816=		[HW,OSS]
>  			Format: <io>,<irq>,<dma>,<dma2>
>  			See also Documentation/sound/oss/AD1816.
> ===== arch/i386/kernel/setup.c 1.115 vs edited =====
> --- 1.115/arch/i386/kernel/setup.c	Fri Apr  2 07:21:43 2004
> +++ edited/arch/i386/kernel/setup.c	Tue Apr 13 17:41:31 2004
> @@ -614,6 +614,12 @@
>  		else if (!memcmp(from, "acpi_sci=low", 12))
>  			acpi_sci_flags.polarity = 3;
>  
> +		else if (!memcmp(from, "acpi_skip_timer_override", 24)) {
> +			extern int acpi_skip_timer_override;
> +
> +			acpi_skip_timer_override = 1;
> +		}
> +
>  #ifdef CONFIG_X86_LOCAL_APIC
>  		/* disable IO-APIC */
>  		else if (!memcmp(from, "noapic", 6))
> ===== arch/i386/kernel/acpi/boot.c 1.57 vs edited =====
> --- 1.57/arch/i386/kernel/acpi/boot.c	Tue Mar 30 17:05:19 2004
> +++ edited/arch/i386/kernel/acpi/boot.c	Tue Apr 13 17:50:14 2004
> @@ -62,6 +62,7 @@
>  
>  acpi_interrupt_flags acpi_sci_flags __initdata;
>  int acpi_sci_override_gsi __initdata;
> +int acpi_skip_timer_override __initdata;
>  
>  #ifdef CONFIG_X86_LOCAL_APIC
>  static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
> @@ -327,6 +328,12 @@
>  		acpi_sci_ioapic_setup(intsrc->global_irq,
>  			intsrc->flags.polarity, intsrc->flags.trigger);
>  		return 0;
> +	}
> +
> +	if (acpi_skip_timer_override &&
> +		intsrc->bus_irq == 0 && intsrc->global_irq == 2) {
> +			printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n");
> +			return 0;
>  	}
>  
>  	mp_override_legacy_irq (
> 
> 
> 

Hi Len, I have updated my nforce2 patches for 2.6.5 to work with your patch.
I have tested them only on one nforce2 board Epox 8Rga+ but as little has
changed in core functionality from past releases I think all will be OK....
Hopefully no clock skew. I saw none on my system but thats no guarantee.
 
I tried your above patch with the timer_ack on as is default in 2.6.5 and
nmi_watchdog=1 failed as expected. I still think Maciej's 8259 ack patch 
is more complete solution to the ack issue but this one gets watchdog going for
nforce2. I cannot see anyone using your above patch without an integrated
apic and tsc so I cannot see a problem triggering it off your kern arg.

The second patch is the C1halt update I suggested in another posting.
http://linux.derkeiler.com/Mailing-Lists/Kernel/2004-04/1707.html

Both patches in attached tarball.
Regards
Ross.

Here is my revised patch for use with "acpi_skip_timer_override" to get 
nmi_debug=1 working with the above patch from Len Brown.

--- linux-2.6.5/arch/i386/kernel/io_apic.c.orig	2004-04-16 00:20:54.000000000 +1000
+++ linux-2.6.5/arch/i386/kernel/io_apic.c	2004-04-15 20:24:18.000000000 +1000
@@ -2179,10 +2179,13 @@ static inline void check_timer(void)
 
 	if (pin1 != -1) {
 		/*
 		 * Ok, does IRQ0 through the IOAPIC work?
 		 */
+		extern int acpi_skip_timer_override;
+		if(acpi_skip_timer_override)
+			timer_ack=0;
 		unmask_IO_APIC_irq(0);
 		if (timer_irq_works()) {
 			if (nmi_watchdog == NMI_IO_APIC) {
 				disable_8259A_irq(0);
 				setup_nmi();

Here is my revised patch for "idle=C1halt" to prevent nforce2 hard lockups.
Now more robust, better tested with apm config, and without x86 apic config, 
and nolapic, noapic, acpi=off. All gave my usual 38C CPU temp when idle and
no hard lockups. Temp measured by leaving machine idle on run level 3 for 
several minutes and then reading bios temp on reboot.

--- linux-2.6.5/arch/i386/kernel/process.c.orig	2004-04-04 13:36:10.000000000 +1000
+++ linux-2.6.5/arch/i386/kernel/process.c	2004-04-15 20:41:13.000000000 +1000
@@ -47,10 +47,13 @@
 #include <asm/irq.h>
 #include <asm/desc.h>
 #ifdef CONFIG_MATH_EMULATION
 #include <asm/math_emu.h>
 #endif
+#if defined(CONFIG_X86_UP_APIC)
+#include <asm/apic.h>
+#endif
 
 #include <linux/irq.h>
 #include <linux/err.h>
 
 asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
@@ -98,10 +101,34 @@ void default_idle(void)
 			local_irq_enable();
 	}
 }
 
 /*
+ * We use this to avoid nforce2 lockups
+ * Reduces frequency of C1 disconnects
+ */
+static void c1halt_idle(void)
+{
+	if (!hlt_counter && current_cpu_data.hlt_works_ok) {
+		local_irq_disable();
+#if defined(CONFIG_X86_UP_APIC)
+		/* only hlt disconnect if more than 1.6% of apic interval remains */
+      	extern int enable_local_apic;
+		if(!need_resched() && (enable_local_apic < 0 ||
+			(apic_read(APIC_TMCCT) > (apic_read(APIC_TMICT)>>6)))) {
+#else
+		/* just adds a little delay to assist in back to back disconnects */
+		if(!need_resched()) {
+#endif
+		ndelay(600); /* helps nforce2 but adds 0.6us hard int latency */
+		safe_halt(); /* nothing better to do until we wake up */
+		} else {
+			local_irq_enable();
+		}
+	}
+}
+/*
  * On SMP it's slightly faster (but much more power-consuming!)
  * to poll the ->work.need_resched flag instead of waiting for the
  * cross-CPU IPI to arrive. Use this option with caution.
  */
 static void poll_idle (void)
@@ -135,20 +162,18 @@ static void poll_idle (void)
  * The idle thread. There's no useful work to be
  * done, so just try to conserve power and have a
  * low exit latency (ie sit in a loop waiting for
  * somebody to say that they'd like to reschedule)
  */
+static void (*idle)(void);
 void cpu_idle (void)
 {
 	/* endless idle loop with no priority at all */
 	while (1) {
 		while (!need_resched()) {
-			void (*idle)(void) = pm_idle;
-
 			if (!idle)
-				idle = default_idle;
-
+				idle = pm_idle ? pm_idle : default_idle;
 			irq_stat[smp_processor_id()].idle_timestamp = jiffies;
 			idle();
 		}
 		schedule();
 	}
@@ -199,16 +224,18 @@ void __init select_idle_routine(const st
 
 static int __init idle_setup (char *str)
 {
 	if (!strncmp(str, "poll", 4)) {
 		printk("using polling idle threads.\n");
-		pm_idle = poll_idle;
+		idle = poll_idle;
 	} else if (!strncmp(str, "halt", 4)) {
 		printk("using halt in idle threads.\n");
-		pm_idle = default_idle;
+		idle = default_idle;
+	} else if (!strncmp(str, "C1halt", 6)) {
+		printk("using C1 halt disconnect friendly idle threads.\n");
+		idle = c1halt_idle;
 	}
-
 	return 1;
 }
 
 __setup("idle=", idle_setup);
 



[-- Attachment #2: nforce2-lockup-patches-rd-2.6.5.tgz --]
[-- Type: application/x-tgz, Size: 1671 bytes --]

  parent reply	other threads:[~2004-04-15 15:07 UTC|newest]

Thread overview: 93+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-13  1:17 IO-APIC on nforce2 Ross Dickson
2004-04-13  4:01 ` really bensoo_at_soo_dot_com
2004-04-13  4:55   ` Ross Dickson
2004-04-13 17:22     ` Christian Kröner
2004-04-13 21:18     ` really bensoo_at_soo_dot_com
2004-04-14  4:24       ` really bensoo_at_soo_dot_com
2004-04-13  5:08 ` Len Brown
2004-04-13  7:03   ` Ross Dickson
2004-04-13 13:46     ` Maciej W. Rozycki
2004-04-14  1:02     ` IO-APIC on nforce2 [PATCH] Len Brown
2004-04-14  5:02       ` Ross Dickson
2004-04-14  6:30         ` Jamie Lokier
2004-04-14 10:37         ` Maciej W. Rozycki
2004-04-15 19:28           ` Len Brown
2004-04-14 19:57         ` Christian Kröner
2004-04-15  0:17           ` Len Brown
2004-04-15  1:48             ` Ross Dickson
2004-04-15 17:09               ` Christian Kröner
2004-04-15 15:10       ` Ross Dickson [this message]
2004-04-15 20:17         ` IO-APIC on nforce2 [PATCH] + [PATCH] for nmi_debug=1 + [PATCH] for idle=C1halt, 2.6.5 Len Brown
2004-04-15 21:04           ` Craig Bradney
2004-04-21 20:22             ` Len Brown
2004-04-21 20:33               ` Ian Kumlien
2004-04-21 20:45               ` Craig Bradney
2004-04-21 21:28               ` Prakash K. Cheemplavam
2004-04-21 22:41                 ` Len Brown
2004-04-22  7:26                   ` Prakash K. Cheemplavam
2004-04-22 14:58                     ` Len Brown
2004-04-22  8:45                   ` Craig Bradney
2004-04-22 15:03                     ` Len Brown
2004-04-22 20:50                       ` Craig Bradney
2004-04-22  8:50                   ` Arjen Verweij
2004-04-22 16:39                   ` Jesse Allen
2004-04-22 17:21                     ` Len Brown
2004-04-22 21:29                       ` Len Brown
2004-04-23  8:48                         ` Prakash K. Cheemplavam
2004-04-23  9:01                           ` Arjen Verweij
2004-04-23  9:08                             ` Prakash K. Cheemplavam
2004-04-23  9:11                             ` Prakash K. Cheemplavam
2004-04-23 12:18                         ` Maciej W. Rozycki
2004-04-27  7:57                         ` ACPI broken on nforce2? Prakash K. Cheemplavam
2004-04-26 11:41                       ` IO-APIC on nforce2 [PATCH] + [PATCH] for nmi_debug=1 + [PATCH] for idle=C1halt, 2.6.5 Ross Dickson
2004-04-27 17:02                         ` Arjen Verweij
2004-04-27 17:35                           ` Ian Kumlien
2004-04-27 18:00                           ` Len Brown
2004-04-27 18:24                             ` Arjen Verweij
2004-04-27 18:51                             ` Jussi Laako
2004-04-28 11:33                             ` Ross Dickson
2004-04-28 20:59                               ` Jesse Allen
2004-04-29 11:44                                 ` Ross Dickson
2004-04-29 11:54                                   ` Maciej W. Rozycki
2004-04-29 12:00                                     ` Jamie Lokier
2004-04-29 12:26                                       ` Maciej W. Rozycki
2004-04-29 11:57                                   ` Jamie Lokier
2004-04-29 12:16                                   ` Craig Bradney
2004-04-29 20:24                                   ` Jesse Allen
2004-04-29 20:31                                     ` Prakash K. Cheemplavam
2004-05-03 20:45                                       ` Jesse Allen
2004-05-17 15:26                                         ` Prakash K. Cheemplavam
2004-05-17 19:32                                           ` Craig Bradney
2004-05-17 19:37                                             ` Prakash K. Cheemplavam
2004-05-17 19:57                                               ` Craig Bradney
2004-04-27 21:31                         ` Prakash K. Cheemplavam
2004-04-28 11:26                           ` Prakash K. Cheemplavam
2004-05-01  6:51                   ` Prakash K. Cheemplavam
2004-04-15 21:56           ` Arjen Verweij
2004-04-15 15:21       ` IO-APIC on nforce2 [PATCH] Zwane Mwaikambo
     [not found] <1KkKQ-2v9-9@gated-at.bofh.it>
     [not found] ` <1Kqdx-6E1-5@gated-at.bofh.it>
     [not found]   ` <1KH4I-3W9-11@gated-at.bofh.it>
     [not found]     ` <1LgOQ-7px-3@gated-at.bofh.it>
     [not found]       ` <1LlEY-36q-11@gated-at.bofh.it>
2004-04-15 23:07         ` IO-APIC on nforce2 [PATCH] + [PATCH] for nmi_debug=1 + [PATCH] for idle=C1halt, 2.6.5 Andi Kleen
2004-04-21 22:00           ` Len Brown
2004-04-23  1:30 Jesse Allen
2004-05-07  4:47 ` Richard James
2004-05-07  7:13   ` Craig Bradney
2004-05-08  5:33   ` Richard James
2004-05-03  8:08 Allen Martin
2004-05-03 22:09 Allen Martin
2004-05-03 23:11 ` Bartlomiej Zolnierkiewicz
2004-05-04  8:28   ` Prakash K. Cheemplavam
2004-05-04 21:10   ` Jeff Garzik
2004-05-04 21:29     ` Bartlomiej Zolnierkiewicz
2004-05-05 12:14   ` Ross Dickson
2004-05-05 12:27     ` Ian Kumlien
2004-05-05 13:12       ` Ross Dickson
2004-05-05 13:23         ` Ian Kumlien
2004-05-05 12:58     ` Maciej W. Rozycki
2004-05-05 12:48   ` Patrick Dreker
2004-05-05 13:34     ` Patrick Dreker
2004-05-05 11:24 ` Ross Dickson
2004-05-05 12:18   ` Ian Kumlien
2004-05-05 12:52     ` Ross Dickson
2004-05-05 13:08       ` Ian Kumlien
2004-05-06  1:50         ` Jesse Allen
2004-05-04 20:38 Jesse Allen
2004-05-04 21:14 ` Craig Bradney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200404160110.37573.ross@datscreative.com.au \
    --to=ross@datscreative.com.au \
    --cc=PrakashKC@gmx.de \
    --cc=a.verweij@student.tudelft.nl \
    --cc=cbradney@zip.com.au \
    --cc=christian.kroener@tu-harburg.de \
    --cc=dan@reactivated.net \
    --cc=jamie@shareable.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=macro@ds2.pg.gda.pl \
    --cc=pomac@vapor.com \
    --cc=the3dfxdude@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome