Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp144544rwd; Sat, 13 May 2023 15:05:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ77WpCLSIoCGNSvQwepTOBjbQRfUbwDtMJ/HU+D/1yd44KnRIZpor3HXlx88gcrjG6Q2keI X-Received: by 2002:a17:90b:1188:b0:250:32dc:3369 with SMTP id gk8-20020a17090b118800b0025032dc3369mr35200648pjb.15.1684015521678; Sat, 13 May 2023 15:05:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684015521; cv=none; d=google.com; s=arc-20160816; b=zEZVZ68dkdCIPMrnK89oycDrfNfB1Q4hNxCyITVPrqOp6Oue74qEh/RNL4yIkzn3QS 9hJqUAG87Hgtn1G5reVYHV0DpYv2rwtr3B9+bDjTGL+ReFlG0550DKFA+scDnlHrLZ9z EedY7psZVM6P4a+PkIVvB+T0vaUqSQCmSL8F2kGxcufiCR9exL0Rs4oRxe4rcSP9thos TtWu93FWKm2mcx7wsKm5/mWyk0J/CGOfXG+e04sDX137AnOeen5TXQdpvHapgXjWJwED npNU161ttLjWkXjkMx13ctVRWfaP/O7IbXcBZ5oL1VX4+o34fXeSCi4doCqBVcGso6iI GRKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=YIDPid/AnU51Zv96DM0MdCj9G9rm9XwyBVfAr/CkjAs=; b=AaQx4+gDFatIwzauSKxYazpvIhIGqiL1FN81ALglAhsBgG2QkbISfO4yMd4PcmgF+P 2EoTSBycmcf0wWMY6TLios21ao6FBg+NJbhlClrieRdqOCA4xetIXzbQ0TMIKNi+/g5e LZksxJk3fcPwP6PONaMeGdVxSEuLiCti0VCObHa3jdPgVXlTMP3Ho0/VELF+mVx0eRMg nOgVih7BYMFb2s8805I7Blph4ibdMzia7bCtKw6fX9MIYX/KcaVTwHsSyw1zdtB06zVX yPM/SDuuzaiY0bZ0elVou8bOs/6m17cB66jkf72dVcQkHfY2UT+TYn++i/4nhxfpBpJO t5jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=cr8F1CRB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z124-20020a633382000000b0051367d909efsi12281153pgz.106.2023.05.13.15.05.04; Sat, 13 May 2023 15:05:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=cr8F1CRB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231637AbjEMVhx (ORCPT + 99 others); Sat, 13 May 2023 17:37:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbjEMVhu (ORCPT ); Sat, 13 May 2023 17:37:50 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0597C26BF; Sat, 13 May 2023 14:37:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1684013732; i=deller@gmx.de; bh=yJRf6LHTP/Tqq0WjA9yc9VAdZA0puqTSbfj+iJUayOI=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=cr8F1CRBH8iQkDkEZ/t6guBO/5jXWPHjvHesKUuGbD0L0xJGMcsfDLG0X9/WHN5tf gmoBZcMozWcEmMI1SXgz60UKtLHg89Qkg3K5IkelB8CkMlNz7sHwAxzIMD7I9clgqG 8BBXU1INAL2hkc4jAoXGc9Lj9qQhDT78CQ4DXrxDBdxOVY1Chk3DgfjVKIVZpGXT/D hVsUkekeRL3hC4ZEJXj+51+YVnf9Nvq9nqI08asyhPuJHM5bnDl2bJRO7+pyeEkSzs makkDeysMdDZ+PR6cOIDeDEyBEo1Ufi+QeDWvXHj3Lo1XEgk6NeIJkd9GLiqmybaVK GkXJUictBPxtg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.20.60] ([94.134.158.250]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MdvqW-1qYw4r4BZ0-00b73t; Sat, 13 May 2023 23:35:32 +0200 Message-ID: Date: Sat, 13 May 2023 23:35:26 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH 08/23] parisc: add pte_unmap() to balance get_ptep() Content-Language: en-US To: Hugh Dickins , Andrew Morton Cc: Mike Kravetz , Mike Rapoport , "Kirill A. Shutemov" , Matthew Wilcox , David Hildenbrand , Suren Baghdasaryan , Qi Zheng , Russell King , Catalin Marinas , Will Deacon , Geert Uytterhoeven , Greg Ungerer , Michal Simek , Thomas Bogendoerfer , John David Anglin , "Aneesh Kumar K.V" , Michael Ellerman , Alexandre Ghiti , Palmer Dabbelt , Heiko Carstens , Christian Borntraeger , Claudio Imbrenda , John Paul Adrian Glaubitz , "David S. Miller" , Chris Zankel , Max Filippov , x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <77a5d8c-406b-7068-4f17-23b7ac53bc83@google.com> <44ebbf90-5fbb-2815-17c7-fcfe3c87d78e@google.com> From: Helge Deller In-Reply-To: <44ebbf90-5fbb-2815-17c7-fcfe3c87d78e@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:02c5NpapKZ0yND7w0y40kUtQXH+Ybc0bQPzvspvwYlotAB99sF5 zFBBfNW47FR7ppsIv7ORzd5debot/2bSdnSyGIDtWWm1xzh1QppJDewIoqcOMGEOc5o3++E GB7D5SsAuS01JsydFNYGrdMOwh1KtcLiZKmwzv4YnhFPj7aU+qawXM/A52PkJ99vIebL33s O5IbJLN5O6SEa/1rmMz5g== UI-OutboundReport: notjunk:1;M01:P0:bhlTqfzpBjQ=;VggY45HBIIx7XaH/PngpNV8urft cjwTlAoz1j7g24v8vlKLAO3PylYnY/qHL1gAemvPDWFLKb+ZHNP7elgmO7WqCtgoC6KjABob8 DNOyUboPP4EN29IO7mQkp5zAUdfcC9dvuIH6FrtIgv24kY/u0UkP0sFqXCCza311xuhuc0bfI W3a3RTKNdId6dAowl5u63DT6seM8Hm4iphC0SPSPZT9g005M9r8+BQH/XC9MFQyJSO3FX3CWI UokhNrxaQU+aZoAGuy0ZKtyCLBTYWL4F6TSIHPfUdr4DKE8vx3tRYWkx+4y1/bi2ullhSCNlL t6uHP3r9oyZotSEHOmuNGQ7W90zXSNq13A8slhX51+wEbYQI7OjJlN5/6SNi0b3fPn7mCmsak 5u96zCjBgO45UkYwIFVS3h7nF/Mwj8eEQpBbuQa/S0dQzwZzDhm85nk91JGJWzeKBhnpogocH HASt2e1tuCNJHXlJDWO5LuLXb/JVmpy/KwGOxafTz0qWr0u9OGwBJyzr/aekEvaK0vqfAKu9G WWPJ6EPxl3C5tMotM5H57EtsA/8G5fV+FiCfWCTjtjTsMZF7DQvd5ixzVKc8aKHYj3o78J5J9 b1xbN4FsZDbke0QSx0p5QFQq4XQal0qGr9xIMYRqRZ0p56T3GrZgrwad5D5lXnpeTj0OqJ47u LkxrOM39notrGfVPy74SGBIJ6LFZQs2aBXs0Hrdb2Ua2vNs/36VHsvhfxQ4rZu2ljsKr7Tnsd t3WHCudqPse4fRr2srS44fxtRfB3efVVWEMsoe5NnAfdFJZgOwt0WYZyDbB2PZ4mU7ilCEJAJ irVSZYdS00VuNKqtGWxFrZ0rrE5AHHHlC1uGoa5UQz1YYRu63D00hqjC4lOZ81YrXtV0VSuXi PDH9rmGqc28YryLY3ce8ZihMjd1Tkl/vP1QN0EuRgkkWHoKGGQ5LzjYSoYI+w24AaBgVLeyTT dmWbT/BmDshTWbB5y4/6VdjN1LM= X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Hugh, On 5/10/23 06:52, Hugh Dickins wrote: > To keep balance in future, remember to pte_unmap() after a successful > get_ptep(). And (we might as well) pretend that flush_cache_pages() > really needed a map there, to read the pfn before "unmapping". > > Signed-off-by: Hugh Dickins > --- > arch/parisc/kernel/cache.c | 26 +++++++++++++++++++++----- > 1 file changed, 21 insertions(+), 5 deletions(-) > > diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c > index 1d3b8bc8a623..b0c969b3a300 100644 > --- a/arch/parisc/kernel/cache.c > +++ b/arch/parisc/kernel/cache.c > @@ -425,10 +425,15 @@ void flush_dcache_page(struct page *page) > offset =3D (pgoff - mpnt->vm_pgoff) << PAGE_SHIFT; > addr =3D mpnt->vm_start + offset; > if (parisc_requires_coherency()) { > + bool needs_flush =3D false; > pte_t *ptep; > > ptep =3D get_ptep(mpnt->vm_mm, addr); > - if (ptep && pte_needs_flush(*ptep)) > + if (ptep) { > + needs_flush =3D pte_needs_flush(*ptep); > + pte_unmap(ptep); > + } > + if (needs_flush) > flush_user_cache_page(mpnt, addr); > } else { > /* > @@ -560,14 +565,20 @@ EXPORT_SYMBOL(flush_kernel_dcache_page_addr); > static void flush_cache_page_if_present(struct vm_area_struct *vma, > unsigned long vmaddr, unsigned long pfn) > { > - pte_t *ptep =3D get_ptep(vma->vm_mm, vmaddr); > + bool needs_flush =3D false; > + pte_t *ptep; > > /* > * The pte check is racy and sometimes the flush will trigger > * a non-access TLB miss. Hopefully, the page has already been > * flushed. > */ > - if (ptep && pte_needs_flush(*ptep)) > + ptep =3D get_ptep(vma->vm_mm, vmaddr); > + if (ptep) { > + needs_flush =3D pte_needs_flush(*ptep)) ^^^^^ One ")" too much and lacks a trailing ";" Should be: needs_flush =3D pte_needs_flush(*ptep); With that fixed the kernel compiles and boots sucessfully on parisc. Helge