Message ID | 20230612151545.3317766-2-ryan.roberts@arm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2672133vqr; Mon, 12 Jun 2023 08:33:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7P+DB2NnhJuONdRqTARTG+c14GRF3nWsSR/RduPkwh2lCHBEjcZAN0vEA/9aoIAULwsQb8 X-Received: by 2002:a17:907:930b:b0:967:e015:f542 with SMTP id bu11-20020a170907930b00b00967e015f542mr9848093ejc.44.1686584037257; Mon, 12 Jun 2023 08:33:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686584037; cv=none; d=google.com; s=arc-20160816; b=lBmeNl0vbmxp7d0MJSWRXdkYe2tMQS/sBYmA9UYekFhdyrBuEdQrUg159WeaWOKbUd 1muSTR7SF+iddJepDZp6n0Cv/P6T/gyyXx5emNQgybDaQMBbQs9YwfYpQzeRyM0pLMka vYbUkkzDsKRjgo3b2rEmSTwbRtV1y3cm3cevBBlz/2LdFYTvCEC6dLwp+JPgC5m0jgGN ZV7gjw3XbEQyyKvGuXuIzI3BLyZF6bKS7AgsCY1FzLCkYGCrHiJLPCSazSYYDXq0KYzD +dtdN/VkDlooCFrLz8E2u9HTpingVc2AvNenVdjqhJgn1aiYZDievrMGleZ+idtfNNs7 D7hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=0+ER2+meiKY6IihdeAmqEesVkZOLrX6iyumSQ77U0Uw=; b=TF6jMwnbn0NE7aYWFmykmfkugTq2Pz+kwkVfJD/hLKgPWnVeerQNBpBhRoRFNNlNgr wZ2A6HZKSoJWReLeACtkbhm1MmJK4mK+qq2AFPfjurNn5o2bMl4OwKqzztmKrBJDB5k8 S6M6C8vZAo863TiVnHg20nELF6V6WAS3yAt37T7U4w8AiQWJjclfeJVUqGmg47vkA2Kp ba228kV9C8rS6TqubenSA+CjAsDphuj539c6F+n702I3KMoswScy3cs/7pz2B9glrjpN wIwwaS7Jo8kWQu5A0Yi6w2fQlQ2gyMp3AW9CsXeA1+IpdWEJTkQKsm6kGJxINyT5YJ0T CGIQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h21-20020a1709063c1500b00977cc7cec71si1707182ejg.285.2023.06.12.08.33.32; Mon, 12 Jun 2023 08:33:57 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239386AbjFLPQL (ORCPT <rfc822;rust.linux@gmail.com> + 99 others); Mon, 12 Jun 2023 11:16:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234242AbjFLPQH (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 12 Jun 2023 11:16:07 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9D4FD8F for <linux-kernel@vger.kernel.org>; Mon, 12 Jun 2023 08:16:06 -0700 (PDT) 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768511543396059986?= X-GMAIL-MSGID: =?utf-8?q?1768511543396059986?= |
Series |
Encapsulate PTE contents from non-arch code
|
|
Commit Message
Ryan Roberts
June 12, 2023, 3:15 p.m. UTC
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(-)
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));