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 0F021C021A6 for ; Thu, 13 Feb 2025 07:46:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9A582280001; Thu, 13 Feb 2025 02:46:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 956956B0095; Thu, 13 Feb 2025 02:46:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 81D37280001; Thu, 13 Feb 2025 02:46:14 -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 63BD36B008C for ; Thu, 13 Feb 2025 02:46:14 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id E67C01207D4 for ; Thu, 13 Feb 2025 07:46:13 +0000 (UTC) X-FDA: 83114138226.18.ED83371 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by imf19.hostedemail.com (Postfix) with ESMTP id 7C5391A0002 for ; Thu, 13 Feb 2025 07:46:11 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=Lw3o8Wtt; spf=pass (imf19.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=1739432771; 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=Nbm7pMR3sppbaW6MivVssSNUZKFF+Yg1bC2W6Ym5u8c=; b=PCul0wRnsswgEUasbNf2hYDbjiMpAYoYPIJ0DKYcVB9yEzYfukmd8SdBVUN6Elpi/J6da5 ldFMg8hbAlF1XLaUe8TZhWAMT8rBWUcXowX+4A7T9h7s38mIM0qHWnaR7W/SircMWhh6m7 qqErVQ8Zrd65+W9bY4Y4Uorsue3AdSU= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=Lw3o8Wtt; spf=pass (imf19.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=1739432771; a=rsa-sha256; cv=none; b=EerLwruENb6/UbzISiK04Arw/hMnB0v1DKZ7rKUpyYb+YaFt8fCT+RvfK2spRJmL51jJJx itDvH+El/VbsVK1pneDXhu9higJnc72XQAo0XvGqyLbA1x/oz3JbYs9Od6vBGQItqluDqZ lWr5IF6qLEsSwzSAX2UUvNrgMdZ/5VM= Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51CIlBdn001335; Thu, 13 Feb 2025 07:46:02 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= Nbm7pMR3sppbaW6MivVssSNUZKFF+Yg1bC2W6Ym5u8c=; b=Lw3o8WtttHYwMIEc eR0749HKN1mOosx+2n65ajRX7+SP0M0JS2mS/1SJwCP+new4pXVbgyw0nTJTBUYO 84VvFZJlwnCUvLu3G5Q8WMto3pqD7i+H3d3i/Uf3uHO/rSzH2jf2DsOtx60aBD0s HgccnCr17KQfSNC7KhXrDYwTUgwjbcYflXram8et1Y0WQDztJMRMdejbP5yVnDMz OCA/AoOTJxjR03WIwARwKvZIOWJGez63NoEF9+rUrgoWRvAAoq3aLs3UpPXV4L6P qgXa0g8/dNE8mY/ROf8AiKMFkuGq8gW7/cww/4EL5ZXC7U9is2qFdwAYc+OR2udu NdbUgw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44rrnfu322-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2025 07:46:02 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 51D7k1nO029626 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2025 07:46:01 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; Wed, 12 Feb 2025 23:45:57 -0800 Message-ID: Date: Thu, 13 Feb 2025 15:45:47 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5] arm64: mm: Populate vmemmap/linear at the page level for hotplugged sections To: Catalin Marinas CC: , , , , , , , , , , , , , , References: <20250109093824.452925-1-quic_zhenhuah@quicinc.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: oD5n2ERUG7vEUbsd4pslOiDQ1za_FgFG X-Proofpoint-ORIG-GUID: oD5n2ERUG7vEUbsd4pslOiDQ1za_FgFG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-13_02,2025-02-11_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 bulkscore=0 malwarescore=0 mlxlogscore=859 lowpriorityscore=0 suspectscore=0 adultscore=0 mlxscore=0 spamscore=0 priorityscore=1501 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2501170000 definitions=main-2502130058 X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 7C5391A0002 X-Stat-Signature: 7ihmxmdjp84kb78dxuisksm3pjbt7ydx X-HE-Tag: 1739432771-30401 X-HE-Meta: U2FsdGVkX1+32vvSkQbCbAGKusVkmebhvu4FXriMRYXul7QGPe3LEfwhu4iB64+5H20xXW+zZs8pOwl7QB6wLS9LHTbwbmZaMNNTAdEvFmGQsNfF9SMQ/dPaYE+lg4X/RgPIw3Vi5E8Q9z9OzrJxARiH7rRLykxAd6r1QxITm5RUgaU14m1LSTKSiOdbuizJeMJzSgzkDW9N1+M5smugmXsJnRjk+pCbDNtgwd64DFuVK1iJDzr9sE4GL10GsRjjxFakx0bo2lGfzy29ZyFqOoawC/1EAM7uXmj6eRD+reIyx2o9NkXkKRb/jPpNeqcoeOQTNRmZ7ZdLF+J9lZGbcZvoHUvy0aHR0uvwdxWPoe79fAe9TdwNuWyG4y3fGZikoCqru9tsozrqGieM3uhJn1rKlo4vvCibc1i2O3XoobwgYKfFIhoUSp/kva69TjQOsotk0A7+nRLQEbTAfIQx94Ur0TXzh8tDOCdckiIOjMsGjMEZQEMPgV1w/Y+XMu3VGHy7GVPjy6kPRxODHCvqImJ629mgFTjwnZUZ8Tr5GQkhd8Pc7wZiW9djeT/Uk3Wg0iLZxXcN80cYZboLXDpntbMIXFY9NiLadwkdMjrzYj3LVRD3edXtFYhKEnH6BiayQU/BSkDy4CLpuDMDsELg2tH6BlZvpxcfTag0wGcymoFKKGERjBqyI9Qr5qRMfOOmzDGDfWduV3YVVZfAFgJox7ZIUAyFPpDFlFZcMltmbOrSC286VO0uaMj2m79uwgJ9i/t66k1MKpBVw85NA4SSnsl6cW3clhL6Txs8iBd+rV+mTIcb/ZtMfKCgKcmY8GK2T8LIIcLrHTj4HDtN1GcIfFhWa9/88yWhzNTJ6WbyxOPc9u13YuDQMI5hAvltgNQEMXHxffhes9k/iPlgx+zV30NDzLOMZFHoIBaHUXvCwtHsIS+BY4Q5hOtG7fEk2AlzM3Gy01ckoCipjueJpPa VjZUGKWT tF5fFVxwa4a85ktw2U1FxE+oPzGlGmh8Z8Ub7Wb65i/3lqzGewViTxVPHxcT6JklW22B357k5quaFM1fuwoCM+cs0aDVmNQH27sEe3mDlVVAQiZgcdScP7Nk3IU18QdOzLCsZp6yhbw7LQVFhUXbYNSO4fquNeU0wJqSr9ArQlk00nLYdpMyUcyJvScilRj2OvhK10sK+QMd1g4yVoBMyZVyMiahOpEgg4QPzc4Uw4NVnBdHPsR4P/JvMn1jYo0PCZcnun5JF/PnmncOLKg2IJA5I0+kkdEv+Xqjtpmu8ziysaZxH9dOWj/mZG7blStgbZfqC2A7ruwnj4Hjzfxqj7xrGlTkhste/XC3JtkqtrB5EU5gQnUINvOZ2zLiKfIvHjFURaVmlWetJyiwe3dtN6zafD1LO8Ja2fsWGh9YcoYEVxpKeii/Ip8bxZLnyhLdfXYBY 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/2/13 2:28, Catalin Marinas wrote: >> @@ -1339,9 +1349,27 @@ int arch_add_memory(int nid, u64 start, u64 size, >> struct mhp_params *params) >> { >> int ret, flags = NO_EXEC_MAPPINGS; >> + unsigned long start_pfn = PFN_DOWN(start); >> + struct mem_section *ms = __pfn_to_section(start_pfn); >> >> VM_BUG_ON(!mhp_range_allowed(start, size, true)); >> >> + /* should not be invoked by early section */ >> + WARN_ON(early_section(ms)); > I don't remember the discussion, do we still need this warning here if > the sections are not marked as early? I guess we can keep it if one does > an arch_add_memory() on an early section. > > I think I suggested to use a WARN_ON_ONCE(!present_section()) but I > completely forgot the memory hotplug code paths. Dear Catalin, The previous discussion can be found at https://lore.kernel.org/lkml/aedbbc4f-8f6c-46d8-a8d7-53103675a816@quicinc.com/, I highlighted the key points from conversation between me and Anshuman for your reference: " >> >> BTW, shall we remove the check for !early_section since arch_add_memory is only called during hotplugging case? Correct me please if I'm mistaken :) > > While this is true, still might be a good idea to keep the early_section() > check in place just to be extra careful here. Otherwise an WARN_ON() might > be needed. Make sense. I would like to add some comments and WARN_ON() if early_section(). " Regarding your suggestion, I believed it was intended for the vmemmap_populate() function ?(Discussion: https://lore.kernel.org/linux-mm/Z3_d59kp4CuHQp97@arm.com/), but as workflow below indicates: Hot plug: 1. section_activate -> vmemmap_populate 2. mark PRESENT In contrast, the early flow: 1. memblocks_present -> mark PRESENT 2. __populate_section_memmap -> vmemmap_populate Could this result in a false warning during hotplugging? I replied with the doubt in above link before but seems you missed :) Could you please share your thoughts if you have a different idea ? I will include your tags, correct capitalization nit and post one new version.