From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E5C3AC0015E for ; Wed, 9 Aug 2023 13:50:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1vKpEZquBZnvdqSDo5QBTEql+cn3I7kB0qi+/37m1lU=; b=cox867bTR0Vmix 7orlXrNdLeKmq0tGXjHSFyNkqJcbiDB0WhYDYe1MgixXrZ/HWFdADXwTKP8we7ulm/GLR5c5ZcZF0 sUcu0JWxSjsAEPGfnnAhXaYQGBKBP07kRGr6rczbfSIGIndlURjH7nLBsZ62egm8BHoi8eeyhPCVq 8w/6rTDwV/Isk2GOf8S/ITd+l4YHqiqKhavHIzYvnacNQ66qpCNwowJ3OotmNBjSShP41yJFDU3KU UJMkaT31pGd4ToWBwC+jEbNI+HsvU+8uwVijaISmHXOPsZ/lWHyzBdy72I9C7eJm87S0ZvGsntwrR dVw9ENi7SG8NI9vE8YuA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qTjZt-0054sW-1R; Wed, 09 Aug 2023 13:50:21 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qTjZr-0054rT-07 for linux-arm-kernel@lists.infradead.org; Wed, 09 Aug 2023 13:50:20 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 84BCE611FD; Wed, 9 Aug 2023 13:50:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EE6FC433CC; Wed, 9 Aug 2023 13:50:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691589018; bh=1hImN3R8rh56hDlOvVWKDW7DBgbqk7msuvf7SxIvhuQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iA1bDz5GA5+hV8FkGZuPhc9bWpOSUxnPn8niO2qk7qAjHvRs2+5hLyruSot4FVsyi YhABA1v+VkkynK/R7bivuLrnkIJE0+fNIM+4hZ1Bz2MgG105zKZjvgm+cNGDwETHDl RHWE0/Okn3fnouRsfVhdjqmjrtGoIDX7xbyTKg0D3zYKIGMoNw1pB/FlGGSrQH7vD7 u867td9eRgkr5Iha6U3A5t7+Mk2V+AvDFOtKRvTFrrAva5WzDE5HfvwSTwBQq+K2w6 0f4+/OziSnBKuAMoKFLOgg9ImdQCX1Ct0psPFMnfSSVEikJ7CNpH0OeYiwiFpdg7iA wrAuuxY69+JEQ== Date: Wed, 9 Aug 2023 14:50:13 +0100 From: Will Deacon To: Michael Shavit Cc: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, robin.murphy@arm.com, nicolinc@nvidia.com, jgg@nvidia.com, jean-philippe@linaro.org Subject: Re: [PATCH v5 8/9] iommu/arm-smmu-v3: Skip cd sync if CD table isn't active Message-ID: <20230809135011.GC4226@willie-the-truck> References: <20230808171446.2187795-1-mshavit@google.com> <20230809011204.v5.8.Idedc0f496231e2faab3df057219c5e2d937bbfe4@changeid> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230809011204.v5.8.Idedc0f496231e2faab3df057219c5e2d937bbfe4@changeid> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230809_065019_113383_33ACF020 X-CRM114-Status: GOOD ( 19.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Aug 09, 2023 at 01:12:04AM +0800, Michael Shavit wrote: > This commit explicitly keeps track of whether a CD table is installed in > an STE so that arm_smmu_sync_cd can skip the sync when unnecessary. This > was previously achieved through the domain->devices list, but we are > moving to a model where arm_smmu_sync_cd directly operates on a master > and the master's CD table instead of a domain. Why is this path worth optimising? > 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 f5ad386cc8760..488d12dd2d4aa 100644 > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > @@ -985,6 +985,9 @@ static void arm_smmu_sync_cd(struct arm_smmu_master *master, > }, > }; > > + if (!master->cd_table.installed) > + return; Doesn't this interact badly with the sync in arm_smmu_detach_dev(), which I think happens after zapping the STE? > cmds.num = 0; > for (i = 0; i < master->num_streams; i++) { > cmd.cfgi.sid = master->streams[i].id; > @@ -1091,7 +1094,7 @@ int arm_smmu_write_ctx_desc(struct arm_smmu_master *master, int ssid, > cdptr[3] = cpu_to_le64(cd->mair); > > /* > - * STE is live, and the SMMU might read dwords of this CD in any > + * STE may be live, and the SMMU might read dwords of this CD in any > * order. Ensure that it observes valid values before reading > * V=1. > */ Why does this patch need to update this comment? Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel