* Re: [PATCH] PCI/shpchp: fix a bus speed issue on hotplug
2014-05-01 14:35 [PATCH] PCI/shpchp: fix a bus speed issue on hotplug Marcel Apfelbaum
@ 2014-05-01 15:43 ` Michael S. Tsirkin
2014-05-01 18:02 ` Bjorn Helgaas
` (2 subsequent siblings)
3 siblings, 0 replies; 12+ messages in thread
From: Michael S. Tsirkin @ 2014-05-01 15:43 UTC (permalink / raw)
To: Marcel Apfelbaum; +Cc: linux-pci, linux-kernel, bhelgaas, matthew
On Thu, May 01, 2014 at 05:35:48PM +0300, Marcel Apfelbaum wrote:
> When a board is added, the shpchp driver checks if there
> is a mismatch between the bridge's adapter and the bus speed.
> If there is, it sets the subordinate speed (if there is no device on it).
>
> However, it takes the reference of the board speed from the primary bus
> and not from the subordinate. If the primary bus is PCI and not PCIX/PCIe,
> its speed is not updated and remains 0xff. As a result hotplug fails
> with error: "Speed of bus ff and adapter 0 mismatch".
>
> Fixed that by checking the speed against the subordinate bus.
>
> Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
> Acked-by: Michael S. Tsirkin <mst@redhat.com>
Looking at git history, I suspect this is a regression
introduced by
commit 3749c51ac6c1560aa1cb1520066bed84c6f8152a
Author: Matthew Wilcox <matthew@wil.cx>
Date: Sun Dec 13 08:11:32 2009 -0500
PCI: Make current and maximum bus speeds part of the PCI core
At least I remember this configuration worked for me early in 2009...
> ---
> drivers/pci/hotplug/shpchp_ctrl.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
> index 5849927..6efc2ec 100644
> --- a/drivers/pci/hotplug/shpchp_ctrl.c
> +++ b/drivers/pci/hotplug/shpchp_ctrl.c
> @@ -282,8 +282,8 @@ static int board_added(struct slot *p_slot)
> return WRONG_BUS_FREQUENCY;
> }
>
> - bsp = ctrl->pci_dev->bus->cur_bus_speed;
> - msp = ctrl->pci_dev->bus->max_bus_speed;
> + bsp = ctrl->pci_dev->subordinate->cur_bus_speed;
> + msp = ctrl->pci_dev->subordinate->max_bus_speed;
>
> /* Check if there are other slots or devices on the same bus */
> if (!list_empty(&ctrl->pci_dev->subordinate->devices))
> --
> 1.8.3.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] PCI/shpchp: fix a bus speed issue on hotplug
2014-05-01 14:35 [PATCH] PCI/shpchp: fix a bus speed issue on hotplug Marcel Apfelbaum
2014-05-01 15:43 ` Michael S. Tsirkin
@ 2014-05-01 18:02 ` Bjorn Helgaas
2014-05-01 18:13 ` Marcel Apfelbaum
2014-05-04 13:48 ` Ronen Hod
2014-05-15 18:41 ` Bjorn Helgaas
3 siblings, 1 reply; 12+ messages in thread
From: Bjorn Helgaas @ 2014-05-01 18:02 UTC (permalink / raw)
To: Marcel Apfelbaum
Cc: linux-pci, linux-kernel, Matthew Wilcox, Michael S. Tsirkin
On Thu, May 1, 2014 at 8:35 AM, Marcel Apfelbaum <marcel.a@redhat.com> wrote:
> When a board is added, the shpchp driver checks if there
> is a mismatch between the bridge's adapter and the bus speed.
> If there is, it sets the subordinate speed (if there is no device on it).
>
> However, it takes the reference of the board speed from the primary bus
> and not from the subordinate. If the primary bus is PCI and not PCIX/PCIe,
> its speed is not updated and remains 0xff. As a result hotplug fails
> with error: "Speed of bus ff and adapter 0 mismatch".
It'd be cool to have a bugzilla for this with lspci and dmesg output.
I'll also have to check the other hotplug drivers for similar issues,
unless you've already done that.
> Fixed that by checking the speed against the subordinate bus.
>
> Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
> Acked-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> drivers/pci/hotplug/shpchp_ctrl.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
> index 5849927..6efc2ec 100644
> --- a/drivers/pci/hotplug/shpchp_ctrl.c
> +++ b/drivers/pci/hotplug/shpchp_ctrl.c
> @@ -282,8 +282,8 @@ static int board_added(struct slot *p_slot)
> return WRONG_BUS_FREQUENCY;
> }
>
> - bsp = ctrl->pci_dev->bus->cur_bus_speed;
> - msp = ctrl->pci_dev->bus->max_bus_speed;
> + bsp = ctrl->pci_dev->subordinate->cur_bus_speed;
> + msp = ctrl->pci_dev->subordinate->max_bus_speed;
>
> /* Check if there are other slots or devices on the same bus */
> if (!list_empty(&ctrl->pci_dev->subordinate->devices))
> --
> 1.8.3.1
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] PCI/shpchp: fix a bus speed issue on hotplug
2014-05-01 18:02 ` Bjorn Helgaas
@ 2014-05-01 18:13 ` Marcel Apfelbaum
2014-05-01 18:57 ` Marcel Apfelbaum
0 siblings, 1 reply; 12+ messages in thread
From: Marcel Apfelbaum @ 2014-05-01 18:13 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: linux-pci, linux-kernel, Matthew Wilcox, Michael S. Tsirkin
On Thu, 2014-05-01 at 12:02 -0600, Bjorn Helgaas wrote:
> On Thu, May 1, 2014 at 8:35 AM, Marcel Apfelbaum <marcel.a@redhat.com> wrote:
> > When a board is added, the shpchp driver checks if there
> > is a mismatch between the bridge's adapter and the bus speed.
> > If there is, it sets the subordinate speed (if there is no device on it).
> >
> > However, it takes the reference of the board speed from the primary bus
> > and not from the subordinate. If the primary bus is PCI and not PCIX/PCIe,
> > its speed is not updated and remains 0xff. As a result hotplug fails
> > with error: "Speed of bus ff and adapter 0 mismatch".
>
> It'd be cool to have a bugzilla for this with lspci and dmesg output.
> I'll also have to check the other hotplug drivers for similar issues,
> unless you've already done that.
I'll open a BZ with the details, sure.
I didn't check the other hotplug drivers, but I do plan
to look into PCIe driver as part of QEMU's PCIe hotplug feature.
Thanks,
Marcel
>
> > Fixed that by checking the speed against the subordinate bus.
> >
> > Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
> > Acked-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> > drivers/pci/hotplug/shpchp_ctrl.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
> > index 5849927..6efc2ec 100644
> > --- a/drivers/pci/hotplug/shpchp_ctrl.c
> > +++ b/drivers/pci/hotplug/shpchp_ctrl.c
> > @@ -282,8 +282,8 @@ static int board_added(struct slot *p_slot)
> > return WRONG_BUS_FREQUENCY;
> > }
> >
> > - bsp = ctrl->pci_dev->bus->cur_bus_speed;
> > - msp = ctrl->pci_dev->bus->max_bus_speed;
> > + bsp = ctrl->pci_dev->subordinate->cur_bus_speed;
> > + msp = ctrl->pci_dev->subordinate->max_bus_speed;
> >
> > /* Check if there are other slots or devices on the same bus */
> > if (!list_empty(&ctrl->pci_dev->subordinate->devices))
> > --
> > 1.8.3.1
> >
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] PCI/shpchp: fix a bus speed issue on hotplug
2014-05-01 18:13 ` Marcel Apfelbaum
@ 2014-05-01 18:57 ` Marcel Apfelbaum
2014-05-01 20:00 ` Bjorn Helgaas
0 siblings, 1 reply; 12+ messages in thread
From: Marcel Apfelbaum @ 2014-05-01 18:57 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: linux-pci, linux-kernel, Matthew Wilcox, Michael S. Tsirkin
On Thu, 2014-05-01 at 21:13 +0300, Marcel Apfelbaum wrote:
> On Thu, 2014-05-01 at 12:02 -0600, Bjorn Helgaas wrote:
> > On Thu, May 1, 2014 at 8:35 AM, Marcel Apfelbaum <marcel.a@redhat.com> wrote:
> > > When a board is added, the shpchp driver checks if there
> > > is a mismatch between the bridge's adapter and the bus speed.
> > > If there is, it sets the subordinate speed (if there is no device on it).
> > >
> > > However, it takes the reference of the board speed from the primary bus
> > > and not from the subordinate. If the primary bus is PCI and not PCIX/PCIe,
> > > its speed is not updated and remains 0xff. As a result hotplug fails
> > > with error: "Speed of bus ff and adapter 0 mismatch".
> >
> > It'd be cool to have a bugzilla for this with lspci and dmesg output.
> > I'll also have to check the other hotplug drivers for similar issues,
> > unless you've already done that.
> I'll open a BZ with the details, sure.
Done: https://bugzilla.kernel.org/show_bug.cgi?id=75251
If you need further details, please let me know.
Thanks,
Marcel
>
> I didn't check the other hotplug drivers, but I do plan
> to look into PCIe driver as part of QEMU's PCIe hotplug feature.
>
> Thanks,
> Marcel
>
> >
> > > Fixed that by checking the speed against the subordinate bus.
> > >
> > > Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
> > > Acked-by: Michael S. Tsirkin <mst@redhat.com>
> > > ---
> > > drivers/pci/hotplug/shpchp_ctrl.c | 4 ++--
> > > 1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
> > > index 5849927..6efc2ec 100644
> > > --- a/drivers/pci/hotplug/shpchp_ctrl.c
> > > +++ b/drivers/pci/hotplug/shpchp_ctrl.c
> > > @@ -282,8 +282,8 @@ static int board_added(struct slot *p_slot)
> > > return WRONG_BUS_FREQUENCY;
> > > }
> > >
> > > - bsp = ctrl->pci_dev->bus->cur_bus_speed;
> > > - msp = ctrl->pci_dev->bus->max_bus_speed;
> > > + bsp = ctrl->pci_dev->subordinate->cur_bus_speed;
> > > + msp = ctrl->pci_dev->subordinate->max_bus_speed;
> > >
> > > /* Check if there are other slots or devices on the same bus */
> > > if (!list_empty(&ctrl->pci_dev->subordinate->devices))
> > > --
> > > 1.8.3.1
> > >
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] PCI/shpchp: fix a bus speed issue on hotplug
2014-05-01 18:57 ` Marcel Apfelbaum
@ 2014-05-01 20:00 ` Bjorn Helgaas
2014-05-01 20:36 ` Marcel Apfelbaum
2014-05-04 10:40 ` Marcel Apfelbaum
0 siblings, 2 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2014-05-01 20:00 UTC (permalink / raw)
To: marcel.a; +Cc: linux-pci, linux-kernel, Matthew Wilcox, Michael S. Tsirkin
On Thu, May 1, 2014 at 12:57 PM, Marcel Apfelbaum
<marcel.apfelbaum@gmail.com> wrote:
> On Thu, 2014-05-01 at 21:13 +0300, Marcel Apfelbaum wrote:
>> On Thu, 2014-05-01 at 12:02 -0600, Bjorn Helgaas wrote:
>> > On Thu, May 1, 2014 at 8:35 AM, Marcel Apfelbaum <marcel.a@redhat.com> wrote:
>> > > When a board is added, the shpchp driver checks if there
>> > > is a mismatch between the bridge's adapter and the bus speed.
>> > > If there is, it sets the subordinate speed (if there is no device on it).
>> > >
>> > > However, it takes the reference of the board speed from the primary bus
>> > > and not from the subordinate. If the primary bus is PCI and not PCIX/PCIe,
>> > > its speed is not updated and remains 0xff. As a result hotplug fails
>> > > with error: "Speed of bus ff and adapter 0 mismatch".
>> >
>> > It'd be cool to have a bugzilla for this with lspci and dmesg output.
>> > I'll also have to check the other hotplug drivers for similar issues,
>> > unless you've already done that.
>> I'll open a BZ with the details, sure.
> Done: https://bugzilla.kernel.org/show_bug.cgi?id=75251
> If you need further details, please let me know.
Thanks. Would you mind attaching the "lspci -vv" output? That should
show more details, including the information used to compute the bus
speed.
Also, you checked the "regression" box. Can you confirm that and
identify a known-working kernel? If we know which kernels are broken,
we can potentially mark the fix to be backported to them.
Bjorn
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] PCI/shpchp: fix a bus speed issue on hotplug
2014-05-01 20:00 ` Bjorn Helgaas
@ 2014-05-01 20:36 ` Marcel Apfelbaum
2014-05-04 10:40 ` Marcel Apfelbaum
1 sibling, 0 replies; 12+ messages in thread
From: Marcel Apfelbaum @ 2014-05-01 20:36 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: linux-pci, linux-kernel, Matthew Wilcox, Michael S. Tsirkin
On Thu, 2014-05-01 at 14:00 -0600, Bjorn Helgaas wrote:
> On Thu, May 1, 2014 at 12:57 PM, Marcel Apfelbaum
> <marcel.apfelbaum@gmail.com> wrote:
> > On Thu, 2014-05-01 at 21:13 +0300, Marcel Apfelbaum wrote:
> >> On Thu, 2014-05-01 at 12:02 -0600, Bjorn Helgaas wrote:
> >> > On Thu, May 1, 2014 at 8:35 AM, Marcel Apfelbaum <marcel.a@redhat.com> wrote:
> >> > > When a board is added, the shpchp driver checks if there
> >> > > is a mismatch between the bridge's adapter and the bus speed.
> >> > > If there is, it sets the subordinate speed (if there is no device on it).
> >> > >
> >> > > However, it takes the reference of the board speed from the primary bus
> >> > > and not from the subordinate. If the primary bus is PCI and not PCIX/PCIe,
> >> > > its speed is not updated and remains 0xff. As a result hotplug fails
> >> > > with error: "Speed of bus ff and adapter 0 mismatch".
> >> >
> >> > It'd be cool to have a bugzilla for this with lspci and dmesg output.
> >> > I'll also have to check the other hotplug drivers for similar issues,
> >> > unless you've already done that.
> >> I'll open a BZ with the details, sure.
> > Done: https://bugzilla.kernel.org/show_bug.cgi?id=75251
> > If you need further details, please let me know.
>
> Thanks. Would you mind attaching the "lspci -vv" output? That should
> show more details, including the information used to compute the bus
> speed.
Sure, done.
>
> Also, you checked the "regression" box. Can you confirm that and
> identify a known-working kernel? If we know which kernels are broken,
> we can potentially mark the fix to be backported to them.
I checked the regression box based on Michael's comment that in early 2009 it did work.
He pointed out a commit he thinks that caused this regression.
I think it can be backported to all the relevant stable versions since
the commit that introduced the code mentioned in the patch.
Thanks,
Marcel
>
> Bjorn
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] PCI/shpchp: fix a bus speed issue on hotplug
2014-05-01 20:00 ` Bjorn Helgaas
2014-05-01 20:36 ` Marcel Apfelbaum
@ 2014-05-04 10:40 ` Marcel Apfelbaum
1 sibling, 0 replies; 12+ messages in thread
From: Marcel Apfelbaum @ 2014-05-04 10:40 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: linux-pci, linux-kernel, Matthew Wilcox, Michael S. Tsirkin
On Thu, 2014-05-01 at 14:00 -0600, Bjorn Helgaas wrote:
> On Thu, May 1, 2014 at 12:57 PM, Marcel Apfelbaum
> <marcel.apfelbaum@gmail.com> wrote:
> > On Thu, 2014-05-01 at 21:13 +0300, Marcel Apfelbaum wrote:
> >> On Thu, 2014-05-01 at 12:02 -0600, Bjorn Helgaas wrote:
> >> > On Thu, May 1, 2014 at 8:35 AM, Marcel Apfelbaum <marcel.a@redhat.com> wrote:
> >> > > When a board is added, the shpchp driver checks if there
> >> > > is a mismatch between the bridge's adapter and the bus speed.
> >> > > If there is, it sets the subordinate speed (if there is no device on it).
> >> > >
> >> > > However, it takes the reference of the board speed from the primary bus
> >> > > and not from the subordinate. If the primary bus is PCI and not PCIX/PCIe,
> >> > > its speed is not updated and remains 0xff. As a result hotplug fails
> >> > > with error: "Speed of bus ff and adapter 0 mismatch".
> >> >
> >> > It'd be cool to have a bugzilla for this with lspci and dmesg output.
> >> > I'll also have to check the other hotplug drivers for similar issues,
> >> > unless you've already done that.
> >> I'll open a BZ with the details, sure.
> > Done: https://bugzilla.kernel.org/show_bug.cgi?id=75251
> > If you need further details, please let me know.
>
> Thanks. Would you mind attaching the "lspci -vv" output? That should
> show more details, including the information used to compute the bus
> speed.
>
> Also, you checked the "regression" box. Can you confirm that and
> identify a known-working kernel? If we know which kernels are broken,
> we can potentially mark the fix to be backported to them.
I checked 2.6.24-26-generic that comes with Ubuntu 8.04 and it works OK.
So we have a working version.
I hope it helps,
Marcel
>
> Bjorn
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] PCI/shpchp: fix a bus speed issue on hotplug
2014-05-01 14:35 [PATCH] PCI/shpchp: fix a bus speed issue on hotplug Marcel Apfelbaum
2014-05-01 15:43 ` Michael S. Tsirkin
2014-05-01 18:02 ` Bjorn Helgaas
@ 2014-05-04 13:48 ` Ronen Hod
2014-05-04 14:07 ` Marcel Apfelbaum
2014-05-15 18:41 ` Bjorn Helgaas
3 siblings, 1 reply; 12+ messages in thread
From: Ronen Hod @ 2014-05-04 13:48 UTC (permalink / raw)
To: Marcel Apfelbaum, linux-pci; +Cc: linux-kernel, bhelgaas, matthew, mst
On 05/01/2014 05:35 PM, Marcel Apfelbaum wrote:
> When a board is added, the shpchp driver checks if there
> is a mismatch between the bridge's adapter and the bus speed.
> If there is, it sets the subordinate speed (if there is no device on it).
Since the speed is irrelevant when running in a VM, I suggest that
you either ignore it altogether, or "normalize" the speed of all the
devices/bridges/buses in QEMU in order to avoid any conflicts
in the first place.
Thanks, Ronen.
>
> However, it takes the reference of the board speed from the primary bus
> and not from the subordinate. If the primary bus is PCI and not PCIX/PCIe,
> its speed is not updated and remains 0xff. As a result hotplug fails
> with error: "Speed of bus ff and adapter 0 mismatch".
>
> Fixed that by checking the speed against the subordinate bus.
>
> Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
> Acked-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> drivers/pci/hotplug/shpchp_ctrl.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
> index 5849927..6efc2ec 100644
> --- a/drivers/pci/hotplug/shpchp_ctrl.c
> +++ b/drivers/pci/hotplug/shpchp_ctrl.c
> @@ -282,8 +282,8 @@ static int board_added(struct slot *p_slot)
> return WRONG_BUS_FREQUENCY;
> }
>
> - bsp = ctrl->pci_dev->bus->cur_bus_speed;
> - msp = ctrl->pci_dev->bus->max_bus_speed;
> + bsp = ctrl->pci_dev->subordinate->cur_bus_speed;
> + msp = ctrl->pci_dev->subordinate->max_bus_speed;
>
> /* Check if there are other slots or devices on the same bus */
> if (!list_empty(&ctrl->pci_dev->subordinate->devices))
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] PCI/shpchp: fix a bus speed issue on hotplug
2014-05-04 13:48 ` Ronen Hod
@ 2014-05-04 14:07 ` Marcel Apfelbaum
0 siblings, 0 replies; 12+ messages in thread
From: Marcel Apfelbaum @ 2014-05-04 14:07 UTC (permalink / raw)
To: Ronen Hod; +Cc: linux-pci, linux-kernel, bhelgaas, mst
On Sun, 2014-05-04 at 16:48 +0300, Ronen Hod wrote:
> On 05/01/2014 05:35 PM, Marcel Apfelbaum wrote:
> > When a board is added, the shpchp driver checks if there
> > is a mismatch between the bridge's adapter and the bus speed.
> > If there is, it sets the subordinate speed (if there is no device on it).
>
> Since the speed is irrelevant when running in a VM, I suggest that
> you either ignore it altogether, or "normalize" the speed of all the
> devices/bridges/buses in QEMU in order to avoid any conflicts
> in the first place.
Before this patch, this would not help since the primary bus speed
is not even set by the kernel.
After this patch, normalizing the QEMU device/bus/... speed may help
avoiding future conflicts, but we should discuss it in qemu mailing list :).
Ignoring emulated/para-virt device's speed when running in a VM it is\
a good question, but I don't know if such a distinction would be feasible.
Any thoughts would be appreciated,
Thanks,
Marcel
>
> Thanks, Ronen.
>
> >
> > However, it takes the reference of the board speed from the primary bus
> > and not from the subordinate. If the primary bus is PCI and not PCIX/PCIe,
> > its speed is not updated and remains 0xff. As a result hotplug fails
> > with error: "Speed of bus ff and adapter 0 mismatch".
> >
> > Fixed that by checking the speed against the subordinate bus.
> >
> > Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
> > Acked-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> > drivers/pci/hotplug/shpchp_ctrl.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
> > index 5849927..6efc2ec 100644
> > --- a/drivers/pci/hotplug/shpchp_ctrl.c
> > +++ b/drivers/pci/hotplug/shpchp_ctrl.c
> > @@ -282,8 +282,8 @@ static int board_added(struct slot *p_slot)
> > return WRONG_BUS_FREQUENCY;
> > }
> >
> > - bsp = ctrl->pci_dev->bus->cur_bus_speed;
> > - msp = ctrl->pci_dev->bus->max_bus_speed;
> > + bsp = ctrl->pci_dev->subordinate->cur_bus_speed;
> > + msp = ctrl->pci_dev->subordinate->max_bus_speed;
> >
> > /* Check if there are other slots or devices on the same bus */
> > if (!list_empty(&ctrl->pci_dev->subordinate->devices))
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] PCI/shpchp: fix a bus speed issue on hotplug
2014-05-01 14:35 [PATCH] PCI/shpchp: fix a bus speed issue on hotplug Marcel Apfelbaum
` (2 preceding siblings ...)
2014-05-04 13:48 ` Ronen Hod
@ 2014-05-15 18:41 ` Bjorn Helgaas
2014-05-17 18:47 ` Michael S. Tsirkin
3 siblings, 1 reply; 12+ messages in thread
From: Bjorn Helgaas @ 2014-05-15 18:41 UTC (permalink / raw)
To: Marcel Apfelbaum; +Cc: linux-pci, linux-kernel, matthew, mst
On Thu, May 01, 2014 at 05:35:48PM +0300, Marcel Apfelbaum wrote:
> When a board is added, the shpchp driver checks if there
> is a mismatch between the bridge's adapter and the bus speed.
> If there is, it sets the subordinate speed (if there is no device on it).
>
> However, it takes the reference of the board speed from the primary bus
> and not from the subordinate. If the primary bus is PCI and not PCIX/PCIe,
> its speed is not updated and remains 0xff. As a result hotplug fails
> with error: "Speed of bus ff and adapter 0 mismatch".
>
> Fixed that by checking the speed against the subordinate bus.
>
> Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
> Acked-by: Michael S. Tsirkin <mst@redhat.com>
I think cpqphp has similar issues. But I can't test it and I don't know if
anybody even uses it any more, so I'm just going to leave it alone.
I reworked the changelog because I got confused about the bridge, adapter,
board, and what was what. Let me know if the one below is inaccurate.
I'll include this for v3.15 since it's a regression fix.
Thanks,
Bjorn
commit be219b7f518a36f62d67f057e9d31ebe9674814f
Author: Marcel Apfelbaum <marcel.a@redhat.com>
Date: Thu May 1 17:35:48 2014 +0300
PCI: shpchp: Check bridge's secondary (not primary) bus speed
When a new device is added below a hotplug bridge, the bridge's secondary
bus speed and the device's bus speed must match. The shpchp driver
previously checked the bridge's *primary* bus speed, not the secondary bus
speed.
This caused hot-add errors like:
shpchp 0000:00:03.0: Speed of bus ff and adapter 0 mismatch
Check the secondary bus speed instead.
[bhelgaas: changelog]
Link: https://bugzilla.kernel.org/show_bug.cgi?id=75251
Fixes: 3749c51ac6c1 ("PCI: Make current and maximum bus speeds part of the PCI core")
Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
CC: stable@vger.kernel.org # v2.6.34+
diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
index 58499277903a..6efc2ec5e4db 100644
--- a/drivers/pci/hotplug/shpchp_ctrl.c
+++ b/drivers/pci/hotplug/shpchp_ctrl.c
@@ -282,8 +282,8 @@ static int board_added(struct slot *p_slot)
return WRONG_BUS_FREQUENCY;
}
- bsp = ctrl->pci_dev->bus->cur_bus_speed;
- msp = ctrl->pci_dev->bus->max_bus_speed;
+ bsp = ctrl->pci_dev->subordinate->cur_bus_speed;
+ msp = ctrl->pci_dev->subordinate->max_bus_speed;
/* Check if there are other slots or devices on the same bus */
if (!list_empty(&ctrl->pci_dev->subordinate->devices))
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] PCI/shpchp: fix a bus speed issue on hotplug
2014-05-15 18:41 ` Bjorn Helgaas
@ 2014-05-17 18:47 ` Michael S. Tsirkin
0 siblings, 0 replies; 12+ messages in thread
From: Michael S. Tsirkin @ 2014-05-17 18:47 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: Marcel Apfelbaum, linux-pci, linux-kernel, matthew
On Thu, May 15, 2014 at 12:41:46PM -0600, Bjorn Helgaas wrote:
> On Thu, May 01, 2014 at 05:35:48PM +0300, Marcel Apfelbaum wrote:
> > When a board is added, the shpchp driver checks if there
> > is a mismatch between the bridge's adapter and the bus speed.
> > If there is, it sets the subordinate speed (if there is no device on it).
> >
> > However, it takes the reference of the board speed from the primary bus
> > and not from the subordinate. If the primary bus is PCI and not PCIX/PCIe,
> > its speed is not updated and remains 0xff. As a result hotplug fails
> > with error: "Speed of bus ff and adapter 0 mismatch".
> >
> > Fixed that by checking the speed against the subordinate bus.
> >
> > Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
> > Acked-by: Michael S. Tsirkin <mst@redhat.com>
>
> I think cpqphp has similar issues. But I can't test it and I don't know if
> anybody even uses it any more, so I'm just going to leave it alone.
>
> I reworked the changelog because I got confused about the bridge, adapter,
> board, and what was what. Let me know if the one below is inaccurate.
It's accurate I think. I only wish someone reworked the actual
shpchp code to avoid the confusing adapter/board terminology.
> I'll include this for v3.15 since it's a regression fix.
>
> Thanks,
> Bjorn
>
> commit be219b7f518a36f62d67f057e9d31ebe9674814f
> Author: Marcel Apfelbaum <marcel.a@redhat.com>
> Date: Thu May 1 17:35:48 2014 +0300
>
> PCI: shpchp: Check bridge's secondary (not primary) bus speed
>
> When a new device is added below a hotplug bridge, the bridge's secondary
> bus speed and the device's bus speed must match. The shpchp driver
> previously checked the bridge's *primary* bus speed, not the secondary bus
> speed.
>
> This caused hot-add errors like:
>
> shpchp 0000:00:03.0: Speed of bus ff and adapter 0 mismatch
>
> Check the secondary bus speed instead.
>
> [bhelgaas: changelog]
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=75251
> Fixes: 3749c51ac6c1 ("PCI: Make current and maximum bus speeds part of the PCI core")
> Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> Acked-by: Michael S. Tsirkin <mst@redhat.com>
> CC: stable@vger.kernel.org # v2.6.34+
>
> diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
> index 58499277903a..6efc2ec5e4db 100644
> --- a/drivers/pci/hotplug/shpchp_ctrl.c
> +++ b/drivers/pci/hotplug/shpchp_ctrl.c
> @@ -282,8 +282,8 @@ static int board_added(struct slot *p_slot)
> return WRONG_BUS_FREQUENCY;
> }
>
> - bsp = ctrl->pci_dev->bus->cur_bus_speed;
> - msp = ctrl->pci_dev->bus->max_bus_speed;
> + bsp = ctrl->pci_dev->subordinate->cur_bus_speed;
> + msp = ctrl->pci_dev->subordinate->max_bus_speed;
>
> /* Check if there are other slots or devices on the same bus */
> if (!list_empty(&ctrl->pci_dev->subordinate->devices))
^ permalink raw reply [flat|nested] 12+ messages in thread