acpi-20040715: functional regression on ASUS M2N
Hi all. Some thoughts on this:
The ELCR save/restore patch is causing regressions for some people. What if the problem is that we're saving/restoring registers at the wrong time?
For example, on the Intel PIIX, the PIC is a child of PCI device 31:function 0. What if this PCI device is disabled at the time we decide to save ELCR? If the I/O space is not mapped, we would probably read 0xff in this case, I think, and I think that would set everything to level. What could be disabling it?
Georg, can you add some printk's to save_ELCR and log the values that we are actually saving?
Nathan
-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one more big change to announce. We are now OSTG- Open Source Technology Group. Come see the changes on the new OSTG site. www.ostg.com
A message that is not in the archive (sent off-list or not yet received): [email protected]
|| On Thu, 05 Aug 2004 14:49:48 -0400 || Nathan Bryant <[email protected]> wrote:
nb> Georg, can you add some printk's to save_ELCR and log the values nb> that we are actually saving?
I'll be glad to do that, but will have to see how to do it in a way that I actually see what is printed. Haven't done much kernel hacking really, is there "the right way" to do it?
Regards,
Georg
Signature · 3 lines
Georg C. F. Greve <greve-mXXj517/[email protected]> Free Software Foundation Europe (http://fsfeurope.org) Brave GNU World (http://brave-gnu-world.org)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines · Georg C. F. Greve
nb> Georg, can you add some printk's to
save_ELCRand log the values nb> that we are actually saving?I'll be glad to do that, but will have to see how to do it in a way that I actually see what is printed. Haven't done much kernel hacking really, is there "the right way" to do it?
The attached patch is good enough. Since the call to restore_ELCR is crashing you, we comment it out, and log the raw values from save_ELCR:
By the way, can you send the output of lspci?
===== arch/i386/kernel/i8259.c 1.35 vs edited =====
arch/i386/kernel/i8259.c +8 -6
@@ -244,21 +244,23 @@*/ static void restore_ELCR (char *trigger) { -outb (trigger[0 ],0x4d0 ); -outb (trigger[1 ],0x4d1 ); +/* IRQ 0,1,2,8,13 are marked as reserved */ +outb (trigger[0 ] &0xF8 ,0x4d0 ); +outb (trigger[1 ] &0xDE ,0x4d1 ); }static void save_ELCR (char *trigger) { -/* IRQ 0,1,2,8,13 are marked as reserved */ - trigger[0 ] =inb (0x4d0 ) &0xF8 ; - trigger[1 ] =inb (0x4d1 ) &0xDE ; + trigger[0 ] =inb (0x4d0 ); + trigger[1 ] =inb (0x4d1 ); +printk (KERN_DEBUG "i8259: saving ELCR: 0x%02x 0x%02x\n" , + trigger[0 ], trigger[1 ]); }static int i8259A_resume (struct sys_device *dev) {init_8259A (0 ); -restore_ELCR (irq_trigger); +/*restore_ELCR(irq_trigger);*/ return 0 ; }
A message that is not in the archive (sent off-list or not yet received): [email protected]
|| On Fri, 06 Aug 2004 09:36:04 -0400 || Nathan Bryant <[email protected]> wrote:
nb> The attached patch is good enough. Since the call to restore_ELCR nb> is crashing you, we comment it out, and log the raw values from nb> save_ELCR:
Thanks.
Okay, took same 2.6.7, applied patches.
Here is what it said for my machine during resume from suspend to ram:
i8259: saving ELCR: 0xfffffff0 0x0a
nb> By the way, can you send the output of lspci?
Sure, here it is:
If you want to know more about my machine, you can also check out
http://bugzilla.kernel.org/show_bug.cgi?id=1774
which is where I also gave some more info.
If I can help you with anything else, please let me know.
Regards,
Georg
Signature · 3 lines
Georg C. F. Greve <greve-mXXj517/[email protected]> Free Software Foundation Europe (http://fsfeurope.org) Brave GNU World (http://brave-gnu-world.org)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 3 lines · Georg C. F. Greve
Here is what it said for my machine during resume from suspend to ram:
i8259: saving ELCR:
0xfffffff00x0a
Interesting. That translates into the following IRQ's set to level trigger:
4
5
6 (!) floppy controller?
7
9
11
But I don't think there's anything wrong with that. It does seem that Matthew Garrett's message holds the key:
Quoted 22 lines · He
Quoted 1 line · Nathan Bryant
Quoted 1 line
The ELCR save/restore patch is causing regressions for some people. What if the problem is that we're saving/restoring registers at the wrong time?
On closer investigation, I found that the system was restoring my ioapic state /after/ it had started the programmable interrupt timer back up. Changing line 310 of
drivers/base/sys.ctolist_for_each_entry_reverseseems to have greatly improved my ability to suspend and resume (which worked fine before the interrupt controller suspend/resume patches, except that I didn't get many interrupts...)There doesn't seem to be any fine-grained way to control the order of suspend/resume for individual drivers. It seems to be assumed that everything that devices depend on will be higher than them in the tree, and so everything will "just work" - I'm not sure this is true. As another example, I just had my wireless card fail to resume correctly. It tried to do a hotplug firmware load on resume. Which was difficult, because it was resumed before the IDE interface was. How can this sort of thing be avoided?
Quoted 1 line
-- Matthew Garrett | [email protected]
-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one more big change to announce. We are now OSTG- Open Source Technology Group. Come see the changes on the new OSTG site. www.ostg.com
A message that is not in the archive (sent off-list or not yet received): [email protected]
|| On Fri, 06 Aug 2004 13:07:33 -0400 || Nathan Bryant <[email protected]> wrote:
Quoted 2 lines
Quoted 2 lines
Here is what it said for my machine during resume from suspend to
ram: i8259: saving ELCR:0xfffffff00x0a
nb> Interesting. That translates into the following IRQ's set to level trigger:
nb> 4
nb> 5
nb> 6 (!) floppy controller?
nb> 7
nb> 9
nb> 11
Actually, this laptop has no floppy. In case it helps:
CPU0
0: 13849154 XT-PIC timer 1: 595 XT-PIC i8042 2: 0 XT-PIC cascade 4: 0 XT-PIC ehci_hcd 5: 0 XT-PIC uhci_hcd 6: 0 XT-PIC Intel 82801DB-ICH4, yenta 7: 146446 XT-PIC uhci_hcd, yenta, eth1 8: 4 XT-PIC rtc 9: 155025 XT-PIC acpi 11: 1019 XT-PIC uhci_hcd, ohci1394, eth0 12: 8438 XT-PIC i8042 14: 44918 XT-PIC ide0 15: 219 XT-PIC ide1 NMI: 0 LOC: 2095462 ERR: 0 MIS: 0
nb> But I don't think there's anything wrong with that. It does seem nb> that Matthew Garrett's message holds the key:
nb> [...]
So should I try to change line 310 of drivers/base/sys.c to list_for_each_entry_reverse and try again?
Will this be useful to anyone to resolve things?
Regards,
Georg
Signature · 3 lines
Georg C. F. Greve <greve-mXXj517/[email protected]> Free Software Foundation Europe (http://fsfeurope.org) Brave GNU World (http://brave-gnu-world.org)
Hi all,
I thought you might like to know that I've just managed to build a kernel that allows me to suspend to ram again -- and in fact better than before in so far as the network cards work correctly after resume. Unfortunately this only works once. So there is progress on the problem, even though it is not fully solved yet.
The kernel is a 2.6.9-rc1 with the following patches applied in this order:
acpi-20040816-26-latest-release.diff.bz2
alsa-bk-2004-08-26.patch.gz
software-suspend-2.0.0.105-for-2.6.8.1.tar.bz2
(Note: the software suspend 2 has one reject that is apparently
relatively easy to fix, however software suspend 2 does not work anymore on this kernel. On suspend it does not switch to the suspend screen, although the machine appears to be suspending successfully, but on resume the machine hangs when "Copying original kernel back")
Please note that the ALSA patch is absolutely necessary for this to work, when I left it out, the resume from suspend to ram hung. Only with the patch applied it resumes properly and I see the messages for irq 6 and irq 11 having been disabled during the suspend phase.
In the syslog it shows that something still appears to be fishy, however:
kernel: Back to C!
kernel: irq 6: nobody cared!
kernel: [__report_bad_irq+42/139] __report_bad_irq+0x2a/0x8b kernel: [note_interrupt+111/159] note_interrupt+0x6f/0x9f kernel: [do_IRQ+295/310] do_IRQ+0x127/0x136 kernel: [common_interrupt+24/32] common_interrupt+0x18/0x20 kernel: [handle_IRQ_event+36/100] handle_IRQ_event+0x24/0x64 kernel: [do_IRQ+148/310] do_IRQ+0x94/0x136 kernel: [common_interrupt+24/32] common_interrupt+0x18/0x20 kernel: [handle_IRQ_event+36/100] handle_IRQ_event+0x24/0x64 kernel: [do_IRQ+148/310] do_IRQ+0x94/0x136 kernel: [common_interrupt+24/32] common_interrupt+0x18/0x20 kernel: [__do_softirq+47/135] __do_softirq+0x2f/0x87 kernel: [do_softirq+38/40] do_softirq+0x26/0x28 kernel: [do_IRQ+259/310] do_IRQ+0x103/0x136 kernel: [time_resume+0/74] time_resume+0x0/0x4a kernel: [common_interrupt+24/32] common_interrupt+0x18/0x20 kernel: [time_resume+0/74] time_resume+0x0/0x4a kernel: [time_resume+66/74] time_resume+0x42/0x4a kernel: [sysdev_resume+225/230] sysdev_resume+0xe1/0xe6 kernel: [device_power_up+5/10] device_power_up+0x5/0xa kernel: [suspend_enter+54/74] suspend_enter+0x36/0x4a kernel: [enter_state+105/161] enter_state+0x69/0xa1 kernel: [acpi_suspend+62/77] acpi_suspend+0x3e/0x4d kernel: [acpi_system_write_sleep+96/139] acpi_system_write_sleep+0x60/0x8b kernel: [acpi_system_write_sleep+117/139] acpi_system_write_sleep+0x75/0x8b kernel: [acpi_system_write_sleep+0/139] acpi_system_write_sleep+0x0/0x8b kernel: [vfs_write+176/281] vfs_write+0xb0/0x119 kernel: [sys_write+81/128] sys_write+0x51/0x80 kernel: [syscall_call+7/11] syscall_call+0x7/0xb kernel: handlers: kernel: [snd_intel8x0_interrupt+0/542] (snd_intel8x0_interrupt+0x0/0x21e) kernel: Disabling IRQ #6 kernel: irq 11: nobody cared! kernel: [__report_bad_irq+42/139] __report_bad_irq+0x2a/0x8b kernel: [note_interrupt+111/159] note_interrupt+0x6f/0x9f kernel: [do_IRQ+295/310] do_IRQ+0x127/0x136 kernel: [common_interrupt+24/32] common_interrupt+0x18/0x20 kernel: [handle_IRQ_event+36/100] handle_IRQ_event+0x24/0x64 kernel: [do_IRQ+148/310] do_IRQ+0x94/0x136 kernel: [common_interrupt+24/32] common_interrupt+0x18/0x20 kernel: [__do_softirq+47/135] __do_softirq+0x2f/0x87 kernel: [do_softirq+38/40] do_softirq+0x26/0x28 kernel: [do_IRQ+259/310] do_IRQ+0x103/0x136 kernel: [time_resume+0/74] time_resume+0x0/0x4a kernel: [common_interrupt+24/32] common_interrupt+0x18/0x20 kernel: [time_resume+0/74] time_resume+0x0/0x4a kernel: [time_resume+66/74] time_resume+0x42/0x4a kernel: [sysdev_resume+225/230] sysdev_resume+0xe1/0xe6 kernel: [device_power_up+5/10] device_power_up+0x5/0xa kernel: [suspend_enter+54/74] suspend_enter+0x36/0x4a kernel: [enter_state+105/161] enter_state+0x69/0xa1 kernel: [acpi_suspend+62/77] acpi_suspend+0x3e/0x4d kernel: [acpi_system_write_sleep+96/139] acpi_system_write_sleep+0x60/0x8b kernel: [acpi_system_write_sleep+117/139] acpi_system_write_sleep+0x75/0x8b kernel: [acpi_system_write_sleep+0/139] acpi_system_write_sleep+0x0/0x8b kernel: [vfs_write+176/281] vfs_write+0xb0/0x119 kernel: [sys_write+81/128] sys_write+0x51/0x80 kernel: [syscall_call+7/11] syscall_call+0x7/0xb
kernel: handlers:
kernel: [pg0+536303635/1068441600] (ohci_irq_handler+0x0/0x80e [ohci1394])
kernel: Disabling IRQ #11
kernel: PM: Finishing up.
[...]
kernel: ACPI: PCI interrupt 0000:00:1d.0[A] -> GSI 11 (level, low) -> IRQ 11
kernel: PCI: Setting latency timer of device 0000:00:1d.0 to 64
kernel: ACPI: PCI interrupt 0000:00:1d.1[B] -> GSI 5 (level, low) -> IRQ 5
kernel: PCI: Setting latency timer of device 0000:00:1d.1 to 64
kernel: ACPI: PCI interrupt 0000:00:1d.2[C] -> GSI 7 (level, low) -> IRQ 7
kernel: PCI: Setting latency timer of device 0000:00:1d.2 to 64
kernel: ACPI: PCI interrupt 0000:00:1d.7[D] -> GSI 4 (level, low) -> IRQ 4
kernel: PCI: Setting latency timer of device 0000:00:1d.7 to 64
kernel: ACPI: PCI interrupt 0000:00:1f.1[A] -> GSI 7 (level, low) -> IRQ 7
kernel: ACPI: PCI interrupt 0000:00:1f.5[B] -> GSI 6 (level, low) -> IRQ 6
kernel: PCI: Setting latency timer of device 0000:00:1f.5 to 64
kernel: ACPI: PCI interrupt 0000:01:03.0[A] -> GSI 6 (level, low) -> IRQ 6
kernel: ACPI: PCI interrupt 0000:01:03.1[B] -> GSI 7 (level, low) -> IRQ 7
kernel: ACPI: PCI interrupt 0000:01:03.2[C] -> GSI 11 (level, low) -> IRQ 11 [...]
kernel: ACPI: PCI interrupt 0000:01:03.0[A] -> GSI 6 (level, low) -> IRQ 6
kernel: Yenta: CardBus bridge found at 0000:01:03.0 [1043:1754]
kernel: yenta 0000:01:03.0: Preassigned resource 1 busy, reconfiguring...
kernel: yenta 0000:01:03.0: Preassigned resource 2 busy, reconfiguring...
kernel: yenta 0000:01:03.0: Preassigned resource 3 busy, reconfiguring...
kernel: Yenta: ISA IRQ mask 0x0000, PCI irq 6
kernel: Socket status: 30000006
kernel: ACPI: PCI interrupt 0000:01:03.1[B] -> GSI 7 (level, low) -> IRQ 7
kernel: Yenta: CardBus bridge found at 0000:01:03.1 [1043:1754]
kernel: yenta 0000:01:03.1: Preassigned resource 0 busy, reconfiguring...
kernel: yenta 0000:01:03.1: Preassigned resource 1 busy, reconfiguring...
kernel: yenta 0000:01:03.1: Preassigned resource 2 busy, reconfiguring...
kernel: yenta 0000:01:03.1: Preassigned resource 3 busy, reconfiguring...
kernel: Yenta: ISA IRQ mask 0x0000, PCI irq 7
[...]
kernel: ehci_hcd 0000:00:1d.7: Intel Corp. 82801DB/DBM (ICH4/ICH4-M) USB 2.0 EHCI Controller
kernel: PCI: Setting latency timer of device 0000:00:1d.7 to 64
kernel: ehci_hcd 0000:00:1d.7: irq 4, pci mem e0434c00
kernel: ehci_hcd 0000:00:1d.7: new USB bus registered, assigned bus number 4
kernel: PCI: cache line size of 32 is not supported by device 0000:00:1d.7
kernel: ehci_hcd 0000:00:1d.7: USB 2.0 enabled, EHCI 1.00, driver 2004-May-10
kernel: hub 4-0:1.0: USB hub found
kernel: hub 4-0:1.0: 6 ports detected
pci.agent[4271]: ehci-hcd: loaded successfully
[...]
kernel: usb 1-1: control timeout on ep0out
kernel: uhci_hcd 0000:00:1d.0: Unlink after no-IRQ? Different ACPI or APIC settings may help.
The second attempt at suspending gives
kernel: ehci_hcd 0000:00:1d.7: remove, state 1
upon stopping the hotplug services. The system does not resume but keeps running, apparently remaining functional.
If more info is helpful, let me know.
Regards,
Georg
Signature · 10 lines
Georg C. F. Greve <greve-mXXj517/[email protected]> Free Software Foundation Europe (http://fsfeurope.org) Brave GNU World (http://brave-gnu-world.org) ------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
Quoted 2 lines · Nathan Bryant
The ELCR save/restore patch is causing regressions for some people. What if the problem is that we're saving/restoring registers at the wrong time?
On closer investigation, I found that the system was restoring my ioapic state /after/ it had started the programmable interrupt timer back up. Changing line 310 of drivers/base/sys.c to list_for_each_entry_reverse seems to have greatly improved my ability to suspend and resume (which worked fine before the interrupt controller suspend/resume patches, except that I didn't get many interrupts...)
There doesn't seem to be any fine-grained way to control the order of suspend/resume for individual drivers. It seems to be assumed that everything that devices depend on will be higher than them in the tree, and so everything will "just work" - I'm not sure this is true. As another example, I just had my wireless card fail to resume correctly. It tried to do a hotplug firmware load on resume. Which was difficult, because it was resumed before the IDE interface was. How can this sort of thing be avoided?
Signature · 9 lines
Matthew Garrett | [email protected] ------------------------------------------------------- This SF.Net email is sponsored by OSTG. Have you noticed the changes on Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one more big change to announce. We are now OSTG- Open Source Technology Group. Come see the changes on the new OSTG site. www.ostg.com
Quoted 13 lines · Matthew Garrett
Quoted 1 line · Nathan Bryant
The ELCR save/restore patch is causing regressions for some people. What if the problem is that we're saving/restoring registers at the wrong time?
On closer investigation, I found that the system was restoring my ioapic state /after/ it had started the programmable interrupt timer back up. Changing line 310 of
drivers/base/sys.ctolist_for_each_entry_reverseseems to have greatly improved my ability to suspend and resume (which worked fine before the interrupt controller suspend/resume patches, except that I didn't get many interrupts...)
Quoted 4 lines
There doesn't seem to be any fine-grained way to control the order of suspend/resume for individual drivers. It seems to be assumed that everything that devices depend on will be higher than them in the tree, and so everything will "just work" - I'm not sure this is true. As
Oh, of course it isn't true. Everyone's just keeping their fingers crossed and hoping to avoid moving resume logic into complex special cases. But we might have to go there regardless...
In this case, it may make sense to consolidate all interrupt-controller-related suspend/resume into a single logical sys device so that we'll be sure to get the order right within that module.
Been thinking about this lately. There is some evidence that we may eventually need resume drivers for southbridge components. For example, my ACPI BIOS doesn't restore the ICH2 LPC bridge's SW_IRQ_GEN register on resume, which leads to some benign debug messages that might be concerning to some people who didn't know what the real problem is... this register is responsible for masking out IRQ1 and/or IRQ12 in legacy-free systems.
But if these southbridge components get their callbacks as a pci_driver, they might run AFTER various sys devices that are more accurately considered children of the south bridge: for example the PIC and the irq router.
Quoted 5 lines
another example, I just had my wireless card fail to resume correctly. It tried to do a hotplug firmware load on resume. Which was difficult, because it was resumed before the IDE interface was. How can this sort of thing be avoided?
That's a little more "interesting"...two possibilities
1) find a more generic mechanism to handle these special-case dependencies ;) Maybe let drivers register themselves as depending on other component classes, and then do a topological sort...
2) move everything that this driver needs to hotplug itself into kernel space
-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one more big change to announce. We are now OSTG- Open Source Technology Group. Come see the changes on the new OSTG site. www.ostg.com
Quoted 11 lines · Matthew Garrett
Quoted 1 line · Nathan Bryant
The ELCR save/restore patch is causing regressions for some people. What if the problem is that we're saving/restoring registers at the wrong time?
On closer investigation, I found that the system was restoring my ioapic state /after/ it had started the programmable interrupt timer back up. Changing line 310 of
drivers/base/sys.ctolist_for_each_entry_reverseseems to have greatly improved my ability to suspend and resume (which worked fine before the interrupt controller suspend/resume patches, except that I didn't get many interrupts...)
Quoted 8 lines
There doesn't seem to be any fine-grained way to control the order of suspend/resume for individual drivers. It seems to be assumed that everything that devices depend on will be higher than them in the tree, and so everything will "just work" - I'm not sure this is true. As another example, I just had my wireless card fail to resume correctly. It tried to do a hotplug firmware load on resume. Which was difficult, because it was resumed before the IDE interface was. How can this sort of thing be avoided?
With a real device framework. We (FreeBSD) propagate suspend requests throough our generic device structure. Each parent and child has a method which can be overridden. This starts at the root and is propagated downward.
For instance, the PCI driver has methods that save/restore BARs:
DEVMETHOD(device_suspend, pci_suspend),
DEVMETHOD(device_resume, pci_resume),
The suspend function does its work and then calls bus_generic_suspend() which propagates the request down to the children. Or if it knows that it needs to run after all children have suspended, it calls bus_generic_suspend() first, then does its work.
/**
* @brief Helper function for implementing DEVICE_SUSPEND() *
* This function can be used to help implement the DEVICE_SUSPEND()
* for a bus. It calls DEVICE_SUSPEND() for each of the device's
* children. If any call to DEVICE_SUSPEND() fails, the suspend
* operation is aborted and any devices which were suspended are
* resumed immediately by calling their DEVICE_RESUME() methods. */
intbus_generic_suspend(device_t dev)
{
int error;
device_t child, child2;
TAILQ_FOREACH(child, &dev->children, link) {
error = DEVICE_SUSPEND(child);
if (error) {
for (child2 = TAILQ_FIRST(&dev->children);
child2 && child2 != child;
child2 = TAILQ_NEXT(child2, link))
DEVICE_RESUME(child2);
return (error);
}
}
return (0);
}The key helpful thing is that each driver can specify its own methods through its device object but they can be called in a generic way. For instance, if the root bus does "device_suspend(pci_dev)", then the actual function call expanded at run time is "pci_suspend(pci_dev)"
-Nate
-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one more big change to announce. We are now OSTG- Open Source Technology Group. Come see the changes on the new OSTG site. www.ostg.com
Quoted 6 lines · Matthew Garrett
As
another example, I just had my wireless card fail to resume correctly. It tried to do a hotplug firmware load on resume. Which was difficult, because it was resumed before the IDE interface was. How can this sort of thing be avoided?
Notwithstanding all the overly grandiose crap I posted earlier (Honestly, I wasn't smoking anything) even on APM systems this sort of thing was typically handled by downing the network interfaces from userspace scripts before suspending.
-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one more big change to announce. We are now OSTG- Open Source Technology Group. Come see the changes on the new OSTG site. www.ostg.com