From patchwork Thu Jan 2 07:40:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhenhua Huang X-Patchwork-Id: 13924310 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 C8E10E77188 for ; Thu, 2 Jan 2025 07:41:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2ED6F6B008C; Thu, 2 Jan 2025 02:41:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 29E856B0092; Thu, 2 Jan 2025 02:41:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 165126B0093; Thu, 2 Jan 2025 02:41:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id EC6996B008C for ; Thu, 2 Jan 2025 02:41:16 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 58280160745 for ; Thu, 2 Jan 2025 07:41:16 +0000 (UTC) X-FDA: 82961713800.19.1E606E3 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by imf23.hostedemail.com (Postfix) with ESMTP id B319414000A for ; Thu, 2 Jan 2025 07:40:40 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=DO3jzXli; spf=pass (imf23.hostedemail.com: domain of quic_zhenhuah@quicinc.com designates 205.220.180.131 as permitted sender) smtp.mailfrom=quic_zhenhuah@quicinc.com; dmarc=pass (policy=none) header.from=quicinc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735803627; a=rsa-sha256; cv=none; b=nBmKmE2JPERVYRYeq4fwLV3lld9MbwALriVK+FX5vLRGLBRL5Ck/Vu+e3AOrK9fz/l8z58 0zf4e/nUcCiETopb77ebfbtAZMfRsV4fCaVEAWPYLjJub7rie1W+muvYm5+cju9rv4rgsE WlKl0POY78G8oV4i6FBrZAwt6qoyAB0= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=DO3jzXli; spf=pass (imf23.hostedemail.com: domain of quic_zhenhuah@quicinc.com designates 205.220.180.131 as permitted sender) smtp.mailfrom=quic_zhenhuah@quicinc.com; dmarc=pass (policy=none) header.from=quicinc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1735803627; 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:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=EK54y8CHU5sNfi7hM3+XjOQepNeNKL+xAEwrzp2ynPQ=; b=b/jCxrHIciXq7MdHYNLFs0Ch96MGGimVw7i8KRNyqba1EKSsq6yjLjBQtcJU4QgnzRUS+P tNr1byuojkKinRSP724GAjckOYHS7EI7hKjT31c80EZD2T65F1j/LAJbZhfPtMq+xXVlA1 VkZ8XBaW4/esCXqTokrcpBPjknuJ8Mk= Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5020NAnD007852; Thu, 2 Jan 2025 07:41:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=qcppdkim1; bh=EK54y8CHU5sNfi7hM3+XjO QepNeNKL+xAEwrzp2ynPQ=; b=DO3jzXliYb9ipc+HEeE9I3ElqmQmeQVWBEYO+q qehVoXrbkJTCOvn9gZHYc8hpZX0xpITUvHG1O0i4uKArO5pSkTpb40Q/zWCv4ixv 9MOaClHVFCTg7et7Zyy60rq0mi14YwNcc0aptXkIVCUJIxiRXvEalX8paXoLrEr8 DqZeTtVUUbw8tP4ai92rqISHHY9H7iipUDadvnPMUIo/4TeOoEbdfAtRdCRM5HS8 /xk4ZqcvRwj9VFMxcoNW+V4DDUUldddnZ6Qed94OZdC5qZ6qCKnupA5ro+RkQzEF /w/j5Jo3PXAgl+RmAmckoZqjxdT4TCCHW3HPPFwA///4bFJg== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 43wba18yc3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 02 Jan 2025 07:41:07 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 5027f6J0012349 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 2 Jan 2025 07:41:06 GMT Received: from ap-kernel-sh01-lnx.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Wed, 1 Jan 2025 23:41:02 -0800 From: Zhenhua Huang To: , CC: , , , , , , , , , , , , , Zhenhua Huang Subject: [PATCH v3] arm64: mm: Test for pmd_sect() in vmemmap_check_pmd() Date: Thu, 2 Jan 2025 15:40:47 +0800 Message-ID: <20250102074047.674156-1-quic_zhenhuah@quicinc.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: Lhnmhoqz3CUaDTaNRgp3XVbPTfOmZ51M X-Proofpoint-ORIG-GUID: Lhnmhoqz3CUaDTaNRgp3XVbPTfOmZ51M X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 mlxlogscore=475 malwarescore=0 bulkscore=0 suspectscore=0 clxscore=1015 spamscore=0 phishscore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501020064 X-Rspamd-Queue-Id: B319414000A X-Stat-Signature: dfn9tena3xjyrqi7bsomd8zix3514xsj X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1735803640-703674 X-HE-Meta: U2FsdGVkX196hHol1YQRBiYuWsEdhrYyNNia8WfUYLe5JaPBnx+qHzmaE8Uay3Lt87Q/LLP6lDIJrMpw7CwBtkqEn12AQ2gtPUvAirSTYJyRpZvHT1oAAEpv7AKG4uxbEPBG2VIgXK1UPdNUE/lp+R404f+jveqrNzClHvAdCVg7VVNVuakxHEjajA4krJDb60uIHvsCpWEW4hwi0viv0e5ead1Tz+D6eroR93+fGwjJQJSlRe/tmV1OByajm0BekhcSML+jlJlyOui7/ulBOlzh8tdCApA3PQxfAgPzmSrjkAtKePLtKPLd+5OK5Sy/zsothaH0e3+yk6EZxnZYNXT1twAn6ChHuTfNSx3KBQgnnjz+3f9Xx6HbMHg5IcjgPRN+ZNROVDh+JDIUtlAKUm2zcTYpfldJT5XefLtQhtBJVit8iiXchMNm0YcACYfcVZiXm+Ef2vyCMlnGrpTnpTvIg/TObLpwl2Oyg00ppi4oXit4LJlHNG5rxZBFmLlKS9tBBlJwqg/pxigjiEZtuWVb0w0sJOba11+WIN96VE+Swm1mDp1+paE/krEK3tANfJjWOOf7fingjATL51RMIb17jOIJg623kIjc4gjJ1DVsiXg+dTMLSx7DvznT5yAcrS7yo9eEfmDaPkdM9mynLth/BtEktsB9vZR9ExSy3ZzP/1mYVfm2Fe6xetckW0BVKksCPF+i+GfjVEQbmfb5RjYTeu/8sA9ROOV8ZV6NZQqm0wMfGte9dYmL06NkQmP1AOEkuAl5WYmaKx+xhIS88C10mUqk7jQLwrVTsPqTzYDKhlLycU1na2+8+Ht8NiPWbdCSDKACNStMSGi075GD9F56zxs1b6jNqned9HVCxvIFGRc0NDF6J05RTpEm7MU/4b7JJjLQd3nTsRv9kXg6SbH2lDcG4Nu/cs4HRNoHQ0jMjU2nyHxtEybmrC5J+QJpkzuWArE9axTXDSQ5b7N guCfUSYr 0yOdOkMrrIankVqSIIBRON6Igc9cmbQbRDacFITpz3LjF5DVO40fk8/FbfUV2R0dIIEFuPLOTz+n2Xt+Z60/hzuSnaxgg+dWZjtV7UemqePkmNxLY1n1HFFf76j5oird+ynmJs5qV+Z89WCEJGAVgpB3j/AKvh8b4qL/KSbCErKW2AjiEM0pHfryMpMKgz72TnfJfL1lIWYxB62I34YLvVNgXQCRjSDlxUIrbHMhsNblrDvmZTCQJ7EqvpNiIiPBI80runJ1QHcY71d3VfmxceEJYMtLJaHmvzdm10lnx4+RtM7k1LDfTDvfSG6oOWDKZZ+KgYa4k8DZvMN31JZCyiChlAmj7HJmmLhZ3l8GNc0vFb7WDeStut6IZHViIngWu5DjEd4wuQRs0/8g= 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: Commit 2045a3b8911b ("mm/sparse-vmemmap: generalise vmemmap_populate_hugepages()") introduces the vmemmap_check_pmd() while does not verify if the entry is a section mapping, as is already done for Loongarch & X86. The update includes a check for pmd_sect(). Only if pmd_sect() returns true, further vmemmap population for the addr is skipped. Signed-off-by: Zhenhua Huang Reviewed-by: Anshuman Khandual --- Separate the patch out based on the discussion: https://lore.kernel.org/linux-arm-kernel/20241209094227.1529977-3-quic_zhenhuah@quicinc.com/T/#m41d49cd91b348ecfe2c37c4b3c0911180426934e arch/arm64/mm/mmu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 9afeb35673a3..50a22c63f450 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -1172,7 +1172,8 @@ int __meminit vmemmap_check_pmd(pmd_t *pmdp, int node, unsigned long addr, unsigned long next) { vmemmap_verify((pte_t *)pmdp, node, addr, next); - return 1; + + return pmd_sect(READ_ONCE(*pmdp)); } int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,