Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp4328049pxt; Wed, 11 Aug 2021 03:34:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCDTLPnhcn0XcpxrZXqrvm3WLjIepyKi3YsTIP6qbPHlmbs8Go3hPRIkAGr4gd1sDkXE4n X-Received: by 2002:a02:c6b8:: with SMTP id o24mr32182318jan.108.1628678089007; Wed, 11 Aug 2021 03:34:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628678089; cv=none; d=google.com; s=arc-20160816; b=QQcRs3+iZS3Zpo3b9WYC4bnjsJVXxCa6S9a9FayhPMwPGXyuoUnq9fzPCjw3iIt2IA ZQWBhCtrSJ1FEegjavbd0gYHGshaqHqBJJje33Lr4Z8U0nBA+ucW10RWfD0oyTAjt+71 inMwfOnRH7Bmy4SkS0sd0nldRogpexDasltTit6tDlSQnrmG70FshJqO/fpzN8/x9AMi UCVJ4/HuN2dWCwi71ey1+9537jp8CLbTE/7UFSuTUy4U1bZuDc3TFWGETE0wcGRf6P50 NqIeLpT7H2yX5LKKKJ2cX7icgJBiv3mg3+vWzBKV90pEj/L29UfRJ2kCT7Fp/KeT6zNz rS2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=QlwX0BQSzOMEOcUEt1HMXtXPU5Umm+8zUZ6ELb4XdAU=; b=nLwlZO3796C7PWFcbbdUNXYxQeS3p89Sq8HENYhxgjJQbAOMM+sbqhQTr1uRb4hs6N Qo6h+9FuFn+sx2VOTDddCmms8qqy9UdcdT0TCqnefEYw8H4Gm4KkFeJ2UxW0Wh1xAg78 eKKTaQhgtYOuKX6YZI4FznrjVQk4KfFTJrxLmkuLigLkO8QKGDk75ApCaSZhcQmuzWt3 5Z+4VpouFDss055TVvesg7xCWe5B0rUk1dv6QRHpWx9BMGCnuxyJkPXsjA+O3TvmgFyK KjJs87ulSlh/tmk425vJe3/V/5nxPmWDFgtI3wpoyYmubieK6EXsXANg3GaaGpuxzdLM rXog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RkuqxgEd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j18si1055827iow.66.2021.08.11.03.34.37; Wed, 11 Aug 2021 03:34:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RkuqxgEd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237173AbhHKKeO (ORCPT + 99 others); Wed, 11 Aug 2021 06:34:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:60388 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237116AbhHKKeN (ORCPT ); Wed, 11 Aug 2021 06:34:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id ECD0360C3E; Wed, 11 Aug 2021 10:33:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628678030; bh=MG7heJZm5M3tEsl415rXYzpWZZsIqmxepajSEhkW4Zo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RkuqxgEd02iFCSEOmFrL6Lj/suWCuMrUu0fBECIz8mEjKlnHsjlvIwLmWXayBI4Re oZvfIrh7+xC86tFxJHW8SKB/YbYeNXNtVKwsFMJrmiRcbkxpnsDM9Gyr0NF9Tx05eL d6n8iqUo9ZMGfyCSqYV81EERnG3geug5cBJRdmmWa96V70yrmdv7REaVMTHpEBiNq+ RBLk8UI5qQHo+uIbngO+jZHUIyWDZQu4gOpt7SiSXL1HF/exMLTmgfxtkMySOuVpry Z/dEEi8lNKQJv6UHHHeefspGTTd3zZSjfhYcuGgUB0TfugRT1VzoeIlIaHegB1TdJm BsEKf0t/yQ4gA== Date: Wed, 11 Aug 2021 11:33:45 +0100 From: Will Deacon To: John Garry Cc: "Leizhen (ThunderTown)" , Robin Murphy , iommu , linux-arm-kernel , linux-kernel Subject: Re: [PATCH RFC 2/8] iommu/arm-smmu-v3: Add and use static helper function arm_smmu_cmdq_issue_cmd_with_sync() Message-ID: <20210811103344.GA4736@willie-the-truck> References: <20210626110130.2416-1-thunder.leizhen@huawei.com> <20210626110130.2416-3-thunder.leizhen@huawei.com> <20210810182454.GB3296@willie-the-truck> <20210811100905.GB4426@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 11, 2021 at 11:31:08AM +0100, John Garry wrote: > > > > > Obviously, inserting as many commands at a time as possible can reduce the > > > > > number of times the mutex contention participates, thereby improving the > > > > > overall performance. At least it reduces the number of calls to function > > > > > arm_smmu_cmdq_issue_cmdlist(). > > > > > > > > > > Therefore, function arm_smmu_cmdq_issue_cmd_with_sync() is added to insert > > > > > the 'cmd+sync' commands at a time. > > > > > > > > > > Signed-off-by: Zhen Lei > > > > > --- > > > > > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 33 +++++++++++++-------- > > > > > 1 file changed, 21 insertions(+), 12 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 2433d3c29b49ff2..a5361153ca1d6a4 100644 > > > > > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > > > > > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > > > > > @@ -858,11 +858,25 @@ static int arm_smmu_cmdq_issue_cmd(struct arm_smmu_device *smmu, > > > > > return arm_smmu_cmdq_issue_cmdlist(smmu, cmd, 1, false); > > > > > } > > > > > -static int arm_smmu_cmdq_issue_sync(struct arm_smmu_device *smmu) > > > > > +static int __maybe_unused arm_smmu_cmdq_issue_sync(struct arm_smmu_device *smmu) > > > > > { > > > > > return arm_smmu_cmdq_issue_cmdlist(smmu, NULL, 0, true); > > > > > } > > > > > +static int arm_smmu_cmdq_issue_cmd_with_sync(struct arm_smmu_device *smmu, > > > > > + struct arm_smmu_cmdq_ent *ent) > > > > > +{ > > > > > + u64 cmd[CMDQ_ENT_DWORDS]; > > > > > + > > > > > + if (arm_smmu_cmdq_build_cmd(cmd, ent)) { > > > > > + dev_warn(smmu->dev, "ignoring unknown CMDQ opcode 0x%x\n", > > > > > + ent->opcode); > > > > > + return -EINVAL; > > Are any of the errors returned from the "issue command" functions actually > consumed? I couldn't see it on mainline code from a brief browse. I don't think so. Can we actually propagate them? Will