Re: x86/.../trampoline_64.S racy?

Previous thread: [patch 00/27] 2.6.22-stable review by Greg KH on Friday, February 1, 2008 - 8:19 pm. (40 messages)

Next thread: [PATCH 1/5] ide: remove write-only ->sata_misc[] from ide_hwif_t by Bartlomiej Zolnierkiewicz on Friday, February 1, 2008 - 8:45 pm. (2 messages)
To: kernel list <linux-kernel@...>
Cc: Linux-pm mailing list <linux-pm@...>, Rafael J. Wysocki <rjw@...>
Date: Friday, February 1, 2008 - 6:07 pm

Hi!

I'm trying to reuse trampoline_64.S for wakeup from ACPI s3... but I'm
getting some badness: If I insert delay loops into trampoline_64.S,
machine fails to boot; but I already increased cpu bootup delay to 200
seconds...

Is it possible that bootup is subtly racy somewhere?

diff --git a/arch/x86/kernel/smpboot_64.c b/arch/x86/kernel/smpboot_64.c
index aaf4e12..3961bcb 100644
--- a/arch/x86/kernel/smpboot_64.c
+++ b/arch/x86/kernel/smpboot_64.c
@@ -188,7 +188,7 @@ void __cpuinit smp_callin(void)
/*
* Waiting 2s total for startup (udelay is not yet working)
*/
- timeout = jiffies + 2*HZ;
+ timeout = jiffies + 200*HZ;
while (time_before(jiffies, timeout)) {
/*
* Has the boot CPU finished it's STARTUP sequence?
diff --git a/arch/x86/kernel/trampoline_64.S b/arch/x86/kernel/trampoline_64.S
index 4aedd0b..34fe9a7 100644
--- a/arch/x86/kernel/trampoline_64.S
+++ b/arch/x86/kernel/trampoline_64.S
@@ -24,12 +24,48 @@
* entries.
*/

+
#include <linux/linkage.h>
#include <asm/pgtable.h>
#include <asm/page.h>
#include <asm/msr.h>
#include <asm/segment.h>

+
+#define BEEP \
+ inb $97, %al; \
+ outb %al, $0x80; \
+ movb $3, %al; \
+ outb %al, $97; \
+ outb %al, $0x80; \
+ movb $-74, %al; \
+ outb %al, $67; \
+ outb %al, $0x80; \
+ movb $-119, %al; \
+ outb %al, $66; \
+ outb %al, $0x80; \
+ movb $15, %al; \
+ outb %al, $66;
+
+#define DISPLAY(x) \
+ pushl %eax ; \
+ movb $x, %al; \
+ outb %al, $0x80; \
+ popl %eax
+
+#define DISPLAY_UNSAFE(x) \
+ movb $x, %al; \
+ outb %al, $0x80; \
+
+#define DELAY_OK \
+ movl $0x30000000,%ecx ; \
+9: loopl 9b ;
+
+#define DELAY \
+ movl $1,%ecx ; \
+9: loopl 9b ;
+
+
/* We can free up trampoline after bootup if cpu hotplug is not supported. */
#ifndef CONFIG_HOTPLUG_CPU
.section .init.data, "aw", @progbits
@@ -55,6 +91,9 @@ r_base = .
# Setup stack
movw $(trampoline_stack_end - r_base), %sp

+ DISPLAY(0x70)
+ DELAY
+
...

To: kernel list <linux-kernel@...>
Cc: Linux-pm mailing list <linux-pm@...>, Rafael J. Wysocki <rjw@...>
Date: Friday, February 1, 2008 - 6:15 pm

No, I just missed another place with timeout:

/*
* Wait 5s total for a response
*/
for (timeout = 0; timeout < 5000000; timeout++) {
if (cpu_isset(cpu, cpu_callin_map))
break; /* It has booted */
udelay(100);
}

Pavel

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--

Previous thread: [patch 00/27] 2.6.22-stable review by Greg KH on Friday, February 1, 2008 - 8:19 pm. (40 messages)

Next thread: [PATCH 1/5] ide: remove write-only ->sata_misc[] from ide_hwif_t by Bartlomiej Zolnierkiewicz on Friday, February 1, 2008 - 8:45 pm. (2 messages)