From patchwork Mon Jul 6 01:19:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia He X-Patchwork-Id: 11644797 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0A5AC739 for ; Mon, 6 Jul 2020 01:20:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CC18C20715 for ; Mon, 6 Jul 2020 01:20:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CC18C20715 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 00CEC6B0005; Sun, 5 Jul 2020 21:20:09 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id F01B36B0006; Sun, 5 Jul 2020 21:20:08 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DECAF6B0007; Sun, 5 Jul 2020 21:20:08 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0095.hostedemail.com [216.40.44.95]) by kanga.kvack.org (Postfix) with ESMTP id C8ABD6B0005 for ; Sun, 5 Jul 2020 21:20:08 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 8AFB42C8F for ; Mon, 6 Jul 2020 01:20:08 +0000 (UTC) X-FDA: 77005894896.28.knee73_120af8026ea7 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id 655ED6C2C for ; Mon, 6 Jul 2020 01:20:08 +0000 (UTC) X-Spam-Summary: 1,0,0,58cafa4b591c4178,d41d8cd98f00b204,justin.he@arm.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1261:1345:1359:1437:1534:1541:1711:1730:1747:1777:1792:2393:2559:2562:2693:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3870:3871:3872:4250:4321:4361:5007:6261:7903:8634:10004:11026:11473:11658:11914:12296:12297:12438:12555:12679:12895:12986:13069:13311:13357:14181:14384:14394:14721:21063:21080:21451:21627:21990:30054:30080,0,RBL:217.140.110.172:@arm.com:.lbl8.mailshell.net-64.100.201.201 62.2.0.100;04y85qqje9gqb4sttnquyo4s8y9bnyc373z1mr9mpmaxeqw18f5xn7aqugtz68t.nbcbggem7o3j5eum4g9ti39kmstz9bid4gbo4xoxcogi99id8zocppw1sjwpwsd.o-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: knee73_120af8026ea7 X-Filterd-Recvd-Size: 2445 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf15.hostedemail.com (Postfix) with ESMTP for ; Mon, 6 Jul 2020 01:20:08 +0000 (UTC) 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 76057C0A; Sun, 5 Jul 2020 18:20:07 -0700 (PDT) Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com [10.169.212.213]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 111313F718; Sun, 5 Jul 2020 18:20:03 -0700 (PDT) From: Jia He To: Catalin Marinas , Will Deacon Cc: Andrew Morton , Mike Rapoport , Baoquan He , Chuhong Yuan , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Kaly Xin , Jia He Subject: [PATCH 1/3] arm64/numa: set numa_off to false when numa node is fake Date: Mon, 6 Jul 2020 09:19:45 +0800 Message-Id: <20200706011947.184166-2-justin.he@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200706011947.184166-1-justin.he@arm.com> References: <20200706011947.184166-1-justin.he@arm.com> X-Rspamd-Queue-Id: 655ED6C2C X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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: Previously, numa_off is set to true unconditionally in dummy_numa_init(), even if there is a fake numa node. But acpi will translate node id to NUMA_NO_NODE(-1) in acpi_map_pxm_to_node() because it regards numa_off as turning off the numa node. Without this patch, pmem can't be probed as a RAM device on arm64 if SRAT table isn't present. $ndctl create-namespace -fe namespace0.0 --mode=devdax --map=dev -s 1g -a 64K kmem dax0.0: rejecting DAX region [mem 0x240400000-0x2bfffffff] with invalid node: -1 kmem: probe of dax0.0 failed with error -22 This fixes it by setting numa_off to false. Signed-off-by: Jia He --- arch/arm64/mm/numa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c index aafcee3e3f7e..7689986020d9 100644 --- a/arch/arm64/mm/numa.c +++ b/arch/arm64/mm/numa.c @@ -440,7 +440,8 @@ static int __init dummy_numa_init(void) return ret; } - numa_off = true; + /* force numa_off to be false since we have a fake numa node here */ + numa_off = false; return 0; } From patchwork Mon Jul 6 01:19:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia He X-Patchwork-Id: 11644799 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 03EC6739 for ; Mon, 6 Jul 2020 01:20:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CF8052074F for ; Mon, 6 Jul 2020 01:20:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CF8052074F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1452F6B0006; Sun, 5 Jul 2020 21:20:13 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 11C486B0007; Sun, 5 Jul 2020 21:20:13 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0321A6B0008; Sun, 5 Jul 2020 21:20:12 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0167.hostedemail.com [216.40.44.167]) by kanga.kvack.org (Postfix) with ESMTP id E35606B0006 for ; Sun, 5 Jul 2020 21:20:12 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 98833180AD801 for ; Mon, 6 Jul 2020 01:20:12 +0000 (UTC) X-FDA: 77005895064.27.twig88_17021b826ea7 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 752243D668 for ; Mon, 6 Jul 2020 01:20:12 +0000 (UTC) X-Spam-Summary: 1,0,0,048302f9e2c79a27,d41d8cd98f00b204,justin.he@arm.com,,RULES_HIT:41:355:379:541:800:960:968:973:988:989:1260:1261:1345:1359:1437:1534:1541:1711:1730:1747:1777:1792:2393:2559:2562:2693:3138:3139:3140:3141:3142:3352:3865:3866:3867:3870:3871:3872:4321:5007:6119:6261:7903:8634:8660:10004:11026:11658:11914:12043:12296:12297:12438:12555:12679:12895:13069:13148:13230:13311:13357:13972:14096:14181:14384:14394:14721:21080:21627:21939:21987:21990:30012:30054:30056,0,RBL:217.140.110.172:@arm.com:.lbl8.mailshell.net-64.100.201.201 62.2.0.100;04yryy8oi16u1im7fqb4z73scefngyckzdnt6uyt5xsyjxyexmaqxhqa88rqhw6.pke766k5q11x99mny6gy7dmgx3178b5isaerjqopq68fmhs57zj53gpbhpbhgy4.1-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: twig88_17021b826ea7 X-Filterd-Recvd-Size: 2894 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Mon, 6 Jul 2020 01:20:12 +0000 (UTC) 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 58B1F101E; Sun, 5 Jul 2020 18:20:11 -0700 (PDT) Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com [10.169.212.213]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id F1BFB3F718; Sun, 5 Jul 2020 18:20:07 -0700 (PDT) From: Jia He To: Catalin Marinas , Will Deacon Cc: Andrew Morton , Mike Rapoport , Baoquan He , Chuhong Yuan , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Kaly Xin , Jia He Subject: [PATCH 2/3] mm/memory_hotplug: harden try_offline_node against bogus nid Date: Mon, 6 Jul 2020 09:19:46 +0800 Message-Id: <20200706011947.184166-3-justin.he@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200706011947.184166-1-justin.he@arm.com> References: <20200706011947.184166-1-justin.he@arm.com> X-Rspamd-Queue-Id: 752243D668 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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: When testing the remove_memory path of dax pmem, there will be a panic with call trace: try_remove_memory+0x84/0x170 remove_memory+0x38/0x58 dev_dax_kmem_remove+0x3c/0x84 [kmem] device_release_driver_internal+0xfc/0x1c8 device_release_driver+0x28/0x38 bus_remove_device+0xd4/0x158 device_del+0x160/0x3a0 unregister_dev_dax+0x30/0x68 devm_action_release+0x20/0x30 release_nodes+0x150/0x240 devres_release_all+0x6c/0x1d0 device_release_driver_internal+0x10c/0x1c8 driver_detach+0xac/0x170 bus_remove_driver+0x64/0x130 driver_unregister+0x34/0x60 dax_pmem_exit+0x14/0xffc4 [dax_pmem] __arm64_sys_delete_module+0x18c/0x2d0 el0_svc_common.constprop.2+0x78/0x168 do_el0_svc+0x34/0xa0 el0_sync_handler+0xe0/0x188 el0_sync+0x164/0x180 It is caused by the bogus nid (-1). Although the root cause is pmem dax translates from pxm to node_id incorrectly due to numa_off, it is worth hardening the codes in try_offline_node(), quiting if !pgdat. Signed-off-by: Jia He --- mm/memory_hotplug.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index da374cd3d45b..e1e290577b45 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1680,6 +1680,9 @@ void try_offline_node(int nid) pg_data_t *pgdat = NODE_DATA(nid); int rc; + if (WARN_ON(!pgdat)) + return; + /* * If the node still spans pages (especially ZONE_DEVICE), don't * offline it. A node spans memory after move_pfn_range_to_zone(), From patchwork Mon Jul 6 01:19:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia He X-Patchwork-Id: 11644801 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AC073618 for ; Mon, 6 Jul 2020 01:20:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 839802074F for ; Mon, 6 Jul 2020 01:20:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 839802074F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 95C6B6B0007; Sun, 5 Jul 2020 21:20:16 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 931C06B0008; Sun, 5 Jul 2020 21:20:16 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 848E76B000A; Sun, 5 Jul 2020 21:20:16 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0081.hostedemail.com [216.40.44.81]) by kanga.kvack.org (Postfix) with ESMTP id 6DEB86B0007 for ; Sun, 5 Jul 2020 21:20:16 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 37121181AC9CC for ; Mon, 6 Jul 2020 01:20:16 +0000 (UTC) X-FDA: 77005895232.29.knot72_141854b26ea7 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin29.hostedemail.com (Postfix) with ESMTP id 1632B18086E2B for ; Mon, 6 Jul 2020 01:20:16 +0000 (UTC) X-Spam-Summary: 1,0,0,fe9327b7348ed538,d41d8cd98f00b204,justin.he@arm.com,,RULES_HIT:41:355:379:541:800:960:968:973:988:989:1260:1261:1345:1359:1437:1534:1541:1711:1730:1747:1777:1792:2194:2199:2393:2559:2562:2741:3138:3139:3140:3141:3142:3352:3865:3866:3870:3871:3872:3874:4321:5007:6261:7903:8603:8634:8660:10004:11026:11658:11914:12043:12114:12297:12438:12555:12679:12895:12986:13069:13148:13161:13229:13230:13311:13357:13972:14181:14384:14394:14721:21080:21627:21939:21987:21990:30054,0,RBL:217.140.110.172:@arm.com:.lbl8.mailshell.net-64.100.201.201 62.2.0.100;04ygq3xbrez5tppe6zrnbr6gamxrzoc9c1x514efy8fkuq3ax36einwr4t56q7h.s3ubotbrzrdt675bsomttsq3ehdzkgzaozakuiexd7c7s3mx7t658k5q3jcsruz.o-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: knot72_141854b26ea7 X-Filterd-Recvd-Size: 2628 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Mon, 6 Jul 2020 01:20:15 +0000 (UTC) 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 45B061042; Sun, 5 Jul 2020 18:20:15 -0700 (PDT) Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com [10.169.212.213]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D5CE53F718; Sun, 5 Jul 2020 18:20:11 -0700 (PDT) From: Jia He To: Catalin Marinas , Will Deacon Cc: Andrew Morton , Mike Rapoport , Baoquan He , Chuhong Yuan , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Kaly Xin , Jia He Subject: [PATCH 3/3] mm/memory_hotplug: fix unpaired mem_hotplug_begin/done Date: Mon, 6 Jul 2020 09:19:47 +0800 Message-Id: <20200706011947.184166-4-justin.he@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200706011947.184166-1-justin.he@arm.com> References: <20200706011947.184166-1-justin.he@arm.com> X-Rspamd-Queue-Id: 1632B18086E2B X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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: When check_memblock_offlined_cb() returns failed rc(e.g. the memblock is online at that time), mem_hotplug_begin/done is unpaired in such case. Therefore a warning: Call Trace: percpu_up_write+0x33/0x40 try_remove_memory+0x66/0x120 ? _cond_resched+0x19/0x30 remove_memory+0x2b/0x40 dev_dax_kmem_remove+0x36/0x72 [kmem] device_release_driver_internal+0xf0/0x1c0 device_release_driver+0x12/0x20 bus_remove_device+0xe1/0x150 device_del+0x17b/0x3e0 unregister_dev_dax+0x29/0x60 devm_action_release+0x15/0x20 release_nodes+0x19a/0x1e0 devres_release_all+0x3f/0x50 device_release_driver_internal+0x100/0x1c0 driver_detach+0x4c/0x8f bus_remove_driver+0x5c/0xd0 driver_unregister+0x31/0x50 dax_pmem_exit+0x10/0xfe0 [dax_pmem] This fixes it by moving mem_hotplug_done ahead of "done" Signed-off-by: Jia He Acked-by: Dan Williams --- mm/memory_hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index e1e290577b45..86b36714342b 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1769,8 +1769,8 @@ static int __ref try_remove_memory(int nid, u64 start, u64 size) try_offline_node(nid); -done: mem_hotplug_done(); +done: return rc; }