Skip to contentSkip to conversation

devlink: Remove extra device_lock assert checks

PATCH Applied Leon Romanovsky 2 participants 2 messages Oct 19, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 devlink: Remove extra device_lock assert checks

From: Leon Romanovsky <[email protected]>

PCI core code in the pci_call_probe() has a path that doesn't hold device_lock. It happens because the ->probe() is called through the workqueue mechanism.

349 static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev,
350 const struct pci_device_id *id)
351 {
352
....
377 if (cpu < nr_cpu_ids)
378 error = work_on_cpu(cpu, local_pci_probe, &ddi);

Luckily enough, the core still ensures that only single flow is executed, so it safe to remove the assert checks that anyway were added for annotations purposes.

Fixes b88f7b1203bf ("devlink: Annotate devlink API calls")
---
 net/core/devlink.c | 2 --
 1 file changed, 2 deletions(-)
net/core/devlink.c +0 -2
index 3ce6147a2fe8..3464854015a2 100644
@@ -9147,7 +9147,6 @@ void devlink_register(struct devlink *devlink)
 {
 	ASSERT_DEVLINK_NOT_REGISTERED(devlink);
 	/* Make sure that we are in .probe() routine */
-	device_lock_assert(devlink->dev);
 
 	mutex_lock(&devlink_mutex);
 	xa_set_mark(&devlinks, devlink->index, DEVLINK_REGISTERED);
@@ -9165,7 +9164,6 @@ void devlink_unregister(struct devlink *devlink)
 {
 	ASSERT_DEVLINK_REGISTERED(devlink);
 	/* Make sure that we are in .remove() routine */
-	device_lock_assert(devlink->dev);
 
 	devlink_put(devlink);
 	wait_for_completion(&devlink->comp);
Signature · 1 line
2.31.1
#1 lore raw
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Quoted 8 lines · On Tue, 19 Oct 2021 10:49:54 +0300 you wrote:

From: Leon Romanovsky <[email protected]>

PCI core code in the pci_call_probe() has a path that doesn't hold device_lock. It happens because the ->probe() is called through the workqueue mechanism.

349 static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev,
350 const struct pci_device_id *id)

Quoted 7 lines
   351 {
   352

....
377 if (cpu < nr_cpu_ids)
378 error = work_on_cpu(cpu, local_pci_probe, &ddi);

[...]

Here is the summary with links:
- [net-next] devlink: Remove extra device_lock assert checks

    https://git.kernel.org/netdev/net-next/c/cb3dc8901ba4

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html