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 autolearn=unavailable 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 A2974C63798 for ; Tue, 24 Nov 2020 15:55:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B3957206FA for ; Tue, 24 Nov 2020 15:55:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="O5+yyy3u" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B3957206FA 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 B2B2E6B005D; Tue, 24 Nov 2020 10:55:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id ADB536B0070; Tue, 24 Nov 2020 10:55:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 97CE26B0071; Tue, 24 Nov 2020 10:55:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0138.hostedemail.com [216.40.44.138]) by kanga.kvack.org (Postfix) with ESMTP id 835C26B005D for ; Tue, 24 Nov 2020 10:55:30 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 3FA98181AEF23 for ; Tue, 24 Nov 2020 15:55:30 +0000 (UTC) X-FDA: 77519761620.30.hate02_3e14aa52736f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id 10F74180B3C85 for ; Tue, 24 Nov 2020 15:55:30 +0000 (UTC) X-HE-Tag: hate02_3e14aa52736f X-Filterd-Recvd-Size: 5334 Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Tue, 24 Nov 2020 15:55:29 +0000 (UTC) Received: by mail-qk1-f193.google.com with SMTP id y197so20840227qkb.7 for ; Tue, 24 Nov 2020 07:55:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=oaa+hWx1KaHAmS3DtMmmCm5kDyFbE+baLseZRB4QB5M=; b=O5+yyy3ugn3/JU8d8MzJuhxMQSAXmFG+K4qLwFzZz9R/0yzGmphek8afsqJ5XmaX7K QFgr2UTIeMkWtrEUfgUgKbsoR4KB1EzCADhT2doRjFOEg0XNrQLFT7UfegvU6LtETQdH BNfxI2uepF2ckC2z3Hg3jdCWPASQ46yKLRwg1QiNwPCb0sAmz1+AfFialcU6UizGRLb/ cFkrXVxqj0abamYnuOiwNBjY7IEIegPAbiNZQupZKDH6jzAd8pc/L3Rexp2KSypUx3WN r58Z5/hOA1lt5wCiVxmAus+J+0CeYWzJLI1kYadqPB7BHX4GvlOoLo7sQ3sz3WRenNdb j0ew== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=oaa+hWx1KaHAmS3DtMmmCm5kDyFbE+baLseZRB4QB5M=; b=FCJt48JVzCGcTjGHwQ4f3mRL5zz+zfId2s5AwKfVlIW2oudQ1+jRpGinXQtvitmZ4b ZTmK2EVO9T2n0nU6R7Y5fIV+Lhhjm8dromLJRo8bT/m35tsjeEs4iszyLemIyvgMQRWR zUGWvykc7ykB9lQ/qXwX1d8PvMkTip+LDvET/wxOM+EEkgiMUnKQyQAjhPrhgBYn+3hZ NDPd8c4e+y37rW33DmPVpywrtexW/i/FaHRBkRfTp7s0uznHrkBP0timUb8fzsCyyN2y SDhsfCS6OzNCOCveyw4Ugmqx9S3vm0T0oPg0OMaVhMIcphUV1G0b/ZKT4Ubct+hsIDgd +6Tg== X-Gm-Message-State: AOAM5310I0zqM3RgwpQ8cNCwqeMfPbapOH5fLi+7hREac0UMBz5wp+zH 255lZkw08R5xLsR21UyudR+DKQ== X-Google-Smtp-Source: ABdhPJzKvpnJwdDviRxMRDTdGK9+HHkdY7h1hzFeJT5r8VTnR/8g0865BSrf5PrqIcB8Qlf6akZbcQ== X-Received: by 2002:a05:620a:2106:: with SMTP id l6mr5371085qkl.302.1606233328732; Tue, 24 Nov 2020 07:55:28 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-156-34-48-30.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.48.30]) by smtp.gmail.com with ESMTPSA id x24sm12795492qkx.23.2020.11.24.07.55.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Nov 2020 07:55:27 -0800 (PST) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1khaf8-000pJU-UM; Tue, 24 Nov 2020 11:55:26 -0400 Date: Tue, 24 Nov 2020 11:55:26 -0400 From: Jason Gunthorpe To: DRI Development , LKML , kvm@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-media@vger.kernel.org, Daniel Vetter , Christoph Hellwig , Kees Cook , Dan Williams , Andrew Morton , John Hubbard , =?utf-8?B?SsOpcsO0bWU=?= Glisse , Jan Kara Subject: Re: [PATCH v6 17/17] RFC: mm: add mmu_notifier argument to follow_pfn Message-ID: <20201124155526.GH5487@ziepe.ca> References: <20201119144146.1045202-1-daniel.vetter@ffwll.ch> <20201119144146.1045202-18-daniel.vetter@ffwll.ch> <20201120183029.GQ244516@ziepe.ca> <20201124142814.GM401619@phenom.ffwll.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201124142814.GM401619@phenom.ffwll.local> 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 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 Jason