Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp971633ybb; Thu, 28 Mar 2019 16:21:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqxV5vWx6bMZYQa2QA9QYQvwvCHysP7FBaCgknQeDuTE+sK4WGtpwrDBnBQqdStB0/twUTQm X-Received: by 2002:a17:902:1a9:: with SMTP id b38mr45461636plb.37.1553815315043; Thu, 28 Mar 2019 16:21:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553815315; cv=none; d=google.com; s=arc-20160816; b=zNB+SrAE6qLDeaa4wnBL58UetwybPLGkiGu7BqJJkFkE4FJPI+0QH+BQrsPJ5xcro8 vgMFTB2pAPv6j8XS2fjiR/Hb6j4mmHMUG77FzQL/v61lcV1BXzYvwa1U3tubeetH8hlM hNMfC0twZ4s6fPGxTT9X8TuPSn5CScX9dV4gPiLdyr9m3S97zNC7ZgQ7XQaqNWlhXQol 7cGAt2M37CSGMLq6gbOLZz2HosWkO3A4AnQdCJE5xmujRkliH9GgMjbtjnQRX1bUFzFK SA5aW8YnnPF8PvJMPSiTIQnoNhG9vKZ1Ftp2ZWG3dInD8KQK2rmNR2uQ00SUC+2vWPrr Zp9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=cwvfXAmYS2xpbe/FjvzNojKYMDG/S4Ny/qLUa3K9/HA=; b=1GISYd1fsgy48yoEBXgqAZqi4U2Nvq4v2fDELFCjEri7+0Gg85qa6yFw3VwTjVCbav 4lM3GzI60ZA0Zz3OBeomUHHAkSA6eyJnaVlD/TUIUWAjACLAU3O6wt7Ip/TvzONCWXQF eGLmz5FJiBLs+a4NfHAfwavcQz/veKHE2BbrlobyudcLmiFB8kdhHT/yuS9sQ7kxcuW6 V2rZq60AkUQPhB7N1qnweT/Nur86rL4gcX3/NKxSXfd9ukUynJHGBDcamau5qoncek3n q9fvAEroZDqCo3livZ/RxAM49c+3V6dMT7pgGefVpcibYUguAZofsQiJ3MH8GW/OY90S UVsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=kNMJMs9C; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h7si304110pfb.167.2019.03.28.16.21.39; Thu, 28 Mar 2019 16:21:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=kNMJMs9C; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728544AbfC1XUj (ORCPT + 99 others); Thu, 28 Mar 2019 19:20:39 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:6479 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727658AbfC1XUj (ORCPT ); Thu, 28 Mar 2019 19:20:39 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Thu, 28 Mar 2019 16:20:41 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Thu, 28 Mar 2019 16:20:38 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Thu, 28 Mar 2019 16:20:38 -0700 Received: from [10.110.48.28] (172.20.13.39) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 28 Mar 2019 23:20:38 +0000 Subject: Re: [PATCH v2 10/11] mm/hmm: add helpers for driver to safely take the mmap_sem v2 To: Jerome Glisse CC: , , Andrew Morton , Dan Williams References: <20190325144011.10560-1-jglisse@redhat.com> <20190325144011.10560-11-jglisse@redhat.com> <9df742eb-61ca-3629-a5f4-8ad1244ff840@nvidia.com> <20190328213047.GB13560@redhat.com> <20190328220824.GE13560@redhat.com> <068db0a8-fade-8ed1-3b9d-c29c27797301@nvidia.com> <20190328224032.GH13560@redhat.com> <0b698b36-da17-434b-b8e7-4a91ac6c9d82@nvidia.com> <20190328230543.GI13560@redhat.com> From: John Hubbard X-Nvconfidentiality: public Message-ID: <9e414b8c-0f98-a2f7-4f46-d335c015fc1b@nvidia.com> Date: Thu, 28 Mar 2019 16:20:37 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.3 MIME-Version: 1.0 In-Reply-To: <20190328230543.GI13560@redhat.com> X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL106.nvidia.com (172.18.146.12) To HQMAIL101.nvidia.com (172.20.187.10) Content-Type: text/plain; charset="utf-8" Content-Language: en-US-large Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1553815241; bh=cwvfXAmYS2xpbe/FjvzNojKYMDG/S4Ny/qLUa3K9/HA=; h=X-PGP-Universal:Subject:To:CC:References:From:X-Nvconfidentiality: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=kNMJMs9C+TM1nNFTqcCV7IrVAkqxMYU++6lQG9ATbs5dJW3bohUET58V2LGYBJ3AS BJOR3Wxcqu+O47jZVuo4jxeNgexPD12CKcgQqGkcjnMg7a14DNYwvxMfNWRsSBQLEg PmVuCr8J6jmZ9N9JV6HxPfnhkC4PZ0lRQyjpXcUJ94q9EVm/ibBxc6wIgOfAefZI5U ALdxLZSvIEDDguQNaUCnjr01WMaGnRhvhwa+gudD1FXzyCnmBQ83NvG4D7CG5Blw03 fRfwFvygK2kgIdrvJZK3kRGV9HlIEiUvIRIqJV8go1+5AoYHs0j3fwtpwlXsSukM1Z wd9dFJcLPiWiA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/28/19 4:05 PM, Jerome Glisse wrote: > On Thu, Mar 28, 2019 at 03:43:33PM -0700, John Hubbard wrote: >> On 3/28/19 3:40 PM, Jerome Glisse wrote: >>> On Thu, Mar 28, 2019 at 03:25:39PM -0700, John Hubbard wrote: >>>> On 3/28/19 3:08 PM, Jerome Glisse wrote: >>>>> On Thu, Mar 28, 2019 at 02:41:02PM -0700, John Hubbard wrote: >>>>>> On 3/28/19 2:30 PM, Jerome Glisse wrote: >>>>>>> On Thu, Mar 28, 2019 at 01:54:01PM -0700, John Hubbard wrote: >>>>>>>> On 3/25/19 7:40 AM, jglisse@redhat.com wrote: >>>>>>>>> From: J=C3=A9r=C3=B4me Glisse >>>> [...] >>>> OK, so let's either drop this patch, or if merge windows won't allow t= hat, >>>> then *eventually* drop this patch. And instead, put in a hmm_sanity_ch= eck() >>>> that does the same checks. >>> >>> RDMA depends on this, so does the nouveau patchset that convert to new = API. >>> So i do not see reason to drop this. They are user for this they are po= sted >>> and i hope i explained properly the benefit. >>> >>> It is a common pattern. Yes it only save couple lines of code but down = the >>> road i will also help for people working on the mmap_sem patchset. >>> >> >> It *adds* a couple of lines that are misleading, because they look like = they >> make things safer, but they don't actually do so. >=20 > It is not about safety, sorry if it confused you but there is nothing abo= ut > safety here, i can add a big fat comment that explains that there is no s= afety > here. The intention is to allow the page fault handler that potential hav= e > hundred of page fault queue up to abort as soon as it sees that it is poi= ntless > to keep faulting on a dying process. >=20 > Again if we race it is _fine_ nothing bad will happen, we are just doing = use- > less work that gonna be thrown on the floor and we are just slowing down = the > process tear down. >=20 In addition to a comment, how about naming this thing to indicate the above= =20 intention? I have a really hard time with this odd down_read() wrapper, wh= ich allows code to proceed without really getting a lock. It's just too wrong-l= ooking. If it were instead named: hmm_is_exiting() and had a comment about why racy is OK, then I'd be a lot happier. :) thanks, --=20 John Hubbard NVIDIA