From: Yinghai Lu <yinghai@kernel.org>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Jesse Brandeburg <jesse.brandeburg@gmail.com>,
David Miller <davem@davemloft.net>, Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
NetDev <netdev@vger.kernel.org>
Subject: Re: [PATCH] igb: fix kexec with igb
Date: Sun, 8 Mar 2009 16:04:02 -0700 [thread overview]
Message-ID: <86802c440903081604u5321ea0y1160cfa4a0504f9@mail.gmail.com> (raw)
In-Reply-To: <200903082357.19623.rjw@sisk.pl>
On Sun, Mar 8, 2009 at 3:57 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> On Sunday 08 March 2009, Yinghai Lu wrote:
>> On Sun, Mar 8, 2009 at 2:32 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
>> > On Sunday 08 March 2009, Rafael J. Wysocki wrote:
>> >> On Sunday 08 March 2009, Yinghai Lu wrote:
>> >> > Rafael J. Wysocki wrote:
>> >> > > On Saturday 07 March 2009, Yinghai Lu wrote:
>> >> > >> On Fri, Mar 6, 2009 at 11:18 PM, Jesse Brandeburg
>> >> > >> <jesse.brandeburg@gmail.com> wrote:
>> >> > >>> On Fri, Mar 6, 2009 at 8:33 PM, Yinghai Lu <yinghai@kernel.org> wrote:
>> >> > >>>> Impact: could probe igb
>> >> > >>>>
>> >> > >>>> Found one system with 82575EB, in the kernel that is kexeced, probe igb
>> >> > >>>> failed with -2.
>> >> > >>>>
>> >> > >>>> it looks like the same behavior happened on forcedeth.
>> >> > >>>>
>> >> > >>>> try to check system_state to make sure if put it on D3
>> >> > >>>>
>> >> > >>>> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>> >> > >>>>
>> >> > >>>> ---
>> >> > >>>> drivers/net/igb/igb_main.c | 19 ++++++++++++++-----
>> >> > >>>> 1 file changed, 14 insertions(+), 5 deletions(-)
>> >> > >>> I see the point of the patch, but I know for a fact that ixgbe when
>> >> > >>> enabled for MSI-X also doesn't work with kexec.
>> >> > >>>
>> >> > >>> so my questions are:
>> >> > >>> are you going to change every driver?
>> >> > >> i tend to only change driver that i have related HW.
>> >> > >>
>> >> > >>> why can't this be fixed in core kernel code instead?
>> >> > >> will check it.
>> >> > >>
>> >> > >>> Shouldn't pci_enable_device take it out of D3?
>> >> > >>> Or maybe it should be taken out of D3 immediately if someone tries to
>> >> > >>> ioremap any of the BARx registers?
>> >> > >>
>> >> > >> looks like second kernel can not detect the state any more.
>> >> > >
>> >> > > In fact pci_enable_device() calls pci_set_power_state(dev, PCI_D0) as the first
>> >> > > thing. The question is why it doesn't work as expected.
>> >> >
>> >> > not sure... please check the version for forcedeth that you made.
>> >> >
>> >> > commit 3cb5599a84c557c0dd9a19feb63a3788268cf249
>> >> > Author: Rafael J. Wysocki <rjw@sisk.pl>
>> >> > Date: Fri Sep 5 14:00:19 2008 -0700
>> >> >
>> >> > forcedeth: fix kexec regression
>> >> >
>> >> > Fix regression tracked as http://bugzilla.kernel.org/show_bug.cgi?id=11361
>> >> > and caused by commit f735a2a1a4f2a0f5cd823ce323e82675990469e2 ("[netdrvr]
>> >> > forcedeth: setup wake-on-lan before shutting down") that makes network
>> >> > adapters integrated into the NVidia MCP55 chipsets fail to work in kexeced
>> >> > kernels. The problem appears to be that if the adapter is put into D3_hot
>> >> > during ->shutdown(), it cannot be brought back into D0 after kexec (ref.
>> >> > http://marc.info/?l=linux-kernel&m=121900062814967&w=4). Therefore, only
>> >> > put forcedeth into D3 during ->shutdown() if the system is to be powered
>> >> > off.
>> >>
>> >> Thanks, I remember now.
>> >
>> > In which case you need to rework igb_shutdown() rather than igb_suspend().
>> >
>> > Something like the patch below, perhaps (totally untested).
>> >
>> > Thanks,
>> > Rafael
>> >
>> > ---
>> > drivers/net/igb/igb_main.c | 24 +++++++++++++++++++-----
>> > 1 file changed, 19 insertions(+), 5 deletions(-)
>> >
>> > Index: linux-2.6/drivers/net/igb/igb_main.c
>> > ===================================================================
>> > --- linux-2.6.orig/drivers/net/igb/igb_main.c
>> > +++ linux-2.6/drivers/net/igb/igb_main.c
>> > @@ -4299,7 +4299,7 @@ int igb_set_spd_dplx(struct igb_adapter
>> > }
>> >
>> >
>> > -static int igb_suspend(struct pci_dev *pdev, pm_message_t state)
>> > +static int __igb_shutdown(struct pci_dev *pdev, bool enable_wake)
>> > {
>> > struct net_device *netdev = pci_get_drvdata(pdev);
>> > struct igb_adapter *adapter = netdev_priv(netdev);
>> > @@ -4359,7 +4359,7 @@ static int igb_suspend(struct pci_dev *p
>> > }
>> >
>> > /* make sure adapter isn't asleep if manageability/wol is enabled */
>> > - if (wufc || adapter->en_mng_pt) {
>> > + if ((wufc || adapter->en_mng_pt) && enable_wake) {
>> > pci_enable_wake(pdev, PCI_D3hot, 1);
>> > pci_enable_wake(pdev, PCI_D3cold, 1);
>> > } else {
>> > @@ -4374,12 +4374,21 @@ static int igb_suspend(struct pci_dev *p
>> >
>> > pci_disable_device(pdev);
>> >
>> > - pci_set_power_state(pdev, pci_choose_state(pdev, state));
>> > -
>> > return 0;
>> > }
>> >
>> > #ifdef CONFIG_PM
>> > +static int igb_suspend(struct pci_dev *pdev, pm_message_t state)
>> > +{
>> > + int retval;
>> > +
>> > + retval = __igb_shutdown(pdev, true);
>> > + if (!retval)
>> > + pci_set_power_state(pdev, PCI_D3hot);
>> > +
>> > + return retval;
>> > +}
>> > +
>> > static int igb_resume(struct pci_dev *pdev)
>> > {
>> > struct net_device *netdev = pci_get_drvdata(pdev);
>> > @@ -4434,7 +4443,12 @@ static int igb_resume(struct pci_dev *pd
>> >
>> > static void igb_shutdown(struct pci_dev *pdev)
>> > {
>> > - igb_suspend(pdev, PMSG_SUSPEND);
>> > + if (system_state == SYSTEM_POWER_OFF) {
>> > + __igb_shutdown(pdev, true);
>> > + pci_set_power_state(pdev, PCI_D3hot);
>>
>> you don't need to use pci_choose_state(pdev, state), but use PCI-D3hot directly?
>
> Yes, because we've already decided we'd put the device into D3_hot by calling
> pci_enable_wake(pdev, PCI_D3hot, 1) in __igb_shutdown().
>
> In fact we should first determine the target state and _then_ call
> pci_enable_wake() and pci_set_power_state() with that as the argument, but this
> is a separate issue. For now, IMO, it's better to use D3_hot in both places
> directly.
>
> On a slightly related note, the sequence
>
> pci_enable_wake(pdev, PCI_D3hot, 1);
> pci_enable_wake(pdev, PCI_D3cold, 1);
>
> is (slightly) incorrect by itself, because ACPI doesn't distinguish bewteen
> D3_hot and D3_cold, so this just causes the same platform code to run twice,
> which may or may not work (it theory it should always work, but still).
>
> This is yet another problem, though.
can you go through e1000, e1000e, ixgb, ixgbe too?
YH
next prev parent reply other threads:[~2009-03-08 23:04 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-07 4:33 Yinghai Lu
2009-03-07 7:18 ` Jesse Brandeburg
2009-03-07 7:31 ` Yinghai Lu
2009-03-07 18:20 ` Eric W. Biederman
2009-03-07 18:50 ` Yinghai Lu
2009-03-08 10:45 ` Rafael J. Wysocki
2009-03-08 10:57 ` Rafael J. Wysocki
2009-03-08 18:03 ` Yinghai Lu
2009-03-08 18:10 ` Yinghai Lu
2009-03-08 21:08 ` Rafael J. Wysocki
2009-03-08 21:18 ` Yinghai Lu
2009-03-08 21:40 ` Rafael J. Wysocki
2009-03-08 21:32 ` Rafael J. Wysocki
2009-03-08 22:35 ` Yinghai Lu
2009-03-08 22:57 ` Rafael J. Wysocki
2009-03-08 23:04 ` Yinghai Lu [this message]
2009-03-08 23:57 ` Rafael J. Wysocki
2009-03-11 23:37 ` Yinghai Lu
2009-03-21 22:04 ` [Updated patch] " Rafael J. Wysocki
2009-03-24 22:35 ` Yinghai Lu
2009-03-28 21:27 ` Rafael J. Wysocki
2009-03-29 2:30 ` Jeff Kirsher
2009-03-29 11:19 ` Rafael J. Wysocki
2009-03-30 21:36 ` Jeff Kirsher
2009-03-30 21:39 ` Rafael J. Wysocki
2009-03-31 19:14 ` Tantilov, Emil S
2009-03-31 19:51 ` Jeff Kirsher
2009-03-31 20:27 ` Rafael J. Wysocki
2009-03-08 8:09 ` [PATCH] pci: fix kexec with power state D3 Yinghai Lu
2009-03-08 10:08 ` Rafael J. Wysocki
2009-03-08 10:15 ` Ingo Molnar
2009-03-08 10:28 ` Rafael J. Wysocki
2009-03-08 10:33 ` Rafael J. Wysocki
2009-03-08 11:08 ` Ingo Molnar
2009-03-20 1:49 ` Jesse Barnes
2009-03-20 11:29 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86802c440903081604u5321ea0y1160cfa4a0504f9@mail.gmail.com \
--to=yinghai@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=jesse.brandeburg@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=netdev@vger.kernel.org \
--cc=rjw@sisk.pl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®