Message ID | ab2581eb-daa6-894e-4aa6-97c81de3b8c@google.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D80A4C7EE23 for <linux-mm@archiver.kernel.org>; Thu, 8 Jun 2023 19:37:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7A5E38E0001; Thu, 8 Jun 2023 15:37:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 755336B0074; Thu, 8 Jun 2023 15:37:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 61D2C8E0001; Thu, 8 Jun 2023 15:37:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 4EEFD6B0072 for <linux-mm@kvack.org>; Thu, 8 Jun 2023 15:37:57 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 2092E8033A for <linux-mm@kvack.org>; Thu, 8 Jun 2023 19:37:57 +0000 (UTC) X-FDA: 80880590994.07.CDDD400 Received: from mail-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.174]) by imf01.hostedemail.com (Postfix) with ESMTP id 51B0240011 for <linux-mm@kvack.org>; Thu, 8 Jun 2023 19:37:54 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=wrjU6S4E; spf=pass (imf01.hostedemail.com: domain of hughd@google.com designates 209.85.128.174 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686253074; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=4B5saBu/vw3gaGnlmIPZ9pQkqfzbj7+JgYM5jpygjcc=; b=eUUEExrfrwmOcWVoGwNf7N0oFqRUUPPcslAtZlyGBEHcksM4gS+Q7TpJhfFOeJe9UFHz/+ v4chvwwx44nMOZIFWDeC8v7LThPxo0/Um04Bf3E4/xAA6S50yzG2Phh+8zCR97TdHSOnZ7 Ev3HbOdK50Vu/0yBaRzTLbXzxMO2jGE= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=wrjU6S4E; spf=pass (imf01.hostedemail.com: domain of hughd@google.com designates 209.85.128.174 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686253074; a=rsa-sha256; cv=none; b=IapfYMfsVMiEJ+RqZRaj3YHr7Y9PGPFTH/+LJsBIeWyJ7FwNT35Mc8Ai41K8znqPHxlsT1 uHkonpHs+VEpAhfyDP0yxtvoSK+9UIOeq1IivCMGQ02T8M3750XR2NDb+n8o4A9k4BY5ux B0jfi+zMdu+Pw52ZSfTrYEpz5cjwL3s= Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-56896c77434so8890497b3.0 for <linux-mm@kvack.org>; Thu, 08 Jun 2023 12:37:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1686253073; x=1688845073; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=4B5saBu/vw3gaGnlmIPZ9pQkqfzbj7+JgYM5jpygjcc=; b=wrjU6S4EMiU3Ufcg2KZPT551Y8sNhg4QKjD2hAgSPlGh9yj39Rxf3Ke0FjcZO6VxtG ALh4CVjSqM9GtJPRdIfEgNIlV/EEkptkG6e4IMSsrcpQSqGrj44uojyylNmPW3FhQBzm h+3YVxQpJctPazelaypN7o1DBk1YFmyjCLOyVuE0ZSJNDZN1IWkDf39Bng35IMFfYc2S OuTO6+N3JH4bhYslynL29X9VjGEwK1A0ffza+fgs91l3oerVxPUep2x461PcKgDhp6i7 yNPgK4idQjhQRO3vK4IICQL9mYykeSLt5G3Lqvr2ymPPunZsH8KwR6J1BbGlfhLHc47C HKFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686253073; x=1688845073; 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=4B5saBu/vw3gaGnlmIPZ9pQkqfzbj7+JgYM5jpygjcc=; b=Y3UsTvwxtQDDvTm3Y3UJSkULIztyxj8G8Y3vLbkRXQ9rzOmZk3goy0V8h8n45bjdDH 61hSPsfC0yDvoXv2+abpaHvIre2lv8nX3dwtsXD3JJcooUjMaMYOgsRyX7fhbUA8M7IC u6HS3Ii4okpbN+40S5m3q8YMD3tIkpNbq5i0SyxzRuLQwlboJcpk1skTus/jrYsrI708 CfeczBvAWAJl/9vDahuKYDWrodD+uCToVRZDUHtZKzgfqwZ+JT1VPmVeEOfoS7Pv4pTA So+EMW2Pp7cnkeduTxp2U4YPsS1AoFOlf/JuXQ7XucMbUx5tqWYXVpFw7fNm+QhZemxi cogA== X-Gm-Message-State: AC+VfDySFmXtddnHGsrjm41ATvPvw/hW9zOdujGKrg+bSHT/xQVwosSj LT97eUZRdEDUIJWGbGZa2bIeZg== X-Google-Smtp-Source: ACHHUZ7Ebli0p9041CLEfO4CyQQvBmxN41VJwJsuM0MQnf822wu8ZsrJRZ2ru1aILLAWUog5xqYpmw== X-Received: by 2002:a81:72d4:0:b0:560:f6ae:a71b with SMTP id n203-20020a8172d4000000b00560f6aea71bmr508956ywc.48.1686253073290; Thu, 08 Jun 2023 12:37:53 -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 i133-20020a816d8b000000b0056953ab06c5sm114950ywc.95.2023.06.08.12.37.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 12:37:52 -0700 (PDT) Date: Thu, 8 Jun 2023 12:37:48 -0700 (PDT) From: Hugh Dickins <hughd@google.com> X-X-Sender: hugh@ripple.attlocal.net To: Andrew Morton <akpm@linux-foundation.org> cc: Mike Kravetz <mike.kravetz@oracle.com>, Mike Rapoport <rppt@kernel.org>, "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>, Matthew Wilcox <willy@infradead.org>, David Hildenbrand <david@redhat.com>, Suren Baghdasaryan <surenb@google.com>, Qi Zheng <zhengqi.arch@bytedance.com>, Peter Zijlstra <peterz@infradead.org>, Russell King <linux@armlinux.org.uk>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, Geert Uytterhoeven <geert@linux-m68k.org>, Greg Ungerer <gerg@linux-m68k.org>, Michal Simek <monstr@monstr.eu>, Thomas Bogendoerfer <tsbogend@alpha.franken.de>, Helge Deller <deller@gmx.de>, John David Anglin <dave.anglin@bell.net>, "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>, Michael Ellerman <mpe@ellerman.id.au>, Alexandre Ghiti <alexghiti@rivosinc.com>, Palmer Dabbelt <palmer@dabbelt.com>, Heiko Carstens <hca@linux.ibm.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Claudio Imbrenda <imbrenda@linux.ibm.com>, Alexander Gordeev <agordeev@linux.ibm.com>, John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>, "David S. Miller" <davem@davemloft.net>, Chris Zankel <chris@zankel.net>, Max Filippov <jcmvbkbc@gmail.com>, 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 Subject: [PATCH v2 23/23] xtensa: add pte_unmap() to balance pte_offset_map() In-Reply-To: <a4963be9-7aa6-350-66d0-2ba843e1af44@google.com> Message-ID: <ab2581eb-daa6-894e-4aa6-97c81de3b8c@google.com> References: <a4963be9-7aa6-350-66d0-2ba843e1af44@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 51B0240011 X-Rspam-User: X-Stat-Signature: iz1cc71p5ouhpy9rmy9xf879n4p6shkk X-Rspamd-Server: rspam01 X-HE-Tag: 1686253074-460703 X-HE-Meta: U2FsdGVkX186xcIxBIxyaIuNGCddSGRhQivpGYj36MtSTQuXRusTPth1JQV1fJw4mlFdSSIaqSpnyjrYMql6M6ZQ3iSeq9s7W44IE9eWxG1byR7L+QbfGVvUqCgDd0gtIKcfahp8PrOpGY0clBtPPuZZYacXgMZvqXugPjvaEE58WxTuhrhmAYM3/K+hinnTkvpde0kn0uXublvw1WecsSN01uRzX/7FUX+egjd2j+tAkiQn1BPB5c1Y2ZMRVlej8lH6RQCgfxrsSSP6cIKTtP7fup6NgvSnlTc/cvWPlxTPkkVBAO8EUUux6Rf+cEjrUbfWCwNJlBKoELqqlIX81rUIG3QqcuLN3oYZT1DXICKG5C+eNW3D94og1bCBl3VUCyxXdIt5Fs6ZqPpRKimE/17GW/3MWRVLke8fmQ47mojB5IKVR2W/5NVNfSLQMRZ/aecIDRMLIcVISdnB2W3zffHTjFDJ+gxICTzvD5JRjXAYtGg0mKSb3y30rM05Vun4AdSBCe3gfgCi//NZn7ARiPxifqPVs5CkqeQ4r2uW/muB7BNWcwWjg5VLU03JetdgbBHYLnZm7DT6cFtRX04xvy7sweMIyAkIMh8NCRweKC07DOd7y7LzxaYn/qLPxZnsa0RYcnBc+htM2sJQDRRw1FGKEu7smZevDvGhf1FuPCOELpkYIr2obtDWA83ekm3RxXG5164foTeBDPcrHT3pS0XaJed/ah8TBRGlOJzX0+FIdF07mZ0yZbh+MksFSpVMeM1UhWQ7ugruI6fGoMCGxlB6yZcObWY3Yc/JWxtUARpkL0hNz7YgqK4QbVOkriyHDzS5h9+3/NfB8IKTdePyK8Weq26BLDYmf4te9F91QJGJFlDxGkYoCxmVTxqd2af8ycrjCW0NmMMotLO+71bD44k8ROLV/LfNTuNKvFfqmdC9iYJcKcOgeB4NPvh3PdjqneAsgIvlZMOvFNdt9h/ sITS53SS 4gN9MSl0oQiZ8/EYmrLuaS6EUX9wamKgc/Qz7uqnN0vSJ9OZV34NMDiXoklpUr70xdkMn7qyGVJh7Wi3GLzEHPc0LNUpaTZQxpfMh0Jl1qDhSfzo/MXNWfZDThBFzzoipKZK+l/jejW9r6P56X428rqs6/ka/OMZaRhJrbRg32lpezoTMBCsNEPYzNhjo1Ucgqdf+XMkaFv+pz4YpBP1k2Vn7WrrUwTbIC4J2WSO6rL9xkap4cPK8JZlQprJ/GqyNJzFWzoNVvQSKq0eMML5RKt85bDYzCPLDDy4ao+VbjqsJtFiKiXzEt6IUj/UynY4VPDzs26jKYQAA6MAszrm9Uk8PY0kVVSMq0UddGSl+oEFDZkH3PICsipYlVP6UhXy15KcaxVaSqvqBRFbV0m3ffRldgFQl1TRWeGYfeSvVAjcOI/8kNueKE/VxYg== 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: <linux-mm.kvack.org> |
Series |
arch: allow pte_offset_map[_lock]() to fail
|
expand
|
diff --git a/arch/xtensa/mm/tlb.c b/arch/xtensa/mm/tlb.c index 27a477dae232..0a11fc5f185b 100644 --- a/arch/xtensa/mm/tlb.c +++ b/arch/xtensa/mm/tlb.c @@ -179,6 +179,7 @@ static unsigned get_pte_for_vaddr(unsigned vaddr) pud_t *pud; pmd_t *pmd; pte_t *pte; + unsigned int pteval; if (!mm) mm = task->active_mm; @@ -197,7 +198,9 @@ static unsigned get_pte_for_vaddr(unsigned vaddr) pte = pte_offset_map(pmd, vaddr); if (!pte) return 0; - return pte_val(*pte); + pteval = pte_val(*pte); + pte_unmap(pte); + return pteval; } enum {
To keep balance in future, remember to pte_unmap() after a successful pte_offset_map(). And act as if get_pte_for_vaddr() really needs a map there, to read the pteval before "unmapping", to be sure page table is not removed. Signed-off-by: Hugh Dickins <hughd@google.com> --- arch/xtensa/mm/tlb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)