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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A8667C7EE23 for ; Fri, 2 Jun 2023 02:50:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:Message-ID:In-Reply-To:Subject:cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zG0KxPZjCn0SAlsVH9wJD9y5jtlDmRpoK8ebL5bfqak=; b=xoPck7CyES8UKAtsYyEq83YLq2 tyw17Z4a7OS+ZGEmU0quuxY/98aWQUrBBxNqMRGbh1K7Ac+2/EC2JMTifj6B6kzcI8tgA+DXBF6Rl VMXzIOq1RKK1YxSplmL5SpqM70jK5kMFR0ss6Z3m+nzWwwsbdcpprqkgZEWsDaLSZLSkMFPQf21nR HTvAVrRMeD1TnjqpK+I9xFyEittHcaQj9Vr1xVaX2kBOdClxgO7BwYOwhogPhoX0MCRLH+935/WnL O6z82srcQhjtudZtYR1chPiBIP5s2AvPpzdGiBNBt8c4AyOwttmUYqFv7kTt4x+x0jug5UP8MNH/M mRI/OWHQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q4us3-005XTS-07; Fri, 02 Jun 2023 02:50:31 +0000 Received: from mail-yb1-xb30.google.com ([2607:f8b0:4864:20::b30]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q4urz-005XRI-2c for linux-arm-kernel@lists.infradead.org; Fri, 02 Jun 2023 02:50:29 +0000 Received: by mail-yb1-xb30.google.com with SMTP id 3f1490d57ef6-bb1f7c5495dso711943276.3 for ; Thu, 01 Jun 2023 19:50:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1685674220; x=1688266220; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=CkFBZ6Z26PEaI+Jgv/5bWGu+0hTm1SzRb6kODNNBn+M=; b=CxDFRuGfcYOWRd6VMHq3ar2M1xRSdWVVRTOsF6xQ0mdly8R3+o2A6R0v/aETwVkb3P 6b58l7Ni9XRQdArFtwuFCZ5arCMLCFw+LE0g4/MaXwrjvut1vrEBPVcT+W6pSsdHU+oi fjJ5UIEWmivzq31pCg6nsnlxQ0kE76d7AibcK5E6hVfvFaaxgiawOUnXccTx0uAP3pHm Idl5hOTvyvy2EPX+52qQ1cF3H5O7fhiSRn3bhB/j26+Hz+Q41PkPVp08UWJRUageIgFV GSVHYv6GOPwAxU0jH5OD/WRtBlcd1wSFGZtdCmsng+zRGOD1mVzbdt39IXv/0dJztfSK LnLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685674220; x=1688266220; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CkFBZ6Z26PEaI+Jgv/5bWGu+0hTm1SzRb6kODNNBn+M=; b=H1dj2xYhf3GYFrUC/OC9CHgUzt6AmaDDaj+X7uzEWVDBOlJrTVazdGjT7lSjbp3ZnC v/s+wBI1xEtQk1vKDbxhY1zMUAS45hX3XvgxhGmV112+eplNJ79CRKgNkLo9pVNeFa0Y RfsGGdAx7tbQN+n9Yq56Aln36MVlSKr+OdukYqaLig8w3Q74L9qNgjOYL3U7AbbbBIgM P2FTTseC/eV3iq5KblqbSpc5QOEKMm3Sz+ViKZtj7mNm3n9wRQfocw5d1qQn8Hcxqi37 u59MqAWjOTQ159vCSUl8NajpOE9XJMLb81WsEv9/mV12iyRMhcf8doTrs58X7dlkI/r+ O5EA== X-Gm-Message-State: AC+VfDzCFDCW+PZCyPCNN4ytfb2TS5SFSAK+h7CUxK2TEOq5Twlh4/em HQg4G6G/POSN4hZwsRatlNoa1w== X-Google-Smtp-Source: ACHHUZ6dtqdDIUgghSG7BNv1ykA9dzLFfcixbLHtolx08NZCshtI3n5qAtyBLAY0i0F+pIWOM2tKpQ== X-Received: by 2002:a81:5247:0:b0:565:d40b:f695 with SMTP id g68-20020a815247000000b00565d40bf695mr10827576ywb.48.1685674220390; Thu, 01 Jun 2023 19:50:20 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id u5-20020a0deb05000000b0055a07585a91sm72029ywe.11.2023.06.01.19.50.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 19:50:19 -0700 (PDT) Date: Thu, 1 Jun 2023 19:50:15 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Jann Horn cc: Hugh Dickins , Andrew Morton , Mike Kravetz , Mike Rapoport , "Kirill A. Shutemov" , Matthew Wilcox , David Hildenbrand , Suren Baghdasaryan , Qi Zheng , Yang Shi , Mel Gorman , Peter Xu , Peter Zijlstra , Will Deacon , Yu Zhao , Alistair Popple , Ralph Campbell , Ira Weiny , Steven Price , SeongJae Park , Naoya Horiguchi , Christophe Leroy , Zack Rusin , Jason Gunthorpe , Axel Rasmussen , Anshuman Khandual , Pasha Tatashin , Miaohe Lin , Minchan Kim , Christoph Hellwig , Song Liu , Thomas Hellstrom , Russell King , "David S. Miller" , Michael Ellerman , "Aneesh Kumar K.V" , Heiko Carstens , Christian Borntraeger , Claudio Imbrenda , Alexander Gordeev , linux-arm-kernel@lists.infradead.org, sparclinux@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 01/12] mm/pgtable: add rcu_read_lock() and rcu_read_unlock()s In-Reply-To: Message-ID: References: <35e983f5-7ed3-b310-d949-9ae8b130cdab@google.com> <88c445ae-552-5243-31a4-2674bac62d4d@google.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="-1463760895-2117762585-1685674219=:27216" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230601_195027_849779_834FE955 X-CRM114-Status: GOOD ( 28.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---1463760895-2117762585-1685674219=:27216 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE On Wed, 31 May 2023, Jann Horn wrote: > On Mon, May 29, 2023 at 8:15=E2=80=AFAM Hugh Dickins w= rote: > > Before putting them to use (several commits later), add rcu_read_lock() > > to pte_offset_map(), and rcu_read_unlock() to pte_unmap(). Make this a > > separate commit, since it risks exposing imbalances: prior commits have > > fixed all the known imbalances, but we may find some have been missed. > [...] > > diff --git a/mm/pgtable-generic.c b/mm/pgtable-generic.c > > index c7ab18a5fb77..674671835631 100644 > > --- a/mm/pgtable-generic.c > > +++ b/mm/pgtable-generic.c > > @@ -236,7 +236,7 @@ pte_t *__pte_offset_map(pmd_t *pmd, unsigned long a= ddr, pmd_t *pmdvalp) > > { > > pmd_t pmdval; > > > > - /* rcu_read_lock() to be added later */ > > + rcu_read_lock(); > > pmdval =3D pmdp_get_lockless(pmd); > > if (pmdvalp) > > *pmdvalp =3D pmdval; >=20 > It might be a good idea to document that this series assumes that the > first argument to __pte_offset_map() is a pointer into a second-level > page table (and not a local copy of the entry) unless the containing > VMA is known to not be THP-eligible or the page table is detached from > the page table hierarchy or something like that. Currently a bunch of > places pass references to local copies of the entry, and while I think > all of these are fine, it would probably be good to at least document > why these are allowed to do it while other places aren't. Thanks Jann: but I have to guess that here you are showing awareness of an important issue that I'm simply ignorant of. I have been haunted by a dim recollection that there is one architecture (arm-32?) which is fussy about the placement of the pmdval being examined (deduces info missing from the arch-independent interface, by following up the address?), but I couldn't track it down when I tried. Please tell me more; or better, don't spend your time explaining to me, but please just send a link to a good reference on the issue. I'll be unable to document what you ask there, without educating myself first. Thanks, Hugh >=20 > $ vgrep 'pte_offset_map(&' > Index File Line Content > 0 arch/sparc/mm/tlb.c 151 pte =3D pte_offset_map(&pmd, vaddr); > 1 kernel/events/core.c 7501 ptep =3D pte_offset_map(&pmd, addr); > 2 mm/gup.c 2460 ptem =3D ptep =3D pte_offset_map(&pmd, a= ddr); > 3 mm/huge_memory.c 2057 pte =3D pte_offset_map(&_pmd, haddr); > 4 mm/huge_memory.c 2214 pte =3D pte_offset_map(&_pmd, haddr); > 5 mm/page_table_check.c 240 pte_t *ptep =3D pte_offset_map(&pmd, add= r); ---1463760895-2117762585-1685674219=:27216 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ---1463760895-2117762585-1685674219=:27216--