Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1039242ybt; Wed, 8 Jul 2020 19:11:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOSXI8rIgu46d9ewn3Tm1wl2QZ0Es5Kl4/wav+I6h0kx+rNuLZBwqoKPcxLM4LpQILiX22 X-Received: by 2002:a05:6402:363:: with SMTP id s3mr57371142edw.238.1594260704846; Wed, 08 Jul 2020 19:11:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594260704; cv=none; d=google.com; s=arc-20160816; b=gwbzQmf6tRLCsBOFpFbNi0rTBRU9gUAsHr3GaeO7jzxO/1q7p4+h+tTwmKah1e13/D JO6+tn9Wj7IMCfqZOIiHW1uVC0Oa8YhEVjqRcDXcGvoF8vSrRJM8UzfNZ62Z1vTGmGlw X1LC3pD6bO2Z46RUHD4caB06uNEWVIoWo6qBihUBq0FMOQbv9HqHfdh926cTDKM6DFGf LCl29gOBDSrsQ4gbQoKUNCOMu1HjacWbpM3McnGm1qtPkvvNDchwZNFkU5iSdXTD8acv f6YVenG4DlYz9JKowgFV0sL2rIWV9Hl3FT9t0cOEzCUlxnJS3HNYGMfefgM4sDPw9CVH 07qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=Gs5Ba9dUSvo84QuQgxXKV8FAubhHs6wYCfy4ci8WVdc=; b=e7/+96xi4nSCQkBcc402id9Xoei7HT1Mrg/cCO6DDCoRWFTiPINGH8Y8mIKDE3NDPW daWSsBaumQLtDoIm69PpUMgSySPWLq9H55+nxIZlYm+kpy0JVyd2yZrCiYPiyk/vUB37 WlXxJhA2bUbkklBd10O1KObftSkcjAMl+8DmYb3C+v6UtxGW4Dj/GLHOSx7HIQRwW3Fa OqMtAIQlnwCHh8nmWeQ1cjfj7O514M4O5wDV+3tBdOgCDrFb2D4NlO3RBkzAtICCHdv/ FYD4Mki2YA66eXCHXugX4geuyYXcvyqiBxTtFGqgEgzsi01dL+PSmG+D8Cj5JA+xFeLA urAw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n23si965055ejx.656.2020.07.08.19.11.15; Wed, 08 Jul 2020 19:11:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726336AbgGICHr (ORCPT + 99 others); Wed, 8 Jul 2020 22:07:47 -0400 Received: from foss.arm.com ([217.140.110.172]:52698 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726072AbgGICHr (ORCPT ); Wed, 8 Jul 2020 22:07:47 -0400 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 501621396; Wed, 8 Jul 2020 19:07:46 -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 B5F703F887; Wed, 8 Jul 2020 19:07:36 -0700 (PDT) From: Jia He To: Catalin Marinas , Will Deacon , Tony Luck , Fenghua Yu , Yoshinori Sato , Rich Felker , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , David Hildenbrand Cc: x86@kernel.org, "H. Peter Anvin" , Dan Williams , Vishal Verma , Dave Jiang , Andrew Morton , Baoquan He , Chuhong Yuan , Mike Rapoport , Logan Gunthorpe , Masahiro Yamada , Michal Hocko , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, linux-nvdimm@lists.01.org, linux-mm@kvack.org, Jonathan Cameron , Kaly Xin , Jia He , stable@vger.kernel.org Subject: [PATCH v3 6/6] mm/memory_hotplug: fix unpaired mem_hotplug_begin/done Date: Thu, 9 Jul 2020 10:06:29 +0800 Message-Id: <20200709020629.91671-7-justin.he@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200709020629.91671-1-justin.he@arm.com> References: <20200709020629.91671-1-justin.he@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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] Fixes: f1037ec0cc8a ("mm/memory_hotplug: fix remove_memory() lockdep splat") Cc: stable@vger.kernel.org # v5.6+ Signed-off-by: Jia He Reviewed-by: David Hildenbrand Acked-by: Michal Hocko Acked-by: Dan Williams --- mm/memory_hotplug.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index b49ab743d914..3e0645387daf 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1752,7 +1752,7 @@ static int __ref try_remove_memory(int nid, u64 start, u64 size) */ rc = walk_memory_blocks(start, size, NULL, check_memblock_offlined_cb); if (rc) - goto done; + return rc; /* remove memmap entry */ firmware_map_remove(start, start + size, "System RAM"); @@ -1776,9 +1776,8 @@ static int __ref try_remove_memory(int nid, u64 start, u64 size) try_offline_node(nid); -done: mem_hotplug_done(); - return rc; + return 0; } /** -- 2.17.1