Skip to contentSkip to conversation

mpt3sas: suppress a warning in debug kernel

PATCH Applied Tomas Henzl 3 participants 4 messages Oct 19, 2023 – Dec 7, 2023

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

PATCH v2 1/1 mpt3sas: suppress a warning in debug kernel

The mpt3sas_ctl_exit should be called after communication with the controller stops but in currently it may cause false warnings about not released memory.
Fix it by leaving mpt3sas_ctl_exit handle misc driver release per driver and release DMA in mpt3sas_ctl_release per ioc.

---
V2: separate handling of DMA release and misc driver deregistration

 drivers/scsi/mpt3sas/mpt3sas_base.h  |  1 +
 drivers/scsi/mpt3sas/mpt3sas_ctl.c   | 42 ++++++++++++++++------------
 drivers/scsi/mpt3sas/mpt3sas_scsih.c |  1 +
 3 files changed, 26 insertions(+), 18 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_base.h +1 -0
index 1be0850ca17a..48ad17bd811d 100644
@@ -1983,6 +1983,7 @@ extern const struct attribute_group *mpt3sas_host_groups[];
 extern const struct attribute_group *mpt3sas_dev_groups[];
 void mpt3sas_ctl_init(ushort hbas_to_enumerate);
 void mpt3sas_ctl_exit(ushort hbas_to_enumerate);
+void mpt3sas_ctl_release(struct MPT3SAS_ADAPTER *ioc);
 u8 mpt3sas_ctl_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
 	u32 reply);
 void mpt3sas_ctl_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc);
drivers/scsi/mpt3sas/mpt3sas_ctl.c +24 -18

55 lines not on this page · raw message

drivers/scsi/mpt3sas/mpt3sas_scsih.c +1 -0
index 605013d3ee83..96dd2af5cd7d 100644
@@ -11350,6 +11350,7 @@ static void scsih_remove(struct pci_dev *pdev)
 	}
 
 	mpt3sas_base_detach(ioc);
+	mpt3sas_ctl_release(ioc);
 	spin_lock(&gioc_lock);
 	list_del(&ioc->list);
 	spin_unlock(&gioc_lock);
Signature · 1 line
2.41.0
#1 lore raw

Tomas,

Quoted 5 lines

The mpt3sas_ctl_exit should be called after communication with the controller stops but in currently it may cause false warnings about not released memory. Fix it by leaving mpt3sas_ctl_exit handle misc driver release per driver and release DMA in mpt3sas_ctl_release per ioc.

Applied to 6.8/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#2 lore raw
In reply to Tomas Henzl
Quoted 8 lines · Tomas Henzl

The mpt3sas_ctl_exit should be called after communication with the controller stops but in currently it may cause false warnings about not released memory.
Fix it by leaving mpt3sas_ctl_exit handle misc driver release per driver and release DMA in mpt3sas_ctl_release per ioc.

[...]

Applied to 6.8/scsi-queue, thanks!

[1/1] mpt3sas: suppress a warning in debug kernel

      https://git.kernel.org/mkp/scsi/c/6a965ee1892a
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#3 lore raw
In reply to Tomas Henzl
Quoted 9 lines

The mpt3sas_ctl_exit should be called after communication with the controller stops but in currently it may cause false warnings about not released memory.
Fix it by leaving mpt3sas_ctl_exit handle misc driver release per driver and release DMA in mpt3sas_ctl_release per ioc.

---
V2: separate handling of DMA release and misc driver deregistration

...

Quoted 1 line

diff

<https://lore.kernel.org/all/[email protected]/#iZ31drivers:scsi:mpt3sas:mpt3sas_scsih.c> --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c > index 605013d3ee83..96dd2af5cd7d 100644 > --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c > +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c > @@ -11350,6 +11350,7 @@ static void scsih_remove(struct pci_dev *pdev) > }

drivers/scsi/mpt3sas/mpt3sas_scsih.c static void scsih_remove(struct pci_dev *pdev) · line 11356

Quoted 6 lines
drivers/scsi/mpt3sas/mpt3sas_scsih.c +1 -0
 	mpt3sas_base_detach(ioc);
+	mpt3sas_ctl_release(ioc);  >  	spin_lock(&gioc_lock);
 	list_del(&ioc->list);
 	spin_unlock(&gioc_lock);

Hi,

does a similarmpt3sas_ctl_release() should also be called in the error handling path of |

_scsih_probe()? CJ |