Re: 2.4.29, e100 and a WOL packet causes keventd going mad

Started by David Härdeman on Jan 30, 2005 · 10 messages from 5 authors · Last reply Jan 31, 2005

open the first message on its own page

Message details and related content
Hi,

I experience the same problems as reported by Michael Gernoth when sending a WOL-packet to computer with a e100 NIC which is already powered on.

In my case, it's running kernel 2.6.8.1 and the NIC is identified by lspci as:
0000:02:08.0 Ethernet controller: Intel Corp. 82562EZ 10/100 Ethernet Controller (rev 02)
or numerically:
0000:02:08.0 0200: 8086:1050 (rev 02)

The symptoms is that kacpid starts using all the CPU time it can, a shutdown takes 5 - 10 minutes after I've done this (in contrast to 20 - 30 seconds when the machine is healthy).

Also, if I do a "shutdown -h" on the machine after sending a WOL packet when it's already powered up, it will shutdown and immediately start up again instead of powering off.

So, any suggestions on how to fix it?

Regards,
David

Please CC me on any replies.
Message details and related content
On Sun, 2005-01-30 at 09:18, David Härdeman wrote:
I experience the same problems as reported by Michael Gernoth when 
sending a WOL-packet to computer with a e100 NIC which is already 
powered on.
I didn't look at the 2.4 case, but for 2.6, it seems e100 was enabling
PME wakeup during probe.  PME shouldn't be enabled while the system is
up.  I suspect the assertion of PME while the system is up is what's
causing problems.  This patch moves PME wakeup enabling to either
suspend or shutdown.

David, would you give this patch a try?  Make sure the system still
wakes from a magic packet if suspended or shut down, and doesn't cause
kacpid to go crazy if system is running.  If it helps for 2.6, perhaps
someone can look into 2.4 to see if there is something similar going on
there.

-scott
--- linux-2.6.11-rc2/drivers/net/e100.c.orig	2005-01-30 19:13:56.850497376 -0800
+++ linux-2.6.11-rc2/drivers/net/e100.c	2005-01-30 19:26:41.154305536 -0800
@@ -1868,7 +1868,6 @@ static int e100_set_wol(struct net_devic
 	else
 		nic->flags &= ~wol_magic;
 
-	pci_enable_wake(nic->pdev, 0, nic->flags & (wol_magic | e100_asf(nic)));
 	e100_exec_cb(nic, NULL, e100_configure);
 
 	return 0;
@@ -2262,8 +2261,6 @@ static int __devinit e100_probe(struct p
 	   (nic->eeprom[eeprom_id] & eeprom_id_wol))
 		nic->flags |= wol_magic;
 
-	pci_enable_wake(pdev, 0, nic->flags & (wol_magic | e100_asf(nic)));
-
 	strcpy(netdev->name, "eth%d");
 	if((err = register_netdev(netdev))) {
 		DPRINTK(PROBE, ERR, "Cannot register net device, aborting.\n");
@@ -2344,6 +2341,15 @@ static int e100_resume(struct pci_dev *p
 }
 #endif
 
+static void e100_shutdown(struct device *dev)
+{
+	struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
+	struct net_device *netdev = pci_get_drvdata(pdev);
+	struct nic *nic = netdev_priv(netdev);
+
+	pci_enable_wake(pdev, 0, nic->flags & (wol_magic | e100_asf(nic)));
+}
+
 static struct pci_driver e100_driver = {
 	.name =         DRV_NAME,
 	.id_table =     e100_id_table,
@@ -2353,6 +2359,9 @@ static struct pci_driver e100_driver = {
 	.suspend =      e100_suspend,
 	.resume =       e100_resume,
 #endif
+	.driver = {
+		.shutdown = e100_shutdown,
+	}
 };
 
 static int __init e100_init_module(void)
Message details and related content
Hi.

Do you also disable the WOL event when resuming?

Regards,

Nigel

On Mon, 2005-01-31 at 14:47, Scott Feldman wrote:
quoted hunk
On Sun, 2005-01-30 at 09:18, David Härdeman wrote:
quoted
I experience the same problems as reported by Michael Gernoth when 
sending a WOL-packet to computer with a e100 NIC which is already 
powered on.
I didn't look at the 2.4 case, but for 2.6, it seems e100 was enabling
PME wakeup during probe.  PME shouldn't be enabled while the system is
up.  I suspect the assertion of PME while the system is up is what's
causing problems.  This patch moves PME wakeup enabling to either
suspend or shutdown.

David, would you give this patch a try?  Make sure the system still
wakes from a magic packet if suspended or shut down, and doesn't cause
kacpid to go crazy if system is running.  If it helps for 2.6, perhaps
someone can look into 2.4 to see if there is something similar going on
there.

-scott
--- linux-2.6.11-rc2/drivers/net/e100.c.orig	2005-01-30 19:13:56.850497376 -0800
+++ linux-2.6.11-rc2/drivers/net/e100.c	2005-01-30 19:26:41.154305536 -0800
@@ -1868,7 +1868,6 @@ static int e100_set_wol(struct net_devic
 	else
 		nic->flags &= ~wol_magic;
 
-	pci_enable_wake(nic->pdev, 0, nic->flags & (wol_magic | e100_asf(nic)));
 	e100_exec_cb(nic, NULL, e100_configure);
 
 	return 0;
@@ -2262,8 +2261,6 @@ static int __devinit e100_probe(struct p
 	   (nic->eeprom[eeprom_id] & eeprom_id_wol))
 		nic->flags |= wol_magic;
 
-	pci_enable_wake(pdev, 0, nic->flags & (wol_magic | e100_asf(nic)));
-
 	strcpy(netdev->name, "eth%d");
 	if((err = register_netdev(netdev))) {
 		DPRINTK(PROBE, ERR, "Cannot register net device, aborting.\n");
@@ -2344,6 +2341,15 @@ static int e100_resume(struct pci_dev *p
 }

32 more quoted lines

-- 
Nigel Cunningham
Software Engineer, Canberra, Australia
http://www.cyclades.com

Ph: +61 (2) 6292 8028      Mob: +61 (417) 100 574
Message details and related content
Scott Feldman wrote:
On Sun, 2005-01-30 at 09:18, David Härdeman wrote:
quoted
I experience the same problems as reported by Michael Gernoth when
sending a WOL-packet to computer with a e100 NIC which is already
powered on.
I didn't look at the 2.4 case, but for 2.6, it seems e100 was enabling
PME wakeup during probe.  PME shouldn't be enabled while the system is
up.  I suspect the assertion of PME while the system is up is what's
causing problems.  This patch moves PME wakeup enabling to either
suspend or shutdown.

David, would you give this patch a try?  Make sure the system still
wakes from a magic packet if suspended or shut down, and doesn't cause
kacpid to go crazy if system is running.  If it helps for 2.6, perhaps
someone can look into 2.4 to see if there is something similar going on
This issue was reported on 2.4.
quoted hunk
there.

-scott
--- linux-2.6.11-rc2/drivers/net/e100.c.orig    2005-01-30 19:13:56.850497376 -0800
+++ linux-2.6.11-rc2/drivers/net/e100.c 2005-01-30 19:26:41.154305536 -0800
@@ -1868,7 +1868,6 @@ static int e100_set_wol(struct net_devic
        else
                nic->flags &= ~wol_magic;

-       pci_enable_wake(nic->pdev, 0, nic->flags & (wol_magic | e100_asf(nic)));
        e100_exec_cb(nic, NULL, e100_configure);

        return 0;
@@ -2262,8 +2261,6 @@ static int __devinit e100_probe(struct p
           (nic->eeprom[eeprom_id] & eeprom_id_wol))
                nic->flags |= wol_magic;

-       pci_enable_wake(pdev, 0, nic->flags & (wol_magic | e100_asf(nic)));
-
        strcpy(netdev->name, "eth%d");
        if((err = register_netdev(netdev))) {
                DPRINTK(PROBE, ERR, "Cannot register net device, aborting.\n");
@@ -2344,6 +2341,15 @@ static int e100_resume(struct pci_dev *p
 }
 #endif

+static void e100_shutdown(struct device *dev)
+{
+       struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
+       struct net_device *netdev = pci_get_drvdata(pdev);
+       struct nic *nic = netdev_priv(netdev);
+
+       pci_enable_wake(pdev, 0, nic->flags & (wol_magic | e100_asf(nic)));
+}
+
 static struct pci_driver e100_driver = {
        .name =         DRV_NAME,
        .id_table =     e100_id_table,

16 more quoted lines

Message details and related content
On Sun, 2005-01-30 at 19:58, Nigel Cunningham wrote:
Do you also disable the WOL event when resuming?
Good catch.  How's this look?
--- linux-2.6.11-rc2/drivers/net/e100.c.orig	2005-01-30 19:13:56.850497376 -0800
+++ linux-2.6.11-rc2/drivers/net/e100.c	2005-01-30 20:53:22.630560952 -0800
@@ -1868,7 +1868,6 @@ static int e100_set_wol(struct net_devic
 	else
 		nic->flags &= ~wol_magic;
 
-	pci_enable_wake(nic->pdev, 0, nic->flags & (wol_magic | e100_asf(nic)));
 	e100_exec_cb(nic, NULL, e100_configure);
 
 	return 0;
@@ -2262,8 +2261,6 @@ static int __devinit e100_probe(struct p
 	   (nic->eeprom[eeprom_id] & eeprom_id_wol))
 		nic->flags |= wol_magic;
 
-	pci_enable_wake(pdev, 0, nic->flags & (wol_magic | e100_asf(nic)));
-
 	strcpy(netdev->name, "eth%d");
 	if((err = register_netdev(netdev))) {
 		DPRINTK(PROBE, ERR, "Cannot register net device, aborting.\n");
@@ -2320,7 +2317,8 @@ static int e100_suspend(struct pci_dev *
 	netif_device_detach(netdev);
 
 	pci_save_state(pdev);
-	pci_enable_wake(pdev, state, nic->flags & (wol_magic | e100_asf(nic)));
+	pci_enable_wake(pdev, pci_choose_state(pdev, state),
+		nic->flags & (wol_magic | e100_asf(nic)));
 	pci_disable_device(pdev);
 	pci_set_power_state(pdev, pci_choose_state(pdev, state));
 
@@ -2333,6 +2331,7 @@ static int e100_resume(struct pci_dev *p
 	struct nic *nic = netdev_priv(netdev);
 
 	pci_set_power_state(pdev, PCI_D0);
+	pci_enable_wake(pdev, PCI_D0, 0);
 	pci_restore_state(pdev);
 	e100_hw_init(nic);
 
@@ -2344,6 +2343,15 @@ static int e100_resume(struct pci_dev *p
 }
 #endif
 
+static void e100_shutdown(struct device *dev)
+{
+	struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
+	struct net_device *netdev = pci_get_drvdata(pdev);
+	struct nic *nic = netdev_priv(netdev);
+
+	pci_enable_wake(pdev, PCI_D0, nic->flags & (wol_magic | e100_asf(nic)));
+}
+
 static struct pci_driver e100_driver = {
 	.name =         DRV_NAME,
 	.id_table =     e100_id_table,
@@ -2353,6 +2361,9 @@ static struct pci_driver e100_driver = {
 	.suspend =      e100_suspend,
 	.resume =       e100_resume,
 #endif
+	.driver = {
+		.shutdown = e100_shutdown,
+	}
 };
 
 static int __init e100_init_module(void)
Message details and related content
Hi.

On Mon, 2005-01-31 at 16:00, Scott Feldman wrote:
On Sun, 2005-01-30 at 19:58, Nigel Cunningham wrote:
quoted
Do you also disable the WOL event when resuming?
Good catch.  How's this look?
I looked at it last week because I used it for an example of device
model drivers at the CELF conference. I got your intel address from the
top of the .c file, but IIRC it bounced. Providence :>

[...]
quoted hunk
@@ -2333,6 +2331,7 @@ static int e100_resume(struct pci_dev *p
 	struct nic *nic = netdev_priv(netdev);
 
 	pci_set_power_state(pdev, PCI_D0);
+	pci_enable_wake(pdev, PCI_D0, 0);
 	pci_restore_state(pdev);
 	e100_hw_init(nic);
Shouldn't this be disable_wake?

Regards,

Nigel
-- 
Nigel Cunningham
Software Engineer, Canberra, Australia
http://www.cyclades.com

Ph: +61 (2) 6292 8028      Mob: +61 (417) 100 574
Message details and related content
Hi again.

Ignore that :> I realised later that there's only one badly named
routine and my assumption that there was another called disable_.. was
wrong :>

Nigel

On Mon, 2005-01-31 at 17:14, Nigel Cunningham wrote:
Hi.

On Mon, 2005-01-31 at 16:00, Scott Feldman wrote:
quoted
On Sun, 2005-01-30 at 19:58, Nigel Cunningham wrote:
quoted
Do you also disable the WOL event when resuming?
Good catch.  How's this look?
I looked at it last week because I used it for an example of device
model drivers at the CELF conference. I got your intel address from the
top of the .c file, but IIRC it bounced. Providence :>

[...]
quoted
@@ -2333,6 +2331,7 @@ static int e100_resume(struct pci_dev *p
 	struct nic *nic = netdev_priv(netdev);
 
 	pci_set_power_state(pdev, PCI_D0);
+	pci_enable_wake(pdev, PCI_D0, 0);
 	pci_restore_state(pdev);
 	e100_hw_init(nic);
Shouldn't this be disable_wake?

Regards,

Nigel
-- 
Nigel Cunningham
Software Engineer, Canberra, Australia
http://www.cyclades.com

Ph: +61 (2) 6292 8028      Mob: +61 (417) 100 574
Message details and related content
On Sun, Jan 30, 2005 at 08:23:47PM -0800, Bukie Mabayoje wrote:
Scott Feldman wrote:
quoted
On Sun, 2005-01-30 at 09:18, David Härdeman wrote:
quoted
I experience the same problems as reported by Michael Gernoth when
sending a WOL-packet to computer with a e100 NIC which is already
powered on.
I didn't look at the 2.4 case, but for 2.6, it seems e100 was enabling
PME wakeup during probe.  PME shouldn't be enabled while the system is
up.  I suspect the assertion of PME while the system is up is what's
causing problems.  This patch moves PME wakeup enabling to either
suspend or shutdown.

David, would you give this patch a try?  Make sure the system still
wakes from a magic packet if suspended or shut down, and doesn't cause
kacpid to go crazy if system is running.  If it helps for 2.6, perhaps
someone can look into 2.4 to see if there is something similar going on
This issue was reported on 2.4.
Can any of you guys test v2.6, please?
Message details and related content
On Mon, Jan 31, 2005 at 01:24:31PM -0200, Marcelo Tosatti wrote:
On Sun, Jan 30, 2005 at 08:23:47PM -0800, Bukie Mabayoje wrote:
quoted
Scott Feldman wrote:
quoted
David, would you give this patch a try?  Make sure the system still
wakes from a magic packet if suspended or shut down, and doesn't cause
kacpid to go crazy if system is running.  If it helps for 2.6, perhaps
someone can look into 2.4 to see if there is something similar going on
This issue was reported on 2.4.
Can any of you guys test v2.6, please?
I tried the second patch provided by Scott on a 2.6.10 kernel, I did some minor tweaks to get it to apply (changed pci_choose_state() and PCI_D0 back to the way they were in 2.6.10) and tested the results five minutes ago.

It works great, I havent tried suspending the machine cause I have no need for that functionality. I have however started the machine via WOL (works), sent WOL-packet to the machine when powered on (nothing happends - kacpid doesn't go wild, works), shutdown (works without the machine spontaneously rebooting).

So everything seems to be fixed by the patch (save for suspending which I didn't test).

Thanks alot, I hope the patch will be in the next stable 2.6 kernel.

Regards,
David
Message details and related content

Marcelo Tosatti wrote:
On Sun, Jan 30, 2005 at 08:23:47PM -0800, Bukie Mabayoje wrote:
quoted
Scott Feldman wrote:
quoted
On Sun, 2005-01-30 at 09:18, David Härdeman wrote:
quoted
I experience the same problems as reported by Michael Gernoth when
sending a WOL-packet to computer with a e100 NIC which is already
powered on.
I didn't look at the 2.4 case, but for 2.6, it seems e100 was enabling
PME wakeup during probe.  PME shouldn't be enabled while the system is
up.  I suspect the assertion of PME while the system is up is what's
causing problems.  This patch moves PME wakeup enabling to either
suspend or shutdown.

David, would you give this patch a try?  Make sure the system still
wakes from a magic packet if suspended or shut down, and doesn't cause
kacpid to go crazy if system is running.  If it helps for 2.6, perhaps
someone can look into 2.4 to see if there is something similar going on
This issue was reported on 2.4.
Can any of you guys test v2.6, please?
I will be glad to test it now but I can't, I am currently doing some work on 2.4. If no one has tested it in the next few days I will validate it then.

By the way,  do anyone have an idea how to get this functionality into 2.4 eepro100. The problem is that eepro100 code works on a non WOL cards.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help