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=-2.4 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 05E5DC47253 for ; Fri, 1 May 2020 12:55:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BA475208D6 for ; Fri, 1 May 2020 12:55:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="Nq8HOg9n" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BA475208D6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 48F478E0005; Fri, 1 May 2020 08:55:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 418D28E0001; Fri, 1 May 2020 08:55:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2B9198E0005; Fri, 1 May 2020 08:55:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0049.hostedemail.com [216.40.44.49]) by kanga.kvack.org (Postfix) with ESMTP id 0B1058E0001 for ; Fri, 1 May 2020 08:55:17 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id A810552A0 for ; Fri, 1 May 2020 12:55:16 +0000 (UTC) X-FDA: 76768145832.15.pigs01_683eeb7e0601f X-HE-Tag: pigs01_683eeb7e0601f X-Filterd-Recvd-Size: 4744 Received: from mail-qv1-f68.google.com (mail-qv1-f68.google.com [209.85.219.68]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Fri, 1 May 2020 12:55:16 +0000 (UTC) Received: by mail-qv1-f68.google.com with SMTP id t8so4652494qvw.5 for ; Fri, 01 May 2020 05:55:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=P0z8kBnXrlZIDie1dLQeqogN9MwmVy7z4o7SA4TqzwU=; b=Nq8HOg9n7Z+VdnITQnbqqVABmWu3/6twaYJ7q1ZG6DqOfwLX2pqDKfEDSh+EIm/he8 8XxNujX7EOvHA+Z3U42zDC/h9oN+aKWNxlISO0Rq2tTCVZNWNCIrJWk7sh2DWdjcVwvU wCvE4KNEgpOv+mKqLqLC6erVH6iCBHZ3nggeOEQIkaDvn7IPj2tAyOj9O8z6V4Qx2f1V 20zcGw/GN8o0n+NfO/8kyZsltT7TcTtCKSej9x25s7Vy8ZXZSAEGpL08aolIMnLihAqM O4lVQbo50EUAWIw62edP+hXhKTif6IJbYSGaALf2LAPuTPfJPTwd2r2FjwrGZ5t7qGNY ydVg== 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:user-agent; bh=P0z8kBnXrlZIDie1dLQeqogN9MwmVy7z4o7SA4TqzwU=; b=BE30EI1FzO24KNdluHwBrc8Vn6JvsCKgqmCUN3V47WYwJ+Nr12cTizuXFcVBRfEo2w A60ezDNQyLu6RmFTwxMQhUQXSBJE9Mp8K9VaB2KOSUDWgdPO2+GzfrKU2UvAKNExYqcw Pd1tzuW/tQjzt1MzPRcZceuu1UpVfHjzuMKFeTxaH5l4/nmDEb41STHMZKgfwUHy2VyY CaKf7NRGIv51pjgxx8R9FRY8gjJ9Ci6OVa6FGaxK1GLFaNSLxtFNdnM4cuU+u1WcGP63 oCpYPsVheM1lpAOx1RTlU6fWUomUSFQcuEnfzFdbUzKol9N3kZr2/c44MtHgQt0LjRkp MFyQ== X-Gm-Message-State: AGi0PublhHeQzlvh4HLxGxOfll5EXfBpMMnfztkd7Thpqfw+LyW4CiOZ Ub4BSwiw4k31Fv21dIfkdvXhWA== X-Google-Smtp-Source: APiQypJcH2wlws52fFFXitF6KkzvvmTMs6scpT5jXa1TBx4TcLMsA/h0u5FOFpvXuuZfcR/nYumjiA== X-Received: by 2002:a05:6214:a4e:: with SMTP id ee14mr3877158qvb.121.1588337715542; Fri, 01 May 2020 05:55:15 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-68-57-212.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.57.212]) by smtp.gmail.com with ESMTPSA id 28sm2645211qkp.10.2020.05.01.05.55.14 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 May 2020 05:55:14 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1jUVCD-0007LO-33; Fri, 01 May 2020 09:55:13 -0300 Date: Fri, 1 May 2020 09:55:13 -0300 From: Jason Gunthorpe To: Christoph Hellwig Cc: Jean-Philippe Brucker , 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: <20200501125513.GN26002@ziepe.ca> References: <20200430143424.2787566-1-jean-philippe@linaro.org> <20200430143424.2787566-18-jean-philippe@linaro.org> <20200501121552.GA6012@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200501121552.GA6012@infradead.org> User-Agent: Mutt/1.9.4 (2018-02-28) 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 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.. Jason