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=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 76A57C388F2 for ; Mon, 2 Nov 2020 15:54:35 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1332822258 for ; Mon, 2 Nov 2020 15:54:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Y5nFjWaS"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="hqSP56nc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1332822258 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=nNHXtYhlRJQESOATlu9ywqMHv0uAhiEPIMlYFxBDd5M=; b=Y5nFjWaSb/4hNUL/CfsjoAFsD 95jUjxO+PRc4PqV6FrrRSkgwzo7HQzjyJ/3Xfd/ekyNBBer+YUWfo1GwLiYy82ncVkrTht+eJiAtd g32WduSpvXnZhD0IuhN3MmRiVFG6WYmxclDfApnctIOlsnsXOX7VQI3SRZ2Y9U/L3A9Lf1cE16csJ 1CaPi0aVA42YTvIuyDvUGRmFgte4Sv3wSzJ3ZKzVXG9AG9KelGDKAZQJ8tScC8nfHAyVRSdKHF8L4 FMwJ0aDS2lOdiIgxhuQNQ4VP/IV1PSsSkC3XE5GGOIqEMbizZperOwA6TVVmeyXjnaNKxcANJxleE trqEFaNgQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZc8k-0004jB-Jf; Mon, 02 Nov 2020 15:53:02 +0000 Received: from mail-qv1-xf43.google.com ([2607:f8b0:4864:20::f43]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZc8h-0004hu-GZ for linux-arm-kernel@lists.infradead.org; Mon, 02 Nov 2020 15:53:00 +0000 Received: by mail-qv1-xf43.google.com with SMTP id ed14so2743361qvb.4 for ; Mon, 02 Nov 2020 07:52:59 -0800 (PST) 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; bh=f4bAkyYQ5JW+w3wAB0B3Wuqs9gDAq+dCKVKb1szgdTE=; b=hqSP56ncN1Xesc0LR+LCBrLcoSGV6TopG9RG3GGTAjXZawK07x4FedOxx8+KwVozhh yTaXjjMacA7HSrB+GRFpwykUXEgHjYuiJRUfTBK6bxwzQkDVZZxpNeA6oR5zy06hcsRr +OWzKfZs32d+rXtNU6sG16vNSbBVRNjen0md3oJEh5m3qEuLJBFDAZd22drwYUhFMUM8 jihAo1Zpdxicjpm3k0zP51jRIixb81HpWfJ8CKClqtFak5XKxto5Xo7s7pUz3s+srShN 1BUfFqWebwl5tOah1zDSpMj6M1bL9GXyO8wQDz9s59OVdbT9CJgBaBWOD1bIDFUY/B+7 N2fQ== 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; bh=f4bAkyYQ5JW+w3wAB0B3Wuqs9gDAq+dCKVKb1szgdTE=; b=GaJStQV30niwntf6qaGgegdLQ9mZsjg993ZihkvkyGKYbMqB7GVPE9PTmBOJzIpVsz b3Sc9UDffh859NlProgeXBUNMM2ygCb7jweGV1tk/B3xjPHuG5zCSBZ7RyXTiLtd1/34 Vxov6Mlu5+zGFTENB1uMxYDeR3I4ua+iYNZwlCv/YgX/UDsr4BdukoOs4Ilh7Ln4JV1l EkzkwTIagAeiwAsZhyfdbcdddkjwhKt7MhfQOU4afKGPvTQOy3hpKzMYPw4iy0D1eDZg kGnMH1q4xOgnGnLtAQ0R+5MV0papO2pt5jopzauaaL7z8Q4QuG4rcuCV2iyS0z556EOB vXtA== X-Gm-Message-State: AOAM532/hJ9FcBeKYNer52ga/bJLfbCZZ+5YtYHqCn0FdSUW3vzTuuFc hdiutCld8uaHJMkO/NtEMBxhuA== X-Google-Smtp-Source: ABdhPJywaNhw5aFpN/pYIk6/MJ/bkf/gh0tZ3udL0VlE8QqDUlZAs/BeSFGHSpJn56VGOhuQYMqcFg== X-Received: by 2002:a0c:a261:: with SMTP id f88mr23351432qva.56.1604332377746; Mon, 02 Nov 2020 07:52:57 -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 v92sm8169357qte.33.2020.11.02.07.52.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 07:52:56 -0800 (PST) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kZc8e-00F975-6s; Mon, 02 Nov 2020 11:52:56 -0400 Date: Mon, 2 Nov 2020 11:52:56 -0400 From: Jason Gunthorpe To: Daniel Vetter Subject: Re: [PATCH v5 08/15] mm: Add unsafe_follow_pfn Message-ID: <20201102155256.GG36674@ziepe.ca> References: <20201030100815.2269-1-daniel.vetter@ffwll.ch> <20201030100815.2269-9-daniel.vetter@ffwll.ch> <20201102072931.GA16419@infradead.org> <20201102130115.GC36674@ziepe.ca> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201102_105259_916935_B7E37851 X-CRM114-Status: GOOD ( 24.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-samsung-soc , Jan Kara , Kees Cook , KVM list , John Hubbard , LKML , DRI Development , Christoph Hellwig , Linux MM , J??r??me Glisse , Daniel Vetter , Dan Williams , Andrew Morton , Linux ARM , "open list:DMA BUFFER SHARING FRAMEWORK" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Nov 02, 2020 at 02:23:58PM +0100, Daniel Vetter wrote: > On Mon, Nov 2, 2020 at 2:01 PM Jason Gunthorpe wrote: > > > > On Mon, Nov 02, 2020 at 01:56:10PM +0100, Daniel Vetter wrote: > > > On Mon, Nov 2, 2020 at 8:29 AM Christoph Hellwig wrote: > > > > > > > > On Fri, Oct 30, 2020 at 11:08:08AM +0100, Daniel Vetter wrote: > > > > > Also mark up follow_pfn as EXPORT_SYMBOL_GPL. The only safe way to use > > > > > that by drivers/modules is together with an mmu_notifier, and that's > > > > > all _GPL stuff. > > > > > > > > I also think it also needs to be renamed to explicitly break any existing > > > > users out of tree or int the submission queue. > > > > > > Ok I looked at the mmu notifier locking again and noticed that > > > mm->subscriptions has its own spinlock. Since there usually shouldn't > > > be a huge pile of these I think it's feasible to check for the mmu > > > notifier in follow_pfn. And that would stuff this gap for good. I'll > > > throw that on top as a final patch and see what people think. > > > > Probably the simplest is to just check mm_has_notifiers() when in > > lockdep or something very simple like that > > lockdep feels wrong, was locking more at CONFIG_DEBUG_VM. And since > generally you only have 1 mmu notifier (especially for kvm) I think we > can also pay the 2nd cacheline miss and actually check the right mmu > notifier is registered. Need to hold the lock to check that and there are two ways to register notifiers these days, so it feels to expensive to me. CH's 'export symbol only for kvm' really does seem the most robust way to handle this though. Jason _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel