Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Desnes Nunes <desnesn@redhat.com>
To: iommu@lists.linux.dev, linux-scsi@vger.kernel.org,
	storagedev@microchip.com, linux-kernel@vger.kernel.org
Cc: hch@lst.de, martin.petersen@oracle.com, don.brace@microchip.com,
	m.szyprowski@samsung.com, robin.murphy@arm.com,
	jejb@linux.ibm.com, jsnitsel@redhat.com,
	Desnes Nunes <desnesn@redhat.com>
Subject: [PATCH v2 3/3] scsi: smartpqi: fix DMA overlapping mappings asymmetry
Date: Thu, 16 Mar 2023 11:09:12 -0300	[thread overview]
Message-ID: <20230316140912.1038404-4-desnesn@redhat.com> (raw)
In-Reply-To: <20230316140912.1038404-1-desnesn@redhat.com>

Currently, pqi_keep_device_offline() calls pqi_build_raid_path_request()
(i.e., a wrapper to pqi_map_single()), but there isn't a pqi_pci_unmap()
call in pqi_keep_device_offline(). Hence, this is flaged as an API viola-
tion due to the overlapping mapping of the physical address.

This patch fixes following warning:

  DMA-API: smartpqi 0000:43:00.0: cacheline tracking EEXIST, overlapping
  mappings aren't supported
  WARNING: CPU: 0 PID: 15 at kernel/dma/debug.c:570
  add_dma_entry+0x1f6/0x2f0
  CPU: 0 PID: 15 Comm: kworker/0:1 Not tainted 6.3.0-rc1-linux #1
  Call Trace:
   <TASK>
   dma_map_page_attrs+0x6f/0xa0
   pqi_map_single+0xaa/0x160 [smartpqi]
   pqi_keep_device_offline+0xaf/0x160 [smartpqi]
   ? dma_unmap_page_attrs+0x1a1/0x1e0
   ? pqi_identify_physical_device.constprop.0+0xd3/0xe0 [smartpqi]
   pqi_update_scsi_devices+0x284/0x7e0 [smartpqi]
   pqi_scan_scsi_devices+0x87/0xe0 [smartpqi]
   pqi_ctrl_init+0x725/0xa60 [smartpqi]
   pqi_pci_probe+0xa7/0x130 [smartpqi]
   local_pci_probe+0x46/0xa0
   work_for_cpu_fn+0x16/0x20
   process_one_work+0x2bf/0x670
   ? __pfx_worker_thread+0x10/0x10
   worker_thread+0x1d1/0x3b0
   ? __pfx_worker_thread+0x10/0x10
   kthread+0xf3/0x120
   ? __pfx_kthread+0x10/0x10
   ret_from_fork+0x2c/0x50
   </TASK>

Fixes: be76f90668d8 ("scsi: smartpqi: Add TEST UNIT READY check for SANITIZE operation")
Signed-off-by: Desnes Nunes <desnesn@redhat.com>
---
 drivers/scsi/smartpqi/smartpqi_init.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index 49a8f91810b6..6fca497ca605 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -1726,6 +1726,8 @@ static bool pqi_keep_device_offline(struct pqi_ctrl_info *ctrl_info,
 
 	rc = pqi_submit_raid_request_synchronous(ctrl_info, &request.header, 0, &error_info);
 
+	pqi_pci_unmap(ctrl_info->pci_dev, request.sg_descriptors, 1, dir);
+
 	if (rc)
 		goto out; /* Assume not offline */
 
-- 
2.39.1


  parent reply	other threads:[~2023-03-16 14:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-16 14:09 [PATCH v2 0/3] scsi: smartpqi: fix DMA overlapping mappings asymmetry Desnes Nunes
2023-03-16 14:09 ` [PATCH v2 1/3] dma-debug: small dma_debug_entry's comment and variable name updates Desnes Nunes
2023-03-16 14:09 ` [PATCH v2 2/3] dma-debug: add cacheline to user/kernel space dump messages Desnes Nunes
2023-03-16 14:09 ` Desnes Nunes [this message]
2023-03-28  1:37 ` [PATCH v2 0/3] scsi: smartpqi: fix DMA overlapping mappings asymmetry Christoph Hellwig
2023-03-29  7:15 ` Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230316140912.1038404-4-desnesn@redhat.com \
    --to=desnesn@redhat.com \
    --cc=don.brace@microchip.com \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux.dev \
    --cc=jejb@linux.ibm.com \
    --cc=jsnitsel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=martin.petersen@oracle.com \
    --cc=robin.murphy@arm.com \
    --cc=storagedev@microchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox