From mboxrd@z Thu Jan 1 00:00:00 1970 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 A6541E77188 for ; Fri, 3 Jan 2025 02:44:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0C8A16B0083; Thu, 2 Jan 2025 21:44:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 078516B0085; Thu, 2 Jan 2025 21:44:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E82246B0088; Thu, 2 Jan 2025 21:44:06 -0500 (EST) 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 CAC976B0083 for ; Thu, 2 Jan 2025 21:44:06 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 72EE443044 for ; Fri, 3 Jan 2025 02:44:06 +0000 (UTC) X-FDA: 82964594118.13.85C5FA1 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by imf12.hostedemail.com (Postfix) with ESMTP id B9AE04000A for ; Fri, 3 Jan 2025 02:43:41 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=FjYFTgdz; dmarc=pass (policy=none) header.from=quicinc.com; spf=pass (imf12.hostedemail.com: domain of quic_zhenhuah@quicinc.com designates 205.220.168.131 as permitted sender) smtp.mailfrom=quic_zhenhuah@quicinc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735872196; a=rsa-sha256; cv=none; b=xqBYPFiv49jS0+gQrxsYfFCUuAjjAXUtC7JeCTurhT0ZhDy5BLQPMKKNh61FTYvqePKogu 7AAhitGuufP5TAQT6vM4Gjd/DdFW3q0kGjd3WNiVVoxkxjpnsc0q2Q4S3D3KQlsCyixn+M q7nsGTxTDyz1MdT2BE9zx2uwTw7RupY= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=FjYFTgdz; dmarc=pass (policy=none) header.from=quicinc.com; spf=pass (imf12.hostedemail.com: domain of quic_zhenhuah@quicinc.com designates 205.220.168.131 as permitted sender) smtp.mailfrom=quic_zhenhuah@quicinc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1735872196; 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:in-reply-to:references:references:dkim-signature; bh=AP4om3HCUGPZiAgSFK/mDowrAQLBhJ1lEYaLjFS047A=; b=k1oKZ+4/zHFDeqKJvA2IcN4tsmebHSNJry/b9Bkrh8TAPveejThUhFNUxJP6wHN4aDM7ho L0Eoa6czqrwRqgl7nyeTlx+yFXUFku92ASrdYsTjMJFwR693KUmtnPlRYmvMbog4QpTuYg TRUd1F1pLpOs2Hbwqgl0Bao8oqggaKk= Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 502G1G7g023410; Fri, 3 Jan 2025 02:43:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= AP4om3HCUGPZiAgSFK/mDowrAQLBhJ1lEYaLjFS047A=; b=FjYFTgdzObI/HD/U DZ5eBX6ScnB0onG6AAEchyS67TpKiwtdrAsspIIbrbWMrY0lsHcBkxCGKO0eJn4e Fr6iz9xbvg3MWr4giz0qL6CFaWsJLnP1Y9hTku/QEDpl4nk4VOIIiURjpvTGnn6h o/ICd2EX0ltNqoxbAQ8enZL3mqk0v+XlHwanHrqEeMF0u8xjSiRf6+mu2/r4/JDz RuQ8eVpjuMvBasEdmLGZ8WVGi26zTWvUTqTqGnITtnOE6VROYQmLxK6dli+u9tXH TFwxSaufxuDv6qAiK1FYLQuTLVSj1WVVvBKuNnYaUDrRmxXp3xRqVPRbw2HLyxXM ayrwvQ== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 43wt3c9nb7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 03 Jan 2025 02:43:58 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 5032hu6T026446 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 3 Jan 2025 02:43:56 GMT Received: from [10.239.132.245] (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; Thu, 2 Jan 2025 18:43:53 -0800 Message-ID: Date: Fri, 3 Jan 2025 10:43:51 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 2/2] arm64: mm: implement vmemmap_check_pmd for arm64 To: Catalin Marinas , Anshuman Khandual CC: , , , , , , , , , , , References: <20241209094227.1529977-1-quic_zhenhuah@quicinc.com> <20241209094227.1529977-3-quic_zhenhuah@quicinc.com> <39a85800-47c5-4529-906d-5a40e58ce136@arm.com> Content-Language: en-US From: Zhenhua Huang In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) 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: HJ5FfEEDirT1_7c4V-vDR19wRnLVmHII X-Proofpoint-ORIG-GUID: HJ5FfEEDirT1_7c4V-vDR19wRnLVmHII 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 adultscore=0 impostorscore=0 clxscore=1015 mlxscore=0 phishscore=0 bulkscore=0 priorityscore=1501 suspectscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 mlxlogscore=710 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501030021 X-Stat-Signature: wyccuz1xa6qxeuntgrcs1pkhh3zkb93m X-Rspam-User: X-Rspamd-Queue-Id: B9AE04000A X-Rspamd-Server: rspam08 X-HE-Tag: 1735872221-443267 X-HE-Meta: U2FsdGVkX1/P4wLJAbbs/ioFdiYBlf+8onactNxm4wi4B/T6zXgf8+7jEdCM1c8fkIdFDpFpHp0ullonOZMJ4vJegeE4HwnqY15IDNXhWWxNRK3tIha8omdpwOZG+43dP16maXVULl0EHIj5wSM5MWRLQiZFvcfCYsZsUUY3gKRk2koRhfQO1cZRmzI/7QTTgYGCko29XyWEHBG9KoBh40y2vQZRsYT5z4MZxjH7Qpi2US7hbh02y5IW8Sm4stmLpk4ouP7z5AORhozQsU9ovJJyJdnR3jwmfoXDGGsXvVXQMkMJH+QD7gQqy4C7dnL9CIffGW+OqNyauZcJ10+mNFnMzUl+coONa6/rzouPuCclMvhL58kOtzwerB7AZbTCuX46kcYx5ItGIt/bKyPQfLeBd3ymfvEI8xLpcXX9JkumYEkz9kgcF/YF3bbGAIxExI0y/oZl3Dh2PbhV8dtJ8jb65QGtw26LD1wMrks1G9wA+lvEHT6EcMTlmv43+kcb0brxjiHOZIIGbhcMZsNU9TgA+T/BhduK78P9usQs6iCQBVMddwEF8eo0jNGERE4kPzWHQDR9U87jgJUo6rynAykmIBsIfmWxyLxqv7BSQS3mSGP5BXispYi+skKLKa/9ldJcVz5KmT0eRR2c+cyqwzppqBrMp66MOtV0sLtOCS7hH7oOfin+8z3XtUWVjRIsbzZJurltJxFLRgQ4frD/Y1nkQRHEr2ZFIP+p/Nct96b9k+beWJBm74OOk03lijKs968kuE8XfBih9y+ZQHrJ+HffUJ5OXmcpZg2alocVK5NHvW5iSOgNKWkcPiFydONveYmsNgAY8WyQn1x9MXcJzOuFjpAgWRrozu+XucLntiwIJgVbawFbUnBDgsB+6UnJ91evsvBAqu1YATqTusvtNNcKjXJ7J0HpgS+RWA34j1loUzo/MPgLXHL7/TAuWCEoqWdrSiFxTjTChgcoHhL oAGbM1Q3 wjyU3h28I8l3/HS+cSujb26NejLHUrgwiS6Ly8C/oYfTjZylRLsYCfbkZ/F5NI3xf9pSyJHwDbroeHBqkSKt+yCF9OFU2nUgaYEMRq2MLs6xN4KIUcTSaspG+wOacFhr3p8hpCdXFGfS2b4UoI0a0Z9WpxkpovnRnTPD+Khfh8aypGdhUuzkGEGmCwHXJN+/ccn3Yrki9dtXnp+F5cQ4lnP23AoHsWAfH8qZ+zdrNay8cj6fNICyIBSyCBKHvj+eZ47O96aD93aT92YQRCKycPy4NhJLN3TbOUISpV7qMx9cDvDVo76BeCep1C1tS4w1tEJ0lM2tKFN5Zjr8yBRS8fLMu1FP6o1x6kcktmUkdWhnl+oq2prBqAxAbRA5Y7yKmvWDfNokWR1xLyGuOPG1SJeoCSt7NoFuUHj2DV8U3Yo5uGbTlFxXsUvjXLA== 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: On 2025/1/3 2:12, Catalin Marinas wrote: > On Fri, Dec 27, 2024 at 08:27:18AM +0530, Anshuman Khandual wrote: >> On 12/21/24 00:05, Catalin Marinas wrote: >>> On Mon, Dec 09, 2024 at 05:42:27PM +0800, Zhenhua Huang wrote: >>>> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c >>>> index fd59ee44960e..41c7978a92be 100644 >>>> --- a/arch/arm64/mm/mmu.c >>>> +++ b/arch/arm64/mm/mmu.c >>>> @@ -1169,7 +1169,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(*pmdp); >> >> Please change this as pmd_sect(READ_ONCE(*pmdp)) instead. >> >>>> } >>>> >>>> int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node, >>> >>> Don't we need this patch only if we implement the first one? Please fold >>> it into the other patch. >> >> Seems like these patches might not be related. >> >> While creating huge page based vmemmap mapping during vmemmap_populate_hugepages(), >> vmemmap_check_pmd() validates if a populated (i.e pmd_none) PMD already represents >> a huge mapping and can be skipped there after. >> >> Current implementation for vmemmap_check_pmd() on arm64, unconditionally returns 1 >> thus asserting that the given populated PMD entry is a huge one indeed, which will >> be the case unless something is wrong. vmemmap_verify() only ensures that the node >> where the pfn is allocated from is local. >> >> 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; >> } >> >> However it does not really check the entry to be a section mapping which it should. >> Returning pmd_sect(READ_ONCE(*pmdp)) is the right thing, which should have been the >> case from the beginning when vmemmap_check_pmd() was added. I guess because arm64's >> original vmemmap_populate() checked only for vmemmap_verify() as well. So probably >> this does not need a "Fixes: " tag. > > I did not say the patch is wrong, only that it wouldn't be needed unless > we have the other patch in this series. However, if we do apply the > other patch, we definitely need this change, so keeping them together > would make it easier to backport. Hi Catalin, Based on our current discussion on patchset #1, we will prohibit hugepages(vmemmap mapping) for all hotplugging sections...The flow: vmemmap_populate vmemmap_populate_hugepages vmemmap_check_pmd will *only* be called for non-early sections. Therefore, with patchset #1, I don't see the patch as essential.. Would it be acceptable if we do not backport this patch? Anshuman's suggestion seems reasonable to me and I separated the patch out: https://lore.kernel.org/lkml/20250102074047.674156-1-quic_zhenhuah@quicinc.com/ Please share your comments and correct me if I'm mistaken :) >