diff mbox series

[03/10] qla2xxx: Fix DMA-API call trace on NVME LS requests

Message ID 20221214045014.19362-4-njavali@marvell.com (mailing list archive)
State Superseded
Headers show
Series Misc. qla2xxx driver bug fixes | expand

Commit Message

Nilesh Javali Dec. 14, 2022, 4:50 a.m. UTC
From: Arun Easi <aeasi@marvell.com>

Following message and call trace was seen with debug kernels:

DMA-API: qla2xxx 0000:41:00.0: device driver failed to check map
error [device address=0x00000002a3ff38d8] [size=1024 bytes] [mapped as
single]
WARNING: CPU: 0 PID: 2930 at kernel/dma/debug.c:1017
	 check_unmap+0xf42/0x1990

Call Trace:
	debug_dma_unmap_page+0xc9/0x100
	qla_nvme_ls_unmap+0x141/0x210 [qla2xxx]

Remove DMA mapping from the driver altogether, as
it is already done by FC layer. This would prevent
the warning itself to appear.

Fixes: c85ab7d9e27a ("scsi: qla2xxx: Fix missed DMA unmap for NVMe ls requests")
Cc: stable@vger.kernel.org
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
---
 drivers/scsi/qla2xxx/qla_nvme.c | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

Comments

Himanshu Madhani Dec. 15, 2022, 5 p.m. UTC | #1
> On Dec 13, 2022, at 8:50 PM, Nilesh Javali <njavali@marvell.com> wrote:
> 
> From: Arun Easi <aeasi@marvell.com>
> 
> Following message and call trace was seen with debug kernels:
> 
> DMA-API: qla2xxx 0000:41:00.0: device driver failed to check map
> error [device address=0x00000002a3ff38d8] [size=1024 bytes] [mapped as
> single]
> WARNING: CPU: 0 PID: 2930 at kernel/dma/debug.c:1017
> 	 check_unmap+0xf42/0x1990
> 
> Call Trace:
> 	debug_dma_unmap_page+0xc9/0x100
> 	qla_nvme_ls_unmap+0x141/0x210 [qla2xxx]
> 
> Remove DMA mapping from the driver altogether, as
> it is already done by FC layer. This would prevent
> the warning itself to appear.
> 
> Fixes: c85ab7d9e27a ("scsi: qla2xxx: Fix missed DMA unmap for NVMe ls requests")
> Cc: stable@vger.kernel.org
> Signed-off-by: Arun Easi <aeasi@marvell.com>
> Signed-off-by: Nilesh Javali <njavali@marvell.com>
> ---
> drivers/scsi/qla2xxx/qla_nvme.c | 19 +------------------
> 1 file changed, 1 insertion(+), 18 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
> index 02fdeb0d31ec..8927ddc5e69c 100644
> --- a/drivers/scsi/qla2xxx/qla_nvme.c
> +++ b/drivers/scsi/qla2xxx/qla_nvme.c
> @@ -170,18 +170,6 @@ static void qla_nvme_release_fcp_cmd_kref(struct kref *kref)
> 	qla2xxx_rel_qpair_sp(sp->qpair, sp);
> }
> 
> -static void qla_nvme_ls_unmap(struct srb *sp, struct nvmefc_ls_req *fd)
> -{
> -	if (sp->flags & SRB_DMA_VALID) {
> -		struct srb_iocb *nvme = &sp->u.iocb_cmd;
> -		struct qla_hw_data *ha = sp->fcport->vha->hw;
> -
> -		dma_unmap_single(&ha->pdev->dev, nvme->u.nvme.cmd_dma,
> -				 fd->rqstlen, DMA_TO_DEVICE);
> -		sp->flags &= ~SRB_DMA_VALID;
> -	}
> -}
> -
> static void qla_nvme_release_ls_cmd_kref(struct kref *kref)
> {
> 	struct srb *sp = container_of(kref, struct srb, cmd_kref);
> @@ -199,7 +187,6 @@ static void qla_nvme_release_ls_cmd_kref(struct kref *kref)
> 
> 	fd = priv->fd;
> 
> -	qla_nvme_ls_unmap(sp, fd);
> 	fd->done(fd, priv->comp_status);
> out:
> 	qla2x00_rel_sp(sp);
> @@ -365,13 +352,10 @@ static int qla_nvme_ls_req(struct nvme_fc_local_port *lport,
> 	nvme->u.nvme.rsp_len = fd->rsplen;
> 	nvme->u.nvme.rsp_dma = fd->rspdma;
> 	nvme->u.nvme.timeout_sec = fd->timeout;
> -	nvme->u.nvme.cmd_dma = dma_map_single(&ha->pdev->dev, fd->rqstaddr,
> -	    fd->rqstlen, DMA_TO_DEVICE);
> +	nvme->u.nvme.cmd_dma = fd->rqstdma;
> 	dma_sync_single_for_device(&ha->pdev->dev, nvme->u.nvme.cmd_dma,
> 	    fd->rqstlen, DMA_TO_DEVICE);
> 
> -	sp->flags |= SRB_DMA_VALID;
> -
> 	rval = qla2x00_start_sp(sp);
> 	if (rval != QLA_SUCCESS) {
> 		ql_log(ql_log_warn, vha, 0x700e,
> @@ -379,7 +363,6 @@ static int qla_nvme_ls_req(struct nvme_fc_local_port *lport,
> 		wake_up(&sp->nvme_ls_waitq);
> 		sp->priv = NULL;
> 		priv->sp = NULL;
> -		qla_nvme_ls_unmap(sp, fd);
> 		qla2x00_rel_sp(sp);
> 		return rval;
> 	}
> -- 
> 2.19.0.rc0
> 

Looks Good. 

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
index 02fdeb0d31ec..8927ddc5e69c 100644
--- a/drivers/scsi/qla2xxx/qla_nvme.c
+++ b/drivers/scsi/qla2xxx/qla_nvme.c
@@ -170,18 +170,6 @@  static void qla_nvme_release_fcp_cmd_kref(struct kref *kref)
 	qla2xxx_rel_qpair_sp(sp->qpair, sp);
 }
 
-static void qla_nvme_ls_unmap(struct srb *sp, struct nvmefc_ls_req *fd)
-{
-	if (sp->flags & SRB_DMA_VALID) {
-		struct srb_iocb *nvme = &sp->u.iocb_cmd;
-		struct qla_hw_data *ha = sp->fcport->vha->hw;
-
-		dma_unmap_single(&ha->pdev->dev, nvme->u.nvme.cmd_dma,
-				 fd->rqstlen, DMA_TO_DEVICE);
-		sp->flags &= ~SRB_DMA_VALID;
-	}
-}
-
 static void qla_nvme_release_ls_cmd_kref(struct kref *kref)
 {
 	struct srb *sp = container_of(kref, struct srb, cmd_kref);
@@ -199,7 +187,6 @@  static void qla_nvme_release_ls_cmd_kref(struct kref *kref)
 
 	fd = priv->fd;
 
-	qla_nvme_ls_unmap(sp, fd);
 	fd->done(fd, priv->comp_status);
 out:
 	qla2x00_rel_sp(sp);
@@ -365,13 +352,10 @@  static int qla_nvme_ls_req(struct nvme_fc_local_port *lport,
 	nvme->u.nvme.rsp_len = fd->rsplen;
 	nvme->u.nvme.rsp_dma = fd->rspdma;
 	nvme->u.nvme.timeout_sec = fd->timeout;
-	nvme->u.nvme.cmd_dma = dma_map_single(&ha->pdev->dev, fd->rqstaddr,
-	    fd->rqstlen, DMA_TO_DEVICE);
+	nvme->u.nvme.cmd_dma = fd->rqstdma;
 	dma_sync_single_for_device(&ha->pdev->dev, nvme->u.nvme.cmd_dma,
 	    fd->rqstlen, DMA_TO_DEVICE);
 
-	sp->flags |= SRB_DMA_VALID;
-
 	rval = qla2x00_start_sp(sp);
 	if (rval != QLA_SUCCESS) {
 		ql_log(ql_log_warn, vha, 0x700e,
@@ -379,7 +363,6 @@  static int qla_nvme_ls_req(struct nvme_fc_local_port *lport,
 		wake_up(&sp->nvme_ls_waitq);
 		sp->priv = NULL;
 		priv->sp = NULL;
-		qla_nvme_ls_unmap(sp, fd);
 		qla2x00_rel_sp(sp);
 		return rval;
 	}