All of lore.kernel.org
 help / color / mirror / Atom feed
* RE: [Resend PATCH 1/2 v3] pci-hyperv: properly handle pci bus remove
       [not found] <1485236721-27620-1-git-send-email-longli@exchange.microsoft.com>
@ 2017-01-27 18:42 ` KY Srinivasan
  2017-02-11  1:18     ` Long Li
  0 siblings, 1 reply; 8+ messages in thread
From: KY Srinivasan @ 2017-01-27 18:42 UTC (permalink / raw)
  To: Long Li, Haiyang Zhang, Bjorn Helgaas
  Cc: devel, linux-pci, linux-kernel, Long Li



> -----Original Message-----
> From: Long Li [mailto:longli@exchange.microsoft.com]
> Sent: Monday, January 23, 2017 9:45 PM
> To: KY Srinivasan <kys@microsoft.com>; Haiyang Zhang
> <haiyangz@microsoft.com>; Bjorn Helgaas <bhelgaas@google.com>
> Cc: devel@linuxdriverproject.org; linux-pci@vger.kernel.org; linux-
> kernel@vger.kernel.org; Long Li <longli@microsoft.com>
> Subject: [Resend PATCH 1/2 v3] pci-hyperv: properly handle pci bus remove
> 
> [This sender failed our fraud detection checks and may not be who they
> appear to be. Learn about spoofing at http://aka.ms/LearnAboutSpoofing]
> 
> From: Long Li <longli@microsoft.com>
> 
> hv_pci_devices_present is called in hv_pci_remove when we remove a PCI
> device from host (e.g. by disabling SRIOV on a device). In hv_pci_remove,
> the bus is already removed before the call, so we don't need to rescan the
> bus in the workqueue scheduled from hv_pci_devices_present. By
> introducing status hv_pcibus_removed, we can avoid this situation.
> 
> Signed-off-by: Long Li <longli@microsoft.com>
> Reported-by: Xiaofeng Wang <xiaofwan@redhat.com>
Acked-by: K. Y. Srinivasan <kys@microsoft.com>
> ---
>  drivers/pci/host/pci-hyperv.c | 20 +++++++++++++++++---
>  1 file changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
> index a8deeca..4a37598 100644
> --- a/drivers/pci/host/pci-hyperv.c
> +++ b/drivers/pci/host/pci-hyperv.c
> @@ -348,6 +348,7 @@ enum hv_pcibus_state {
>         hv_pcibus_init = 0,
>         hv_pcibus_probed,
>         hv_pcibus_installed,
> +       hv_pcibus_removed,
>         hv_pcibus_maximum
>  };
> 
> @@ -1481,13 +1482,24 @@ static void pci_devices_present_work(struct
> work_struct *work)
>                 put_pcichild(hpdev, hv_pcidev_ref_initial);
>         }
> 
> -       /* Tell the core to rescan bus because there may have been changes. */
> -       if (hbus->state == hv_pcibus_installed) {
> +       switch (hbus->state) {
> +       case hv_pcibus_installed:
> +               /*
> +                * Tell the core to rescan bus
> +                * because there may have been changes.
> +                */
>                 pci_lock_rescan_remove();
>                 pci_scan_child_bus(hbus->pci_bus);
>                 pci_unlock_rescan_remove();
> -       } else {
> +               break;
> +
> +       case hv_pcibus_init:
> +       case hv_pcibus_probed:
>                 survey_child_resources(hbus);
> +               break;
> +
> +       default:
> +               break;
>         }
> 
>         up(&hbus->enum_sem);
> @@ -2163,6 +2175,7 @@ static int hv_pci_probe(struct hv_device *hdev,
>         hbus = kzalloc(sizeof(*hbus), GFP_KERNEL);
>         if (!hbus)
>                 return -ENOMEM;
> +       hbus->state = hv_pcibus_init;
> 
>         /*
>          * The PCI bus "domain" is what is called "segment" in ACPI and
> @@ -2305,6 +2318,7 @@ static int hv_pci_remove(struct hv_device *hdev)
>                 pci_stop_root_bus(hbus->pci_bus);
>                 pci_remove_root_bus(hbus->pci_bus);
>                 pci_unlock_rescan_remove();
> +               hbus->state = hv_pcibus_removed;
>         }
> 
>         ret = hv_send_resources_released(hdev);
> --
> 1.8.5.6

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [Resend PATCH 1/2 v3] pci-hyperv: properly handle pci bus remove
  2017-01-27 18:42 ` [Resend PATCH 1/2 v3] pci-hyperv: properly handle pci bus remove KY Srinivasan
@ 2017-02-11  1:18     ` Long Li
  0 siblings, 0 replies; 8+ messages in thread
From: Long Li @ 2017-02-11  1:18 UTC (permalink / raw)
  To: KY Srinivasan, Haiyang Zhang, Bjorn Helgaas
  Cc: devel, linux-pci, linux-kernel

Hi Bjorn,

This patch and the other one in the series ([Resend PATCH 2/2 v3] pci-hyperv: lock pci bus on device eject) have been Acked.

Is there anything else should be done before it can be merged? Please let me know.

Thanks

Long

> -----Original Message-----
> From: KY Srinivasan
> Sent: Friday, January 27, 2017 10:42 AM
> To: Long Li <longli@microsoft.com>; Haiyang Zhang
> <haiyangz@microsoft.com>; Bjorn Helgaas <bhelgaas@google.com>
> Cc: devel@linuxdriverproject.org; linux-pci@vger.kernel.org; linux-
> kernel@vger.kernel.org; Long Li <longli@microsoft.com>
> Subject: RE: [Resend PATCH 1/2 v3] pci-hyperv: properly handle pci bus
> remove
> 
> 
> 
> > -----Original Message-----
> > From: Long Li [mailto:longli@exchange.microsoft.com]
> > Sent: Monday, January 23, 2017 9:45 PM
> > To: KY Srinivasan <kys@microsoft.com>; Haiyang Zhang
> > <haiyangz@microsoft.com>; Bjorn Helgaas <bhelgaas@google.com>
> > Cc: devel@linuxdriverproject.org; linux-pci@vger.kernel.org; linux-
> > kernel@vger.kernel.org; Long Li <longli@microsoft.com>
> > Subject: [Resend PATCH 1/2 v3] pci-hyperv: properly handle pci bus
> > remove
> >
> > [This sender failed our fraud detection checks and may not be who they
> > appear to be. Learn about spoofing at
> > http://aka.ms/LearnAboutSpoofing]
> >
> > From: Long Li <longli@microsoft.com>
> >
> > hv_pci_devices_present is called in hv_pci_remove when we remove a PCI
> > device from host (e.g. by disabling SRIOV on a device). In
> > hv_pci_remove, the bus is already removed before the call, so we don't
> > need to rescan the bus in the workqueue scheduled from
> > hv_pci_devices_present. By introducing status hv_pcibus_removed, we
> can avoid this situation.
> >
> > Signed-off-by: Long Li <longli@microsoft.com>
> > Reported-by: Xiaofeng Wang <xiaofwan@redhat.com>
> Acked-by: K. Y. Srinivasan <kys@microsoft.com>
> > ---
> >  drivers/pci/host/pci-hyperv.c | 20 +++++++++++++++++---
> >  1 file changed, 17 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/pci/host/pci-hyperv.c
> > b/drivers/pci/host/pci-hyperv.c index a8deeca..4a37598 100644
> > --- a/drivers/pci/host/pci-hyperv.c
> > +++ b/drivers/pci/host/pci-hyperv.c
> > @@ -348,6 +348,7 @@ enum hv_pcibus_state {
> >         hv_pcibus_init = 0,
> >         hv_pcibus_probed,
> >         hv_pcibus_installed,
> > +       hv_pcibus_removed,
> >         hv_pcibus_maximum
> >  };
> >
> > @@ -1481,13 +1482,24 @@ static void pci_devices_present_work(struct
> > work_struct *work)
> >                 put_pcichild(hpdev, hv_pcidev_ref_initial);
> >         }
> >
> > -       /* Tell the core to rescan bus because there may have been changes.
> */
> > -       if (hbus->state == hv_pcibus_installed) {
> > +       switch (hbus->state) {
> > +       case hv_pcibus_installed:
> > +               /*
> > +                * Tell the core to rescan bus
> > +                * because there may have been changes.
> > +                */
> >                 pci_lock_rescan_remove();
> >                 pci_scan_child_bus(hbus->pci_bus);
> >                 pci_unlock_rescan_remove();
> > -       } else {
> > +               break;
> > +
> > +       case hv_pcibus_init:
> > +       case hv_pcibus_probed:
> >                 survey_child_resources(hbus);
> > +               break;
> > +
> > +       default:
> > +               break;
> >         }
> >
> >         up(&hbus->enum_sem);
> > @@ -2163,6 +2175,7 @@ static int hv_pci_probe(struct hv_device *hdev,
> >         hbus = kzalloc(sizeof(*hbus), GFP_KERNEL);
> >         if (!hbus)
> >                 return -ENOMEM;
> > +       hbus->state = hv_pcibus_init;
> >
> >         /*
> >          * The PCI bus "domain" is what is called "segment" in ACPI
> > and @@ -2305,6 +2318,7 @@ static int hv_pci_remove(struct hv_device
> *hdev)
> >                 pci_stop_root_bus(hbus->pci_bus);
> >                 pci_remove_root_bus(hbus->pci_bus);
> >                 pci_unlock_rescan_remove();
> > +               hbus->state = hv_pcibus_removed;
> >         }
> >
> >         ret = hv_send_resources_released(hdev);
> > --
> > 1.8.5.6

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [Resend PATCH 1/2 v3] pci-hyperv: properly handle pci bus remove
@ 2017-02-11  1:18     ` Long Li
  0 siblings, 0 replies; 8+ messages in thread
From: Long Li @ 2017-02-11  1:18 UTC (permalink / raw)
  To: KY Srinivasan, Haiyang Zhang, Bjorn Helgaas
  Cc: devel, linux-pci, linux-kernel

Hi Bjorn,

This patch and the other one in the series ([Resend PATCH 2/2 v3] pci-hyper=
v: lock pci bus on device eject) have been Acked.

Is there anything else should be done before it can be merged? Please let m=
e know.

Thanks

Long

> -----Original Message-----
> From: KY Srinivasan
> Sent: Friday, January 27, 2017 10:42 AM
> To: Long Li <longli@microsoft.com>; Haiyang Zhang
> <haiyangz@microsoft.com>; Bjorn Helgaas <bhelgaas@google.com>
> Cc: devel@linuxdriverproject.org; linux-pci@vger.kernel.org; linux-
> kernel@vger.kernel.org; Long Li <longli@microsoft.com>
> Subject: RE: [Resend PATCH 1/2 v3] pci-hyperv: properly handle pci bus
> remove
>=20
>=20
>=20
> > -----Original Message-----
> > From: Long Li [mailto:longli@exchange.microsoft.com]
> > Sent: Monday, January 23, 2017 9:45 PM
> > To: KY Srinivasan <kys@microsoft.com>; Haiyang Zhang
> > <haiyangz@microsoft.com>; Bjorn Helgaas <bhelgaas@google.com>
> > Cc: devel@linuxdriverproject.org; linux-pci@vger.kernel.org; linux-
> > kernel@vger.kernel.org; Long Li <longli@microsoft.com>
> > Subject: [Resend PATCH 1/2 v3] pci-hyperv: properly handle pci bus
> > remove
> >
> > [This sender failed our fraud detection checks and may not be who they
> > appear to be. Learn about spoofing at
> > http://aka.ms/LearnAboutSpoofing]
> >
> > From: Long Li <longli@microsoft.com>
> >
> > hv_pci_devices_present is called in hv_pci_remove when we remove a PCI
> > device from host (e.g. by disabling SRIOV on a device). In
> > hv_pci_remove, the bus is already removed before the call, so we don't
> > need to rescan the bus in the workqueue scheduled from
> > hv_pci_devices_present. By introducing status hv_pcibus_removed, we
> can avoid this situation.
> >
> > Signed-off-by: Long Li <longli@microsoft.com>
> > Reported-by: Xiaofeng Wang <xiaofwan@redhat.com>
> Acked-by: K. Y. Srinivasan <kys@microsoft.com>
> > ---
> >  drivers/pci/host/pci-hyperv.c | 20 +++++++++++++++++---
> >  1 file changed, 17 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/pci/host/pci-hyperv.c
> > b/drivers/pci/host/pci-hyperv.c index a8deeca..4a37598 100644
> > --- a/drivers/pci/host/pci-hyperv.c
> > +++ b/drivers/pci/host/pci-hyperv.c
> > @@ -348,6 +348,7 @@ enum hv_pcibus_state {
> >         hv_pcibus_init =3D 0,
> >         hv_pcibus_probed,
> >         hv_pcibus_installed,
> > +       hv_pcibus_removed,
> >         hv_pcibus_maximum
> >  };
> >
> > @@ -1481,13 +1482,24 @@ static void pci_devices_present_work(struct
> > work_struct *work)
> >                 put_pcichild(hpdev, hv_pcidev_ref_initial);
> >         }
> >
> > -       /* Tell the core to rescan bus because there may have been chan=
ges.
> */
> > -       if (hbus->state =3D=3D hv_pcibus_installed) {
> > +       switch (hbus->state) {
> > +       case hv_pcibus_installed:
> > +               /*
> > +                * Tell the core to rescan bus
> > +                * because there may have been changes.
> > +                */
> >                 pci_lock_rescan_remove();
> >                 pci_scan_child_bus(hbus->pci_bus);
> >                 pci_unlock_rescan_remove();
> > -       } else {
> > +               break;
> > +
> > +       case hv_pcibus_init:
> > +       case hv_pcibus_probed:
> >                 survey_child_resources(hbus);
> > +               break;
> > +
> > +       default:
> > +               break;
> >         }
> >
> >         up(&hbus->enum_sem);
> > @@ -2163,6 +2175,7 @@ static int hv_pci_probe(struct hv_device *hdev,
> >         hbus =3D kzalloc(sizeof(*hbus), GFP_KERNEL);
> >         if (!hbus)
> >                 return -ENOMEM;
> > +       hbus->state =3D hv_pcibus_init;
> >
> >         /*
> >          * The PCI bus "domain" is what is called "segment" in ACPI
> > and @@ -2305,6 +2318,7 @@ static int hv_pci_remove(struct hv_device
> *hdev)
> >                 pci_stop_root_bus(hbus->pci_bus);
> >                 pci_remove_root_bus(hbus->pci_bus);
> >                 pci_unlock_rescan_remove();
> > +               hbus->state =3D hv_pcibus_removed;
> >         }
> >
> >         ret =3D hv_send_resources_released(hdev);
> > --
> > 1.8.5.6

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Resend PATCH 1/2 v3] pci-hyperv: properly handle pci bus remove
  2017-02-11  1:18     ` Long Li
  (?)
@ 2017-02-11 17:35     ` Bjorn Helgaas
  2017-02-13 19:02         ` Long Li
  -1 siblings, 1 reply; 8+ messages in thread
From: Bjorn Helgaas @ 2017-02-11 17:35 UTC (permalink / raw)
  To: Long Li; +Cc: KY Srinivasan, Haiyang Zhang, devel, linux-pci, linux-kernel

On Fri, Feb 10, 2017 at 7:18 PM, Long Li <longli@microsoft.com> wrote:
> Hi Bjorn,
>
> This patch and the other one in the series ([Resend PATCH 2/2 v3] pci-hyperv: lock pci bus on device eject) have been Acked.
>
> Is there anything else should be done before it can be merged? Please let me know.

Sorry, I don't know what happened here.  I see your Jan 23 posting in
my work email (bhelgaas@google.com), but I don't see it on the
linux-pci or linux-kernel lists, and patchwork [1] doesn't have a copy
either.   I suspect there was something about your email that made
vger drop it (maybe an HTML or other "fancy" stuff per
http://vger.kernel.org/majordomo-info.html).

Patchwork works by subscribing to linux-pci and collecting things that
look like patches.  Then I work from patchwork as a to-do list.
That's a convenient way to ensure that patches appear on the mailing
list before I apply them.  It also means that if a patch doesn't
appear on linux-pci and subsequently in patchwork, I don't know about
it.

Patchwork does have copies of previous versions, but I marked them
"changes requested".  When I do that, the patch drops off the to-do
list because I'm expecting a new version, which *will* appear on the
list.  I don't mark things "changes requested" if I'm only waiting for
an ack, so it looks like the only change I was looking for was a
changelog revision.  Normally I just tweak changelogs myself, so I
apologize for not doing that in this case.

Anyway, can you just post the current version, including the acks, and
make sure it shows up on the mailing list?

I'm sorry this has languished so long.  Thanks for reminding me about
it so we can sort this out.

[1] https://patchwork.ozlabs.org/project/linux-pci/list/?submitter=69886&state=*&q=&archive=both&delegate=

>> -----Original Message-----
>> From: KY Srinivasan
>> Sent: Friday, January 27, 2017 10:42 AM
>> To: Long Li <longli@microsoft.com>; Haiyang Zhang
>> <haiyangz@microsoft.com>; Bjorn Helgaas <bhelgaas@google.com>
>> Cc: devel@linuxdriverproject.org; linux-pci@vger.kernel.org; linux-
>> kernel@vger.kernel.org; Long Li <longli@microsoft.com>
>> Subject: RE: [Resend PATCH 1/2 v3] pci-hyperv: properly handle pci bus
>> remove
>>
>>
>>
>> > -----Original Message-----
>> > From: Long Li [mailto:longli@exchange.microsoft.com]
>> > Sent: Monday, January 23, 2017 9:45 PM
>> > To: KY Srinivasan <kys@microsoft.com>; Haiyang Zhang
>> > <haiyangz@microsoft.com>; Bjorn Helgaas <bhelgaas@google.com>
>> > Cc: devel@linuxdriverproject.org; linux-pci@vger.kernel.org; linux-
>> > kernel@vger.kernel.org; Long Li <longli@microsoft.com>
>> > Subject: [Resend PATCH 1/2 v3] pci-hyperv: properly handle pci bus
>> > remove
>> >
>> > [This sender failed our fraud detection checks and may not be who they
>> > appear to be. Learn about spoofing at
>> > http://aka.ms/LearnAboutSpoofing]
>> >
>> > From: Long Li <longli@microsoft.com>
>> >
>> > hv_pci_devices_present is called in hv_pci_remove when we remove a PCI
>> > device from host (e.g. by disabling SRIOV on a device). In
>> > hv_pci_remove, the bus is already removed before the call, so we don't
>> > need to rescan the bus in the workqueue scheduled from
>> > hv_pci_devices_present. By introducing status hv_pcibus_removed, we
>> can avoid this situation.
>> >
>> > Signed-off-by: Long Li <longli@microsoft.com>
>> > Reported-by: Xiaofeng Wang <xiaofwan@redhat.com>
>> Acked-by: K. Y. Srinivasan <kys@microsoft.com>
>> > ---
>> >  drivers/pci/host/pci-hyperv.c | 20 +++++++++++++++++---
>> >  1 file changed, 17 insertions(+), 3 deletions(-)
>> >
>> > diff --git a/drivers/pci/host/pci-hyperv.c
>> > b/drivers/pci/host/pci-hyperv.c index a8deeca..4a37598 100644
>> > --- a/drivers/pci/host/pci-hyperv.c
>> > +++ b/drivers/pci/host/pci-hyperv.c
>> > @@ -348,6 +348,7 @@ enum hv_pcibus_state {
>> >         hv_pcibus_init = 0,
>> >         hv_pcibus_probed,
>> >         hv_pcibus_installed,
>> > +       hv_pcibus_removed,
>> >         hv_pcibus_maximum
>> >  };
>> >
>> > @@ -1481,13 +1482,24 @@ static void pci_devices_present_work(struct
>> > work_struct *work)
>> >                 put_pcichild(hpdev, hv_pcidev_ref_initial);
>> >         }
>> >
>> > -       /* Tell the core to rescan bus because there may have been changes.
>> */
>> > -       if (hbus->state == hv_pcibus_installed) {
>> > +       switch (hbus->state) {
>> > +       case hv_pcibus_installed:
>> > +               /*
>> > +                * Tell the core to rescan bus
>> > +                * because there may have been changes.
>> > +                */
>> >                 pci_lock_rescan_remove();
>> >                 pci_scan_child_bus(hbus->pci_bus);
>> >                 pci_unlock_rescan_remove();
>> > -       } else {
>> > +               break;
>> > +
>> > +       case hv_pcibus_init:
>> > +       case hv_pcibus_probed:
>> >                 survey_child_resources(hbus);
>> > +               break;
>> > +
>> > +       default:
>> > +               break;
>> >         }
>> >
>> >         up(&hbus->enum_sem);
>> > @@ -2163,6 +2175,7 @@ static int hv_pci_probe(struct hv_device *hdev,
>> >         hbus = kzalloc(sizeof(*hbus), GFP_KERNEL);
>> >         if (!hbus)
>> >                 return -ENOMEM;
>> > +       hbus->state = hv_pcibus_init;
>> >
>> >         /*
>> >          * The PCI bus "domain" is what is called "segment" in ACPI
>> > and @@ -2305,6 +2318,7 @@ static int hv_pci_remove(struct hv_device
>> *hdev)
>> >                 pci_stop_root_bus(hbus->pci_bus);
>> >                 pci_remove_root_bus(hbus->pci_bus);
>> >                 pci_unlock_rescan_remove();
>> > +               hbus->state = hv_pcibus_removed;
>> >         }
>> >
>> >         ret = hv_send_resources_released(hdev);
>> > --
>> > 1.8.5.6
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [Resend PATCH 1/2 v3] pci-hyperv: properly handle pci bus remove
  2017-02-11 17:35     ` Bjorn Helgaas
@ 2017-02-13 19:02         ` Long Li
  0 siblings, 0 replies; 8+ messages in thread
From: Long Li @ 2017-02-13 19:02 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: KY Srinivasan, Haiyang Zhang, devel, linux-pci, linux-kernel

> -----Original Message-----
> From: Bjorn Helgaas [mailto:bhelgaas@google.com]
> Sent: Saturday, February 11, 2017 9:35 AM
> To: Long Li <longli@microsoft.com>
> Cc: KY Srinivasan <kys@microsoft.com>; Haiyang Zhang
> <haiyangz@microsoft.com>; devel@linuxdriverproject.org; linux-
> pci@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [Resend PATCH 1/2 v3] pci-hyperv: properly handle pci bus
> remove
> 
> On Fri, Feb 10, 2017 at 7:18 PM, Long Li <longli@microsoft.com> wrote:
> > Hi Bjorn,
> >
> > This patch and the other one in the series ([Resend PATCH 2/2 v3] pci-
> hyperv: lock pci bus on device eject) have been Acked.
> >
> > Is there anything else should be done before it can be merged? Please let
> me know.
> 
> Sorry, I don't know what happened here.  I see your Jan 23 posting in my
> work email (bhelgaas@google.com), but I don't see it on the linux-pci or
> linux-kernel lists, and patchwork [1] doesn't have a copy
> either.   I suspect there was something about your email that made
> vger drop it (maybe an HTML or other "fancy" stuff per
> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvger.ke
> rnel.org%2Fmajordomo-
> info.html&data=02%7C01%7Clongli%40microsoft.com%7Cd3d9fb666bdd4244
> 901b08d452a4692b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C63
> 6224313474452403&sdata=UcQu75mTXO3xh5ot%2FZTRDgL5GXayaXjs%2Fugt
> wWe91Ko%3D&reserved=0).
> 
> Patchwork works by subscribing to linux-pci and collecting things that look
> like patches.  Then I work from patchwork as a to-do list.
> That's a convenient way to ensure that patches appear on the mailing list
> before I apply them.  It also means that if a patch doesn't appear on linux-pci
> and subsequently in patchwork, I don't know about it.
> 
> Patchwork does have copies of previous versions, but I marked them
> "changes requested".  When I do that, the patch drops off the to-do list
> because I'm expecting a new version, which *will* appear on the list.  I don't
> mark things "changes requested" if I'm only waiting for an ack, so it looks like
> the only change I was looking for was a changelog revision.  Normally I just
> tweak changelogs myself, so I apologize for not doing that in this case.
> 
> Anyway, can you just post the current version, including the acks, and make
> sure it shows up on the mailing list?
> 
> I'm sorry this has languished so long.  Thanks for reminding me about it so we
> can sort this out.

Thank you. I will fix the email and resend the patch.

> 
> [1]
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatch
> work.ozlabs.org%2Fproject%2Flinux-
> pci%2Flist%2F%3Fsubmitter%3D69886%26state%3D*%26q%3D%26archive%3
> Dboth%26delegate&data=02%7C01%7Clongli%40microsoft.com%7Cd3d9fb66
> 6bdd4244901b08d452a4692b%7C72f988bf86f141af91ab2d7cd011db47%7C1%
> 7C0%7C636224313474452403&sdata=ELx04yDnSbe1fxXLy7z2iFoKwazKEMlDLrl
> p4CWhXbk%3D&reserved=0=
> 
> >> -----Original Message-----
> >> From: KY Srinivasan
> >> Sent: Friday, January 27, 2017 10:42 AM
> >> To: Long Li <longli@microsoft.com>; Haiyang Zhang
> >> <haiyangz@microsoft.com>; Bjorn Helgaas <bhelgaas@google.com>
> >> Cc: devel@linuxdriverproject.org; linux-pci@vger.kernel.org; linux-
> >> kernel@vger.kernel.org; Long Li <longli@microsoft.com>
> >> Subject: RE: [Resend PATCH 1/2 v3] pci-hyperv: properly handle pci
> >> bus remove
> >>
> >>
> >>
> >> > -----Original Message-----
> >> > From: Long Li [mailto:longli@exchange.microsoft.com]
> >> > Sent: Monday, January 23, 2017 9:45 PM
> >> > To: KY Srinivasan <kys@microsoft.com>; Haiyang Zhang
> >> > <haiyangz@microsoft.com>; Bjorn Helgaas <bhelgaas@google.com>
> >> > Cc: devel@linuxdriverproject.org; linux-pci@vger.kernel.org; linux-
> >> > kernel@vger.kernel.org; Long Li <longli@microsoft.com>
> >> > Subject: [Resend PATCH 1/2 v3] pci-hyperv: properly handle pci bus
> >> > remove
> >> >
> >> > [This sender failed our fraud detection checks and may not be who
> >> > they appear to be. Learn about spoofing at
> >> >
> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Faka
> >> >
> .ms%2FLearnAboutSpoofing&data=02%7C01%7Clongli%40microsoft.com%7C
> d3
> >> >
> d9fb666bdd4244901b08d452a4692b%7C72f988bf86f141af91ab2d7cd011db47
> %7
> >> >
> C1%7C0%7C636224313474452403&sdata=jlfhIYsJJT4HbcPGSPTk43AApcip%2F
> 9m
> >> > w7snnFn%2FvI74%3D&reserved=0]
> >> >
> >> > From: Long Li <longli@microsoft.com>
> >> >
> >> > hv_pci_devices_present is called in hv_pci_remove when we remove a
> >> > PCI device from host (e.g. by disabling SRIOV on a device). In
> >> > hv_pci_remove, the bus is already removed before the call, so we
> >> > don't need to rescan the bus in the workqueue scheduled from
> >> > hv_pci_devices_present. By introducing status hv_pcibus_removed, we
> >> can avoid this situation.
> >> >
> >> > Signed-off-by: Long Li <longli@microsoft.com>
> >> > Reported-by: Xiaofeng Wang <xiaofwan@redhat.com>
> >> Acked-by: K. Y. Srinivasan <kys@microsoft.com>
> >> > ---
> >> >  drivers/pci/host/pci-hyperv.c | 20 +++++++++++++++++---
> >> >  1 file changed, 17 insertions(+), 3 deletions(-)
> >> >
> >> > diff --git a/drivers/pci/host/pci-hyperv.c
> >> > b/drivers/pci/host/pci-hyperv.c index a8deeca..4a37598 100644
> >> > --- a/drivers/pci/host/pci-hyperv.c
> >> > +++ b/drivers/pci/host/pci-hyperv.c
> >> > @@ -348,6 +348,7 @@ enum hv_pcibus_state {
> >> >         hv_pcibus_init = 0,
> >> >         hv_pcibus_probed,
> >> >         hv_pcibus_installed,
> >> > +       hv_pcibus_removed,
> >> >         hv_pcibus_maximum
> >> >  };
> >> >
> >> > @@ -1481,13 +1482,24 @@ static void pci_devices_present_work(struct
> >> > work_struct *work)
> >> >                 put_pcichild(hpdev, hv_pcidev_ref_initial);
> >> >         }
> >> >
> >> > -       /* Tell the core to rescan bus because there may have been
> changes.
> >> */
> >> > -       if (hbus->state == hv_pcibus_installed) {
> >> > +       switch (hbus->state) {
> >> > +       case hv_pcibus_installed:
> >> > +               /*
> >> > +                * Tell the core to rescan bus
> >> > +                * because there may have been changes.
> >> > +                */
> >> >                 pci_lock_rescan_remove();
> >> >                 pci_scan_child_bus(hbus->pci_bus);
> >> >                 pci_unlock_rescan_remove();
> >> > -       } else {
> >> > +               break;
> >> > +
> >> > +       case hv_pcibus_init:
> >> > +       case hv_pcibus_probed:
> >> >                 survey_child_resources(hbus);
> >> > +               break;
> >> > +
> >> > +       default:
> >> > +               break;
> >> >         }
> >> >
> >> >         up(&hbus->enum_sem);
> >> > @@ -2163,6 +2175,7 @@ static int hv_pci_probe(struct hv_device
> *hdev,
> >> >         hbus = kzalloc(sizeof(*hbus), GFP_KERNEL);
> >> >         if (!hbus)
> >> >                 return -ENOMEM;
> >> > +       hbus->state = hv_pcibus_init;
> >> >
> >> >         /*
> >> >          * The PCI bus "domain" is what is called "segment" in ACPI
> >> > and @@ -2305,6 +2318,7 @@ static int hv_pci_remove(struct hv_device
> >> *hdev)
> >> >                 pci_stop_root_bus(hbus->pci_bus);
> >> >                 pci_remove_root_bus(hbus->pci_bus);
> >> >                 pci_unlock_rescan_remove();
> >> > +               hbus->state = hv_pcibus_removed;
> >> >         }
> >> >
> >> >         ret = hv_send_resources_released(hdev);
> >> > --
> >> > 1.8.5.6
> >

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [Resend PATCH 1/2 v3] pci-hyperv: properly handle pci bus remove
@ 2017-02-13 19:02         ` Long Li
  0 siblings, 0 replies; 8+ messages in thread
From: Long Li @ 2017-02-13 19:02 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: KY Srinivasan, Haiyang Zhang, devel, linux-pci, linux-kernel

PiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBCam9ybiBIZWxnYWFzIFttYWls
dG86YmhlbGdhYXNAZ29vZ2xlLmNvbV0NCj4gU2VudDogU2F0dXJkYXksIEZlYnJ1YXJ5IDExLCAy
MDE3ID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+IGFuZCBAQCAtMjMw
NSw2ICsyMzE4LDcgQEAgc3RhdGljIGludCBodl9wY2lfcmVtb3ZlKHN0cnVjdCBodl9kZXZpY2UN
Cj4gPj4gKmhkZXYpDQo+ID4+ID4gICAgICAgICAgICAgICAgIHBjaV9zdG9wX3Jvb3RfYnVzKGhi
dXMtPnBjaV9idXMpOw0KPiA+PiA+ICAgICAgICAgICAgICAgICBwY2lfcmVtb3ZlX3Jvb3RfYnVz
KGhidXMtPnBjaV9idXMpOw0KPiA+PiA+ICAgICAgICAgICAgICAgICBwY2lfdW5sb2NrX3Jlc2Nh
bl9yZW1vdmUoKTsNCj4gPj4gPiArICAgICAgICAgICAgICAgaGJ1cy0+c3RhdGUgPSBodl9wY2li
dXNfcmVtb3ZlZDsNCj4gPj4gPiAgICAgICAgIH0NCj4gPj4gPg0KPiA+PiA+ICAgICAgICAgcmV0
ID0gaHZfc2VuZF9yZXNvdXJjZXNfcmVsZWFzZWQoaGRldik7DQo+ID4+ID4gLS0NCj4gPj4gPiAx
LjguNS42DQo+ID4NCg==

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Resend PATCH 1/2 v3] pci-hyperv: properly handle pci bus remove
@ 2017-02-24 21:41 ` Long Li
  0 siblings, 0 replies; 8+ messages in thread
From: Long Li @ 2017-02-24 21:41 UTC (permalink / raw)
  To: KY Srinivasan, Haiyang Zhang, Bjorn Helgaas
  Cc: devel, linux-pci, linux-kernel

hv_pci_devices_present is called in hv_pci_remove when we remove a PCI device from host (e.g. by disabling SRIOV on a device). In hv_pci_remove, the bus is already removed before the call, so we don't need to rescan the bus in the workqueue scheduled from hv_pci_devices_present. By introducing status hv_pcibus_removed, we can avoid this situation.

Signed-off-by: Long Li <longli@microsoft.com>
Reported-by: Xiaofeng Wang <xiaofwan@redhat.com>
Acked-by: K. Y. Srinivasan <kys@microsoft.com>
---
 drivers/pci/host/pci-hyperv.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
index a8deeca..4a37598 100644
--- a/drivers/pci/host/pci-hyperv.c
+++ b/drivers/pci/host/pci-hyperv.c
@@ -348,6 +348,7 @@ enum hv_pcibus_state {
 	hv_pcibus_init = 0,
 	hv_pcibus_probed,
 	hv_pcibus_installed,
+	hv_pcibus_removed,
 	hv_pcibus_maximum
 };
 
@@ -1481,13 +1482,24 @@ static void pci_devices_present_work(struct work_struct *work)
 		put_pcichild(hpdev, hv_pcidev_ref_initial);
 	}
 
-	/* Tell the core to rescan bus because there may have been changes. */
-	if (hbus->state == hv_pcibus_installed) {
+	switch (hbus->state) {
+	case hv_pcibus_installed:
+		/*
+		 * Tell the core to rescan bus
+		 * because there may have been changes.
+		 */
 		pci_lock_rescan_remove();
 		pci_scan_child_bus(hbus->pci_bus);
 		pci_unlock_rescan_remove();
-	} else {
+		break;
+
+	case hv_pcibus_init:
+	case hv_pcibus_probed:
 		survey_child_resources(hbus);
+		break;
+
+	default:
+		break;
 	}
 
 	up(&hbus->enum_sem);
@@ -2163,6 +2175,7 @@ static int hv_pci_probe(struct hv_device *hdev,
 	hbus = kzalloc(sizeof(*hbus), GFP_KERNEL);
 	if (!hbus)
 		return -ENOMEM;
+	hbus->state = hv_pcibus_init;
 
 	/*
 	 * The PCI bus "domain" is what is called "segment" in ACPI and
@@ -2305,6 +2318,7 @@ static int hv_pci_remove(struct hv_device *hdev)
 		pci_stop_root_bus(hbus->pci_bus);
 		pci_remove_root_bus(hbus->pci_bus);
 		pci_unlock_rescan_remove();
+		hbus->state = hv_pcibus_removed;
 	}
 
 	ret = hv_send_resources_released(hdev);
-- 
1.8.5.6

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Resend PATCH 1/2 v3] pci-hyperv: properly handle pci bus remove
@ 2017-02-24 21:41 ` Long Li
  0 siblings, 0 replies; 8+ messages in thread
From: Long Li @ 2017-02-24 21:41 UTC (permalink / raw)
  To: KY Srinivasan, Haiyang Zhang, Bjorn Helgaas
  Cc: devel, linux-pci, linux-kernel

hv_pci_devices_present is called in hv_pci_remove when we remove a PCI devi=
ce from host (e.g. by disabling SRIOV on a device). In hv_pci_remove, the b=
us is already removed before the call, so we don't need to rescan the bus i=
n the workqueue scheduled from hv_pci_devices_present. By introducing statu=
s hv_pcibus_removed, we can avoid this situation.

Signed-off-by: Long Li <longli@microsoft.com>
Reported-by: Xiaofeng Wang <xiaofwan@redhat.com>
Acked-by: K. Y. Srinivasan <kys@microsoft.com>
---
 drivers/pci/host/pci-hyperv.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
index a8deeca..4a37598 100644
--- a/drivers/pci/host/pci-hyperv.c
+++ b/drivers/pci/host/pci-hyperv.c
@@ -348,6 +348,7 @@ enum hv_pcibus_state {
 	hv_pcibus_init =3D 0,
 	hv_pcibus_probed,
 	hv_pcibus_installed,
+	hv_pcibus_removed,
 	hv_pcibus_maximum
 };
=20
@@ -1481,13 +1482,24 @@ static void pci_devices_present_work(struct work_st=
ruct *work)
 		put_pcichild(hpdev, hv_pcidev_ref_initial);
 	}
=20
-	/* Tell the core to rescan bus because there may have been changes. */
-	if (hbus->state =3D=3D hv_pcibus_installed) {
+	switch (hbus->state) {
+	case hv_pcibus_installed:
+		/*
+		 * Tell the core to rescan bus
+		 * because there may have been changes.
+		 */
 		pci_lock_rescan_remove();
 		pci_scan_child_bus(hbus->pci_bus);
 		pci_unlock_rescan_remove();
-	} else {
+		break;
+
+	case hv_pcibus_init:
+	case hv_pcibus_probed:
 		survey_child_resources(hbus);
+		break;
+
+	default:
+		break;
 	}
=20
 	up(&hbus->enum_sem);
@@ -2163,6 +2175,7 @@ static int hv_pci_probe(struct hv_device *hdev,
 	hbus =3D kzalloc(sizeof(*hbus), GFP_KERNEL);
 	if (!hbus)
 		return -ENOMEM;
+	hbus->state =3D hv_pcibus_init;
=20
 	/*
 	 * The PCI bus "domain" is what is called "segment" in ACPI and
@@ -2305,6 +2318,7 @@ static int hv_pci_remove(struct hv_device *hdev)
 		pci_stop_root_bus(hbus->pci_bus);
 		pci_remove_root_bus(hbus->pci_bus);
 		pci_unlock_rescan_remove();
+		hbus->state =3D hv_pcibus_removed;
 	}
=20
 	ret =3D hv_send_resources_released(hdev);
--=20
1.8.5.6

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-02-24 21:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1485236721-27620-1-git-send-email-longli@exchange.microsoft.com>
2017-01-27 18:42 ` [Resend PATCH 1/2 v3] pci-hyperv: properly handle pci bus remove KY Srinivasan
2017-02-11  1:18   ` Long Li
2017-02-11  1:18     ` Long Li
2017-02-11 17:35     ` Bjorn Helgaas
2017-02-13 19:02       ` Long Li
2017-02-13 19:02         ` Long Li
2017-02-24 21:41 Long Li
2017-02-24 21:41 ` Long Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.