* FAILED: patch "[PATCH] PCI: hv: Add hv_pci_remove_slots() when we unload the driver" failed to apply to 4.14-stable tree
@ 2019-05-15 8:35 gregkh
2019-05-15 23:19 ` Dexuan Cui
0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2019-05-15 8:35 UTC (permalink / raw)
To: decui, lorenzo.pieralisi, mikelley, sthemmin; +Cc: stable
The patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 15becc2b56c6eda3d9bf5ae993bafd5661c1fad1 Mon Sep 17 00:00:00 2001
From: Dexuan Cui <decui@microsoft.com>
Date: Mon, 4 Mar 2019 21:34:48 +0000
Subject: [PATCH] PCI: hv: Add hv_pci_remove_slots() when we unload the driver
When we unload the pci-hyperv host controller driver, the host does not
send us a PCI_EJECT message.
In this case we also need to make sure the sysfs PCI slot directory is
removed, otherwise a command on a slot file eg:
"cat /sys/bus/pci/slots/2/address"
will trigger a
"BUG: unable to handle kernel paging request"
and, if we unload/reload the driver several times we would end up with
stale slot entries in PCI slot directories in /sys/bus/pci/slots/
root@localhost:~# ls -rtl /sys/bus/pci/slots/
total 0
drwxr-xr-x 2 root root 0 Feb 7 10:49 2
drwxr-xr-x 2 root root 0 Feb 7 10:49 2-1
drwxr-xr-x 2 root root 0 Feb 7 10:51 2-2
Add the missing code to remove the PCI slot and fix the current
behaviour.
Fixes: a15f2c08c708 ("PCI: hv: support reporting serial number as slot information")
Signed-off-by: Dexuan Cui <decui@microsoft.com>
[lorenzo.pieralisi@arm.com: reformatted the log]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Stephen Hemminger <sthemmin@microsoft.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Cc: stable@vger.kernel.org
diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
index 30f16b882746..b489412e3502 100644
--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -1486,6 +1486,21 @@ static void hv_pci_assign_slots(struct hv_pcibus_device *hbus)
}
}
+/*
+ * Remove entries in sysfs pci slot directory.
+ */
+static void hv_pci_remove_slots(struct hv_pcibus_device *hbus)
+{
+ struct hv_pci_dev *hpdev;
+
+ list_for_each_entry(hpdev, &hbus->children, list_entry) {
+ if (!hpdev->pci_slot)
+ continue;
+ pci_destroy_slot(hpdev->pci_slot);
+ hpdev->pci_slot = NULL;
+ }
+}
+
/**
* create_root_hv_pci_bus() - Expose a new root PCI bus
* @hbus: Root PCI bus, as understood by this driver
@@ -2680,6 +2695,7 @@ static int hv_pci_remove(struct hv_device *hdev)
pci_lock_rescan_remove();
pci_stop_root_bus(hbus->pci_bus);
pci_remove_root_bus(hbus->pci_bus);
+ hv_pci_remove_slots(hbus);
pci_unlock_rescan_remove();
hbus->state = hv_pcibus_removed;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: FAILED: patch "[PATCH] PCI: hv: Add hv_pci_remove_slots() when we unload the driver" failed to apply to 4.14-stable tree
2019-05-15 8:35 FAILED: patch "[PATCH] PCI: hv: Add hv_pci_remove_slots() when we unload the driver" failed to apply to 4.14-stable tree gregkh
@ 2019-05-15 23:19 ` Dexuan Cui
2019-05-17 0:48 ` Sasha Levin
0 siblings, 1 reply; 3+ messages in thread
From: Dexuan Cui @ 2019-05-15 23:19 UTC (permalink / raw)
To: gregkh, lorenzo.pieralisi, Michael Kelley, Stephen Hemminger; +Cc: stable
[-- Attachment #1: Type: text/plain, Size: 3492 bytes --]
> From: gregkh@linuxfoundation.org <gregkh@linuxfoundation.org>
> Sent: Wednesday, May 15, 2019 1:35 AM
> To: Dexuan Cui <decui@microsoft.com>; lorenzo.pieralisi@arm.com; Michael
> Kelley <mikelley@microsoft.com>; Stephen Hemminger
> <sthemmin@microsoft.com>
> Cc: stable@vger.kernel.org
> Subject: FAILED: patch "[PATCH] PCI: hv: Add hv_pci_remove_slots() when we
> unload the driver" failed to apply to 4.14-stable tree
>
>
> The patch below does not apply to the 4.14-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.
>
> thanks,
>
> greg k-h
>
> ------------------ original commit in Linus's tree ------------------
>
> From 15becc2b56c6eda3d9bf5ae993bafd5661c1fad1 Mon Sep 17 00:00:00
> 2001
> From: Dexuan Cui <decui@microsoft.com>
> Date: Mon, 4 Mar 2019 21:34:48 +0000
> Subject: [PATCH] PCI: hv: Add hv_pci_remove_slots() when we unload the
> driver
>
> When we unload the pci-hyperv host controller driver, the host does not
> send us a PCI_EJECT message.
>
> In this case we also need to make sure the sysfs PCI slot directory is
> removed, otherwise a command on a slot file eg:
>
> "cat /sys/bus/pci/slots/2/address"
>
> will trigger a
>
> "BUG: unable to handle kernel paging request"
>
> and, if we unload/reload the driver several times we would end up with
> stale slot entries in PCI slot directories in /sys/bus/pci/slots/
>
> root@localhost:~# ls -rtl /sys/bus/pci/slots/
> total 0
> drwxr-xr-x 2 root root 0 Feb 7 10:49 2
> drwxr-xr-x 2 root root 0 Feb 7 10:49 2-1
> drwxr-xr-x 2 root root 0 Feb 7 10:51 2-2
>
> Add the missing code to remove the PCI slot and fix the current
> behaviour.
>
> Fixes: a15f2c08c708 ("PCI: hv: support reporting serial number as slot
> information")
> Signed-off-by: Dexuan Cui <decui@microsoft.com>
> [lorenzo.pieralisi@arm.com: reformatted the log]
> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Reviewed-by: Stephen Hemminger <sthemmin@microsoft.com>
> Reviewed-by: Michael Kelley <mikelley@microsoft.com>
> Cc: stable@vger.kernel.org
>
> diff --git a/drivers/pci/controller/pci-hyperv.c
> b/drivers/pci/controller/pci-hyperv.c
> index 30f16b882746..b489412e3502 100644
> --- a/drivers/pci/controller/pci-hyperv.c
> +++ b/drivers/pci/controller/pci-hyperv.c
> @@ -1486,6 +1486,21 @@ static void hv_pci_assign_slots(struct
> hv_pcibus_device *hbus)
> }
> }
>
> +/*
> + * Remove entries in sysfs pci slot directory.
> + */
> +static void hv_pci_remove_slots(struct hv_pcibus_device *hbus)
> +{
> + struct hv_pci_dev *hpdev;
> +
> + list_for_each_entry(hpdev, &hbus->children, list_entry) {
> + if (!hpdev->pci_slot)
> + continue;
> + pci_destroy_slot(hpdev->pci_slot);
> + hpdev->pci_slot = NULL;
> + }
> +}
> +
> /**
> * create_root_hv_pci_bus() - Expose a new root PCI bus
> * @hbus: Root PCI bus, as understood by this driver
> @@ -2680,6 +2695,7 @@ static int hv_pci_remove(struct hv_device *hdev)
> pci_lock_rescan_remove();
> pci_stop_root_bus(hbus->pci_bus);
> pci_remove_root_bus(hbus->pci_bus);
> + hv_pci_remove_slots(hbus);
> pci_unlock_rescan_remove();
> hbus->state = hv_pcibus_removed;
> }
Hi,
I backported the patch for linux-4.14.y.
Please use the attached patch, which is [PATCH 2/3]
Thanks,
-- Dexuan
[-- Attachment #2: For_v4.14.119-0002-PCI-hv-Add-hv_pci_remove_slots-when-we-unload-the-dr.patch --]
[-- Type: application/octet-stream, Size: 1543 bytes --]
From 946e3d43b4378e040593ac5a3a48ee46d8f3cd77 Mon Sep 17 00:00:00 2001
From: Dexuan Cui <decui@microsoft.com>
Date: Wed, 15 May 2019 15:59:15 -0700
Subject: [PATCH for v4.14.119 2/3] PCI: hv: Add hv_pci_remove_slots() when we
unload the driver
This patch is backported for v4.14.119 from the mainline
commit 15becc2b56c6 ("PCI: hv: Add hv_pci_remove_slots() when we unload the driver")
Signed-off-by: Dexuan Cui <decui@microsoft.com>
---
drivers/pci/host/pci-hyperv.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
index 292450c7da62..a5825bbcded7 100644
--- a/drivers/pci/host/pci-hyperv.c
+++ b/drivers/pci/host/pci-hyperv.c
@@ -1513,6 +1513,21 @@ static void hv_pci_assign_slots(struct hv_pcibus_device *hbus)
}
}
+/*
+ * Remove entries in sysfs pci slot directory.
+ */
+static void hv_pci_remove_slots(struct hv_pcibus_device *hbus)
+{
+ struct hv_pci_dev *hpdev;
+
+ list_for_each_entry(hpdev, &hbus->children, list_entry) {
+ if (!hpdev->pci_slot)
+ continue;
+ pci_destroy_slot(hpdev->pci_slot);
+ hpdev->pci_slot = NULL;
+ }
+}
+
/**
* create_root_hv_pci_bus() - Expose a new root PCI bus
* @hbus: Root PCI bus, as understood by this driver
@@ -2719,6 +2734,7 @@ static int hv_pci_remove(struct hv_device *hdev)
pci_lock_rescan_remove();
pci_stop_root_bus(hbus->pci_bus);
pci_remove_root_bus(hbus->pci_bus);
+ hv_pci_remove_slots(hbus);
pci_unlock_rescan_remove();
hbus->state = hv_pcibus_removed;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: FAILED: patch "[PATCH] PCI: hv: Add hv_pci_remove_slots() when we unload the driver" failed to apply to 4.14-stable tree
2019-05-15 23:19 ` Dexuan Cui
@ 2019-05-17 0:48 ` Sasha Levin
0 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2019-05-17 0:48 UTC (permalink / raw)
To: Dexuan Cui
Cc: gregkh, lorenzo.pieralisi, Michael Kelley, Stephen Hemminger, stable
On Wed, May 15, 2019 at 11:19:40PM +0000, Dexuan Cui wrote:
>> From: gregkh@linuxfoundation.org <gregkh@linuxfoundation.org>
>> Sent: Wednesday, May 15, 2019 1:35 AM
>> To: Dexuan Cui <decui@microsoft.com>; lorenzo.pieralisi@arm.com; Michael
>> Kelley <mikelley@microsoft.com>; Stephen Hemminger
>> <sthemmin@microsoft.com>
>> Cc: stable@vger.kernel.org
>> Subject: FAILED: patch "[PATCH] PCI: hv: Add hv_pci_remove_slots() when we
>> unload the driver" failed to apply to 4.14-stable tree
>>
>>
>> The patch below does not apply to the 4.14-stable tree.
>> If someone wants it applied there, or to any other stable or longterm
>> tree, then please email the backport, including the original git commit
>> id to <stable@vger.kernel.org>.
>>
>> thanks,
>>
>> greg k-h
>>
>> ------------------ original commit in Linus's tree ------------------
>>
>> From 15becc2b56c6eda3d9bf5ae993bafd5661c1fad1 Mon Sep 17 00:00:00
>> 2001
>> From: Dexuan Cui <decui@microsoft.com>
>> Date: Mon, 4 Mar 2019 21:34:48 +0000
>> Subject: [PATCH] PCI: hv: Add hv_pci_remove_slots() when we unload the
>> driver
>>
>> When we unload the pci-hyperv host controller driver, the host does not
>> send us a PCI_EJECT message.
>>
>> In this case we also need to make sure the sysfs PCI slot directory is
>> removed, otherwise a command on a slot file eg:
>>
>> "cat /sys/bus/pci/slots/2/address"
>>
>> will trigger a
>>
>> "BUG: unable to handle kernel paging request"
>>
>> and, if we unload/reload the driver several times we would end up with
>> stale slot entries in PCI slot directories in /sys/bus/pci/slots/
>>
>> root@localhost:~# ls -rtl /sys/bus/pci/slots/
>> total 0
>> drwxr-xr-x 2 root root 0 Feb 7 10:49 2
>> drwxr-xr-x 2 root root 0 Feb 7 10:49 2-1
>> drwxr-xr-x 2 root root 0 Feb 7 10:51 2-2
>>
>> Add the missing code to remove the PCI slot and fix the current
>> behaviour.
>>
>> Fixes: a15f2c08c708 ("PCI: hv: support reporting serial number as slot
>> information")
>> Signed-off-by: Dexuan Cui <decui@microsoft.com>
>> [lorenzo.pieralisi@arm.com: reformatted the log]
>> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
>> Reviewed-by: Stephen Hemminger <sthemmin@microsoft.com>
>> Reviewed-by: Michael Kelley <mikelley@microsoft.com>
>> Cc: stable@vger.kernel.org
>>
>> diff --git a/drivers/pci/controller/pci-hyperv.c
>> b/drivers/pci/controller/pci-hyperv.c
>> index 30f16b882746..b489412e3502 100644
>> --- a/drivers/pci/controller/pci-hyperv.c
>> +++ b/drivers/pci/controller/pci-hyperv.c
>> @@ -1486,6 +1486,21 @@ static void hv_pci_assign_slots(struct
>> hv_pcibus_device *hbus)
>> }
>> }
>>
>> +/*
>> + * Remove entries in sysfs pci slot directory.
>> + */
>> +static void hv_pci_remove_slots(struct hv_pcibus_device *hbus)
>> +{
>> + struct hv_pci_dev *hpdev;
>> +
>> + list_for_each_entry(hpdev, &hbus->children, list_entry) {
>> + if (!hpdev->pci_slot)
>> + continue;
>> + pci_destroy_slot(hpdev->pci_slot);
>> + hpdev->pci_slot = NULL;
>> + }
>> +}
>> +
>> /**
>> * create_root_hv_pci_bus() - Expose a new root PCI bus
>> * @hbus: Root PCI bus, as understood by this driver
>> @@ -2680,6 +2695,7 @@ static int hv_pci_remove(struct hv_device *hdev)
>> pci_lock_rescan_remove();
>> pci_stop_root_bus(hbus->pci_bus);
>> pci_remove_root_bus(hbus->pci_bus);
>> + hv_pci_remove_slots(hbus);
>> pci_unlock_rescan_remove();
>> hbus->state = hv_pcibus_removed;
>> }
>
>Hi,
>I backported the patch for linux-4.14.y.
>
>Please use the attached patch, which is [PATCH 2/3]
>
>Thanks,
>-- Dexuan
Queued for 4.14, thank you.
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-05-17 0:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-15 8:35 FAILED: patch "[PATCH] PCI: hv: Add hv_pci_remove_slots() when we unload the driver" failed to apply to 4.14-stable tree gregkh
2019-05-15 23:19 ` Dexuan Cui
2019-05-17 0:48 ` Sasha Levin
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.