From patchwork Thu Aug 20 09:18:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 265266 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B36FC433DF for ; Thu, 20 Aug 2020 13:50:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E3A95208DB for ; Thu, 20 Aug 2020 13:50:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597931402; bh=60+DBkJWt3XI2uQV883o7GcZFr+YWqgW+hXSwr9d2BA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=A0ZtoJrMJJwf6EmOSEZzeyx/HjtpQO14YokNHJDW1wvJ2b96m1Nbvys38KQseh+sT ZqOsDGBtJ7Pm3eXuJlTbs/XK8u9STUe20TifjR/YS8brLE7/IxVRO1DJik19/VDRwR CT8eUuiY+zKExQtgNTAoFBbMRse76DT0ZXboPHZk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729309AbgHTNtr (ORCPT ); Thu, 20 Aug 2020 09:49:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:37100 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727986AbgHTJ1c (ORCPT ); Thu, 20 Aug 2020 05:27:32 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F3E5322CB1; Thu, 20 Aug 2020 09:27:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597915650; bh=60+DBkJWt3XI2uQV883o7GcZFr+YWqgW+hXSwr9d2BA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BWkM36rZX1s/FDf/ZfOyTPmePaeYAbsNc3PR0lfkUu0A/ODY4xnPpUosjwHUvcMLf El+LU9S/1D+Rzi6pv8HPld4dDkOl0iFzBzHZ5GCokcKc9JFp09fASEnYlJTArPLw5m G6rOnnZH4YZG3zyPVskXOVstbWRhrq7n1dTQXIkU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jia He , Andrew Morton , David Hildenbrand , Michal Hocko , Dan Williams , Andy Lutomirski , Baoquan He , Borislav Petkov , Catalin Marinas , Chuhong Yuan , Dave Hansen , Dave Jiang , Fenghua Yu , "H. Peter Anvin" , Ingo Molnar , Jonathan Cameron , Kaly Xin , Logan Gunthorpe , Masahiro Yamada , Mike Rapoport , Peter Zijlstra , Rich Felker , Thomas Gleixner , Tony Luck , Vishal Verma , Will Deacon , Yoshinori Sato , Linus Torvalds Subject: [PATCH 5.8 087/232] mm/memory_hotplug: fix unpaired mem_hotplug_begin/done Date: Thu, 20 Aug 2020 11:18:58 +0200 Message-Id: <20200820091617.036020693@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091612.692383444@linuxfoundation.org> References: <20200820091612.692383444@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jia He commit b4223a510e2ab1bf0f971d50af7c1431014b25ad upstream. 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") Signed-off-by: Jia He Signed-off-by: Andrew Morton Reviewed-by: David Hildenbrand Acked-by: Michal Hocko Acked-by: Dan Williams Cc: [5.6+] Cc: Andy Lutomirski Cc: Baoquan He Cc: Borislav Petkov Cc: Catalin Marinas Cc: Chuhong Yuan Cc: Dave Hansen Cc: Dave Jiang Cc: Fenghua Yu Cc: "H. Peter Anvin" Cc: Ingo Molnar Cc: Jonathan Cameron Cc: Kaly Xin Cc: Logan Gunthorpe Cc: Masahiro Yamada Cc: Mike Rapoport Cc: Peter Zijlstra Cc: Rich Felker Cc: Thomas Gleixner Cc: Tony Luck Cc: Vishal Verma Cc: Will Deacon Cc: Yoshinori Sato Link: http://lkml.kernel.org/r/20200710031619.18762-3-justin.he@arm.com Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/memory_hotplug.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1742,7 +1742,7 @@ static int __ref try_remove_memory(int n */ 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"); @@ -1766,9 +1766,8 @@ static int __ref try_remove_memory(int n try_offline_node(nid); -done: mem_hotplug_done(); - return rc; + return 0; } /**