iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/3] iommu/arm-smmu-v3: permit users to disable msi polling
@ 2020-08-18 23:38 Barry Song
  2020-08-18 23:38 ` [PATCH v4 1/3] iommu/arm-smmu-v3: replace symbolic permissions by octal permissions for module parameter Barry Song
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Barry Song @ 2020-08-18 23:38 UTC (permalink / raw)
  To: will, robin.murphy, joro; +Cc: iommu, linux-arm-kernel, prime.zeng, linuxarm

patch 1/3 and patch 2/3 are the preparation of patch 3/3 which permits users
to disable MSI-based polling by cmd line.

-v4:
  with respect to Robin's comments
  * cleanup the code of the existing module parameter disable_bypass
  * add ARM_SMMU_OPT_MSIPOLL flag. on the other hand, we only need to check
    a bit in options rather than two bits in features

Barry Song (3):
  iommu/arm-smmu-v3: replace symbolic permissions by octal permissions
    for module parameter
  iommu/arm-smmu-v3: replace module_param_named by module_param for
    disable_bypass
  iommu/arm-smmu-v3: permit users to disable msi polling

 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

-- 
2.27.0


_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v4 1/3] iommu/arm-smmu-v3: replace symbolic permissions by octal permissions for module parameter
  2020-08-18 23:38 [PATCH v4 0/3] iommu/arm-smmu-v3: permit users to disable msi polling Barry Song
@ 2020-08-18 23:38 ` Barry Song
  2020-08-18 23:38 ` [PATCH v4 2/3] iommu/arm-smmu-v3: replace module_param_named by module_param for disable_bypass Barry Song
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Barry Song @ 2020-08-18 23:38 UTC (permalink / raw)
  To: will, robin.murphy, joro; +Cc: iommu, linux-arm-kernel, prime.zeng, linuxarm

This fixed the below checkpatch issue:
WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using
octal permissions '0444'.
417: FILE: drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:417:
module_param_named(disable_bypass, disable_bypass, bool, S_IRUGO);

-v4:
   * cleanup the existing module parameter of bypass_
   * add ARM_SMMU_OPT_MSIPOLL flag with respect to Robin's comments

Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>
---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 7196207be7ea..eea5f7c6d9ab 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -414,7 +414,7 @@
 #define MSI_IOVA_LENGTH			0x100000
 
 static bool disable_bypass = 1;
-module_param_named(disable_bypass, disable_bypass, bool, S_IRUGO);
+module_param_named(disable_bypass, disable_bypass, bool, 0444);
 MODULE_PARM_DESC(disable_bypass,
 	"Disable bypass streams such that incoming transactions from devices that are not attached to an iommu domain will report an abort back to the device and will not be allowed to pass through the SMMU.");
 
-- 
2.27.0


_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v4 2/3] iommu/arm-smmu-v3: replace module_param_named by module_param for disable_bypass
  2020-08-18 23:38 [PATCH v4 0/3] iommu/arm-smmu-v3: permit users to disable msi polling Barry Song
  2020-08-18 23:38 ` [PATCH v4 1/3] iommu/arm-smmu-v3: replace symbolic permissions by octal permissions for module parameter Barry Song
@ 2020-08-18 23:38 ` Barry Song
  2020-08-18 23:38 ` [PATCH v4 3/3] iommu/arm-smmu-v3: permit users to disable msi polling Barry Song
  2020-08-20 13:10 ` [PATCH v4 0/3] " Robin Murphy
  3 siblings, 0 replies; 5+ messages in thread
From: Barry Song @ 2020-08-18 23:38 UTC (permalink / raw)
  To: will, robin.murphy, joro; +Cc: iommu, linux-arm-kernel, prime.zeng, linuxarm

Just use module_param() - going out of the way to specify a "different"
name that's identical to the variable name is silly.

Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>
---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index eea5f7c6d9ab..5b40d535a7c8 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -414,7 +414,7 @@
 #define MSI_IOVA_LENGTH			0x100000
 
 static bool disable_bypass = 1;
-module_param_named(disable_bypass, disable_bypass, bool, 0444);
+module_param(disable_bypass, bool, 0444);
 MODULE_PARM_DESC(disable_bypass,
 	"Disable bypass streams such that incoming transactions from devices that are not attached to an iommu domain will report an abort back to the device and will not be allowed to pass through the SMMU.");
 
-- 
2.27.0


_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v4 3/3] iommu/arm-smmu-v3: permit users to disable msi polling
  2020-08-18 23:38 [PATCH v4 0/3] iommu/arm-smmu-v3: permit users to disable msi polling Barry Song
  2020-08-18 23:38 ` [PATCH v4 1/3] iommu/arm-smmu-v3: replace symbolic permissions by octal permissions for module parameter Barry Song
  2020-08-18 23:38 ` [PATCH v4 2/3] iommu/arm-smmu-v3: replace module_param_named by module_param for disable_bypass Barry Song
@ 2020-08-18 23:38 ` Barry Song
  2020-08-20 13:10 ` [PATCH v4 0/3] " Robin Murphy
  3 siblings, 0 replies; 5+ messages in thread
From: Barry Song @ 2020-08-18 23:38 UTC (permalink / raw)
  To: will, robin.murphy, joro; +Cc: iommu, linux-arm-kernel, prime.zeng, linuxarm

Polling by MSI isn't necessarily faster than polling by SEV. Tests on
hi1620 show hns3 100G NIC network throughput can improve from 25G to
27G if we disable MSI polling while running 16 netperf threads sending
UDP packets in size 32KB. TX throughput can improve from 7G to 7.7G for
single thread.
The reason for the throughput improvement is that the latency to poll
the completion of CMD_SYNC becomes smaller. After sending a CMD_SYNC
in an empty cmd queue, typically we need to wait for 280ns using MSI
polling. But we only need around 190ns after disabling MSI polling.
This patch provides a command line option so that users can decide to
use MSI polling or not based on their tests.

Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>
---
 -v4: add ARM_SMMU_OPT_MSIPOLL flag with respect to Robin's comment

 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 5b40d535a7c8..7332251dd8cd 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -418,6 +418,11 @@ module_param(disable_bypass, bool, 0444);
 MODULE_PARM_DESC(disable_bypass,
 	"Disable bypass streams such that incoming transactions from devices that are not attached to an iommu domain will report an abort back to the device and will not be allowed to pass through the SMMU.");
 
+static bool disable_msipolling;
+module_param(disable_msipolling, bool, 0444);
+MODULE_PARM_DESC(disable_msipolling,
+	"Disable MSI-based polling for CMD_SYNC completion.");
+
 enum pri_resp {
 	PRI_RESP_DENY = 0,
 	PRI_RESP_FAIL = 1,
@@ -652,6 +657,7 @@ struct arm_smmu_device {
 
 #define ARM_SMMU_OPT_SKIP_PREFETCH	(1 << 0)
 #define ARM_SMMU_OPT_PAGE0_REGS_ONLY	(1 << 1)
+#define ARM_SMMU_OPT_MSIPOLL		(1 << 2)
 	u32				options;
 
 	struct arm_smmu_cmdq		cmdq;
@@ -992,8 +998,7 @@ static void arm_smmu_cmdq_build_sync_cmd(u64 *cmd, struct arm_smmu_device *smmu,
 	 * Beware that Hi16xx adds an extra 32 bits of goodness to its MSI
 	 * payload, so the write will zero the entire command on that platform.
 	 */
-	if (smmu->features & ARM_SMMU_FEAT_MSI &&
-	    smmu->features & ARM_SMMU_FEAT_COHERENCY) {
+	if (smmu->options & ARM_SMMU_OPT_MSIPOLL) {
 		ent.sync.msiaddr = q->base_dma + Q_IDX(&q->llq, prod) *
 				   q->ent_dwords * 8;
 	}
@@ -1332,8 +1337,7 @@ static int __arm_smmu_cmdq_poll_until_consumed(struct arm_smmu_device *smmu,
 static int arm_smmu_cmdq_poll_until_sync(struct arm_smmu_device *smmu,
 					 struct arm_smmu_ll_queue *llq)
 {
-	if (smmu->features & ARM_SMMU_FEAT_MSI &&
-	    smmu->features & ARM_SMMU_FEAT_COHERENCY)
+	if (smmu->options & ARM_SMMU_OPT_MSIPOLL)
 		return __arm_smmu_cmdq_poll_until_msi(smmu, llq);
 
 	return __arm_smmu_cmdq_poll_until_consumed(smmu, llq);
@@ -3741,8 +3745,11 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
 	if (reg & IDR0_SEV)
 		smmu->features |= ARM_SMMU_FEAT_SEV;
 
-	if (reg & IDR0_MSI)
+	if (reg & IDR0_MSI) {
 		smmu->features |= ARM_SMMU_FEAT_MSI;
+		if (coherent && !disable_msipolling)
+			smmu->options |= ARM_SMMU_OPT_MSIPOLL;
+	}
 
 	if (reg & IDR0_HYP)
 		smmu->features |= ARM_SMMU_FEAT_HYP;
-- 
2.27.0


_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v4 0/3] iommu/arm-smmu-v3: permit users to disable msi polling
  2020-08-18 23:38 [PATCH v4 0/3] iommu/arm-smmu-v3: permit users to disable msi polling Barry Song
                   ` (2 preceding siblings ...)
  2020-08-18 23:38 ` [PATCH v4 3/3] iommu/arm-smmu-v3: permit users to disable msi polling Barry Song
@ 2020-08-20 13:10 ` Robin Murphy
  3 siblings, 0 replies; 5+ messages in thread
From: Robin Murphy @ 2020-08-20 13:10 UTC (permalink / raw)
  To: Barry Song, will, joro; +Cc: iommu, linux-arm-kernel, prime.zeng, linuxarm

On 2020-08-19 00:38, Barry Song wrote:
> patch 1/3 and patch 2/3 are the preparation of patch 3/3 which permits users
> to disable MSI-based polling by cmd line.
> 
> -v4:
>    with respect to Robin's comments
>    * cleanup the code of the existing module parameter disable_bypass
>    * add ARM_SMMU_OPT_MSIPOLL flag. on the other hand, we only need to check
>      a bit in options rather than two bits in features

Thanks Barry - for all 3 patches,

Reviewed-by: Robin Murphy <robin.murphy@arm.com>

I'd be inclined to squash #2 into #1, but I'll leave that up to Will.

Cheers,
Robin.

> 
> Barry Song (3):
>    iommu/arm-smmu-v3: replace symbolic permissions by octal permissions
>      for module parameter
>    iommu/arm-smmu-v3: replace module_param_named by module_param for
>      disable_bypass
>    iommu/arm-smmu-v3: permit users to disable msi polling
> 
>   drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 19 +++++++++++++------
>   1 file changed, 13 insertions(+), 6 deletions(-)
> 
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-08-20 13:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-18 23:38 [PATCH v4 0/3] iommu/arm-smmu-v3: permit users to disable msi polling Barry Song
2020-08-18 23:38 ` [PATCH v4 1/3] iommu/arm-smmu-v3: replace symbolic permissions by octal permissions for module parameter Barry Song
2020-08-18 23:38 ` [PATCH v4 2/3] iommu/arm-smmu-v3: replace module_param_named by module_param for disable_bypass Barry Song
2020-08-18 23:38 ` [PATCH v4 3/3] iommu/arm-smmu-v3: permit users to disable msi polling Barry Song
2020-08-20 13:10 ` [PATCH v4 0/3] " Robin Murphy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).