Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1253624pxa; Thu, 20 Aug 2020 06:51:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJVu33dH4f1cY7bnA7gif1knttohCDezOHfRyV1UNSo3nlY/MEOCDgnSogKodObYsAM2My X-Received: by 2002:a05:6402:1c85:: with SMTP id cy5mr3079100edb.6.1597931489445; Thu, 20 Aug 2020 06:51:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597931489; cv=none; d=google.com; s=arc-20160816; b=Ae0n89nmjkYsHstzhyzlujy/bWt1ZxIzSKzMBlEW+t6Bt1hnZA4fZyHNVlSOr8uslv LGP4oQfetdZgZfymFt2nd0//X8YLrz/dzlNdyxBB0DUgpPSXbQ7BWfiHQfsr0lj9Ngtk CvyjCw3iIxh93EnuZaKnbefvbXB/wL1eYkklf1ZcU7DRNl0JFiy+rBvfPBhoV7MH36y8 TA6AF+Q2Y+wbKi+DvOdVwp2kvoSS0tdsaS+5VdbZhWaEFJrneigdAPJUxLuc3omIm7nH fbDyPe0rjCmnjCyyntDfXAeDAT/xNj1Ap8txeLzQSEwM0RnWASdgncQljDtZODzvf3Iz KpKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=21uJFcCEn2870XY+psBrk8cp1KlppfMuP8lOGo6fvSY=; b=wy/VIk0SiBrn7zZBO8xFkKTDUlySQBBJRU6+NKwUqNRQLrNPCAKIbIiKcV1rGOJSJ7 ElcMi1qY4KEfRMWRYvX5kGQrZkxJWl6Du1wNB5YJkzlaFMh+rER8obhjcBEhWuTOtQFv VOjrXhsFGouMx1gVyvKL6EWfhVnt5RsxEGPRtlc5msz+GbD3iSK75YIySe67nLe61yvA fHNtEgGJ4ytB4WouMGBYpNLEcu1nuWRFRE1GvMYEUObPDuTChnuzt9mMoDDeeyik2Z1L Xuk8ZESAVO5DJqk3tDpkOty6GeI6sv00+f34eWkXv6uOS5O489xRxebu37tB4mOjCaNq enmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BWkM36rZ; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l23si1184359ejq.620.2020.08.20.06.51.05; Thu, 20 Aug 2020 06:51:29 -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; dkim=pass header.i=@kernel.org header.s=default header.b=BWkM36rZ; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729552AbgHTNts (ORCPT + 99 others); Thu, 20 Aug 2020 09:49:48 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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; } /**