Skip to contentSkip to conversation

FAILED: patch "[PATCH] driver core: Release all resources during unbind before" failed to apply to 5.15-stable tree

PATCH In review [email protected] 2 participants 5 messages Nov 23, 2023 – Dec 5, 2023

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.15-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 <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x 2e84dc37920012b458e9458b19fc4ed33f81bc74
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023112330-squealer-strife-0ecc@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^..

Possible dependencies:

2e84dc379200 ("driver core: Release all resources during unbind before updating device links") 25f3bcfc54bc ("driver core: Add dma_cleanup callback in bus_type")
9ad307213fa4 ("driver core: Refactor multiple copies of device cleanup") d8f7a5484f21 ("driver core: Free DMA range map when device is released") 885e50253bfd ("driver core: Move driver_sysfs_remove() after driver_sysfs_add()")

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 2e84dc37920012b458e9458b19fc4ed33f81bc74 Mon Sep 17 00:00:00 2001
From: Saravana Kannan <[email protected]>
Date: Tue, 17 Oct 2023 18:38:50 -0700
Subject: [PATCH] driver core: Release all resources during unbind before
updating device links
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This commit fixes a bug in commit 9ed9895370ae ("driver core: Functional dependencies tracking support") where the device link status was incorrectly updated in the driver unbind path before all the device's resources were released.

drivers/base/dd.c +1 -1
index a528cec24264..0c3725c3eefa 100644
@@ -1274,8 +1274,8 @@ static void __device_release_driver(struct device *dev, struct device *parent)
 		if (dev->bus && dev->bus->dma_cleanup)
 			dev->bus->dma_cleanup(dev);
 
-		device_links_driver_cleanup(dev);
 		device_unbind_cleanup(dev);
+		device_links_driver_cleanup(dev);
 
 		klist_remove(&dev->p->knode_driver);
 		device_pm_check_callbacks(dev);
#1 lore raw

PATCH 1/1 driver core: Release all resources during unbind before updating device links

From: Saravana Kannan <[email protected]>

[ Upstream commit 2e84dc37920012b458e9458b19fc4ed33f81bc74 ]

This commit fixes a bug in commit 9ed9895370ae ("driver core: Functional dependencies tracking support") where the device link status was incorrectly updated in the driver unbind path before all the device's resources were released.

---
Hello,

this needed some conflict resolution around commit 9ad307213fa4 ("driver core: Refactor multiple copies of device cleanup").

Best regards
Uwe

 drivers/base/dd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/base/dd.c +2 -2
index ab0b2eb5fa07..0bd166ad6f13 100644
@@ -1228,8 +1228,6 @@ static void __device_release_driver(struct device *dev, struct device *parent)
 		else if (drv->remove)
 			drv->remove(dev);
 
-		device_links_driver_cleanup(dev);
-
 		devres_release_all(dev);
 		arch_teardown_dma_ops(dev);
 		kfree(dev->dma_range_map);
@@ -1241,6 +1239,8 @@ static void __device_release_driver(struct device *dev, struct device *parent)
 		pm_runtime_reinit(dev);
 		dev_pm_set_driver_flags(dev, 0);
 
+		device_links_driver_cleanup(dev);
+
 		klist_remove(&dev->p->knode_driver);
 		device_pm_check_callbacks(dev);
 		if (dev->bus)

base-commit: 2a910f4af54d11deaefdc445f895724371645a97

Signature · 1 line
2.42.0
author maintainer
#2 lore raw

Re: [PATCH 5.15.y] driver core: Release all resources during unbind before updating device links

Quoted 62 lines · Uwe Kleine-König

From: Saravana Kannan <[email protected]>

[ Upstream commit 2e84dc37920012b458e9458b19fc4ed33f81bc74 ]

This commit fixes a bug in commit 9ed9895370ae ("driver core: Functional dependencies tracking support") where the device link status was incorrectly updated in the driver unbind path before all the device's resources were released.

---
Hello,

this needed some conflict resolution around commit 9ad307213fa4 ("driver core: Refactor multiple copies of device cleanup").

Best regards
Uwe

 drivers/base/dd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/base/dd.c +2 -2
index ab0b2eb5fa07..0bd166ad6f13 100644
@@ -1228,8 +1228,6 @@ static void __device_release_driver(struct device *dev, struct device *parent)
 		else if (drv->remove)
 			drv->remove(dev);
 
-		device_links_driver_cleanup(dev);
-
 		devres_release_all(dev);
 		arch_teardown_dma_ops(dev);
 		kfree(dev->dma_range_map);
@@ -1241,6 +1239,8 @@ static void __device_release_driver(struct device *dev, struct device *parent)
 		pm_runtime_reinit(dev);
 		dev_pm_set_driver_flags(dev, 0);
 
+		device_links_driver_cleanup(dev);
+
 		klist_remove(&dev->p->knode_driver);
 		device_pm_check_callbacks(dev);
 		if (dev->bus)
Quoted 1 line

base-commit: 2a910f4af54d11deaefdc445f895724371645a97

Thanks, I've queued this up now.

greg k-h

#3 lore raw

Re: [PATCH 5.15.y] driver core: Release all resources during unbind before updating device links

Hello Greg,

Quoted 29 lines · Greg Kroah-Hartman
Quoted 19 lines · Uwe Kleine-König

From: Saravana Kannan <[email protected]>

[ Upstream commit 2e84dc37920012b458e9458b19fc4ed33f81bc74 ]

This commit fixes a bug in commit 9ed9895370ae ("driver core: Functional dependencies tracking support") where the device link status was incorrectly updated in the driver unbind path before all the device's resources were released.

Fixes 9ed9895370ae ("driver core: Functional dependencies tracking support")
Cc stable <[email protected]>
Cc Thierry Reding <[email protected]>
Cc Yang Yingliang <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc Mark Brown <[email protected]>
Cc Matti Vaittinen <[email protected]>
Quoted 8 lines
Quoted 1 line

Thanks, I've queued this up now.

I see it landed in v5.15.140 (as 947c9e12ddd6866603fd60000c0cca8981687dd3), but not in v5.10.x and the older stables. It should go there, too.

947c9e12ddd6866603fd60000c0cca8981687dd3 can be cherry-picked without conflicts on top of v5.10.202, 5.4.262, 4.19.300 and 4.14.331.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
author maintainer
#4 lore raw

Re: [PATCH 5.15.y] driver core: Release all resources during unbind before updating device links

Quoted 32 lines · Uwe Kleine-König

Hello Greg,

Quoted 29 lines · Greg Kroah-Hartman
Quoted 27 lines · Uwe Kleine-König

From: Saravana Kannan <[email protected]>

[ Upstream commit 2e84dc37920012b458e9458b19fc4ed33f81bc74 ]

This commit fixes a bug in commit 9ed9895370ae ("driver core: Functional dependencies tracking support") where the device link status was incorrectly updated in the driver unbind path before all the device's resources were released.

Quoted 8 lines
Quoted 1 line

Thanks, I've queued this up now.

I see it landed in v5.15.140 (as 947c9e12ddd6866603fd60000c0cca8981687dd3), but not in v5.10.x and the older stables. It should go there, too.

947c9e12ddd6866603fd60000c0cca8981687dd3 can be cherry-picked without conflicts on top of v5.10.202, 5.4.262, 4.19.300 and 4.14.331.

Now queued up, thanks.

greg k-h