Skip to contentSkip to conversation

e1000e: Fix usage under kexec

PATCH In review Sven Anders 4 participants 6 messages Nov 9, 2009 – Dec 4, 2009

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

PATCH 1/1 e1000e: Fix usage under kexec

Hello!

We're experiencing the following problem:

We start a minimal linux system, prepare the system and start the final system via kexec.
On two different systems (one with a 82573 and one with a 82574), the driver cannot initialize the network hardware, because the PHY is not recognized.

We get the following error:
e1000e: probe of 0000:02:00.0 failed with error -2

We cannot unload the driver of the first kernel, because it's compiled in statically.

It's caused by the PHY, because it's already initialized by the first driver and therefore does not respond correctly. The driver assumes the PHY to be in 'reset' state, which is done by the BIOS.

We fixed it by adding a

+ /* Reset PHY before initializing it. Allows re-init after kexec. */
+ if (!e1000_check_reset_block(hw))
+ e1000_phy_hw_reset(hw);

to the initialization routine. I'm not sure, if we need the additional "block" check.
A patch is attached.

Please send a note, if the patch is correct or wrong...

Regards
Sven Anders

Signature · 9 lines
 Sven Anders <[email protected]>                 () Ascii Ribbon Campaign
                                                 /\ Support plain text e-mail
 ANDURAS service solutions AG
 Innstrasse 71 - 94036 Passau - Germany
 Web: www.anduras.de - Tel: +49 (0)851-4 90 50-0 - Fax: +49 (0)851-4 90 50-55

Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety.
  - Benjamin Franklin
drivers/net/e1000e/82571.c renamed from drivers/net/e1000e/82571.c.orig +4 -0
@@ -107,6 +107,10 @@ static s32 e1000_init_phy_params_82571(s
 		break;
 	}
 
+	/* Reset PHY before initializing it. Allows re-init after kexec. */
+	if (!e1000_check_reset_block(hw))
+	  e1000_phy_hw_reset(hw);
+
 	/* This can only be done after all function pointers are setup. */
 	ret_val = e1000_get_phy_id_82571(hw);
 

begin:vcard
fn:Sven Anders
n:Anders;Sven
adr;quoted-printable:;;Weidestra=C3=9Fe 19;Hannover;Niedersachsen;30453;Deutschland email;internet:[email protected]
tel;home:+49 (0)511 / 2123090
tel;cell:+49 (0)170 / 8091180
x-mozilla-html:FALSE
url:http://staff.anduras.de/anders
version:2.1
end:vcard

#1 lore raw
Quoted 13 lines · Sven Anders

We get the following error:
e1000e: probe of 0000:02:00.0 failed with error -2

We cannot unload the driver of the first kernel, because it's compiled in statically.

It's caused by the PHY, because it's already initialized by the first driver and therefore does not respond correctly. The driver assumes the PHY to be in 'reset' state, which is done by the BIOS.

We fixed it by adding a

drivers/net/e1000e/82571.c static s32 e1000_init_phy_params_82571(s · line 112

Quoted 3 lines
drivers/net/e1000e/82571.c renamed from drivers/net/e1000e/82571.c.orig +3 -0
+       /* Reset PHY before initializing it. Allows re-init after kexec. */
+       if (!e1000_check_reset_block(hw))
+         e1000_phy_hw_reset(hw);

The problem of resetting PHYs in the driver init path is that it tends to lose link-state, and if the link takes some time to re-negotiate you can significantly slow down the "total time to network access" at boot.

Perhaps you could only reset when the message above would trigger and try again?

-Andi

#2 lore raw
In reply to Sven Anders
Quoted 4 lines · Sven Anders

Hello!

We're experiencing the following problem:

Quoted 8 lines

We start a minimal linux system, prepare the system and start the final system via kexec.
On two different systems (one with a 82573 and one with a 82574), the driver cannot initialize the network hardware, because the PHY is not recognized.

We get the following error:
e1000e: probe of 0000:02:00.0 failed with error -2

Hi Sven,

have a look at the following thread, it seems very similar.
http://kerneltrap.org/mailarchive/linux-netdev/2009/3/7/5114394

Stefan
--

Stefan Assmann         | Red Hat GmbH
Software Engineer      | Otto-Hahn-Strasse 20, 85609 Dornach
                       | HR: Amtsgericht Muenchen HRB 153243
                       | GF: Brendan Lane, Charlie Peters,
sassmann at redhat.com |     Michael Cunningham, Charles Cachera
#3 lore raw
Quoted 18 lines · Stefan Assmann
Quoted 11 lines · Sven Anders

Hello!

We're experiencing the following problem:

We start a minimal linux system, prepare the system and start the final system via kexec. On two different systems (one with a 82573 and one with a 82574), the driver cannot initialize the network hardware, because the PHY is not recognized.

We get the following error:
e1000e: probe of 0000:02:00.0 failed with error -2

Hi Sven,

have a look at the following thread, it seems very similar.
http://kerneltrap.org/mailarchive/linux-netdev/2009/3/7/5114394

Quoted 7 lines

Stefan
--

Stefan Assmann         | Red Hat GmbH
Software Engineer      | Otto-Hahn-Strasse 20, 85609 Dornach
                       | HR: Amtsgericht Muenchen HRB 153243
                       | GF: Brendan Lane, Charlie Peters,
sassmann at redhat.com |     Michael Cunningham, Charles Cachera

But there is already similar code in e1000e:
http://git.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commit;h=4f9de721ab73a5271a79b126f7b5140b01a05c99

#4 lore raw
In reply to Stefan Assmann
Quoted 18 lines · Stefan Assmann
Quoted 11 lines · Sven Anders

Hello!

We're experiencing the following problem:

We start a minimal linux system, prepare the system and start the final system via kexec. On two different systems (one with a 82573 and one with a 82574), the driver cannot initialize the network hardware, because the PHY is not recognized.

We get the following error:
e1000e: probe of 0000:02:00.0 failed with error -2

Hi Sven,

have a look at the following thread, it seems very similar.
http://kerneltrap.org/mailarchive/linux-netdev/2009/3/7/5114394

Quoted 7 lines

Stefan
--

Stefan Assmann         | Red Hat GmbH
Software Engineer      | Otto-Hahn-Strasse 20, 85609 Dornach
                       | HR: Amtsgericht Muenchen HRB 153243
                       | GF: Brendan Lane, Charlie Peters,
sassmann at redhat.com |     Michael Cunningham, Charles Cachera

Ignore my previous email - wrong click sent it sooner than intended.

There is already similar code in e1000e:
http://git.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commit;h=4f9de721ab73a5271a79b126f7b5140b01a05c99

Sven, could you provide some additional information about your system and kernel/driver verison you used when the issue occurred?

I have not been able to reproduce it on my setup.

Thanks,
Emil

#5 lore raw
Quoted 12 lines · Emil S
Quoted 11 lines · Stefan Assmann
Quoted 10 lines · Sven Anders

We're experiencing the following problem:

We start a minimal linux system, prepare the system and start the final system via kexec. On two different systems (one with a 82573 and one with a 82574), the driver cannot initialize the network hardware, because the PHY is not recognized.

We get the following error:
e1000e: probe of 0000:02:00.0 failed with error -2

Quoted 7 lines
Quoted 4 lines

Hi Sven,

have a look at the following thread, it seems very similar.
http://kerneltrap.org/mailarchive/linux-netdev/2009/3/7/5114394

There is already similar code in e1000e:
http://git.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commit;h=4f9de721ab73a5271a79b126f7b5140b01a05c99

Yes it sound similar. We will test this when we upgrade the kernel for our next OS release...

Quoted 3 lines

Sven, could you provide some additional information about your system and kernel/driver verison you used when the issue occurred?
I have not been able to reproduce it on my setup.

Currently we are using the Linux kernel 2.6.29.6 for our appliances. Which is/was the first officially released kernel with this patch?

Quoted 11 lines · Andi Kleen
Quoted 5 lines

We fixed it by adding a

Quoted 4 lines
drivers/net/e1000e/82571.c renamed from drivers/net/e1000e/82571.c.orig +3 -0
+       /* Reset PHY before initializing it. Allows re-init after kexec. */
+       if (!e1000_check_reset_block(hw))
+         e1000_phy_hw_reset(hw);

The problem of resetting PHYs in the driver init path is that it tends to lose link-state, and if the link takes some time to re-negotiate you can significantly slow down the "total time to network access" at boot.

Quoted 4 lines

Perhaps you could only reset when the message above would trigger and try again?

-Andi

Ok, know we are doing the following. But maybe it isn't needed with the new kernel any more...

@@ -109,6 +109,13 @@ static s32 e1000_init_phy_params_82571(s

        /* This can only be done after all function pointers are setup. */
        ret_val = e1000_get_phy_id_82571(hw);

+ /* Could not determine PHY id. This can happen when booting
+ via kexec. So reset and try again. */
+ if (ret_val == -E1000_ERR_PHY) {
+ e1000_phy_hw_reset(hw);
+ ret_val = e1000_get_phy_id_82571(hw);
+ }
+

        /* Verify phy id */
        switch (hw->mac.type) {
        case e1000_82571:

Regards
Sven Anders

Signature · 9 lines
 Sven Anders <[email protected]>                 () Ascii Ribbon Campaign
                                                 /\ Support plain text e-mail
 ANDURAS service solutions AG
 Innstrasse 71 - 94036 Passau - Germany
 Web: www.anduras.de - Tel: +49 (0)851-4 90 50-0 - Fax: +49 (0)851-4 90 50-55

Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety.
  - Benjamin Franklin

begin:vcard
fn:Sven Anders
n:Anders;Sven
adr;quoted-printable:;;Weidestra=C3=9Fe 19;Hannover;Niedersachsen;30453;Deutschland email;internet:[email protected]
tel;home:+49 (0)511 / 2123090
tel;cell:+49 (0)170 / 8091180
x-mozilla-html:FALSE
url:http://staff.anduras.de/anders
version:2.1
end:vcard