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.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 16AE6C4724C for ; Mon, 4 May 2020 16:07:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CB1F720721 for ; Mon, 4 May 2020 16:07:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="tOa5oTLa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CB1F720721 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 64B6C8E0057; Mon, 4 May 2020 12:07:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5FBA78E0024; Mon, 4 May 2020 12:07:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4EACB8E0057; Mon, 4 May 2020 12:07:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0056.hostedemail.com [216.40.44.56]) by kanga.kvack.org (Postfix) with ESMTP id 324718E0024 for ; Mon, 4 May 2020 12:07:46 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id CAE2216467 for ; Mon, 4 May 2020 16:07:45 +0000 (UTC) X-FDA: 76779517290.13.pull58_43bb08be63f4a X-HE-Tag: pull58_43bb08be63f4a X-Filterd-Recvd-Size: 4936 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Mon, 4 May 2020 16:07:45 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id r26so115878wmh.0 for ; Mon, 04 May 2020 09:07:45 -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=nMl6SHOaMost3dT1wGRgIQNBlt6LwoX99r9Dd84bUXI=; b=tOa5oTLa/BSYByPuQ+26pv5RJej5b20cBe+rvpOGPI/KofVkXxxl26y2MJakqaW0FQ rZJEar4QOw/8Ea95uNmoZPskH+y3kSmV2qqvfj7xz7WuAu3apmEB/RRqtnxyMYZ1rwFV kt9KI3iTKOxkoNvLOTBuIDR0pT38dqKuazvuidA+F4t6y11UNBS8CQ764TRmaAXE6n7m q2Ud0IZOLQGVjWMbEwM4ap6Y19/3twFdisN9Kmfa5J4pXzqmJ6e1dcc/hcuI7bWLKgbg 5Oqx76DnLKrP1ppU9XJcOJPcIjL1Te3iy2p8xs4JkrbmXrwXC2o4X+EqXTaqX6KHcXrS DrRA== 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=nMl6SHOaMost3dT1wGRgIQNBlt6LwoX99r9Dd84bUXI=; b=lTXyRrj7OmQJvGWRu/wasJJHgcZpdeQ8g36Gcr17Am0QtpTa98P9cEbh24IeRYToMO Nmae07VZkbTcEHilm2tKrZ+P6Ed3ZErqkigecGajlxJE3S5WauQRfFF7Sa8l/D2oqV9G /ejZCvvwu0+9AfIwH72Wt4Bu+C5eG5JT7H0fD6AAV+MpylPcMaZqXgkX3J+Lmrr0HbLi e+JjYZxJgBwhP7TWx3CzdV6vKn3eQf30HaJVyqd7AKmCj5a6mDxS5Ag5bx+y2GQQEIOm fz3cchDw4hM6E3sT+P//C58f2f4cChT23+p68lOXptDUpW8MgzHAmlHNiUVcWJ3LOyzW ZaxQ== X-Gm-Message-State: AGi0PuY+Ck9FY4GTGFc03aR8nYLPoR6/TQxNSEgg0vWWq7tjfDZeXgdG iDCY7WnK6Sf6K0iVYciydYKQCG+osKc= X-Google-Smtp-Source: APiQypLRnG6LvHqUIo2qBJAF7F6DJOi32Rx7XybV+rqHkWXfxFrCE9dU7PixYXhfr6u9mhKSarqUxQ== X-Received: by 2002:a7b:cb0c:: with SMTP id u12mr16851030wmj.137.1588608464322; Mon, 04 May 2020 09:07:44 -0700 (PDT) Received: from myrica ([2001:171b:226e:c200:c43b:ef78:d083:b355]) by smtp.gmail.com with ESMTPSA id l15sm13514230wmi.48.2020.05.04.09.07.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2020 09:07:43 -0700 (PDT) Date: Mon, 4 May 2020 18:07:34 +0200 From: Jean-Philippe Brucker To: Jason Gunthorpe Cc: Christoph Hellwig , iommu@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, linux-mm@kvack.org, fenghua.yu@intel.com, kevin.tian@intel.com, catalin.marinas@arm.com, robin.murphy@arm.com, zhangfei.gao@linaro.org, felix.kuehling@amd.com, will@kernel.org, christian.koenig@amd.com Subject: Re: [PATCH v6 17/25] iommu/arm-smmu-v3: Implement iommu_sva_bind/unbind() Message-ID: <20200504160734.GE170104@myrica> References: <20200430143424.2787566-1-jean-philippe@linaro.org> <20200430143424.2787566-18-jean-philippe@linaro.org> <20200501121552.GA6012@infradead.org> <20200501125513.GN26002@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200501125513.GN26002@ziepe.ca> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, May 01, 2020 at 09:55:13AM -0300, Jason Gunthorpe wrote: > 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? > > > > > + 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; > > > + } > > > + } > > I also would like it if searching for mms in linked lists was not > necessary, this is kind of the point of 'get' > > Is this a side effect of the earlier remark to get rid of the linked > list inside the notifier? > > > 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. > > This might be the best option if it can absorb the above search.. It wouldn't, the above search is separate. I currently register the MMU notifier on (IOMMU domain, mm). The (dev, mm) search above is to follow the iommu_sva_bind_device() API doc, that states we should return the same handle for a given (dev, mm) pair. Thanks, Jean