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 X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9DFAC4724C for ; Mon, 4 May 2020 16:06:56 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 80827206A4 for ; Mon, 4 May 2020 16:06:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ojaEqEAx"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Dw8xcNvj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 80827206A4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject: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=lFChnvlsyq2YkWE186fiqEIRHeOV+FLeXBA4mFnCrD0=; b=ojaEqEAxAmDwXo E+oU1AHDcKA9pQBvKqzPYm4NF0KnQ5y5x6YFDnZ0qDoIRNBkUiS2FGGEBGauAX0RZNbd03+XzLJq6 bLyUhjg57jNegKBJvUci6q1zwzFJwhOPtyRZus1aosyu+JgU1JCeMZT8LazmfffAiWyYtTV8tFuKg 6ycnsQEAKI5MorD3zFWJisoMtBCOnMVQ+hGmkIalqvxLB9gGHeoqtanuFiSmx/7seE1E7PEolMEer Yu+kdrLk9OuPcxRBsw/RXy1Xz/IysgL/yBmDWxgoDdkCXuv5gFMJhA/GSNtCWZYajXb1foglMGUbH aYS0pok/SWoQCAYVojlw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVdcN-0002gz-Ph; Mon, 04 May 2020 16:06:55 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVdcK-0002fl-SQ for linux-arm-kernel@lists.infradead.org; Mon, 04 May 2020 16:06:54 +0000 Received: by mail-wm1-x343.google.com with SMTP id 188so90089wmc.2 for ; Mon, 04 May 2020 09:06:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=bp4AZOmEDFlGnUKxwTpEGrX9Ywb+/ercU9RXG60YpkA=; b=Dw8xcNvj2qmOKxxn59CPRrnhgYrQ5x4sBPM8qK0pmcxzWd1aH/YyCVxlXW3TIWT8Fw tx++cxMdi9+OTPqOJQ0MUb+cNtf6m3SYTI32z98924olcf+4nnXYi+IsldgCldMoIM07 4h4F+MxzAqq6y91AHErfmlevgojJiWj+WryxD4tS6DchG+1L3m2rsTys97s7V6H+LEdC LCsZJU4jP6ekqf6cSccjS9Se5DU1Jiz5dlTN66yFFKaWMHEZyAdh3cs63tmpeqdXo7uR T2cb+IBgx5aIR71N/OxSIdsY99sFfZqoNjBPUH6CNGyQrSLxrlGkp1kmGkSQF8YKLWZh DMTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=bp4AZOmEDFlGnUKxwTpEGrX9Ywb+/ercU9RXG60YpkA=; b=o55TfALKJxaKTdYPzffBJKpNOSpDFrgNY2+gvAvsjHp79mEN/8Y+ZEN8FR+jZ3pMa3 eKLCO13WIHso+bcs2ca/2T3CmBSlMFeoikDwuNW5bKEhpfIRkqpiOzC6ErwONRVTDlzP YYNE+d6N8Jn8zfVz4fcrk0g/Qgu9nh4cMbrD1dPDH3dLPR0CbzbNhLRgdNNilJZpOmTA l65OwB9rRTvem8zeETyhS0t94bJZacg1tDjF074OnHiUNLgoxftzUYTXocWRZWJREgty yJJhJ31W9xxqcQgu23WppDvZZ+Ur4L2IXliwPqV2FTfWabr5RQeE9Gu4+kVQGzys0bhW 9UyA== X-Gm-Message-State: AGi0PuZSHfeHqMAXXRBGC/Aa7U6IVvbkpZKVpiUPPqU/hPvabwXEkLCL s5c3E0+bnNgXwDM8YrK4QLP7lA== X-Google-Smtp-Source: APiQypKPyLr9D3x5aJJfh1E5/6u+cb8JP6Qo0I2a/ao2kDBpvQii1AZTwUzgtbi+yEe+qplCF2lrWg== X-Received: by 2002:a1c:3182:: with SMTP id x124mr16738870wmx.54.1588608410123; Mon, 04 May 2020 09:06:50 -0700 (PDT) Received: from myrica ([2001:171b:226e:c200:c43b:ef78:d083:b355]) by smtp.gmail.com with ESMTPSA id b66sm15224708wmh.12.2020.05.04.09.06.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2020 09:06:48 -0700 (PDT) Date: Mon, 4 May 2020 18:06:39 +0200 From: Jean-Philippe Brucker To: Christoph Hellwig Subject: Re: [PATCH v6 17/25] iommu/arm-smmu-v3: Implement iommu_sva_bind/unbind() Message-ID: <20200504160639.GD170104@myrica> References: <20200430143424.2787566-1-jean-philippe@linaro.org> <20200430143424.2787566-18-jean-philippe@linaro.org> <20200501121552.GA6012@infradead.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200501121552.GA6012@infradead.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200504_090653_084749_4EA7C3C4 X-CRM114-Status: GOOD ( 15.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, kevin.tian@intel.com, will@kernel.org, fenghua.yu@intel.com, jgg@ziepe.ca, linux-pci@vger.kernel.org, felix.kuehling@amd.com, linux-mm@kvack.org, iommu@lists.linux-foundation.org, catalin.marinas@arm.com, zhangfei.gao@linaro.org, robin.murphy@arm.com, christian.koenig@amd.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, May 01, 2020 at 05:15:52AM -0700, Christoph Hellwig wrote: > > @@ -432,6 +432,7 @@ config ARM_SMMU_V3 > > tristate "ARM Ltd. System MMU Version 3 (SMMUv3) Support" > > depends on ARM64 > > select IOMMU_API > > + select IOMMU_SVA > > select IOMMU_IO_PGTABLE_LPAE > > select GENERIC_MSI_IRQ_DOMAIN > > Doesn't this need to select MMU_NOTIFIER now? Yes, will fix > > + struct mmu_notifier_ops mn_ops; > > Note: not a pointer. > > > + /* If bind() was already called for this (dev, mm) pair, reuse it. */ > > + list_for_each_entry(bond, &master->bonds, list) { > > + if (bond->mm == mm) { > > + refcount_inc(&bond->refs); > > + return &bond->sva; > > + } > > + } > > + > > + mn = mmu_notifier_get(&smmu_domain->mn_ops, mm); > > + if (IS_ERR(mn)) > > + return ERR_CAST(mn); > > Which seems to be to avoid mmu_notifier_get reusing notifiers registered > by other arm_smmu_master instance right? Yes, although I'm registering a single mmu notifier per (domain, mm) pair, not (master, mm), because the SMMU driver keeps one set of PASID tables per IOMMU domain. > Either you could just use plain old mmu_notifier_register to avoid > the reuse. Or we could enhance the mmu_notifier_get to pass a private > oaque instance ID pointer, which is checked in addition to the ops, > and you could probably kill off the bonds list and lookup. Going back to mmu_notifier_register() seems better for now. I don't want to change the core APIs just for this driver, because it's likely to change again when more hardware starts appearing and we optimize it. Thanks, Jean _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel