From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: John Garry <john.garry@huawei.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
Sasha Levin <sashal@kernel.org>,
jejb@linux.ibm.com, linux-scsi@vger.kernel.org
Subject: [PATCH AUTOSEL 5.10 04/11] scsi: hisi_sas: Limit max hw sectors for v3 HW
Date: Wed, 6 Jul 2022 11:32:49 -0400 [thread overview]
Message-ID: <20220706153256.1598411-4-sashal@kernel.org> (raw)
In-Reply-To: <20220706153256.1598411-1-sashal@kernel.org>
From: John Garry <john.garry@huawei.com>
[ Upstream commit fce54ed027577517df1e74b7d54dc2b1bd536887 ]
If the controller is behind an IOMMU then the IOMMU IOVA caching range can
affect performance, as discussed in [0].
Limit the max HW sectors to not exceed this limit. We need to hardcode the
value until a proper DMA mapping API is available.
[0] https://lore.kernel.org/linux-iommu/20210129092120.1482-1-thunder.leizhen@huawei.com/
Link: https://lore.kernel.org/r/1655988119-223714-1-git-send-email-john.garry@huawei.com
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
index cd41dc061d87..dfe7e6370d84 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
@@ -2738,6 +2738,7 @@ static int slave_configure_v3_hw(struct scsi_device *sdev)
struct hisi_hba *hisi_hba = shost_priv(shost);
struct device *dev = hisi_hba->dev;
int ret = sas_slave_configure(sdev);
+ unsigned int max_sectors;
if (ret)
return ret;
@@ -2755,6 +2756,12 @@ static int slave_configure_v3_hw(struct scsi_device *sdev)
}
}
+ /* Set according to IOMMU IOVA caching limit */
+ max_sectors = min_t(size_t, queue_max_hw_sectors(sdev->request_queue),
+ (PAGE_SIZE * 32) >> SECTOR_SHIFT);
+
+ blk_queue_max_hw_sectors(sdev->request_queue, max_sectors);
+
return 0;
}
--
2.35.1
next prev parent reply other threads:[~2022-07-06 15:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-06 15:32 [PATCH AUTOSEL 5.10 01/11] virtio_mmio: Add missing PM calls to freeze/restore Sasha Levin
2022-07-06 15:32 ` [PATCH AUTOSEL 5.10 02/11] virtio_mmio: Restore guest page size on resume Sasha Levin
2022-07-06 15:32 ` [PATCH AUTOSEL 5.10 03/11] netfilter: br_netfilter: do not skip all hooks with 0 priority Sasha Levin
2022-07-06 15:32 ` Sasha Levin [this message]
2022-07-06 15:32 ` [PATCH AUTOSEL 5.10 05/11] cpufreq: pmac32-cpufreq: Fix refcount leak bug Sasha Levin
2022-07-06 15:32 ` [PATCH AUTOSEL 5.10 06/11] platform/x86: hp-wmi: Ignore Sanitization Mode event Sasha Levin
2022-07-06 15:32 ` [PATCH AUTOSEL 5.10 07/11] net: tipc: fix possible refcount leak in tipc_sk_create() Sasha Levin
2022-07-06 15:32 ` [PATCH AUTOSEL 5.10 08/11] NFC: nxp-nci: don't print header length mismatch on i2c error Sasha Levin
2022-07-06 15:32 ` [PATCH AUTOSEL 5.10 09/11] nvme-tcp: always fail a request when sending it failed Sasha Levin
2022-07-06 15:32 ` [PATCH AUTOSEL 5.10 10/11] nvme: fix regression when disconnect a recovering ctrl Sasha Levin
2022-07-06 15:32 ` [PATCH AUTOSEL 5.10 11/11] net: sfp: fix memory leak in sfp_probe() Sasha Levin
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=20220706153256.1598411-4-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=jejb@linux.ibm.com \
--cc=john.garry@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=stable@vger.kernel.org \
/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