Skip to contentSkip to conversation

ice: stop calling pci_disable_device() as we use pcim

PATCH In review Przemek Kitszel 2 participants 2 messages Aug 30, 2024 – Sep 4, 2024

Subsystems (2)
lore
Share & tools
lore

Przemek Kitszel

author maintainer
#0 lore raw

PATCH v2 1/1 ice: stop calling pci_disable_device() as we use pcim

Our driver uses devres to manage resources, in particular we call pcim_enable_device(), what also means we express the intent to get automatic pci_disable_device() call at driver removal. Manual calls to pci_disable_device() misuse the API.

Recent commit (see "Fixes" tag) has changed the removal action from conditional (silent ignore of double call to pci_disable_device()) to unconditional, but able to catch unwanted redundant calls; see cited "Fixes" commit for details.

Since that, unloading the driver yields following warn+splat:

[70633.628490] ice 0000:af:00.7: disabling already-disabled device
[70633.628512] WARNING: CPU: 52 PID: 33890 at drivers/pci/pci.c:2250 pci_disable_device+0xf4/0x100
...
[70633.628744]  ? pci_disable_device+0xf4/0x100
[70633.628752]  release_nodes+0x4a/0x70
[70633.628759]  devres_release_all+0x8b/0xc0
[70633.628768]  device_unbind_cleanup+0xe/0x70
[70633.628774]  device_release_driver_internal+0x208/0x250
[70633.628781]  driver_detach+0x47/0x90
[70633.628786]  bus_remove_driver+0x80/0x100
[70633.628791]  pci_unregister_driver+0x2a/0xb0
[70633.628799]  ice_module_exit+0x11/0x3a [ice]

Note that this is the only Intel ethernet driver that needs such fix.

Fixes f748a07a0b64 ("PCI: Remove legacy pcim_release()")

---
v2: Reworded commit message to make it clear that removal action
was there since long ago, Fixes commit just made it (properly) unconditional (Philipp Stanner).

v1:
https://lore.kernel.org/intel-wired-lan/[email protected]

---
 drivers/net/ethernet/intel/ice/ice_main.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +0 -2
index 6f97ed471fe9..18e4950316f1 100644
@@ -5350,7 +5350,6 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)
 	ice_deinit(pf);
 err_init:
 	ice_adapter_put(pdev);
-	pci_disable_device(pdev);
 	return err;
 }
 
@@ -5457,7 +5456,6 @@ static void ice_remove(struct pci_dev *pdev)
 	ice_set_wake(pf);
 
 	ice_adapter_put(pdev);
-	pci_disable_device(pdev);
 }
 
 /**

base-commit: 4186c8d9e6af57bab0687b299df10ebd47534a0a

Signature · 1 line
2.46.0
Tested-by on v2 1/1
#1 lore raw
Quoted 30 lines

-----Original Message-----
From: Kitszel, Przemyslaw <[email protected]>
Sent: Friday, August 30, 2024 7:14 PM
To: [email protected]; Nguyen, Anthony L <[email protected]>
Cc: Pucha, HimasekharX Reddy <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Zaremba, Larysa <[email protected]>; Philipp Stanner <[email protected]>
Subject: [PATCH iwl-net v2] ice: stop calling pci_disable_device() as we use pcim

Our driver uses devres to manage resources, in particular we call pcim_enable_device(), what also means we express the intent to get automatic pci_disable_device() call at driver removal. Manual calls to pci_disable_device() misuse the API.

Recent commit (see "Fixes" tag) has changed the removal action from conditional (silent ignore of double call to pci_disable_device()) to unconditional, but able to catch unwanted redundant calls; see cited "Fixes" commit for details.

Since that, unloading the driver yields following warn+splat:

[70633.628490] ice 0000:af:00.7: disabling already-disabled device [70633.628512] WARNING: CPU: 52 PID: 33890 at drivers/pci/pci.c:2250 pci_disable_device+0xf4/0x100 ...
[70633.628744]  ? pci_disable_device+0xf4/0x100 [70633.628752]  release_nodes+0x4a/0x70 [70633.628759]  devres_release_all+0x8b/0xc0 [70633.628768]  device_unbind_cleanup+0xe/0x70 [70633.628774]  device_release_driver_internal+0x208/0x250
[70633.628781]  driver_detach+0x47/0x90
[70633.628786]  bus_remove_driver+0x80/0x100 [70633.628791]  pci_unregister_driver+0x2a/0xb0 [70633.628799]  ice_module_exit+0x11/0x3a [ice]

Note that this is the only Intel ethernet driver that needs such fix.

Fixes f748a07a0b64 ("PCI: Remove legacy pcim_release()")

---
v2: Reworded commit message to make it clear that removal action
was there since long ago, Fixes commit just made it (properly)
unconditional (Philipp Stanner).

Quoted 6 lines

v1:
https://lore.kernel.org/intel-wired-lan/[email protected]

---
 drivers/net/ethernet/intel/ice/ice_main.c | 2 --
 1 file changed, 2 deletions(-)