Skip to contentSkip to conversation

S4bios support for 2.5.63

PATCH Pavel Machek 10 participants 31 messages Feb 26, 2003 – Mar 4, 2003 2 messages not in the archive

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Hi!

This is S4bios support for 2.5.63. I'd like to see it in since it is easier to understand and more foolproof. Please apply,

Pavel

arch/i386/kernel/acpi/wakeup.S +25 -0
@@ -319,6 +319,31 @@
 	pushl saved_context_eflags ; popfl
 	ret
 
+ENTRY(do_suspend_lowlevel_s4bios)
+	cmpl $0,4(%esp)
+	jne ret_point
+	call save_processor_state
+
+	movl %esp, saved_context_esp
+	movl %eax, saved_context_eax
+	movl %ebx, saved_context_ebx
+	movl %ecx, saved_context_ecx
+	movl %edx, saved_context_edx
+	movl %ebp, saved_context_ebp
+	movl %esi, saved_context_esi
+	movl %edi, saved_context_edi
+	pushfl ; popl saved_context_eflags
+
+	movl $ret_point,saved_eip
+	movl %esp,saved_esp
+	movl %ebp,saved_ebp
+	movl %ebx,saved_ebx
+	movl %edi,saved_edi
+	movl %esi,saved_esi
+
+	call acpi_enter_sleep_state_s4bios
+	ret
+
 ALIGN
 # saved registers
 saved_gdt:	.long	0,0
drivers/acpi/acpi_ksyms.c +1 -0
@@ -86,6 +86,7 @@
 EXPORT_SYMBOL(acpi_get_register);
 EXPORT_SYMBOL(acpi_set_register);
 EXPORT_SYMBOL(acpi_enter_sleep_state);
+EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios);
 EXPORT_SYMBOL(acpi_get_system_info);
 EXPORT_SYMBOL(acpi_get_devices);
 
drivers/acpi/hardware/hwsleep.c +45 -0

51 lines not on this page · raw message

drivers/acpi/sleep/main.c +23 -2
@@ -183,14 +180,21 @@
 		status = acpi_enter_sleep_state(state);
 		break;
 
-	case ACPI_STATE_S2:
 #ifdef CONFIG_SOFTWARE_SUSPEND
+	case ACPI_STATE_S2:
 	case ACPI_STATE_S3:
 		do_suspend_lowlevel(0);
+		break;
 #endif
+	case ACPI_STATE_S4:
+		do_suspend_lowlevel_s4bios(0);
+		break;
+	default:
+		printk(KERN_WARNING PREFIX "don't know how to handle %d state.\n", state);
 		break;
 	}
 	local_irq_restore(flags);
+	printk(KERN_CRIT "Back to C!\n");
 
 	return status;
 }
@@ -211,10 +215,20 @@
 	if (state < ACPI_STATE_S1 || state > ACPI_STATE_S5)
 		return AE_ERROR;
 
+	/* Since we handle S4OS via a different path (swsusp), give up if no s4bios. */
+	if (state == ACPI_STATE_S4 && !acpi_gbl_FACS->S4bios_f)
+		return AE_ERROR;
+
+	/*
+	 * TBD: S1 can be done without device_suspend.  Make a CONFIG_XX
+	 * to handle however when S1 failed without device_suspend.
+	 */
 	freeze_processes();		/* device_suspend needs processes to be stopped */
 
 	/* do we have a wakeup address for S2 and S3? */
-	if (state == ACPI_STATE_S2 || state == ACPI_STATE_S3) {
+	/* Here, we support only S4BIOS, those we set the wakeup address */
+	/* S4OS is only supported for now via swsusp.. */
+	if (state == ACPI_STATE_S2 || state == ACPI_STATE_S3 || ACPI_STATE_S4) {
 		if (!acpi_wakeup_address)
 			return AE_ERROR;
 		acpi_set_firmware_waking_vector((acpi_physical_address) acpi_wakeup_address);
@@ -268,6 +282,10 @@
 			sleep_states[i] = 1;
 			printk(" S%d", i);
 		}
+		if (i == ACPI_STATE_S4 && acpi_gbl_FACS->S4bios_f) {
+			sleep_states[i] = 1;
+			printk(" S4bios");
+		}
 	}
 	printk(")\n");
 
drivers/acpi/sleep/proc.c +4 -1
@@ -27,8 +27,11 @@
 	ACPI_FUNCTION_TRACE("acpi_system_sleep_seq_show");
 
 	for (i = 0; i <= ACPI_STATE_S5; i++) {
-		if (sleep_states[i])
+		if (sleep_states[i]) {
 			seq_printf(seq,"S%d ", i);
+			if (i == ACPI_STATE_S4 && acpi_gbl_FACS->S4bios_f)
+				seq_printf(seq, "S4bios ");
+		}
 	}
 
 	seq_puts(seq, "\n");
include/acpi/acpixf.h +4 -0
@@ -399,6 +399,10 @@
 	u8                              sleep_state);
 
 acpi_status
+acpi_enter_sleep_state_s4bios (
+	void);
+
+acpi_status
 acpi_leave_sleep_state (
 	u8                              sleep_state);
 
include/linux/suspend.h +1 -0
@@ -73,6 +73,7 @@
 /* Communication between acpi and arch/i386/suspend.c */
 
 extern void do_suspend_lowlevel(int resume);
+extern void do_suspend_lowlevel_s4bios(int resume);
 
 #else
 static inline void software_suspend(void)
Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
#1 lore raw
Quoted 31 lines · Pavel Machek

Hi!

This is S4bios support for 2.5.63. I'd like to see it in since it is easier to understand and more foolproof. Please apply,

Pavel

drivers/acpi/hardware/hwsleep.c +25 -0
+/******************************************************************************
+ *
+ * FUNCTION:    acpi_enter_sleep_state_s4bios
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Perform a s4 bios request.
+ *              THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_enter_sleep_state_s4bios (
+	void)
+{
+	u32                     in_value;
+	acpi_status             status;
+
+
+	ACPI_FUNCTION_TRACE ("Acpi_enter_sleep_state_s4bios");
+
+	acpi_set_register (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_LOCK);
+	acpi_hw_clear_acpi_status();

drivers/acpi/hardware/hwsleep.c line 373

Quoted 10 lines
drivers/acpi/hardware/hwsleep.c +10 -0
+
+	acpi_hw_disable_non_wakeup_gpes();
+
+	ACPI_FLUSH_CPU_CACHE();
+
+	status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, (acpi_integer) acpi_gbl_FADT->S4bios_req, 8);
+
+	do {
+		acpi_os_stall(1000);
+		status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value, ACPI_MTX_LOCK);

Please use ACPI_MTX_DO_NOT_LOCK flags.

1- all others user land are no more scheduled, and irqs are disabled. 2- the saved memory image is the one that appar 'randomly' when the suspension
happen, it is then possible that that we enter acpi_get_register()
3- acpi_get_register() touch one semaphore (a mutex) if you pass ACPI_MTX_LOCK,
then it is possible that this mutex is not released:
we are supposed to go to 'ret_point' in arch/i386/kernel/acpi/wakeup.S

4- after resuming, any try to acquire this mutex will deadlock (this will happen early
in acpi_leave_sleep_state()).

Cheers,

Signature · 4 lines
Ducrot Bruno

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.
#2 lore raw

Hi!

Quoted 6 lines

drivers/acpi/hardware/hwsleep.c line 373

Quoted 4 lines
drivers/acpi/hardware/hwsleep.c +4 -0
+
+	do {
+		acpi_os_stall(1000);
+		status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value, ACPI_MTX_LOCK);

Please use ACPI_MTX_DO_NOT_LOCK flags.

Is s/MTX_LOCK/MTX_DO_NOT_LOCK/
enough?

Pavel

Signature · 2 lines
				Pavel
Written on sharp zaurus, because my Velo1 broke. If you have Velo you don't need...
#3 lore raw
Quoted 10 lines · Pavel Machek

Hi!

Quoted 6 lines

drivers/acpi/hardware/hwsleep.c line 373

Quoted 4 lines
drivers/acpi/hardware/hwsleep.c +4 -0
+
+	do {
+		acpi_os_stall(1000);
+		status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value, ACPI_MTX_LOCK);

Please use ACPI_MTX_DO_NOT_LOCK flags.

Quoted 3 lines

Is s/MTX_LOCK/MTX_DO_NOT_LOCK/
enough?

Never mind. Someone has already made the modif.

Signature · 4 lines
Ducrot Bruno

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.
#4 lore raw
In reply to Pavel Machek
Quoted 2 lines · Pavel Machek

This is S4bios support for 2.5.63. I'd like to see it in since it is easier to understand and more foolproof. Please apply,

Pavel,

Since 2.5.61 at least swsusp doesn't work here, with or without S4bios. It lists a heap of processes entering the refrigerator, then prints '=|' and moves one line downwards, cursor blinking on an empty line.

Nothing appears to happen then, except that if I press alt-f7, my screen blanks as if X is still partly alive. Alt-SysRQ also works and shows heaps of processes, most of them with 'refrigerator' somewhere in their traceback.

Nothing is written to disk however.

I try to suspend with "echo 4 > /proc/acpi/sleep".

Quoted 1 line

From dmesg on bootup:

BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
BIOS-e820: 00000000000e8000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 000000000bff0000 (usable)
BIOS-e820: 000000000bff0000 - 000000000bff8000 (ACPI data)
BIOS-e820: 000000000bff8000 - 000000000c000000 (ACPI NVS)
BIOS-e820: 00000000ffef0000 - 00000000fff00000 (reserved)
BIOS-e820: 00000000ffff0000 - 0000000100000000 (reserved)
191MB LOWMEM available.
ACPI: have wakeup address 0xc0001000
On node 0 totalpages: 49136
DMA zone: 4096 pages, LIFO batch:1
Normal zone: 45040 pages, LIFO batch:10
HighMem zone: 0 pages, LIFO batch:1
ACPI: RSDP (v000 AMI ) @ 0x000fc740
ACPI: RSDT (v001 AMIINT AMIINT09 00000.04096) @ 0x0bff0000
ACPI: FADT (v001 AMIINT AMIINT09 00000.04096) @ 0x0bff0030
ACPI: DSDT (v001 SiS 630 00000.04096) @ 0x00000000
ACPI: BIOS passes blacklist
Building zonelist for node : 0
Kernel command line: root=/dev/hda1 resume=/dev/hda2
Initializing CPU#0
PID hash table entries: 1024 (order 10: 8192 bytes)
Detected 1096.985 MHz processor.
--
biovec pool[1]: 4 bvecs: 256 entries (48 bytes)
biovec pool[2]: 16 bvecs: 256 entries (192 bytes)
biovec pool[3]: 64 bvecs: 256 entries (768 bytes)
biovec pool[4]: 128 bvecs: 256 entries (1536 bytes)
biovec pool[5]: 256 bvecs: 256 entries (3072 bytes)
ACPI: Subsystem revision 20030122
tbxface-0117 [03] acpi_load_tables : ACPI Tables successfully acquired
Parsing all Control Methods:............................................................................................................................... Table [DSDT] - 419 Objects with 37 Devices 127 Methods 20 Regions
ACPI Namespace successfully loaded at root c040eb9c
evxfevnt-0092 [04] acpi_enable : Transition to ACPI mode successful
Executing all Device _STA and_INI methods:.....................................
37 Devices found containing: 37 _STA, 1 _INI methods
Completing Region/Field/Buffer/Package initialization:................................................................
Initialized 16/20 Regions 0/0 Fields 29/29 Buffers 19/19 Packages (419 nodes)
ACPI: Interpreter enabled
ACPI: Using PIC for interrupt routing
ACPI: PCI Root Bridge [PCI0] (00:00)
PCI: Probing PCI hardware (bus 00)
ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT]
ACPI: Embedded Controller [EC0] (gpe 11)
ACPI: Power Resource [FDDP] (off)
ACPI: Power Resource [LPTP] (off)
ACPI: Power Resource [URP2] (off)
ACPI: Power Resource [URP1] (off)
pci_link-0249 [07] acpi_pci_link_get_curr: Invalid use of IRQ 0
ACPI: PCI Interrupt Link [LNKB] (IRQs 4 6 7 11 12 14 15, disabled)
pci_link-0249 [07] acpi_pci_link_get_curr: Invalid use of IRQ 0
ACPI: PCI Interrupt Link [LNKC] (IRQs 6 7 10 12 14 15, disabled)
pci_link-0249 [07] acpi_pci_link_get_curr: Invalid use of IRQ 0
ACPI: PCI Interrupt Link [LNKD] (IRQs 11, disabled)
ACPI: Power Resource [FN10] (on)
block request queues:
128 requests per read queue
128 requests per write queue
8 requests per batch
enter congestion at 15
exit congestion at 17
ACPI: PCI Interrupt Link [LNKB] enabled at IRQ 11
ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 10
ACPI: PCI Interrupt Link [LNKD] enabled at IRQ 11
PCI: Using ACPI for IRQ routing
PCI: if you experience problems, try using option 'pci=noacpi' or even 'acpi=off'
NET4: Frame Diverter 0.46
Enabling SEP on CPU 0
aio_setup: sizeof(struct page) = 40
Journalled Block Device driver loaded
devfs: v1.22 (20021013) Richard Gooch ([email protected])
devfs: boot_options: 0x0
Initializing Cryptographic API
ACPI: AC Adapter [AC0] (on-line)
ACPI: Battery Slot [BAT0] (battery present)
ACPI: Lid Switch [LIDD]
ACPI: Sleep Button (CM) [SLPB]
ACPI: Power Button (CM) [PWRB]
ACPI: Fan [FAN1] (off)
ACPI: Processor [CPU1] (supports C1 C2, 8 throttling states)
exfldio-0140 [25] ex_setup_region : Field [TMPS] Base+Offset+Width 4+0+4 is beyond end of region [M4D0] (length 6)
psparse-1121: *** Error: Method execution failed [\_TZ_.THRM._TMP] (Node cbf11148), AE_AML_REGION_LIMIT
Serial: 8250/16550 driver $Revision: 1.90 $ IRQ sharing disabled
tts/0 at I/O 0x3f8 (irq = 4) is a 16550A
tts/1 at I/O 0x2f8 (irq = 3) is a 16550A
--
Initializing IPsec netlink socket
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
IPv6 v0.8 for NET4.0
IPv6 over IPv4 tunneling driver
divert: not allocating divert_blk for non-ethernet device sit0
ACPI: (supports S0 S1 S4 S5)

.config:

# egrep -i 'acpi|susp' /mnt/linux-2.5.63/.config
# Power management options (ACPI, APM)
CONFIG_SOFTWARE_SUSPEND=y
# ACPI Support
CONFIG_ACPI=y
CONFIG_ACPI_BOOT=y
CONFIG_ACPI_SLEEP=y
CONFIG_ACPI_SLEEP_PROC_FS=y
CONFIG_ACPI_AC=y
CONFIG_ACPI_BATTERY=y
CONFIG_ACPI_BUTTON=y
CONFIG_ACPI_FAN=y
CONFIG_ACPI_PROCESSOR=y
CONFIG_ACPI_THERMAL=y
CONFIG_ACPI_TOSHIBA=y
CONFIG_ACPI_DEBUG=y
CONFIG_ACPI_BUS=y
CONFIG_ACPI_INTERPRETER=y
CONFIG_ACPI_EC=y
CONFIG_ACPI_POWER=y
CONFIG_ACPI_PCI=y
CONFIG_ACPI_SYSTEM=y

If you have further questions about my configuration, just let me know.

Regards,

bert

Signature · 3 lines
http://www.PowerDNS.com      Open source, database driven DNS Software 
http://lartc.org           Linux Advanced Routing & Traffic Control HOWTO
http://netherlabs.nl                         Consulting
#5 lore raw

Hi.

This bug is fixed in Linus tree. If you want swsusp to work in the mean time, look for a couple of patches Pavel sent recently.

Regards,

Nigel

#6 lore raw
Quoted 4 lines · Nigel Cunningham

Hi.

This bug is fixed in Linus tree. If you want swsusp to work in the mean time, look for a couple of patches Pavel sent recently.

Ok,

In 2.5.63bk5 I get a BUG on drivers/ide/ide-disk.c:1557:

        BUG_ON (HWGROUP(drive)->handler);

It now says (copied by hand):

	freeing memory: .....................|
(this 'freeing' takes ages, around 30 seconds, while in progress, the disk
 light blinks every once in a while, perhaps each time while a dot is being
printed)
	syncing disks
	suspending devices
	suspending c0418bcc
	suspending devices
	suspending c0418bcc
	suspending: hda ------------------[ cut here

trace back:

device_susp()
drivers_susp()
do_sofware_susp()

Regards,

bert

Signature · 3 lines
http://www.PowerDNS.com      Open source, database driven DNS Software 
http://lartc.org           Linux Advanced Routing & Traffic Control HOWTO
http://netherlabs.nl                         Consulting
#7 lore raw
Quoted 6 lines · bert hubert
Quoted 4 lines · Nigel Cunningham

Hi.

This bug is fixed in Linus tree. If you want swsusp to work in the mean time, look for a couple of patches Pavel sent recently.

Quoted 6 lines

Ok,

In 2.5.63bk5 I get a BUG on drivers/ide/ide-disk.c:1557:

        BUG_ON (HWGROUP(drive)->handler);

Looks like swsuspend attempted to run an operation while one was in progress. IDE tries to catch that because the result of missing it isnt very pretty at fsck time.

A message that is not in the archive (sent off-list or not yet received): 1046643757.3700.20.camel-MMxVpc8zpTQVh3rx8e9g/fyykp6/[email protected]

#9 lore raw
Quoted 9 lines · Alan Cox
Quoted 8 lines · bert hubert
Quoted 4 lines · Nigel Cunningham

Hi.

This bug is fixed in Linus tree. If you want swsusp to work in the mean time, look for a couple of patches Pavel sent recently.

Ok,

Quoted 9 lines
Quoted 4 lines

In 2.5.63bk5 I get a BUG on drivers/ide/ide-disk.c:1557:

        BUG_ON (HWGROUP(drive)->handler);

Looks like swsuspend attempted to run an operation while one was in progress. IDE tries to catch that because the result of missing it isnt very pretty at fsck time.

Forgive me for my misunderstanding (i"m only new to acpi/kernel development), but if the problem is swsuspend running an operation while one is in progress, is there anyway way to pause the suspend process until all operations are done, so that IDE has nothing to catch....?

I have the same problem in 2.6.63 + acpi20030228 when entering S3, except it happens occasionally, not all the time.

Regards,

Chris Bennett

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#10 lore raw
In reply to bert hubert
Quoted 5 lines · bert hubert

In 2.5.63bk5 I get a BUG on drivers/ide/ide-disk.c:1557:

        BUG_ON (HWGROUP(drive)->handler);

That problem has been around for a while. I reported it for 2.5.59 which just happened to be the first 2.5 kernel I tested with swsuspend.

I'm seeing the bug every time I try swsuspend on 2.5. The same Vanilla kernels seem to work for other people, though.

The only thing that came up at the time was a suggestion to replace BUG_ON with while (which I didn't try because I'd like to keep my data).

Roger

#11 lore raw
Quoted 2 lines · Roger Luethi

I'm seeing the bug every time I try swsuspend on 2.5. The same Vanilla kernels seem to work for other people, though.

Yes - I have no problems in this area.

Quoted 2 lines

The only thing that came up at the time was a suggestion to replace BUG_ON with while (which I didn't try because I'd like to keep my data).

I'll see if I can find a solution.

Regards,

Nigel

#12 lore raw
Quoted 4 lines · Nigel Cunningham
Quoted 2 lines

The only thing that came up at the time was a suggestion to replace BUG_ON with while (which I didn't try because I'd like to keep my data).

I'll see if I can find a solution.

A data point may be that at one point, swsusp did work just fine for me. This was around 2.5.53, 2.5.54:

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=20021227142032.GA6945%40outpost.ds9a.nl&rnum=1&prev=/groups%3Fq%3Dswsusp%2Bbert%2Bhubert%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3D20021227142032.GA6945%2540outpost.ds9a.nl%26rnum%3D1

I now use gcc 3.2.2 for compiling though. I've tried suspending a few times with 2.5.63bk5 and I get the BUG every time, so it appears to be deterministic and not racey.

Regards,

bert

Signature · 3 lines
http://www.PowerDNS.com      Open source, database driven DNS Software 
http://lartc.org           Linux Advanced Routing & Traffic Control HOWTO
http://netherlabs.nl                         Consulting
#13 lore raw
Quoted 3 lines · bert hubert

I now use gcc 3.2.2 for compiling though. I've tried suspending a few times with 2.5.63bk5 and I get the BUG every time, so it appears to be deterministic and not racey.

Yep. It's not the compiler, though. I'm using 2.95.3.

Roger

#14 lore raw
In reply to bert hubert

Hi!

Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

The only thing that came up at the time was a suggestion to replace BUG_ON with while (which I didn't try because I'd like to keep my data).

I'll see if I can find a solution.

Quoted 8 lines

A data point may be that at one point, swsusp did work just fine for me. This was around 2.5.53, 2.5.54:

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=20021227142032.GA6945%40outpost.ds9a.nl&rnum=1&prev=/groups%3Fq%3Dswsusp%2Bbert%2Bhubert%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3D20021227142032.GA6945%2540outpost.ds9a.nl%26rnum%3D1

I now use gcc 3.2.2 for compiling though. I've tried suspending a few times with 2.5.63bk5 and I get the BUG every time, so it appears to be deterministic and not racey.

Well, it does not happen on my machines, but I've already seen it happen on computer with two harddrives.

Pavel

Signature · 2 lines
Horseback riding is like software...
...vgf orggre jura vgf serr.
#15 lore raw

[ pruned mr Grover from the CC list ]

Quoted 2 lines · Pavel Machek

Well, it does not happen on my machines, but I've already seen it happen on computer with two harddrives.

This is a laptop with only one. Anything I can do to help, let me know. Alan has suggested that an IDE transaction was still in progress, perhaps a small wait could prove/disprove this assumption?

Regards,

bert

Signature · 3 lines
http://www.PowerDNS.com      Open source, database driven DNS Software 
http://lartc.org           Linux Advanced Routing & Traffic Control HOWTO
http://netherlabs.nl                         Consulting
#16 lore raw

Hi!

Quoted 9 lines

[ pruned mr Grover from the CC list ]

Quoted 2 lines · Pavel Machek

Well, it does not happen on my machines, but I've already seen it happen on computer with two harddrives.

This is a laptop with only one. Anything I can do to help, let me know. Alan has suggested that an IDE transaction was still in progress, perhaps a small wait could prove/disprove this assumption?

Start adding printks to see whats going on. Try going ext2. Try killing sys_sync() from kernel/suspend.c.

Pavel

Signature · 2 lines
Horseback riding is like software...
...vgf orggre jura vgf serr.

A message that is not in the archive (sent off-list or not yet received): 20030303124133.GH20929-jyMamyUUXNJG4ohzP4jBZS1Fcj925eT/@public.gmane.org

#18 lore raw

Hi,

just to add my experience. Maybe it helps. I haven't been able to get swsusp working on any 2.4.x kernel until i did an
hdparm -u1 /dev/hda
now the strange thing: I tried to turn on the frame buffer device and it started chrashing again until i did
hdparm -u0 /dev/hda
Before I tried using suspend in 2.5.x with varying success. Now everything runs like a charm. Without unmask irq's first the kernel dumped
with either a kernel BUG statement or a fault in ide-disk.c

hope it helps, regards

Troels Haugboelle

PS. I am running on fujitsu lifebook P4-M laptop with reiserfs and intel 845 chipset.
I have only one hard disk too.

Quoted 16 lines · Pavel Machek

Hi!

Quoted 9 lines

[ pruned mr Grover from the CC list ]

Quoted 2 lines · Pavel Machek

Well, it does not happen on my machines, but I've already seen it happen on computer with two harddrives.

This is a laptop with only one. Anything I can do to help, let me know. Alan has suggested that an IDE transaction was still in progress, perhaps a small wait could prove/disprove this assumption?

Start adding printks to see whats going on. Try going ext2. Try killing sys_sync() from kernel/suspend.c.

Pavel

#19 lore raw

[removed ACPI mailing list from cc:]

Quoted 10 lines · Troels Haugboelle

just to add my experience. Maybe it helps. I haven't been able to get swsusp working on any 2.4.x kernel until i did an
hdparm -u1 /dev/hda
now the strange thing: I tried to turn on the frame buffer device and it started chrashing again until i did
hdparm -u0 /dev/hda
Before I tried using suspend in 2.5.x with varying success. Now everything runs like a charm. Without unmask irq's first the kernel dumped
with either a kernel BUG statement or a fault in ide-disk.c

Not sure I follow all of your story but I can confirm that hdparm -u1 successfully gets me to the kernel panic due to highmem support still lacking -- i.e. way beyond the BUG_ON() I've been hitting. So it looks like you found a good work-around.

FWIW I'm using reiserfs, too. Two harddisks, ALi chipset.

Roger

#20 lore raw
Quoted 4 lines · Roger Luethi

Not sure I follow all of your story but I can confirm that hdparm -u1 successfully gets me to the kernel panic due to highmem support still lacking -- i.e. way beyond the BUG_ON() I've been hitting. So it looks like you found a good work-around.

You were hitting the BUG_ON before swsusp was even trying to write the image?!! That is interesting! Since count_and_copy is first called post driver suspend in the current version, perhaps they are somehow related. (This is before swsusp tries to write any of the image to disk).

Regards,

Nigel

#21 lore raw
Quoted 10 lines · Nigel Cunningham
Quoted 4 lines · Roger Luethi

Not sure I follow all of your story but I can confirm that hdparm -u1 successfully gets me to the kernel panic due to highmem support still lacking -- i.e. way beyond the BUG_ON() I've been hitting. So it looks like you found a good work-around.

You were hitting the BUG_ON before swsusp was even trying to write the image?!! That is interesting! Since count_and_copy is first called post driver suspend in the current version, perhaps they are somehow related. (This is before swsusp tries to write any of the image to disk).

Huh? After a glance at the code I agree that drivers_suspend happens before count_and_copy_data_pages, but that means hitting the BUG_ON in idedisk_suspend before the panic in count_and_copy_data_pages is what I'd expect. How is that remarkable? ... My current kernel has HIGHMEM enabled, but previous ones that failed the same way didn't.

Anyway, a few more tests showed that hdparm -u1 helps if I have lots of memory used (say for fs caches). In two out of two tests, I saw Pavel's request to send him 1 GB RAM via email.

Suspending directly from a clean boot (after issuing the same hdparm -u1 commands for both disks) I hit the BUG_ON in idedisk_suspend (two out of two tests, too).

Roger

#22 lore raw
Quoted 11 lines · Roger Luethi
Quoted 4 lines · Nigel Cunningham

You were hitting the BUG_ON before swsusp was even trying to write the image?!! That is interesting! Since count_and_copy is first called post driver suspend in the current version, perhaps they are somehow related. (This is before swsusp tries to write any of the image to disk).

Huh? After a glance at the code I agree that drivers_suspend happens before count_and_copy_data_pages, but that means hitting the BUG_ON in idedisk_suspend before the panic in count_and_copy_data_pages is what I'd expect. How is that remarkable? ... My current kernel has HIGHMEM enabled, but previous ones that failed the same way didn't.

I was surprised because I thought you were getting the BUG_ON during writing the image. Now I see that it's well beforehand.

Quoted 3 lines

Anyway, a few more tests showed that hdparm -u1 helps if I have lots of memory used (say for fs caches). In two out of two tests, I saw Pavel's request to send him 1 GB RAM via email.

On this topic, would you be willing to test a 2.4 version that supported highmem? I haven't written support yet, but hope to do it shortly. (I don't have that much ram myself so you can send me 1GB if you prefer :>).

Quoted 3 lines

Suspending directly from a clean boot (after issuing the same hdparm -u1 commands for both disks) I hit the BUG_ON in idedisk_suspend (two out of two tests, too).

Hmmm.. strange.

Regards,

Nigel

#23 lore raw
Quoted 4 lines · Nigel Cunningham

On this topic, would you be willing to test a 2.4 version that supported highmem? I haven't written support yet, but hope to do it shortly. (I don't have that much ram myself so you can send me 1GB if you prefer :>).

If I did so, I wouldn't have enough memory left to boot my workstation <g>. But when you have a patch highmem support, I can dig out some 2.4 kernel and give it a try.

Roger

#24 lore raw
In reply to Nigel Cunningham
Quoted 3 lines · Nigel Cunningham

You were hitting the BUG_ON before swsusp was even trying to write the image?!! That is interesting! Since count_and_copy is first called post driver suspend in the current version, perhaps they are somehow related.

Sure, I get this too:

It now says (copied by hand):

         freeing memory: .....................|

(this 'freeing' takes ages, around 30 seconds, while in progress, the disk
light blinks every once in a while, perhaps each time while a dot is being
printed)
syncing disks
suspending devices
suspending device c0418bcc
suspending devices
suspending device c0418bcc
suspending: hda ------------------[ cut here
trace back:

device_susp()
drivers_susp()
do_software_susp()

This happens, I think, from here in kernel/suspend.c:

/* Called from process context */
static int drivers_suspend(void)

{
        device_suspend(4, SUSPEND_NOTIFY);
	device_suspend(4, SUSPEND_SAVE_STATE);
        device_suspend(4, SUSPEND_DISABLE);
	...

I think the problem occurs on the second call, SUSPEND_SAVE_STATE:

static int idedisk_suspend(struct device *dev, u32 state, u32 level)

{
        ide_drive_t *drive = dev->driver_data;

        printk("Suspending device %p\n", dev->driver_data);

        /* I hope that every freeze operation from the upper levels have
         * already been done...
         */

        if (level != SUSPEND_SAVE_STATE)
                return 0;

        /* set the drive to standby */
        printk(KERN_INFO "suspending: %s ", drive->name);
        do_idedisk_standby(drive);
        drive->blocked = 1;

        BUG_ON (HWGROUP(drive)->handler);  // <----- this BUGs
        return 0;
}

Regards,

bert

Signature · 3 lines
http://www.PowerDNS.com      Open source, database driven DNS Software 
http://lartc.org           Linux Advanced Routing & Traffic Control HOWTO
http://netherlabs.nl                         Consulting
#25 lore raw
In reply to Pavel Machek
Quoted 2 lines · Pavel Machek

Start adding printks to see whats going on. Try going ext2. Try killing sys_sync() from kernel/suspend.c.

I've tried:
hdparm -u1 /dev/hda
killing sys_sync()
doing both

To no avail. I'm investigating how I can go ext2 on this machine as I read elsewhere that the kernel will silently mount an ext3 partition with a journal as ext3 even when asked to mount as ext2.

Regards,

bert

Signature · 3 lines
http://www.PowerDNS.com      Open source, database driven DNS Software 
http://lartc.org           Linux Advanced Routing & Traffic Control HOWTO
http://netherlabs.nl                         Consulting
#26 lore raw
Quoted 3 lines · bert hubert

To no avail. I'm investigating how I can go ext2 on this machine as I read elsewhere that the kernel will silently mount an ext3 partition with a journal as ext3 even when asked to mount as ext2.

hdparm -u1 is just changing the timing its not actually touching the bug in the suspend code.

#27 lore raw
In reply to Pavel Machek
Quoted 6 lines
Quoted 6 lines

[ pruned mr Grover from the CC list ]

Quoted 2 lines · Pavel Machek

Well, it does not happen on my machines, but I've already seen it happen on computer with two harddrives.

Quoted 8 lines
Quoted 3 lines

This is a laptop with only one. Anything I can do to help, let me know. Alan has suggested that an IDE transaction was still in progress, perhaps a small wait could prove/disprove this assumption?

Start adding printks to see whats going on. Try going ext2. Try killing sys_sync() from kernel/suspend.c.

Pavel

This looks like the problem I've been reporting since 2.5.5x . On my machine (HP XE3GC) I get a rare chance that this happens.
One raw hack I have been using to get around that, is my 'sleep' script (for S1):
/etc/init.d/ypbind stop #i.e. prepare the system
sleep 9 #allow me to lock the screen etc.

sync #This is where I reduce the chance I have dirty buffers
sleep 1 # calm down
echo 1 >/proc/acpi/sleep #sleep now

That won't fix the bug, of course, but shows what may go wrong..

#28 lore raw
In reply to Pavel Machek
Quoted 2 lines · Pavel Machek

Start adding printks to see whats going on. Try going ext2. Try killing sys_sync() from kernel/suspend.c.

Problem remains with ext2 and with all fs 'emergency mounted r/o' with alt-sysrq beforehand.

This mostly ends my ability to debug this problem further as I lack the knowledge to figure out what is going on within the IDE code.

Regards,

bert

Signature · 3 lines
http://www.PowerDNS.com      Open source, database driven DNS Software 
http://lartc.org           Linux Advanced Routing & Traffic Control HOWTO
http://netherlabs.nl                         Consulting
#29 lore raw
In reply to bert hubert
Quoted 3 lines · bert hubert

This is a laptop with only one. Anything I can do to help, let me know. Alan has suggested that an IDE transaction was still in progress, perhaps a small wait could prove/disprove this assumption?

Two drives would make some sense as an easier trigger. An IDE command can only be outstanding per interface not per device.

#30 lore raw
In reply to Pavel Machek
Quoted 2 lines · Pavel Machek

Well, it does not happen on my machines, but I've already seen it happen on computer with two harddrives.

That was my initial suspicion, since I have two of them and typical swsusp (Laptop) users tend not to have more than one. But I gave up on that theory when Bert's log showed only one disk:

#        syncing disks
#        suspending devices
#        suspending c0418bcc
#        suspending devices
#        suspending c0418bcc
#        suspending: hda ------------------[ cut here

If he had two disks, his trace should look more like mine:

# Syncing disks before copy
# Suspending devices
# Suspending device c0390e4c
# Suspending device c03911a4
# Suspending devices
# Suspending device c0390e4c
# suspending: had ------------[ cut here ]------------

# kernel BUG at drivers/ide/ide-disk.c:1557!

Roger

#31 lore raw
In reply to Roger Luethi
Quoted 2 lines · Roger Luethi

The only thing that came up at the time was a suggestion to replace BUG_ON with while (which I didn't try because I'd like to keep my data).

That isnt far off what you want. IDE has proper command queuing functionality and providing you are suspending in a sleeping context you can do what you are trying to do through the IDE layer politely. Take a look at how the various ide taskfile ioctls issue commands.

#32 lore raw
Quoted 9 lines · Alan Cox
Quoted 2 lines · Roger Luethi

The only thing that came up at the time was a suggestion to replace BUG_ON with while (which I didn't try because I'd like to keep my data).

That isnt far off what you want. IDE has proper command queuing functionality and providing you are suspending in a sleeping context you can do what you are trying to do through the IDE layer politely. Take a look at how the various ide taskfile ioctls issue commands.

the problem is that the suspend/resume code bypass the this kind of stuff imho.

Signature · 4 lines
Ducrot Bruno

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.