Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp219818pxu; Wed, 25 Nov 2020 01:03:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJyr5llUtBVH0wMuseuHqcY8Lr1PSmqmZ6eHhKN+7q0LV//mmlqOeTxE/EhmStEC5EM6/apE X-Received: by 2002:a50:e88a:: with SMTP id f10mr7877edn.123.1606294998139; Wed, 25 Nov 2020 01:03:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606294998; cv=none; d=google.com; s=arc-20160816; b=rjU9M29TE/SACVQ9N/WPAOkXf78olb66iC2zJJb2tVU4JyryrbZJo5zp3+74ZH2UTA b3v7eEXkidSmr8NMo/pcQ69kIfcDe4sfjbmT5V1VzmJQumvTIWaPh/PXfZFgugWYtLUS K+W8+91ftg9o7pfsXgA7pn47Ess62Il/tTGOp6w8BthwnLRQ2UgWtcWRAgdZAkg/FHgd 16mop/EGDJI9DpgW3VJ6Gt+MBpg0rELQ+/4RlVOrkoh5aWHnFJCD3Nm4oVnYjs+lclfR kHHbj2v8YEgJCXdgDrPfN3OHJ6awkWVcpI1OOgpN02SwgPc6Z6mWwVAAuVVlj7THxdo1 OXzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=cb0IyYfwRRpwkSMXLoK5meWkqSB6m3aHpp32lgtuG5E=; b=nWHz3PaoJiGbwOxkmjFjZFYKOBVFphaWtccFzFFN/p/2oHvdRydBPP97DZYSfUKj7t phsY8WIkFTBaXJAa0YsWQXJSlGSlD8OKFPRpnsmYV4RMTEwCSyLlHEPgxM3rFXE+3/8N Ui4jIYKh+EgT2c7LzCnWfMN0WBPEKOea+jiDgTg6l9CSXhMo9N+pNOtYi6U+Hw7MeS8Q PBn7fFAI6sjgK+Dy8gGONGSIp6CTQ7hV/Qx37hgXuSXspmLkGvAMwxq9Jy+p9N1Ty46l Q/o7/lC2seN2MwcC2irsrKmxmw9YnASgR5/PW6b3U7oO9xgHzHA5aktYho503IBWDgeV O8Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=JkicOjiQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q7si825789edr.253.2020.11.25.01.02.54; Wed, 25 Nov 2020 01:03:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=JkicOjiQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726357AbgKYJAz (ORCPT + 99 others); Wed, 25 Nov 2020 04:00:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726158AbgKYJAy (ORCPT ); Wed, 25 Nov 2020 04:00:54 -0500 Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30F80C0613D4 for ; Wed, 25 Nov 2020 01:00:54 -0800 (PST) Received: by mail-ot1-x336.google.com with SMTP id n11so1603473ota.2 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=Nv1GjyeBr750Quuh6WMbvCwMQfuptyo8Trp+nletW60fHt1ABShwipQ2r9HpTReBcr G8yMU4/YArXSWp980S1BgTZX369uMIXN2egoDefukuugx8e060k5x0+RsGZRl2Yhfhut VKR/s/7P/3kAF/S16U5oA5zDhkS9A0tPC35dvYsz+TZDn7xbcMnQd0FhP1+9Xa2JfhY7 smhOTEIjnMJCTIBREzbX5rz04aAEIN4FRtlF/QHwRPTDlHcI7ZW583CEPMHxYn4BRuZ8 PSyDYWmYKc8Lj012p9tj2yjY6rNXIW/MUnrJGK27AHp4d4EeUz/0/Mc9L0PSXvAGrdpJ GqZQ== X-Gm-Message-State: AOAM533NbfaomrdR/ktVasaJmMa1q4DJLCOwt0AQRQUYYJbUP5emnLTR ktBxkWMxC60KvtFwe348z3hgHqS0EW+A9DhWHeZHFQ== 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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