Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3710838ybv; Mon, 10 Feb 2020 05:08:07 -0800 (PST) X-Google-Smtp-Source: APXvYqxeQ8YzrcT1nWcmWBv3hOO5aJxa11US1xoJvVW2v3R5if/stDe2zw0nJxZTvD986igGQfN7 X-Received: by 2002:a9d:6c0d:: with SMTP id f13mr951314otq.354.1581340087386; Mon, 10 Feb 2020 05:08:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581340087; cv=none; d=google.com; s=arc-20160816; b=Yjtxn3KqGHZAaB6UStqiMyNPN6bnkdOQoMwgD1X7A7OfxvJAp8KjmhysshScD0ufXK m6CZo9Prsk4wOXag5olGUUR4LUhX5/ck36LUgfU2Ri8YCK0sUQD8YVSKizVb+J5+51rK 56iTAh9DI3AEqeACJtEbiyp0t4/FVivfl2FB8aPeMc7J7mJm4AgVE2IeKkykJ7qDKRRV zI3vKrWxumJ3myaHXHj5gw1wE54v0r1afZtrAi3XhXi7Nx2KLVNJ3sTPDpS099iAcKKY lTXD8hTVuPkrHw3Bk7JxB52ZbuALP8+K0SfBFALhrMlVLIzo3WArl7lQl/E6nK9oF8px xFEg== 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=Pl0/YTVso8x5pWWEysZudlHrZqc1NNOf/cpvDFF2wBQ=; b=gvQ33ORWVm7W/XF9go5dGitUQ1a3a/IyTKr8DKgKJ5El+liMLTkEhQo6Hbk6fKTd9D zpx+fqmZo+7DEmlaDr00r27y9hrSIjkShb5qPeFNIT1vL8L1WVZgjoxYoCD0i+jYom0S sX0ExicK/9o/DCh7AwrMStlPtz0ulHNPTXd4G+0zyImMNGhQkwLVpnh/hFUCMtGtnimM 97Ypp7bAkr7fWOxWdiTVQOvX5oM/dODgbE+IXrGf+0SsqpSYeRcEaWZezDqbwOqT/PFv 7iUsxNZCYBjoR4SQ4CM4RLkGhaz+spyFxF9lSJ+zgmI5aBflyHFJTUtn6DbQzxssQWbp HVgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BC8CDaAY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 65si166510oif.14.2020.02.10.05.07.55; Mon, 10 Feb 2020 05:08:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BC8CDaAY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729649AbgBJNHu (ORCPT + 99 others); Mon, 10 Feb 2020 08:07:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:37844 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728137AbgBJMjk (ORCPT ); Mon, 10 Feb 2020 07:39:40 -0500 Received: from localhost (unknown [209.37.97.194]) (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 84E342051A; Mon, 10 Feb 2020 12:39:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338378; bh=Iaomh9OrMmWwgmV3r5KWLTmAR3fNuUtA1Fh7Wys/DQ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BC8CDaAY8P1OdQuXXiR3Hmpt+NtUDxIDofxD/tuz5OD0b1v9No5mIxmQZwrXemx6i bIPvbKehwh1MKzwAJhJDa+vlxFV1l9ZeF+rxPJb5vJrmxSyf51Ewru8aGSV35VB/FU UEoHrHJj7GDH79zX/4XWnFSUx5zBq+fm8i0J4lb0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pingfan Liu , Michal Hocko , David Hildenbrand , Dan Williams , Oscar Salvador , Baoquan He , Qian Cai , Kazuhito Hagio , Andrew Morton , Linus Torvalds Subject: [PATCH 5.5 055/367] mm/sparse.c: reset sections mem_map when fully deactivated Date: Mon, 10 Feb 2020 04:29:28 -0800 Message-Id: <20200210122429.133079039@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122423.695146547@linuxfoundation.org> References: <20200210122423.695146547@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: Pingfan Liu commit 1f503443e7df8dc8366608b4d810ce2d6669827c upstream. After commit ba72b4c8cf60 ("mm/sparsemem: support sub-section hotplug"), when a mem section is fully deactivated, section_mem_map still records the section's start pfn, which is not used any more and will be reassigned during re-addition. In analogy with alloc/free pattern, it is better to clear all fields of section_mem_map. Beside this, it breaks the user space tool "makedumpfile" [1], which makes assumption that a hot-removed section has mem_map as NULL, instead of checking directly against SECTION_MARKED_PRESENT bit. (makedumpfile will be better to change the assumption, and need a patch) The bug can be reproduced on IBM POWERVM by "drmgr -c mem -r -q 5" , trigger a crash, and save vmcore by makedumpfile [1]: makedumpfile, commit e73016540293 ("[v1.6.7] Update version") Link: http://lkml.kernel.org/r/1579487594-28889-1-git-send-email-kernelfans@gmail.com Signed-off-by: Pingfan Liu Acked-by: Michal Hocko Acked-by: David Hildenbrand Cc: Dan Williams Cc: Oscar Salvador Cc: Baoquan He Cc: Qian Cai Cc: Kazuhito Hagio Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/sparse.c +++ b/mm/sparse.c @@ -789,7 +789,7 @@ static void section_deactivate(unsigned ms->usage = NULL; } memmap = sparse_decode_mem_map(ms->section_mem_map, section_nr); - ms->section_mem_map = sparse_encode_mem_map(NULL, section_nr); + ms->section_mem_map = (unsigned long)NULL; } if (section_is_early && memmap)