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=-2.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 ADEF8C2BD09 for ; Thu, 5 Dec 2019 16:03:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 71835206DB for ; Thu, 5 Dec 2019 16:03:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VaSz2b/5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 71835206DB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EACC06B1101; Thu, 5 Dec 2019 11:03:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E5C496B1102; Thu, 5 Dec 2019 11:03:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D72396B1103; Thu, 5 Dec 2019 11:03:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0055.hostedemail.com [216.40.44.55]) by kanga.kvack.org (Postfix) with ESMTP id BF5996B1101 for ; Thu, 5 Dec 2019 11:03:35 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 6EDF51829B8F3 for ; Thu, 5 Dec 2019 16:03:35 +0000 (UTC) X-FDA: 76231557990.20.tail11_7696bfb483429 X-HE-Tag: tail11_7696bfb483429 X-Filterd-Recvd-Size: 5980 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by imf09.hostedemail.com (Postfix) with ESMTP for ; Thu, 5 Dec 2019 16:03:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575561814; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oHd+4w0V9iVfUn6tAMIGauQiWjLxMUn18cIdw9bXNzA=; b=VaSz2b/5TeIzw/CS0oNKxhi+xt/6DOgoW3/N2h9jZo8IWNBqF36g0bpDH1uDZYHYNtQ955 f0MROrh0HaLPHUv7va4uTno3RGcrTrA1r+F2HZ45iQETJPQbuxN7B73g+ezYG1nTulwHl3 ocUg8CtIIUk08irOGnwwlxBlg4aVO1I= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-385-MoRTtIA4PDWwtQt6J_dX7Q-1; Thu, 05 Dec 2019 11:03:30 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4E4D312A7E49; Thu, 5 Dec 2019 16:03:28 +0000 (UTC) Received: from redhat.com (unknown [10.20.6.225]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1CC4D600D1; Thu, 5 Dec 2019 16:03:26 +0000 (UTC) Date: Thu, 5 Dec 2019 11:03:24 -0500 From: Jerome Glisse To: Jason Gunthorpe Cc: Linus Torvalds , Ralph Campbell , David Airlie , "Kuehling, Felix" , "dri-devel@lists.freedesktop.org" , Christoph Hellwig , "linux-mm@kvack.org" , "amd-gfx@lists.freedesktop.org" , "Deucher, Alexander" , Andrew Morton , Dan Williams , "linux-rdma@vger.kernel.org" Subject: Re: [GIT PULL] Please pull hmm changes Message-ID: <20191205160324.GB5819@redhat.com> References: <20191125204248.GA2485@ziepe.ca> <20191203024206.GC5795@mellanox.com> MIME-Version: 1.0 In-Reply-To: <20191203024206.GC5795@mellanox.com> User-Agent: Mutt/1.12.1 (2019-06-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: MoRTtIA4PDWwtQt6J_dX7Q-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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, Dec 03, 2019 at 02:42:12AM +0000, Jason Gunthorpe wrote: > On Sat, Nov 30, 2019 at 10:23:31AM -0800, Linus Torvalds wrote: > > On Sat, Nov 30, 2019 at 10:03 AM Linus Torvalds > > wrote: > > > > > > I'll try to figure the code out, but my initial reaction was "yeah, > > > not in my VM". > >=20 > > Why is it ok to sometimes do > >=20 > > WRITE_ONCE(mni->invalidate_seq, cur_seq); > >=20 > > (to pair with the unlocked READ_ONCE), and sometimes then do > >=20 > > mni->invalidate_seq =3D mmn_mm->invalidate_seq; > >=20 > > My initial guess was that latter is only done at initialization time, > > but at least in one case it's done *after* the mni has been added to > > the mmn_mm (oh, how I despise those names - I can only repeat: WTF?). >=20 > Yes, the only occurrences are in the notifier_insert, under the > spinlock. The one case where it is out of the natural order was to > make the manipulation of seq a bit saner, but in all cases since the > spinlock is held there is no way for another thread to get the pointer > to the 'mmu_interval_notifier *' to do the unlocked read. >=20 > Regarding the ugly names.. Naming has been really hard here because > currently everything is a 'mmu notifier' and the natural abberviations > from there are crummy. Here is the basic summary: >=20 > struct mmu_notifier_mm (ie the mm->mmu_notifier_mm) > -> mmn_mm > struct mm_struct=20 > -> mm > struct mmu_notifier (ie the user subscription to the mm_struct) > -> mn > struct mmu_interval_notifier (the other kind of user subscription) > -> mni What about "interval" the context should already tell people it is related to mmu notifier and thus a notifier. I would just remove the notifier suffix, this would match the below range. > struct mmu_notifier_range (ie the args to invalidate_range) > -> range Yeah range as context should tell you it is related to mmu notifier. >=20 > I can send a patch to switch mmn_mm to mmu_notifier_mm, which is the > only pre-existing name for this value. But IIRC, it is a somewhat ugly > with long line wrapping. 'mni' is a pain, I have to reflect on that. > (honesly, I dislike mmu_notififer_mm quite a lot too) >=20 > I think it would be overall nicer with better names for the original > structs. Perhaps: >=20 > mmn_* - MMU notifier prefix > mmn_state <- struct mmu_notifier_mm > mmn_subscription (mmn_sub) <- struct mmu_notifier > mmn_range_subscription (mmn_range_sub) <- struct mmu_interval_notifier > mmn_invalidate_desc <- struct mmu_notifier_range This looks good. >=20 > At least this is how I describe them in my mind.. This is a lot of > churn, and spreads through many drivers. This is why I kept the names > as-is and we ended up with the also quite bad 'mmu_interval_notifier' >=20 > Maybe just switch mmu_notifier_mm for mmn_state and leave the drivers > alone? >=20 > Anyone on the CC list have advice? Maybe we can do a semantic patch to do convertion and then Linus can easily apply the patch by just re-running the coccinelle. Cheers, J=E9r=F4me