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 ED639C63798 for ; Tue, 24 Nov 2020 14:28:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 54FB52076E for ; Tue, 24 Nov 2020 14:28:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="M8OKVKLP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 54FB52076E 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 607696B0149; Tue, 24 Nov 2020 09:28:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 590836B014A; Tue, 24 Nov 2020 09:28:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3E3458D0001; Tue, 24 Nov 2020 09:28:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0113.hostedemail.com [216.40.44.113]) by kanga.kvack.org (Postfix) with ESMTP id 249E76B0149 for ; Tue, 24 Nov 2020 09:28:20 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id C5D2A3626 for ; Tue, 24 Nov 2020 14:28:19 +0000 (UTC) X-FDA: 77519541918.04.lace93_5e0d81b2736e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id A0491800967F for ; Tue, 24 Nov 2020 14:28:19 +0000 (UTC) X-HE-Tag: lace93_5e0d81b2736e X-Filterd-Recvd-Size: 5349 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by imf42.hostedemail.com (Postfix) with ESMTP for ; Tue, 24 Nov 2020 14:28:18 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id i2so3477892wrs.4 for ; Tue, 24 Nov 2020 06:28:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=KSq6GECp1i25ezV0Y6T/3NvT3N3r3AJ5cEVxbDW0CLw=; b=M8OKVKLPb+FMINuPALRG9V3PVI91CXQvXh6el7xGRjUkVyzBaQH4KHu/tMBmJ5taDe 59iDiQDNm2o3xbPwv0oSLio8yFOJvro7J42g63pWYI73IIHBT3JzdvD1M0d8OksY+kMI XGPBgQVF+ghp0Mqq2KbUaYPWwm0MKVO12MAPQ= 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 :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=KSq6GECp1i25ezV0Y6T/3NvT3N3r3AJ5cEVxbDW0CLw=; b=huASPx/LzBs9nvne94s000iBBuwInKZcw8lGCQVe+9+4G3jWK90i6JBZkNr30KFhRz PAccOLAWP0vIpUO45aHOhTaY8ZQbheFXsd71BxoeTs3//Y8tRskF+WRbpufpmmTY/l5e ldTl6IpTs9Sph3bOpGETt+aybwm2SoIff5KUyAn6l9hF/LPb6Leg3U0g8nLZl8P1S6Za QrIoVZE2OKO10gRVbkqHLlbGe8skDTKFERUOJCMg5mRD/JoDirT386IwjSJusPaempDQ xvUeMQqooyvf6mX0pAXmX++uLEHmTSwPMh9nzWiKezSlcOUZDy2icqve4QX3xlMbUoWh 6Yvg== X-Gm-Message-State: AOAM531LfYLupx0XfXmuWenawJlErYx3pIVrF3A5krUA5OIwRwwgWtsC LhxLVroPBlEsa5W80mg/LNzx0A== X-Google-Smtp-Source: ABdhPJzYIyfiFO7Qic0f+2tVMFNssr9Nw0LvMxY+vwY4ywKdlugcFp6ONKZKvUGFaWMjY1vmdCWa+w== X-Received: by 2002:a5d:610d:: with SMTP id v13mr5595456wrt.425.1606228097589; Tue, 24 Nov 2020 06:28:17 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id 35sm27158318wro.71.2020.11.24.06.28.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Nov 2020 06:28:16 -0800 (PST) Date: Tue, 24 Nov 2020 15:28:14 +0100 From: Daniel Vetter To: Jason Gunthorpe Cc: Daniel Vetter , 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 , =?iso-8859-1?B?Suly9G1l?= Glisse , Jan Kara Subject: Re: [PATCH v6 17/17] RFC: mm: add mmu_notifier argument to follow_pfn Message-ID: <20201124142814.GM401619@phenom.ffwll.local> Mail-Followup-To: Jason Gunthorpe , 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 , =?iso-8859-1?B?Suly9G1l?= Glisse , Jan Kara References: <20201119144146.1045202-1-daniel.vetter@ffwll.ch> <20201119144146.1045202-18-daniel.vetter@ffwll.ch> <20201120183029.GQ244516@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201120183029.GQ244516@ziepe.ca> X-Operating-System: Linux phenom 5.7.0-1-amd64 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, 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. 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. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch