From mboxrd@z Thu Jan 1 00:00:00 1970 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=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham 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 C7D69C33CA1 for ; Mon, 20 Jan 2020 07:29:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9362F20684 for ; Mon, 20 Jan 2020 07:29:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9362F20684 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3185B6B05B3; Mon, 20 Jan 2020 02:29:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C9276B05B5; Mon, 20 Jan 2020 02:29:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1DE3B6B05B6; Mon, 20 Jan 2020 02:29:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0154.hostedemail.com [216.40.44.154]) by kanga.kvack.org (Postfix) with ESMTP id 0492C6B05B3 for ; Mon, 20 Jan 2020 02:29:43 -0500 (EST) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id A8D9F824805A for ; Mon, 20 Jan 2020 07:29:43 +0000 (UTC) X-FDA: 76397187846.23.juice66_37c5fb117b517 X-HE-Tag: juice66_37c5fb117b517 X-Filterd-Recvd-Size: 3446 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Mon, 20 Jan 2020 07:29:43 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 48F2AACE3; Mon, 20 Jan 2020 07:29:40 +0000 (UTC) Date: Mon, 20 Jan 2020 08:29:39 +0100 From: Michal Hocko To: Pingfan Liu Cc: linux-mm@kvack.org, Andrew Morton , David Hildenbrand , Dan Williams , Oscar Salvador , Baoquan He , Qian Cai , kexec@lists.infradead.org, Kazuhito Hagio Subject: Re: [PATCHv2] mm/sparse: reset section's mem_map when fully deactivated Message-ID: <20200120072939.GD18451@dhcp22.suse.cz> References: <1579487594-28889-1-git-send-email-kernelfans@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1579487594-28889-1-git-send-email-kernelfans@gmail.com> User-Agent: Mutt/1.12.2 (2019-09-21) 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: On Mon 20-01-20 10:33:14, Pingfan Liu wrote: > 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-added. > > 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 While makedumpfile lives very closely to the kernel and occasional breakage is to be expected I still believe that Fixes: ba72b4c8cf60 is due. > [1]: makedumpfile, commit e73016540293 ("[v1.6.7] Update version") > > Signed-off-by: Pingfan Liu > To: linux-mm@kvack.org > Cc: Andrew Morton > Cc: David Hildenbrand > Cc: Dan Williams > Cc: Oscar Salvador > Cc: Michal Hocko > Cc: Baoquan He > Cc: Qian Cai > Cc: kexec@lists.infradead.org > Cc: Kazuhito Hagio Acked-by: Michal Hocko > --- > v1 -> v2: > make an explicit convertion from NULL to ulong > improve commit log > > mm/sparse.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/sparse.c b/mm/sparse.c > index 3822ecb..3918fc3 100644 > --- a/mm/sparse.c > +++ b/mm/sparse.c > @@ -789,7 +789,7 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages, > 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) > -- > 2.7.5 -- Michal Hocko SUSE Labs