From patchwork Thu Jun 23 12:29:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aneesh Kumar K.V" X-Patchwork-Id: 12892320 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 C1CCFC43334 for ; Thu, 23 Jun 2022 12:29:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2AC748E014E; Thu, 23 Jun 2022 08:29:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 25B3C8E0144; Thu, 23 Jun 2022 08:29:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0FC9D8E014E; Thu, 23 Jun 2022 08:29:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id EF26E8E0144 for ; Thu, 23 Jun 2022 08:29:50 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id CC51A120562 for ; Thu, 23 Jun 2022 12:29:50 +0000 (UTC) X-FDA: 79609432140.20.66EA286 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf06.hostedemail.com (Postfix) with ESMTP id 6643C180012 for ; Thu, 23 Jun 2022 12:29:50 +0000 (UTC) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25NB9hFI020381; Thu, 23 Jun 2022 12:29:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=RGryCYURKDY8Qu4/Ymm4xXmR1+MO7CbnQzjjjZ8qSVI=; b=sUr+h9maMpx3xOVfxzWybmp5w/7X+4ePcYDurTJ02Rz3BL5ymqVXv9g2djPN1o8g+rcI PsV6hthGQJFh8+dump3+m5CYJC6xxW2LazR1VsEynX2sRriSdY2y9uEVZrApAxOom2co L9Ys+essJ0aVREUgIT7yqRq8QUrIxi8jcvmgSseN8io0RFdgCIrAzmsQX/T2GPNylLcG eFHcYwU7gh9kFa4QfpTqkWlJE6C/GpTXi65nxeVWwfTBA1iy7b7dSgSRuHrdn4doX+Le XYxtwafsRG2AX5+QbWf44JuYzzJetbv0lMkTxHzPFgqukfc6ZIczg4lZYIM2V4HhBoR2 9w== Received: from ppma02wdc.us.ibm.com (aa.5b.37a9.ip4.static.sl-reverse.com [169.55.91.170]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3gvgpwd1jr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jun 2022 12:29:39 +0000 Received: from pps.filterd (ppma02wdc.us.ibm.com [127.0.0.1]) by ppma02wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 25NCLZMn022980; Thu, 23 Jun 2022 12:29:38 GMT Received: from b01cxnp23034.gho.pok.ibm.com (b01cxnp23034.gho.pok.ibm.com [9.57.198.29]) by ppma02wdc.us.ibm.com with ESMTP id 3gs6bahfet-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jun 2022 12:29:38 +0000 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 25NCTckE32309702 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jun 2022 12:29:38 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E560B2805A; Thu, 23 Jun 2022 12:29:37 +0000 (GMT) Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5695428058; Thu, 23 Jun 2022 12:29:35 +0000 (GMT) Received: from skywalker.ibmuc.com (unknown [9.43.18.68]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP; Thu, 23 Jun 2022 12:29:35 +0000 (GMT) From: "Aneesh Kumar K.V" To: linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au Cc: linux-mm@kvack.org, Michal Hocko , "Aneesh Kumar K.V" , Kefeng Wang , Christophe Leroy Subject: [PATCH 1/3] powerpc/memhotplug: Add add_pages override for PPC Date: Thu, 23 Jun 2022 17:59:20 +0530 Message-Id: <20220623122922.640980-1-aneesh.kumar@linux.ibm.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: UKWEnAgRl5uWR42veB9mcyKmk0-SNvJA X-Proofpoint-GUID: UKWEnAgRl5uWR42veB9mcyKmk0-SNvJA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-06-23_05,2022-06-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 adultscore=0 spamscore=0 clxscore=1011 suspectscore=0 malwarescore=0 mlxscore=0 bulkscore=0 impostorscore=0 phishscore=0 lowpriorityscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206230049 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655987390; a=rsa-sha256; cv=none; b=MHSWyLL9sFpnfT9dBUCrNVvDoAYlHOHqbpFWK3vtZONc2RR2AH6gheV35qb87hiKOIo5I3 Axn1VKanvZqIy3zaGGEiVFuvznONcjXqTmrP16ggxOWkjFrEe0DSRRCT6u1HoitR4JkcoI BYFI5H2GrXcm0wv5/p+QrIfk9iT4EY0= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=sUr+h9ma; spf=pass (imf06.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655987390; 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:references:dkim-signature; bh=RGryCYURKDY8Qu4/Ymm4xXmR1+MO7CbnQzjjjZ8qSVI=; b=4wb8Cobo5HK/p//z5X6b3T68mzDWmIlXWQCtHGYHisPdoLZoxBcLls9qdRGRXWH5Fh2RcU hel5EybzDdP0Rig1edo4gcabcWeXp6xo8nBH3niqDMpv6VXFnzTZN3w36eqRhOfy28b8x1 owZ46Ii7CJbS7v4p/yS6H4qXHGzIV7s= Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=sUr+h9ma; spf=pass (imf06.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 6643C180012 X-Stat-Signature: pjoqbwunz3yw4c3x8awm5yangq84hu6s X-Rspam-User: X-HE-Tag: 1655987390-613292 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: With commit ffa0b64e3be5 ("powerpc: Fix virt_addr_valid() for 64-bit Book3E & 32-bit") the kernel now validate the addr against high_memory value. This results in the below BUG_ON with dax pfns. [ 635.798741][T26531] kernel BUG at mm/page_alloc.c:5521! 1:mon> e cpu 0x1: Vector: 700 (Program Check) at [c000000007287630] pc: c00000000055ed48: free_pages.part.0+0x48/0x110 lr: c00000000053ca70: tlb_finish_mmu+0x80/0xd0 sp: c0000000072878d0 msr: 800000000282b033 current = 0xc00000000afabe00 paca = 0xc00000037ffff300 irqmask: 0x03 irq_happened: 0x05 pid = 26531, comm = 50-landscape-sy kernel BUG at :5521! Linux version 5.19.0-rc3-14659-g4ec05be7c2e1 (kvaneesh@ltc-boston8) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #625 SMP Thu Jun 23 00:35:43 CDT 2022 1:mon> t [link register ] c00000000053ca70 tlb_finish_mmu+0x80/0xd0 [c0000000072878d0] c00000000053ca54 tlb_finish_mmu+0x64/0xd0 (unreliable) [c000000007287900] c000000000539424 exit_mmap+0xe4/0x2a0 [c0000000072879e0] c00000000019fc1c mmput+0xcc/0x210 [c000000007287a20] c000000000629230 begin_new_exec+0x5e0/0xf40 [c000000007287ae0] c00000000070b3cc load_elf_binary+0x3ac/0x1e00 [c000000007287c10] c000000000627af0 bprm_execve+0x3b0/0xaf0 [c000000007287cd0] c000000000628414 do_execveat_common.isra.0+0x1e4/0x310 [c000000007287d80] c00000000062858c sys_execve+0x4c/0x60 [c000000007287db0] c00000000002c1b0 system_call_exception+0x160/0x2c0 [c000000007287e10] c00000000000c53c system_call_common+0xec/0x250 The fix is to make sure we update high_memory on memory hotplug. This is similar to what x86 does in commit 3072e413e305 ("mm/memory_hotplug: introduce add_pages") Fixes: ffa0b64e3be5 ("powerpc: Fix virt_addr_valid() for 64-bit Book3E & 32-bit") Cc: Kefeng Wang Cc: Christophe Leroy Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/Kconfig | 1 + arch/powerpc/mm/mem.c | 32 +++++++++++++++++++++++++++++++- arch/x86/Kconfig | 5 +---- mm/Kconfig | 3 +++ 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index c2ce2e60c8f0..20c1f8e26c96 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -112,6 +112,7 @@ config PPC select ARCH_DISABLE_KASAN_INLINE if PPC_RADIX_MMU select ARCH_ENABLE_MEMORY_HOTPLUG select ARCH_ENABLE_MEMORY_HOTREMOVE + select ARCH_HAS_ADD_PAGES if ARCH_ENABLE_MEMORY_HOTPLUG select ARCH_HAS_COPY_MC if PPC64 select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DEBUG_VIRTUAL diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c index 52b77684acda..2a63920c369d 100644 --- a/arch/powerpc/mm/mem.c +++ b/arch/powerpc/mm/mem.c @@ -105,6 +105,36 @@ void __ref arch_remove_linear_mapping(u64 start, u64 size) vm_unmap_aliases(); } +/* + * After memory hotplug the variables max_pfn, max_low_pfn and high_memory need + * updating. + */ +static void update_end_of_memory_vars(u64 start, u64 size) +{ + unsigned long end_pfn = PFN_UP(start + size); + + if (end_pfn > max_pfn) { + max_pfn = end_pfn; + max_low_pfn = end_pfn; + high_memory = (void *)__va(max_pfn * PAGE_SIZE - 1) + 1; + } +} + +int __ref add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages, + struct mhp_params *params) +{ + int ret; + + ret = __add_pages(nid, start_pfn, nr_pages, params); + WARN_ON_ONCE(ret); + + /* update max_pfn, max_low_pfn and high_memory */ + update_end_of_memory_vars(start_pfn << PAGE_SHIFT, + nr_pages << PAGE_SHIFT); + + return ret; +} + int __ref arch_add_memory(int nid, u64 start, u64 size, struct mhp_params *params) { @@ -115,7 +145,7 @@ int __ref arch_add_memory(int nid, u64 start, u64 size, rc = arch_create_linear_mapping(nid, start, size, params); if (rc) return rc; - rc = __add_pages(nid, start_pfn, nr_pages, params); + rc = add_pages(nid, start_pfn, nr_pages, params); if (rc) arch_remove_linear_mapping(start, size); return rc; diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index be0b95e51df6..151ddb96ae46 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -68,6 +68,7 @@ config X86 select ARCH_ENABLE_SPLIT_PMD_PTLOCK if (PGTABLE_LEVELS > 2) && (X86_64 || X86_PAE) select ARCH_ENABLE_THP_MIGRATION if X86_64 && TRANSPARENT_HUGEPAGE select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI + select ARCH_HAS_ADD_PAGES if ARCH_ENABLE_MEMORY_HOTPLUG select ARCH_HAS_CACHE_LINE_SIZE select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DEBUG_VIRTUAL @@ -2453,10 +2454,6 @@ source "kernel/livepatch/Kconfig" endmenu -config ARCH_HAS_ADD_PAGES - def_bool y - depends on ARCH_ENABLE_MEMORY_HOTPLUG - config ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE def_bool y diff --git a/mm/Kconfig b/mm/Kconfig index 169e64192e48..af4e3f9a3019 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -475,6 +475,9 @@ config EXCLUSIVE_SYSTEM_RAM config HAVE_BOOTMEM_INFO_NODE def_bool n +config ARCH_HAS_ADD_PAGES + bool + config ARCH_ENABLE_MEMORY_HOTPLUG bool From patchwork Thu Jun 23 12:29:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aneesh Kumar K.V" X-Patchwork-Id: 12892319 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 5E251C43334 for ; Thu, 23 Jun 2022 12:29:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D5B828E014D; Thu, 23 Jun 2022 08:29:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D09988E0144; Thu, 23 Jun 2022 08:29:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BD1C28E014D; Thu, 23 Jun 2022 08:29:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id A87CE8E0144 for ; Thu, 23 Jun 2022 08:29:46 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 6DF28207DC for ; Thu, 23 Jun 2022 12:29:46 +0000 (UTC) X-FDA: 79609431972.29.E3E8794 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf16.hostedemail.com (Postfix) with ESMTP id EA73A180033 for ; Thu, 23 Jun 2022 12:29:45 +0000 (UTC) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25NAQYEA027943; Thu, 23 Jun 2022 12:29:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=Qj3YNZEYqlTD/obmc7ResKquiY/z5yJ+P0dEzb2i7Cg=; b=q1gl5buXMVaxxsHqdY3Ym9rlpLP6rgMoOeYXApIXYZ9IODId3HlkoHZCgct6ADyfo014 lOvH6zGHcn3JX48ajmlV1PsAfBiMSnunIc8FDtJgJxbvIxJys88zvUpzb7a5bdW2R1Kc rPy9qX8aGZiMv0KF2HgrUEQ8tCsi2PgN0DQtkBpHJu9FtG0riUjCc7spKQIt9dJZkY0+ ve0NTK++q8k5/PK/3Q35IKvwD5WzzkYdc1p6UwVSNs9/7PdBt9VVJUAI64QTHdRdaCGD O0SWbTpzeBgBLrjlvznsl3ywAuPHwoHogf0WdANg5UrLR0K+Uyvdv1ZiBZXwYQ/IbES9 0Q== Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3gvmfhpqxp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jun 2022 12:29:42 +0000 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 25NCKT23028658; Thu, 23 Jun 2022 12:29:41 GMT Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com [9.57.198.25]) by ppma01dal.us.ibm.com with ESMTP id 3guk92mjub-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jun 2022 12:29:41 +0000 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 25NCTelF39911920 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jun 2022 12:29:40 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8E3AD2805E; Thu, 23 Jun 2022 12:29:40 +0000 (GMT) Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7B57728059; Thu, 23 Jun 2022 12:29:38 +0000 (GMT) Received: from skywalker.ibmuc.com (unknown [9.43.18.68]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP; Thu, 23 Jun 2022 12:29:38 +0000 (GMT) From: "Aneesh Kumar K.V" To: linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au Cc: linux-mm@kvack.org, Michal Hocko , "Aneesh Kumar K.V" Subject: [PATCH 2/3] powerpc/mm: Update max/min_low_pfn in the same function Date: Thu, 23 Jun 2022 17:59:21 +0530 Message-Id: <20220623122922.640980-2-aneesh.kumar@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623122922.640980-1-aneesh.kumar@linux.ibm.com> References: <20220623122922.640980-1-aneesh.kumar@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: W38rCs6DVUqOFs3BtnxNiVpGY2-S6j3Z X-Proofpoint-ORIG-GUID: W38rCs6DVUqOFs3BtnxNiVpGY2-S6j3Z X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-06-23_05,2022-06-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 clxscore=1015 priorityscore=1501 spamscore=0 mlxlogscore=935 suspectscore=0 lowpriorityscore=0 mlxscore=0 impostorscore=0 malwarescore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206230049 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655987386; a=rsa-sha256; cv=none; b=PSD3jRLR9sjNIWx+RtHT8PdREo40GMq7Kw1JWsWkrI6D1k1xnJi9aLjZwPFHq+SQlUHxCR h19Vr3dkTLu3nQHmPCZzuTkKs/dE3pnO6em0EzEgvF5MN1ynUdF10CUuxiTuhXSsV6yyBy PhfhCColIWB76o5cszur/ETlsj2qLAo= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=q1gl5buX; spf=pass (imf16.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655987386; 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:dkim-signature; bh=Qj3YNZEYqlTD/obmc7ResKquiY/z5yJ+P0dEzb2i7Cg=; b=3FI/hsS6lQNsNBI57D/8tp+xLXKxUZpRUXG8UsoP0T/htVNBh+FVIBoqoDjbJwmoZmYGw0 9TeUaEcIgmH+9RK5XIM7ZoQqyQAgz08UgFEoHCoS/QJ7ewjbDQ61docEv1rQj/9DNflAcd DPH3D0UWS4to41Xchy+j1Rooh4QAWg4= X-Rspamd-Queue-Id: EA73A180033 X-Rspam-User: Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=q1gl5buX; spf=pass (imf16.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com X-Rspamd-Server: rspam08 X-Stat-Signature: yuadm1szs6e848pn36g7bwu3h8uumw38 X-HE-Tag: 1655987385-348561 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: For both CONFIG_NUMA enabled/disabled use mem_topology_setup to update max/min_low_pfn. This also add min_low_pfn update to CONFIG_NUMA which was initialized to zero before. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/numa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index 0801b2ce9b7d..b44ce71917d7 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c @@ -1160,6 +1160,9 @@ void __init mem_topology_setup(void) { int cpu; + max_low_pfn = max_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT; + min_low_pfn = MEMORY_START >> PAGE_SHIFT; + /* * Linux/mm assumes node 0 to be online at boot. However this is not * true on PowerPC, where node 0 is similar to any other node, it @@ -1204,9 +1207,6 @@ void __init initmem_init(void) { int nid; - max_low_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT; - max_pfn = max_low_pfn; - memblock_dump_all(); for_each_online_node(nid) { From patchwork Thu Jun 23 12:29:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aneesh Kumar K.V" X-Patchwork-Id: 12892321 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 D1768C43334 for ; Thu, 23 Jun 2022 12:30:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5BA558E014F; Thu, 23 Jun 2022 08:30:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 568838E0144; Thu, 23 Jun 2022 08:30:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 430968E014F; Thu, 23 Jun 2022 08:30:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 2F8A88E0144 for ; Thu, 23 Jun 2022 08:30:01 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 061FF2094F for ; Thu, 23 Jun 2022 12:30:01 +0000 (UTC) X-FDA: 79609432602.28.0B48CF1 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf19.hostedemail.com (Postfix) with ESMTP id 645481A00B0 for ; Thu, 23 Jun 2022 12:30:00 +0000 (UTC) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25NBogOS003688; Thu, 23 Jun 2022 12:29:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=I0XDoqGAyD9wFQlqMc8lxz6HDUp5LOCjaeVn1njh074=; b=otjtix2pSjz9u7VmbEFDcM8gMhYNWciWNnmg21J9JA04jPwbH43QSwjpSKwhPPGdjMTC ipXE8k1FTHGKBzn37KqZ76onVX4DJdZQ49uZRA00ZYfghTHdkkOIrBrPGqJQjs/fP285 4Qre1wT74JUKMsWTQhMpWMiP708WE5yla+40+zbVFEK4GBDysuMeoWfAaznJt/LU8Od8 gLytjCV9Zo6J/+iALdyyNYcYn7iD63fRD2AVS864w7ApQZ/pEo9tUZuBJGNDXn9OsUax CMCKKzEpjUvh/3rwRbNlyRdwNxX5ZBrzCcegDBbm5t4XKb7edzwoTcJBmT2f2Lpw+VLa Pg== Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3gvqnj1327-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jun 2022 12:29:45 +0000 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 25NCKcXa003896; Thu, 23 Jun 2022 12:29:44 GMT Received: from b01cxnp23032.gho.pok.ibm.com (b01cxnp23032.gho.pok.ibm.com [9.57.198.27]) by ppma01wdc.us.ibm.com with ESMTP id 3gv5cjwxtr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jun 2022 12:29:44 +0000 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 25NCThKB18415966 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jun 2022 12:29:43 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BADF628058; Thu, 23 Jun 2022 12:29:43 +0000 (GMT) Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2393F28059; Thu, 23 Jun 2022 12:29:41 +0000 (GMT) Received: from skywalker.ibmuc.com (unknown [9.43.18.68]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP; Thu, 23 Jun 2022 12:29:40 +0000 (GMT) From: "Aneesh Kumar K.V" To: linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au Cc: linux-mm@kvack.org, Michal Hocko , "Aneesh Kumar K.V" , Kefeng Wang , Christophe Leroy Subject: [PATCH 3/3] powerpc/mm: Use VMALLOC_START to validate addr Date: Thu, 23 Jun 2022 17:59:22 +0530 Message-Id: <20220623122922.640980-3-aneesh.kumar@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623122922.640980-1-aneesh.kumar@linux.ibm.com> References: <20220623122922.640980-1-aneesh.kumar@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: lqFXGDskXzs26GTPeZJKCdYL15mWLfZt X-Proofpoint-ORIG-GUID: lqFXGDskXzs26GTPeZJKCdYL15mWLfZt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-06-23_05,2022-06-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 bulkscore=0 suspectscore=0 lowpriorityscore=0 adultscore=0 malwarescore=0 spamscore=0 phishscore=0 mlxscore=0 mlxlogscore=870 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206230049 ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=otjtix2p; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf19.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655987400; 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:dkim-signature; bh=I0XDoqGAyD9wFQlqMc8lxz6HDUp5LOCjaeVn1njh074=; b=FHOPI75Ig2XJ95fduQ5qn95qeHcrWk3UihDi/VVdP1PS4a7l7AOSeD/rienB304z/ajML5 PI9TYvdBEY1KMZaxWIYJXBi4xOpBK5ZYKDxKkG2R7FXPWQGz6UUR5CJ5JrEJqlGtX9NuKP OXAY7n71TdSoF5R4i/kyO5MrcqDhAB4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655987400; a=rsa-sha256; cv=none; b=uo11XYX3sL1pyopX1LJcfty0bNU4Cx/pFmZOHxlGi31HInUTYTjbG82J6iMnMdSTlIuPJ1 LDP9rnhhxJTATZsMlS9hHMEiHTTIGlUzaGHJM4dzsLRoriNzPMVOYkACDRpQz8t5erwL4b o4zrY5kdlI+S79lNIGkZaI2bLwj3cAk= X-Rspam-User: Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=otjtix2p; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf19.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com X-Stat-Signature: 1qiqjigo3rxzfoh3fahuppm7py5o4411 X-Rspamd-Queue-Id: 645481A00B0 X-Rspamd-Server: rspam12 X-HE-Tag: 1655987400-499738 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: Instead of high_memory use VMALLOC_START to validate that the address is not in the vmalloc range. Cc: Kefeng Wang Cc: Christophe Leroy Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/page.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h index e5f75c70eda8..256cad69e42e 100644 --- a/arch/powerpc/include/asm/page.h +++ b/arch/powerpc/include/asm/page.h @@ -134,7 +134,7 @@ static inline bool pfn_valid(unsigned long pfn) #define virt_addr_valid(vaddr) ({ \ unsigned long _addr = (unsigned long)vaddr; \ - _addr >= PAGE_OFFSET && _addr < (unsigned long)high_memory && \ + _addr >= PAGE_OFFSET && _addr < (unsigned long)VMALLOC_START && \ pfn_valid(virt_to_pfn(_addr)); \ })