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=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 868E5C56201 for ; Wed, 25 Nov 2020 09:00:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9D35E206F7 for ; Wed, 25 Nov 2020 09:00:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="JkicOjiQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9D35E206F7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E7A376B0071; Wed, 25 Nov 2020 04:00:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E026E6B0072; Wed, 25 Nov 2020 04:00:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC9C76B0073; Wed, 25 Nov 2020 04:00:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0090.hostedemail.com [216.40.44.90]) by kanga.kvack.org (Postfix) with ESMTP id B0E8F6B0071 for ; Wed, 25 Nov 2020 04:00:55 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 77869180AD806 for ; Wed, 25 Nov 2020 09:00:55 +0000 (UTC) X-FDA: 77522345670.12.cat29_6314b2227375 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 4D25B18006AD5 for ; Wed, 25 Nov 2020 09:00:55 +0000 (UTC) X-HE-Tag: cat29_6314b2227375 X-Filterd-Recvd-Size: 5093 Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Wed, 25 Nov 2020 09:00:54 +0000 (UTC) Received: by mail-ot1-f45.google.com with SMTP id n12so1608170otk.0 for ; Wed, 25 Nov 2020 01:00:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cb0IyYfwRRpwkSMXLoK5meWkqSB6m3aHpp32lgtuG5E=; b=JkicOjiQYuUe4qC0NCYmxG5Jf2Qdd6VpUQG0aEBdA3L/hZkGUrza6gxYa2hMmPMY/s ewVWRJYqWnQURjTZ+yFTAdl1Ez4sxo1/0FaXREz0psNNjo/Ewp3/C0rJLjM2dFGW9gyu BSTEd4SBqAlo0o+/0PsIWfkx3MMZ6g5rTd+P4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cb0IyYfwRRpwkSMXLoK5meWkqSB6m3aHpp32lgtuG5E=; b=Nymk6ABqwuTqYCtG92qfA5NWE/g4kyDTd3Sg3wWLx57G1U+yQq+KdxLA+LKENuJH1P My2JQWykQQbVdCrS6L1OW7ysXgMXXFKZPQER9wbnZvMRuwHCwF/ew9TB2xEpEDfWIpxe ojjk3VB/yrvrgNw0BA+5Ft84x/RWccxnZTSQRUWRLXnYq7AxfzFetIYs+ncGGxxcygdZ kdsQlnjj2uBvPXH/cgGxujWPNW1Mzuxx65jeM25HlKsmwNDPGlFDszRPoHj1yRgxWwip gBX/MsX+Ioe+hQ14yFPssHvtTQOZZK7FxoA40JTqVe6nvuyn+21bHsmHXrnlWwtq7bIE a+KQ== X-Gm-Message-State: AOAM5315l8K93hts2HOnX9ZtjU3dymFk5H15WsZjQN8h5nRbObZy8Ghv xDc0C4wH1TDcB/abOHwP/gpCXTG+MAFoE2aBJ79dUg== X-Google-Smtp-Source: ABdhPJzdLrBChJNmwAufHSFyRkbYFLtVRK1HD1rbwhJfrbBBuHxsolU3fINxVDwgeq07RNzsEDacWevGKQb60NxLVLQ= X-Received: by 2002:a05:6830:3155:: with SMTP id c21mr2109430ots.281.1606294853508; Wed, 25 Nov 2020 01:00:53 -0800 (PST) MIME-Version: 1.0 References: <20201119144146.1045202-1-daniel.vetter@ffwll.ch> <20201119144146.1045202-18-daniel.vetter@ffwll.ch> <20201120183029.GQ244516@ziepe.ca> <20201124142814.GM401619@phenom.ffwll.local> <20201124155526.GH5487@ziepe.ca> In-Reply-To: <20201124155526.GH5487@ziepe.ca> From: Daniel Vetter Date: Wed, 25 Nov 2020 10:00:42 +0100 Message-ID: Subject: Re: [PATCH v6 17/17] RFC: mm: add mmu_notifier argument to follow_pfn To: Jason Gunthorpe Cc: DRI Development , LKML , KVM list , Linux MM , Linux ARM , linux-samsung-soc , "open list:DMA BUFFER SHARING FRAMEWORK" , Daniel Vetter , Christoph Hellwig , Kees Cook , Dan Williams , Andrew Morton , John Hubbard , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Jan Kara Content-Type: text/plain; charset="UTF-8" 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 Wed, Nov 25, 2020 at 9:13 AM Jason Gunthorpe wrote: > > On Tue, Nov 24, 2020 at 03:28:14PM +0100, Daniel Vetter wrote: > > On Fri, Nov 20, 2020 at 02:30:29PM -0400, Jason Gunthorpe wrote: > > > On Thu, Nov 19, 2020 at 03:41:46PM +0100, Daniel Vetter wrote: > > > > @@ -4805,21 +4824,15 @@ EXPORT_SYMBOL(follow_pte_pmd); > > > > * Return: zero and the pfn at @pfn on success, -ve otherwise. > > > > */ > > > > int follow_pfn(struct vm_area_struct *vma, unsigned long address, > > > > - unsigned long *pfn) > > > > + unsigned long *pfn, struct mmu_notifier *subscription) > > > > { > > > > - int ret = -EINVAL; > > > > - spinlock_t *ptl; > > > > - pte_t *ptep; > > > > + if (WARN_ON(!subscription->mm)) > > > > + return -EINVAL; > > > > > > > > + if (WARN_ON(subscription->mm != vma->vm_mm)) > > > > + return -EINVAL; > > > > > > These two things are redundant right? vma->vm_mm != NULL? > > > > Yup, will remove. > > > > > BTW, why do we even have this for nommu? If the only caller is kvm, > > > can you even compile kvm on nommu?? > > > > Kinda makes sense, but I have no idea how to make sure with compile > > testing this is really the case. And I didn't see any hard evidence in > > Kconfig or Makefile that mmu notifiers requires CONFIG_MMU. So not sure > > what to do here. > > It looks like only some arches have selectable CONFIG_MMU: arm, > m68k, microblaze, riscv, sh > > If we look at arches that work with HAVE_KVM, I only see: arm64, mips, > powerpc, s390, x86 > > So my conclusion is there is no intersection between !MMU and HAVE_KVM? > > > Should I just remove the nommu version of follow_pfn and see what happens? > > We can't remove it earlier since it's still used by other > > subsystems. > > This is what I was thinking might work Makes sense, I'll do that for the next round. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch