mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [PATCH] APM fix for 2.4.20pre1
  2002-08-06 13:43 [PATCH] APM fix for 2.4.20pre1 Willy TARREAU
@ 2001-08-20 20:45 ` Pavel Machek
  2002-08-06 16:07 ` Alan Cox
  1 sibling, 0 replies; 4+ messages in thread
From: Pavel Machek @ 2001-08-20 20:45 UTC (permalink / raw)
  To: Willy TARREAU; +Cc: marcelo, linux-kernel

Hi!

> @@ -897,10 +889,11 @@
>  	 */
>  #ifdef CONFIG_SMP
>  	/* Some bioses don't like being called from CPU != 0 */
> -	while (cpu_number_map(smp_processor_id()) != 0) {
> -		kernel_thread(apm_magic, NULL,
> -			CLONE_FS | CLONE_FILES | CLONE_SIGHAND | SIGCHLD);
> +	if (cpu_number_map(smp_processor_id()) != 0) {
> +		current->cpus_allowed = 1;
>  		schedule();
> +		if (unlikely(cpu_number_map(smp_processor_id()) != 0))
> +			BUG();

BUG_ON()?
								Pavel
-- 
Philips Velo 1: 1"x4"x8", 300gram, 60, 12MB, 40bogomips, linux, mutt,
details at http://atrey.karlin.mff.cuni.cz/~pavel/velo/index.html.


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

* [PATCH] APM fix for 2.4.20pre1
@ 2002-08-06 13:43 Willy TARREAU
  2001-08-20 20:45 ` Pavel Machek
  2002-08-06 16:07 ` Alan Cox
  0 siblings, 2 replies; 4+ messages in thread
From: Willy TARREAU @ 2002-08-06 13:43 UTC (permalink / raw)
  To: marcelo; +Cc: linux-kernel

Hi Marcelo,

I resend you this patch against 2.4.19-rc5 which prevents my SMP box from
randomly crashing at boot during APM initialization. It still applies to
2.4.20-pre1. Alan included it in 19-ac4 too. Basically, it forces bios
calls to be made only from CPU0.

Please include it in 2.4.20-pre2.

Thanks,
Willy

PS: people using O(1) scheduler should not use this patch, but Alan's.

--- linux-2.4.19-rc5/arch/i386/kernel/apm.c	Thu Aug  1 22:07:39 2002
+++ linux-2.4.19-rc5-fix/arch/i386/kernel/apm.c	Fri Aug  2 01:52:55 2002
@@ -862,14 +862,6 @@
 		apm_do_busy();
 }
 
-#ifdef CONFIG_SMP
-static int apm_magic(void * unused)
-{
-	while (1)
-		schedule();
-}
-#endif
-
 /**
  *	apm_power_off	-	ask the BIOS to power off
  *
@@ -897,10 +889,11 @@
 	 */
 #ifdef CONFIG_SMP
 	/* Some bioses don't like being called from CPU != 0 */
-	while (cpu_number_map(smp_processor_id()) != 0) {
-		kernel_thread(apm_magic, NULL,
-			CLONE_FS | CLONE_FILES | CLONE_SIGHAND | SIGCHLD);
+	if (cpu_number_map(smp_processor_id()) != 0) {
+		current->cpus_allowed = 1;
 		schedule();
+		if (unlikely(cpu_number_map(smp_processor_id()) != 0))
+			BUG();
 	}
 #endif
 	if (apm_info.realmode_power_off)
@@ -1661,6 +1654,21 @@
 	strcpy(current->comm, "kapmd");
 	sigfillset(&current->blocked);
 
+#ifdef CONFIG_SMP
+	/* 2002/08/01 - WT
+	 * This is to avoid random crashes at boot time during initialization
+	 * on SMP systems in case of "apm=power-off" mode. Seen on ASUS A7M266D.
+	 * Some bioses don't like being called from CPU != 0.
+	 * Method suggested by Ingo Molnar.
+	 */
+	if (cpu_number_map(smp_processor_id()) != 0) {
+		current->cpus_allowed = 1;
+		schedule();
+		if (unlikely(cpu_number_map(smp_processor_id()) != 0))
+			BUG();
+	}
+#endif
+	
 	if (apm_info.connection_version == 0) {
 		apm_info.connection_version = apm_info.bios.version;
 		if (apm_info.connection_version > 0x100) {
@@ -1707,7 +1715,7 @@
 		}
 	}
 
-	if (debug && (smp_num_cpus == 1)) {
+	if (debug) {
 		error = apm_get_power_status(&bx, &cx, &dx);
 		if (error)
 			printk(KERN_INFO "apm: power status not available\n");


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

* Re: [PATCH] APM fix for 2.4.20pre1
  2002-08-06 16:07 ` Alan Cox
@ 2002-08-06 13:59   ` Marcelo Tosatti
  0 siblings, 0 replies; 4+ messages in thread
From: Marcelo Tosatti @ 2002-08-06 13:59 UTC (permalink / raw)
  To: Alan Cox; +Cc: Willy TARREAU, linux-kernel



On 6 Aug 2002, Alan Cox wrote:

> On Tue, 2002-08-06 at 14:43, Willy TARREAU wrote:
> > Hi Marcelo,
> >
> > I resend you this patch against 2.4.19-rc5 which prevents my SMP box from
> > randomly crashing at boot during APM initialization. It still applies to
> > 2.4.20-pre1. Alan included it in 19-ac4 too. Basically, it forces bios
> > calls to be made only from CPU0.
>
> Doing the job right is a bit more complex than that. Thanks to your hint
> I've actually got APM SMP working a lot better on multiple boxes now.
> Marcelo - I may send you some cooler stuff but this one should be
> applied anyway

Its already applied.


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

* Re: [PATCH] APM fix for 2.4.20pre1
  2002-08-06 13:43 [PATCH] APM fix for 2.4.20pre1 Willy TARREAU
  2001-08-20 20:45 ` Pavel Machek
@ 2002-08-06 16:07 ` Alan Cox
  2002-08-06 13:59   ` Marcelo Tosatti
  1 sibling, 1 reply; 4+ messages in thread
From: Alan Cox @ 2002-08-06 16:07 UTC (permalink / raw)
  To: Willy TARREAU; +Cc: Marcelo Tosatti, linux-kernel

On Tue, 2002-08-06 at 14:43, Willy TARREAU wrote:
> Hi Marcelo,
> 
> I resend you this patch against 2.4.19-rc5 which prevents my SMP box from
> randomly crashing at boot during APM initialization. It still applies to
> 2.4.20-pre1. Alan included it in 19-ac4 too. Basically, it forces bios
> calls to be made only from CPU0.

Doing the job right is a bit more complex than that. Thanks to your hint
I've actually got APM SMP working a lot better on multiple boxes now.
Marcelo - I may send you some cooler stuff but this one should be
applied anyway


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

end of thread, other threads:[~2002-08-19 20:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-06 13:43 [PATCH] APM fix for 2.4.20pre1 Willy TARREAU
2001-08-20 20:45 ` Pavel Machek
2002-08-06 16:07 ` Alan Cox
2002-08-06 13:59   ` Marcelo Tosatti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®