From patchwork Fri Sep 13 08:44:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 13803151 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55A15FA3730 for ; Fri, 13 Sep 2024 08:45:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DA75C6B00C8; Fri, 13 Sep 2024 04:45:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D56C86B00CA; Fri, 13 Sep 2024 04:45:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BF9066B00CD; Fri, 13 Sep 2024 04:45:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 9FB1D6B00C8 for ; Fri, 13 Sep 2024 04:45:01 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 4DB1BAB673 for ; Fri, 13 Sep 2024 08:45:01 +0000 (UTC) X-FDA: 82559080002.10.BB63462 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf10.hostedemail.com (Postfix) with ESMTP id C06C3C000D for ; Fri, 13 Sep 2024 08:44:59 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=none; spf=pass (imf10.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@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=1726216959; 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=xnAQgJcUkss6MVbxBchJezWd1R3vqAyy+/YYfgOLdDI=; b=4H2ZJQBgrHWd3HEQI+m+D/bjLq9hIPaZyHScd4b9lYdJ1uYykT0Rz3RaC/XQ19bbVPc4iA Rv2TB+ATHkfJWy3BpP6yjHjnIpPIbb/XmA1yPR4556n6fTdPuhGXYid3z04pfn1/3iZ/Rr rod8YOpf4O+Xuexn0KqvqUT459gTmOo= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=none; spf=pass (imf10.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726216959; a=rsa-sha256; cv=none; b=EEcvPkUeMSHmOm6/uWi0PsB7tED67A56/mFIAtU4FX+qZZEYV3Kg5pF6Rofhow/u1JQ+Pa ZWxeQiT4VqZebQ+M6sUvLU4SkXtekFJ6isjN1wlpzqrZXvLE1w8HRQE/JCRyNCSPvTHW1k 9sgnWQgLVnQ1vQAwpQDqJ1HZIpZt04o= 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 5B0C6153B; Fri, 13 Sep 2024 01:45:28 -0700 (PDT) Received: from a077893.blr.arm.com (a077893.blr.arm.com [10.162.16.84]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 1F8E53F73B; Fri, 13 Sep 2024 01:44:54 -0700 (PDT) From: Anshuman Khandual To: linux-mm@kvack.org Cc: Anshuman Khandual , Andrew Morton , David Hildenbrand , Ryan Roberts , "Mike Rapoport (IBM)" , Arnd Bergmann , x86@kernel.org, linux-m68k@lists.linux-m68k.org, linux-fsdevel@vger.kernel.org, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: [PATCH 3/7] mm: Use ptep_get() for accessing PTE entries Date: Fri, 13 Sep 2024 14:14:29 +0530 Message-Id: <20240913084433.1016256-4-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240913084433.1016256-1-anshuman.khandual@arm.com> References: <20240913084433.1016256-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: C06C3C000D X-Stat-Signature: itxax81p7g15q9ewuzamjhexqoaxgwwc X-Rspam-User: X-HE-Tag: 1726217099-625640 X-HE-Meta: U2FsdGVkX19tW3208aDOaT5m/KXY7MWWrV77AilTAVUa1PJjLFDj5Wxt32ceAldwapLUROv/Xw13sIjENm0x93i3+neA3/pYa4RPcCQL/szTYFNNzNhnyGxOWfGaonyheeqFh/n6Ng8sWSHE9RsPbTMx7M6CsIeSaVnj2k/1S1lZOaJanZ4IIDEslN0zs0AzEpb/FrhDt6iMxN/pnpRpYaQdYmolWZNVX99WbdwYDA/9DzoCop6c/zkoXP2Pf6Eg6JRcTqVAKRSYpJv28xKpiqniHI1Sd3PPl/lLlaVaTxBPbkDUh6JQ35v1ifPp1CiKS4GBo/nCw0Sg3EO2BzpLFDmCSGXivPrERDcn7+eYJiaBXbzpfUUAZvqNTArFTjX06JxPby8hbYd8Omo+oC3DrMPdJdhn6mPGQw9uxaTwsiz9Bv43dDVuPzr+Ojp8WW1LLoYbeowTXy6QbhrY2whC6VkD1NOkxPvkfLI/3FRei/Jp27YB9s/nOlkbZQY8hTYrp6ZbjBW3FLaxJTTR/x6DjyxlRFR2bJfg2UKJ7PyDw0HbKjN1a0ZPe6h+Otq1FIk75RsYY4MYvWrjaKdRsOMkxmrjHBESDCh2BCyxNUSrVdUQ+8XLvXZGdXPa2ny0/3HYkC4FcYf1p96BPdnHQF16aCXt2ngDzAHEafS6Q2QBXRNAZAiGkZk44bdTgITNM1vZXVgtbhkD/hx6T4leAlIH6kNB89mMJCi2p/RfEZpzT29oEvqpNneojFEAE2c1V7OYghyG9mG5oUgoSt5Hld3LKbpM+BsBa1a8xAHX93H9R/jL5D4ClH8r0PVLKjuKXwYKEO7VNA1JkNpz3KQS2phNc0oI/TnwRc9ap9EjsjwGKOKt1HxofvmILUSihq04NHYGGbMqXveh3VyZkI8c7EW3GYNbm2juHFQshTYW9Ou4UjzM0UKN+MmosBkb6sRu4eQLZR7HIonF+CKabVbb4Nd wSGzAHpi 0OeTBFVLOhrIPUIDZnH6+8wcdNZ/QafsRT5KWxvEJjgBeYENLo3jqiGl9aTMfuz3B5zulSIoF0zcNbDo2E3ZB+HlG00M7/AweesP+OKUif5DSuL8ngqnjKEV9o6aZIWNHCayoah3KKhomFY27JPadxE/uErN07BE9JlDm70U30IiqPqglENG5UNN3Dd3h/sBq2fJoEld/Lvi52jydyIZmESv0h1Uz/R7WKK87k1Ff3Ih2VLK9TH0Rr+f0L3ii+A2dZTj2NwZQz6OsyUGz1AFBlfvsNITfuUi9t2TZia6T+YHf586hwMpA/Y78K15ewHWV2WJbq1RJKC4RJ0Ys4eWNRvCj6MAhVrIAZ2yRmeS2yfa7RWSTWpjfsJC9Qg== 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: List-Subscribe: List-Unsubscribe: Convert PTE accesses via ptep_get() helper that defaults as READ_ONCE() but also provides the platform an opportunity to override when required. Cc: Andrew Morton Cc: David Hildenbrand Cc: Ryan Roberts Cc: "Mike Rapoport (IBM)" Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- include/linux/pgtable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 2a6a3cccfc36..05e6995c1b93 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -1060,7 +1060,7 @@ static inline int pgd_same(pgd_t pgd_a, pgd_t pgd_b) */ #define set_pte_safe(ptep, pte) \ ({ \ - WARN_ON_ONCE(pte_present(*ptep) && !pte_same(*ptep, pte)); \ + WARN_ON_ONCE(pte_present(ptep_get(ptep)) && !pte_same(ptep_get(ptep), pte)); \ set_pte(ptep, pte); \ })