Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2847875pxb; Tue, 19 Jan 2021 07:32:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJztctFeXMLQ3HC+HjrS3VFi6zYesC8gQ3W45zWD34zpWdlC7YTzTPJEWFOmPlTWtuWKNu4Y X-Received: by 2002:a17:906:9345:: with SMTP id p5mr3322014ejw.40.1611070361221; Tue, 19 Jan 2021 07:32:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611070361; cv=none; d=google.com; s=arc-20160816; b=nhy730ucsWbhF0aAfNaPcRS/6vjcgIebQuCIdf2fzl4N6iaFHInDiKS2qIv1byJN4R t9Ua1jvulR8OJmYC86u/d1ZyPzNvbxzxxx9AsyJApDR/rA7LZ2rt90yLqwZIG/5ID1pW rKfqMXdQjm9gtKxHWNMfC8GA/6HF1064ANQDWLvmhh56hjYzLtLae0WZJHr12M+Xlufz zaKK54fcmU9iVS38KJG/Mt45BdhgVoRthwhD967Blet8OfU5+40ulk4XQsngoO3Ht+P+ uQvq7r19uZVj80mDZItJcq/7EfhO40q+qJwsIaYk3s/U1tsQ3muu6eVsPUmaA/Qgp6l6 m9cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9SdVCTr5RtENV5upn/rU9VC9X6XHYMAQhYyklwuow6I=; b=FtlKwAfdKbeY5Aa/DAUL+Zqze7unK74NocZH173Icz+TjbnNuAGE+f2t2rPbqkXUCd qp3IaN7FXiJuIUzaFA6IzPry9EAlSEgYyGqs7KmmTy8i5rq3dP+g1jc9IW1PbxDI/AFb 0MK7dingIvs9r1bpycd9gLAhA0p74lRggwMHc9eDCVKKWDrZ5i4kYueqUj6a+7H5GZa+ YL5MFQux0y1v/8raVjQTtHQrfF/RVp6udRUf5+p2cpqb/7Lc7bdJwBVP7OfDN0UKLR6P fJBlYPTp82XbZOa9LUKeboTm62c73BKT2Aicsf5hHOzMP8YfDUeoo9YOXEIUUx6w8cLs uujA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=r6y945BE; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oq7si8971835ejb.471.2021.01.19.07.32.17; Tue, 19 Jan 2021 07:32:41 -0800 (PST) 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=@infradead.org header.s=casper.20170209 header.b=r6y945BE; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391102AbhASP2w (ORCPT + 99 others); Tue, 19 Jan 2021 10:28:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391638AbhASP1b (ORCPT ); Tue, 19 Jan 2021 10:27:31 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4642C061575 for ; Tue, 19 Jan 2021 07:26:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=9SdVCTr5RtENV5upn/rU9VC9X6XHYMAQhYyklwuow6I=; b=r6y945BEZul6pRcpcA5ykCihA0 Ae4HrojblkggZV3csM55ZIrdN9YR9ANUTWGDoK6/0BKH1ouP7Z9LquJ2d8pUvqLEfTkQJtTnc+Qxx VJkhYWjse4546XjYVeU1aAmAd1JDkfBwOcSQo1OuyUSspelmUHfNAxPt4n1VO+hMcpZ0YBGRrXaOM 6T4Fa0Zx03mJzZPevgRNn7MBjvv/jxRC/mKFc2jEn5KUXJkwTJ3VmBlZCR3kZixm1skOEe9wNhzwW ejhwCOmjEzq74EfKbFOOxlVVYfUCJWX8YoSjiZaG+WMDlm3QVXYBw0U2GxJynTgCbDqUaQixiT5QP A7jshzNQ==; Received: from hch by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1l1su1-00EUfP-Vk; Tue, 19 Jan 2021 15:26:46 +0000 Date: Tue, 19 Jan 2021 15:26:41 +0000 From: Christoph Hellwig To: Lianbo Jiang Cc: linux-kernel@vger.kernel.org, thomas.lendacky@amd.com, will@kernel.org, iommu@lists.linux-foundation.org, robin.murphy@arm.com Subject: Re: [PATCH 1/2 v2] dma-iommu: use static-key to minimize the impact in the fast-path Message-ID: <20210119152641.GA3453587@infradead.org> References: <20210119111616.12761-1-lijiang@redhat.com> <20210119111616.12761-2-lijiang@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210119111616.12761-2-lijiang@redhat.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 19, 2021 at 07:16:15PM +0800, Lianbo Jiang wrote: > +static DEFINE_STATIC_KEY_FALSE(__deferred_attach); Why the strange underscores? Wouldn't iommu_deferred_attach_enabled be a better name? > - if (unlikely(iommu_dma_deferred_attach(dev, domain))) > + if (static_branch_unlikely(&__deferred_attach) && > + iommu_dma_deferred_attach(dev, domain)) Also insted of duplicating this logic in three places, maybe rename iommu_dma_deferred_attach to __iommu_dma_deferred_attach and create a small inline wrapper for it?