Message ID | 20230612151545.3317766-2-ryan.roberts@arm.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 116BDC88CB2 for <linux-mm@archiver.kernel.org>; Mon, 12 Jun 2023 15:16:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A1DE86B0075; Mon, 12 Jun 2023 11:16:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9CDFA6B0078; Mon, 12 Jun 2023 11:16:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 86F0E6B007B; Mon, 12 Jun 2023 11:16:09 -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 7887C6B0075 for <linux-mm@kvack.org>; Mon, 12 Jun 2023 11:16:09 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 4D2BC1602AA for <linux-mm@kvack.org>; Mon, 12 Jun 2023 15:16:09 +0000 (UTC) X-FDA: 80894446458.04.38EE1C4 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf04.hostedemail.com (Postfix) with ESMTP id 72EAE40014 for <linux-mm@kvack.org>; Mon, 12 Jun 2023 15:16:07 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=none; spf=pass (imf04.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686582967; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0+ER2+meiKY6IihdeAmqEesVkZOLrX6iyumSQ77U0Uw=; b=lEKUJEd8KiSUJFpklhwhf3tmGcv4NXszMMbXbB3NdSJZck1NlHzCISFf/YZCsfByj54B3h OAtRlKEghsbXvVHWnxF8L1bJvk3+P5XiwlrfBK14Ot9ra7V6FCIHOhsZ4XxiHPLmOXE5NZ PCkSbk4kDLASs6CIOAEMXLvls+vkJ8E= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686582967; a=rsa-sha256; cv=none; b=QuYhWvZi3JSpvnhxPwNYGy7ET8gyPWiAKmceULsk7eIsWMJ6XItB/4E3YfxIATnHfIqT/Q 7V99W2jDBIuPoaJBempa9h8fFhkvhRNwfaI+DQ/DcEHDpbNTNSDIIIcYXdoSpN3gCWQ/HX IeW5Sy8Hoh2JiY+F3LT7pWgC5dwzyF0= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; spf=pass (imf04.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 64A882F4; Mon, 12 Jun 2023 08:16:51 -0700 (PDT) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7B93A3F5A1; Mon, 12 Jun 2023 08:16:01 -0700 (PDT) From: Ryan Roberts <ryan.roberts@arm.com> To: Andrew Morton <akpm@linux-foundation.org>, SeongJae Park <sj@kernel.org>, "Matthew Wilcox (Oracle)" <willy@infradead.org>, "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>, Mike Rapoport <rppt@kernel.org>, Yu Zhao <yuzhao@google.com>, Jason Gunthorpe <jgg@ziepe.ca>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Dimitri Sivanich <dimitri.sivanich@hpe.com>, Alex Williamson <alex.williamson@redhat.com>, Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>, Alexander Viro <viro@zeniv.linux.org.uk>, Christian Brauner <brauner@kernel.org>, Mike Kravetz <mike.kravetz@oracle.com>, Muchun Song <muchun.song@linux.dev>, Mark Rutland <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>, Ian Rogers <irogers@google.com>, Adrian Hunter <adrian.hunter@intel.com>, =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= <jglisse@redhat.com>, Andrey Ryabinin <ryabinin.a.a@gmail.com>, Alexander Potapenko <glider@google.com>, Andrey Konovalov <andreyknvl@gmail.com>, Dmitry Vyukov <dvyukov@google.com>, Vincenzo Frascino <vincenzo.frascino@arm.com>, Johannes Weiner <hannes@cmpxchg.org>, Michal Hocko <mhocko@kernel.org>, Roman Gushchin <roman.gushchin@linux.dev>, Shakeel Butt <shakeelb@google.com>, Naoya Horiguchi <naoya.horiguchi@nec.com>, Miaohe Lin <linmiaohe@huawei.com>, Pasha Tatashin <pasha.tatashin@soleen.com>, Uladzislau Rezki <urezki@gmail.com>, Christoph Hellwig <hch@infradead.org>, Lorenzo Stoakes <lstoakes@gmail.com> Cc: Ryan Roberts <ryan.roberts@arm.com>, linux-kernel@vger.kernel.org, linux-mm@kvack.org, damon@lists.linux.dev Subject: [PATCH v3 1/3] mm: ptdump should use ptep_get_lockless() Date: Mon, 12 Jun 2023 16:15:43 +0100 Message-Id: <20230612151545.3317766-2-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230612151545.3317766-1-ryan.roberts@arm.com> References: <20230612151545.3317766-1-ryan.roberts@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Stat-Signature: o8dmm13y9sd5mqkkmiu31nyhyow67xb6 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 72EAE40014 X-Rspam-User: X-HE-Tag: 1686582967-28977 X-HE-Meta: U2FsdGVkX1+vA0XzQp3/D0NSpwmnrxYH4y5n5SCqOvUsd7zpaIBml85q9fPfky8cQOVTfgCT+OfaFuprDFgqaaAm/WUNrZdrmum49r/GAjd4elwudpowVTZJPaT3rN94ekFJ66H5ySHlf8YkuEf0b6ZTRevMR7+evg++j2OT1ZPljvHqL72eaZQIF4SWRSb6haq/eAIynDb1Mev/jck7M6fUoEHulVvqAtar+gujAZWfLLMbyZLkYtkeZfg8Tf7PQfr6JWV/1FHSCP0Pkv+ZIa4vWUCnOy7lY0U0/Z+fbtZ+cAFfv6R3EV0KDSKnsRQmLtmGpaLl452s8lRGAMxndM3s+KmjHft6OdrLqnn4GxJjpzcFAk8DXYKJjWLtcnguAfO7aX0fFaK6Wp8rcIHHX6Znvn17fiF1awtL/G/vpYfuKuKNyiXAjBoeHgDgVR/ca1rIftNLzpIjHb+GkGHisfNzuf1m5HIsuRM2x1/Nqz4Jcj3YpN2Mtxr/dW4oXdOUxoLG4Vn/cEnYTzo17LnzQP+qVgkrvMWGMrU9Y5b36eAhXOMYX7PCXejoldcr6URqaZzltSKGjEmseTYhgsc0pYyNoptTn0bNV0op6BWJZzGScH3wIYE99o+NF/TCf64rVTn/h8l9AxHPA9C2/3vmjVsb4c5C7BPrr0ZlXkh2cRrW0/iSsbMk3JALr+ZxXA6nKLcPMjuks2PdL/XZCoc20RCqEqxtwr2yvErewHWQNQ6qznREBhRTxZSu7p52xXRcaOiuNbKdYW85c9mprQwRbh53Ai1gX0SNfQAMYCNQJZ0oQgE/OLPFMVoSKKH+yiGn4GRd429CpDy6dnaYfu9+GA1+9nbrJ9zPmsdWPEZFp9nl7J86wQPFeZCImvcYiKfPgJa9lvodSJcTZDaq2mKl6X/SRcaN3FT8RjzetWEb347wvA8UDC0CN3V0oDhG7DCZoQ+xlBpigbPe3HN7AGk HbSBcx45 0zvFVXv5kJ5WeISm5l/+DMCzOPj4zMPrjRN9Ssz/unyhPwfOplHiJaMc6hYHZPsX1MeUs7JyWAUAoQe7VhWQlEBZNwLhjDokCZ6DdgW/aSBEVzttAScah+9QaO0Pny7dSQ7H8+h4ll8awN74zRrPtEAuipKIs/9rTGplo5qH3NNrjm5kaI4jbbLj4zVFVoPtLZVhp5ccowL5ewo6/p1hHuFVtbS6Eubyf4ibtn2u4WdG07DqBNq4B5/MWi96LhK26uZKHhSygWWWQF+2GJEsUKMGD+eTa1+D5ezhMVzGHXiRjflg= 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 |
Encapsulate PTE contents from non-arch code
|
expand
|
diff --git a/mm/ptdump.c b/mm/ptdump.c index 8adab455a68b..03c1bdae4a43 100644 --- a/mm/ptdump.c +++ b/mm/ptdump.c @@ -119,7 +119,7 @@ static int ptdump_pte_entry(pte_t *pte, unsigned long addr, unsigned long next, struct mm_walk *walk) { struct ptdump_state *st = walk->private; - pte_t val = ptep_get(pte); + pte_t val = ptep_get_lockless(pte); if (st->effective_prot) st->effective_prot(st, 4, pte_val(val));
The page table dumper uses walk_page_range_novma() to walk the page tables, which does not lock the PTL before calling the pte_entry() callback. Therefore, the page table dumper's callback must use ptep_get_lockless() rather than ptep_get() to ensure that the pte it reads is not torn or otherwise corrupt when racing with writers. Signed-off-by: Ryan Roberts <ryan.roberts@arm.com> --- mm/ptdump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)