From: "Michael S. Tsirkin" <mst@dev.mellanox.co.il>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"Kok, Auke" <auke-jan.h.kok@intel.com>,
Ingo Molnar <mingo@elte.hu>, Jeff Garzik <jeff@garzik.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Pavel Machek <pavel@ucw.cz>, Jens Axboe <jens.axboe@oracle.com>,
Adrian Bunk <bunk@stusta.de>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
linux-pm@lists.osdl.org,
Michal Piotrowski <michal.k.k.piotrowski@gmail.com>
Subject: Re: SATA resume slowness, e1000 MSI warning
Date: Mon, 16 Apr 2007 22:56:49 +0300 [thread overview]
Message-ID: <20070416195649.GA4507@mellanox.co.il> (raw)
In-Reply-To: <20070311112400.GB24475@mellanox.co.il>
> > > Hmm. pci_save_pcix_state/pci_restore_pcix_state seem to only handle
> > > regular devices and seem to ignore the fact that for bridge PCI-X
> > > capability has a different structure.
> > >
> > > Is this intentional?
> >
> > Probably not a such. I don't think we have any drivers for bridge
> > devices so I don't think it matters. It likely wouldn't hurt to fix
> > it just in case though.
> >
> > Do any of the mellanox cards do anything with the bridge on the card?
>
> Yes but they do their own thing wrt saving/restoring registers.
> Look at drivers/infiniband/hw/mthca/mthca_reset.c
>
> > > If not, here's a patch to fix this. Warning: completely untested.
> >
> > If you fix the offsets and diff this against my last fix (to never
> > free the buffer) I think your patch makes sense.
>
> Let's agree what the correct offsets are.
>
> > > PCI: restore bridge PCI-X capability registers after PM event
> > >
> > > Restore PCI-X bridge up/downstream capability registers
> > > after PM event. This includes maxumum split transaction
> > > commitment limit which might be vital for PCI X.
> > >
> > > Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
> > >
> > > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> > > index df49530..4b788ef 100644
> > > --- a/drivers/pci/pci.c
> > > +++ b/drivers/pci/pci.c
> > > @@ -597,14 +597,19 @@ static int pci_save_pcix_state(struct pci_dev *dev)
> > > if (pos <= 0)
> > > return 0;
> > >
> > > - save_state = kzalloc(sizeof(*save_state) + sizeof(u16), GFP_KERNEL);
> > > + save_state = kzalloc(sizeof(*save_state) + sizeof(u16) * 2, GFP_KERNEL);
> > > if (!save_state) {
> > > - dev_err(&dev->dev, "Out of memory in pci_save_pcie_state\n");
> > > + dev_err(&dev->dev, "Out of memory in pci_save_pcix_state\n");
> > > return -ENOMEM;
> > > }
> > > cap = (u16 *)&save_state->data[0];
> > >
> > > - pci_read_config_word(dev, pos + PCI_X_CMD, &cap[i++]);
> > > + if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
> >
> > This appears to be the proper test.
> >
> > > + pci_read_config_word(dev, pos + PCI_X_BRIDGE_UP_SPL_CTL, &cap[i++]);
> > > + pci_read_config_word(dev, pos + PCI_X_BRIDGE_DN_SPL_CTL, &cap[i++]);
> > > + } else
> > > + pci_read_config_word(dev, pos + PCI_X_CMD, &cap[i++]);
> > > +
> > > pci_add_saved_cap(dev, save_state);
> > > return 0;
> > > }
> > > @@ -621,7 +626,11 @@ static void pci_restore_pcix_state(struct pci_dev *dev)
> > > return;
> > > cap = (u16 *)&save_state->data[0];
> > >
> > > - pci_write_config_word(dev, pos + PCI_X_CMD, cap[i++]);
> > > + if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
> > > + pci_write_config_word(dev, pos + PCI_X_BRIDGE_UP_SPL_CTL, cap[i++]);
> > > + pci_write_config_word(dev, pos + PCI_X_BRIDGE_DN_SPL_CTL, cap[i++]);
> >
> > These look like the proper two registers to save.
> >
> > > + } else
> > > + pci_write_config_word(dev, pos + PCI_X_CMD, cap[i++]);
> > > pci_remove_saved_cap(save_state);
> > > kfree(save_state);
> > > }
> > > diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
> > > index f09cce2..fb7eefd 100644
> > > --- a/include/linux/pci_regs.h
> > > +++ b/include/linux/pci_regs.h
> > > @@ -332,6 +332,8 @@
> > > #define PCI_X_STATUS_SPL_ERR 0x20000000 /* Rcvd Split Completion Error Msg */
> > > #define PCI_X_STATUS_266MHZ 0x40000000 /* 266 MHz capable */
> > > #define PCI_X_STATUS_533MHZ 0x80000000 /* 533 MHz capable */
> > > +#define PCI_X_BRIDGE_UP_SPL_CTL 10 /* PCI-X upstream split transaction limit */
> > > +#define PCI_X_BRIDGE_DN_SPL_CTL 14 /* PCI-X downstream split transaction limit */
> >
> > Unless I am completely misreading the spec. While you have picked the
> > right register to save the offsets should be 0x08 and 0x0c or 8 and 12....
>
> No, the spec is written in terms of dwords (32 bit), we are storing words (16 bits).
> The data at offsets 8 and 12 is read-only split transaction capacity.
> Split transaction limit starts at bit 16 so you need to add 2 to byte offset.
So, Eric, what are your thoughts on this patch (probably wrt 2.6.22)?
Since the rest of the save/restore code uses 16 bit transactions,
it should be safe here too?
--
MST
next prev parent reply other threads:[~2007-04-16 19:56 UTC|newest]
Thread overview: 104+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.LNX.4.64.0702202043280.4043@woody.linux-foundation.org>
2007-02-25 17:52 ` 2.6.21-rc1: known regressions (part 1) Adrian Bunk
2007-02-28 18:16 ` Karasyov, Konstantin A
2007-02-25 17:55 ` 2.6.21-rc1: known regressions (part 2) Adrian Bunk
2007-02-27 10:02 ` Jens Axboe
2007-02-27 10:21 ` Pavel Machek
2007-02-27 10:30 ` Jens Axboe
2007-02-27 10:34 ` Ingo Molnar
2007-02-27 10:59 ` Jens Axboe
2007-02-27 11:15 ` Jens Axboe
2007-02-27 13:09 ` Jens Axboe
2007-03-01 9:34 ` Ingo Molnar
2007-03-01 10:41 ` Ingo Molnar
2007-03-01 14:52 ` Ingo Molnar
2007-03-01 16:12 ` Rafael J. Wysocki
2007-03-02 0:26 ` Linus Torvalds
2007-03-02 0:41 ` Linus Torvalds
2007-03-02 7:14 ` Ingo Molnar
2007-03-02 7:21 ` Ingo Molnar
2007-03-02 8:04 ` Ingo Molnar
2007-03-02 10:20 ` Ingo Molnar
2007-03-02 10:22 ` [patch] KVM: T60 resume fix Ingo Molnar
2007-03-02 11:39 ` Michael S. Tsirkin
2007-03-03 8:22 ` Avi Kivity
2007-03-03 8:21 ` Avi Kivity
2007-03-03 11:57 ` Andrew Morton
2007-03-03 12:07 ` Junio C Hamano
2007-03-05 8:22 ` Ingo Molnar
2007-03-05 8:50 ` Avi Kivity
2007-03-05 8:44 ` Ingo Molnar
2007-03-05 8:57 ` Ingo Molnar
2007-03-05 9:27 ` Avi Kivity
2007-03-05 10:05 ` Ingo Molnar
2007-03-05 10:33 ` Avi Kivity
2007-03-05 10:33 ` Ingo Molnar
2007-03-05 10:40 ` Michael S. Tsirkin
2007-03-05 12:54 ` Michael S. Tsirkin
2007-03-05 12:50 ` Ingo Molnar
2007-03-05 13:26 ` Michael S. Tsirkin
2007-03-05 13:32 ` Ingo Molnar
2007-03-05 10:23 ` Michael S. Tsirkin
2007-03-05 10:29 ` Ingo Molnar
2007-03-05 15:44 ` 2.6.21-rc1: known regressions (part 2) Michael S. Tsirkin
2007-03-05 16:14 ` Michael S. Tsirkin
2007-03-05 16:41 ` Ingo Molnar
2007-03-05 18:16 ` Jens Axboe
2007-03-01 23:36 ` Linus Torvalds
2007-03-02 10:07 ` Pavel Machek
2007-03-05 8:42 ` Michael S. Tsirkin
2007-03-05 10:11 ` SATA resume slowness, e1000 MSI warning Ingo Molnar
2007-03-06 5:30 ` Jeff Garzik
2007-03-06 6:35 ` Kok, Auke
2007-03-06 9:04 ` Ingo Molnar
2007-03-06 15:34 ` Kok, Auke
2007-03-07 4:15 ` Eric W. Biederman
2007-03-07 16:31 ` Kok, Auke
2007-03-07 16:45 ` Kok, Auke
2007-03-07 19:28 ` Eric W. Biederman
2007-03-08 2:53 ` Andrew Morton
2007-03-08 6:58 ` Eric W. Biederman
2007-03-08 9:55 ` Jeff Garzik
2007-03-08 17:27 ` Eric W. Biederman
2007-03-08 19:58 ` [PATCH 0/2] Repair pci_restore_state when used with device resets Eric W. Biederman
2007-03-08 20:04 ` [PATCH 1/2] msi: Safer state caching Eric W. Biederman
2007-03-08 20:06 ` [PATCH 2/2] pci: Repair pci_save/restore_state so we can restore one save many times Eric W. Biederman
2007-03-12 22:46 ` Kok, Auke
2007-03-08 20:08 ` [PATCH 0/2] Repair pci_restore_state when used with device resets Ingo Molnar
2007-03-08 20:26 ` Eric W. Biederman
2007-03-08 10:23 ` SATA resume slowness, e1000 MSI warning Michael S. Tsirkin
2007-03-11 11:11 ` Eric W. Biederman
2007-03-11 11:24 ` Michael S. Tsirkin
2007-03-11 17:37 ` Eric W. Biederman
2007-03-11 18:03 ` Michael S. Tsirkin
2007-03-11 18:27 ` Eric W. Biederman
2007-03-11 18:37 ` Michael S. Tsirkin
2007-03-11 19:50 ` Eric W. Biederman
2007-03-12 4:35 ` Michael S. Tsirkin
2007-04-16 19:56 ` Michael S. Tsirkin [this message]
2007-03-09 23:06 ` Kok, Auke
2007-03-10 3:41 ` Eric W. Biederman
2007-03-06 9:06 ` Ingo Molnar
2007-03-06 16:26 ` Thomas Gleixner
2007-03-06 16:52 ` Linus Torvalds
2007-03-06 17:09 ` Kok, Auke
2007-03-09 6:44 ` 2.6.21-rc1: known regressions (part 2) Pavel Machek
2007-03-05 15:34 ` Michael S. Tsirkin
2007-02-27 22:09 ` Adrian Bunk
2007-02-28 7:41 ` Jens Axboe
2007-02-26 22:01 ` 2.6.21-rc1: known regressions (v2) (part 1) Adrian Bunk
2007-02-27 4:09 ` Sergio Monteiro Basto
2007-02-27 12:50 ` S.Çağlar Onur
2007-02-27 13:25 ` Ismail Dönmez
2007-02-28 21:13 ` Michael S. Tsirkin
2007-02-28 21:27 ` Thomas Gleixner
2007-02-28 21:40 ` Michael S. Tsirkin
2007-03-01 3:45 ` Jeff Chua
2007-03-02 12:26 ` [linux-pm] " Pavel Machek
2007-03-03 11:17 ` Jens Axboe
2007-03-05 0:04 ` Adrian Bunk
2007-03-06 1:32 ` Jeff Chua
2007-03-06 12:03 ` Jeff Chua
2007-03-06 12:08 ` Michael S. Tsirkin
2007-03-06 12:12 ` Jeff Chua
2007-03-19 15:32 ` Pavel Machek
2007-03-19 21:23 ` 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=20070416195649.GA4507@mellanox.co.il \
--to=mst@dev.mellanox.co.il \
--cc=akpm@linux-foundation.org \
--cc=auke-jan.h.kok@intel.com \
--cc=bunk@stusta.de \
--cc=ebiederm@xmission.com \
--cc=jeff@garzik.org \
--cc=jens.axboe@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.osdl.org \
--cc=michal.k.k.piotrowski@gmail.com \
--cc=mingo@elte.hu \
--cc=pavel@ucw.cz \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/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