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.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 8EDEEC3F2CE for ; Wed, 4 Mar 2020 17:03:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2590B22B48 for ; Wed, 4 Mar 2020 17:03:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ig2mp4xj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2590B22B48 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id ACAFA6B0005; Wed, 4 Mar 2020 12:03:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A7A2E6B0007; Wed, 4 Mar 2020 12:03:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 942D06B0008; Wed, 4 Mar 2020 12:03:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0114.hostedemail.com [216.40.44.114]) by kanga.kvack.org (Postfix) with ESMTP id 71DCB6B0005 for ; Wed, 4 Mar 2020 12:03:14 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id ED9358248047 for ; Wed, 4 Mar 2020 17:03:13 +0000 (UTC) X-FDA: 76558300308.28.start17_39456b2747510 X-HE-Tag: start17_39456b2747510 X-Filterd-Recvd-Size: 25334 Received: from mail-yw1-f65.google.com (mail-yw1-f65.google.com [209.85.161.65]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Wed, 4 Mar 2020 17:03:13 +0000 (UTC) Received: by mail-yw1-f65.google.com with SMTP id a132so2685000ywb.2 for ; Wed, 04 Mar 2020 09:03:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=1JiC5x4jtb0FUlxtnMwrMz/AoNO8+nSNY3p9zkt0Q0k=; b=ig2mp4xj03QpTVZZ9wvRfYX+BvXLc+KT1df/VDUF3niDwuSs5mJQ489RcuptDh4SKZ 566vH9BEELXic+UrMDXHaWWBzEYUJ3JjDf4+xqGF/X0Uf1KzWoldz7Hu+cqVmjh18wpq fPkz9XhInryPHKF9kNM/xJvTEAGkJpTtchV97OHe06I7d63UhiOmKarPayqMRtxLjh0V WchFV41OszrQMi0XPJRdyycFHxmk1QR0gbb3xJNR5diBN3fCv4rpFWGz/CdwlZMhUDvG GuW+NFAdEUM2AefTCXbeRUEoic6mQg8ahD2uUli+Odu43utF13hS22bdOWsJws/cVB9B IUPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=1JiC5x4jtb0FUlxtnMwrMz/AoNO8+nSNY3p9zkt0Q0k=; b=aOypWCBqtcQ6hZfxXItR9QK0wUJffdWypsPlkqlPlbRx8tF9EyEk6g4mBx/JrbqDv4 o93caKrnXfR/GkyEzm7t3nd5O/DodMn0p7WmYtUD4tnuudtyR656ExYHBcs/BfFnPis+ PgiHL5JTWwQX4O69PkEwxueKO2AOMzVF2GBAl/G+Tg/fOfF3LkWFpJ4enPyh55BFGoFI 4wSbZlPO3409TkKpgj5YQQfRLlVw3iTmL03iVqWeV2XCNbwKP74wBKL8aQWnQCORWmZE CHAyQMMQPpUb5SXxcT88XlXTe6BNyslw2b+Fyo0OlGPIBICULFIGivr9umKE7yVPzLz0 ZnOQ== X-Gm-Message-State: ANhLgQ2F/mBuA/bQB6lJrg+j12OLbE762f+7HH4Xj1PiEpBwMm7iyDFw OuFHcPmKkneNss/F0d0cd2U2Xrwoh/jyJ/42FQtYol03 X-Google-Smtp-Source: ADFU+vtFrbE60RJc+BvWzwasaLqzzClSnzDgYv7hm1RKMp1px/B/KTuwhtKevP1v4TxVU4UPGZRQUc7sh/kuchZpI4E= X-Received: by 2002:a5b:41:: with SMTP id e1mr3255576ybp.292.1583341392301; Wed, 04 Mar 2020 09:03:12 -0800 (PST) MIME-Version: 1.0 From: Marshall Midden Date: Wed, 4 Mar 2020 11:03:01 -0600 Message-ID: Subject: kdump twirling - does not finish - commit 326e1b8f83a4318b09033ef754f40c785aed5e68 To: linux-mm@kvack.org Cc: "mark.d.rustad@intel.com" Content-Type: multipart/alternative; boundary="0000000000003f136b05a00a651c" 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: --0000000000003f136b05a00a651c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I know a translator is required - trying... Mark - is this better than typical? Problem: kdump is not finishing, hangs twirling ... iKVM Found: Power failure. Qlogic/Cavium/Marvell driver crash, but no kernel dump. v5.3.8+local. Reproduce: Boot, "echo c > /proc/sysrq-trigger" Last known working release: v5.2.x (any of them). First release failure: v5.3-rc1 Tried many versions up to v5.6-rc4 (2020-03-01). Repository: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.gi= t System: Supermicro X10 dual socket x86_64, 64g/256g/512g (different systems/MB/CPUs). UserLand: RedHat7.5 Tried (did not fix) kexec-tools fetched Feb 25th, 2020 from: git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git .config: No modules, except those listed below (only 10 "=3Dm"). No modules in initramfs, /etc/dracut.conf.d/xxxx: omit_drivers+=3D"qla2xxx nfs_layout_flexfiles" omit_drivers+=3D" tcm_loop tcm_fc target_core_mod iscsi_target_mod target_core_file" omit_drivers+=3D" target_core_iblock target_core_mod target_core_pscsi" Commit where problem appeared (git bisect): commit 326e1b8f83a4318b09033ef754f40c785aed5e68 Author: Dan Williams Date: Thu Jul 18 15:58:00 2019 -0700 ---------------------------------------------------------------------------= --- -rw------- 1 root root 2174976 Feb 28 13:33 vmcore-incomplete -rw-r--r-- 1 root root 87611 Feb 28 13:33 vmcore-dmesg.txt verses -rw------- 1 root root 1186929986 Mar 3 18:57 vmcore -rw-r--r-- 1 root root 181709 Mar 3 18:57 vmcore-dmesg.txt ---------------------------------------------------------------------------= --- What am I breaking -- if I comment out the usage of early_section(ms) in file mm/sparse.c -- although kdump's seems to work fine, etc. // bool section_is_early =3D early_section(ms); ... // if (!section_is_early) { kfree(ms->usage); ms->usage =3D NULL; // } ---------------------------------------------------------------------------= --- Humor: commit 5f9e832c137075045d15cd6899ab0505cfb2ca4b (tag: v5.3-rc1) Author: Linus Torvalds Date: Sun Jul 21 14:05:38 2019 -0700 Linus 5.3-rc1 ^ Horror: No one else has run into this since the end of July? ---------------------------------------------------------------------------= --- Full git show below: commit 326e1b8f83a4318b09033ef754f40c785aed5e68 Author: Dan Williams Date: Thu Jul 18 15:58:00 2019 -0700 mm/sparsemem: introduce a SECTION_IS_EARLY flag In preparation for sub-section hotplug, track whether a given section was created during early memory initialization, or later via memory hotplug. This distinction is needed to maintain the coarse expectation that pfn_valid() returns true for any pfn within a given section even i= f that section has pages that are reserved from the page allocator. For example one of the of goals of subsection hotplug is to support cases where the system physical memory layout collides System RAM and PMEM within a section. Several pfn_valid() users expect to just check if a section is valid, but they are not careful to check if the given pfn is within a "System RAM" boundary and instead expect pgdat information to further validate the pfn. Rather than unwind those paths to make their pfn_valid() queries more precise a follow on patch uses the SECTION_IS_EARLY flag to maintain th= e traditional expectation that pfn_valid() returns true for all early sections. Link: https://lore.kernel.org/lkml/1560366952-10660-1-git-send-email-cai@lca.pw/ Link: http://lkml.kernel.org/r/156092350358.979959.5817209875548072819.stgit@dwil= lia2-desk3.amr.corp.intel.com Signed-off-by: Dan Williams Reported-by: Qian Cai Tested-by: Aneesh Kumar K.V [ppc64] Reviewed-by: Oscar Salvador Cc: Michal Hocko Cc: Logan Gunthorpe Cc: David Hildenbrand Cc: Pavel Tatashin Cc: Jane Chu Cc: Jeff Moyer Cc: J=C3=A9r=C3=B4me Glisse Cc: Jonathan Corbet Cc: Mike Rapoport Cc: Toshi Kani Cc: Vlastimil Babka Cc: Wei Yang Cc: Jason Gunthorpe Cc: Christoph Hellwig Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 2520336bdfd1..4be40634238b 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -1260,7 +1260,8 @@ extern size_t mem_section_usage_size(void); #define SECTION_MARKED_PRESENT (1UL<<0) #define SECTION_HAS_MEM_MAP (1UL<<1) #define SECTION_IS_ONLINE (1UL<<2) -#define SECTION_MAP_LAST_BIT (1UL<<3) +#define SECTION_IS_EARLY (1UL<<3) +#define SECTION_MAP_LAST_BIT (1UL<<4) #define SECTION_MAP_MASK (~(SECTION_MAP_LAST_BIT-1)) #define SECTION_NID_SHIFT 3 @@ -1286,6 +1287,11 @@ static inline int valid_section(struct mem_section *section) return (section && (section->section_mem_map & SECTION_HAS_MEM_MAP)); } +static inline int early_section(struct mem_section *section) +{ + return (section && (section->section_mem_map & SECTION_IS_EARLY)); +} + static inline int valid_section_nr(unsigned long nr) { return valid_section(__nr_to_section(nr)); diff --git a/mm/sparse.c b/mm/sparse.c index 41bef8e1f65c..6d23a526279a 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -288,11 +288,11 @@ struct page *sparse_decode_mem_map(unsigned long coded_mem_map, unsigned long pn static void __meminit sparse_init_one_section(struct mem_section *ms, unsigned long pnum, struct page *mem_map, - struct mem_section_usage *usage) + struct mem_section_usage *usage, unsigned long flags) { ms->section_mem_map &=3D ~SECTION_MAP_MASK; - ms->section_mem_map |=3D sparse_encode_mem_map(mem_map, pnum) | - SECTION_HAS_MEM_MAP= ; + ms->section_mem_map |=3D sparse_encode_mem_map(mem_map, pnum) + | SECTION_HAS_MEM_MAP | flags; ms->usage =3D usage; } @@ -497,7 +497,8 @@ static void __init sparse_init_nid(int nid, unsigned long pnum_begin, goto failed; } check_usemap_section_nr(nid, usage); - sparse_init_one_section(__nr_to_section(pnum), pnum, map, usage); + sparse_init_one_section(__nr_to_section(pnum), pnum, map, usage, + SECTION_IS_EARLY); usage =3D (void *) usage + mem_section_usage_size(); } sparse_buffer_fini(); @@ -732,7 +733,7 @@ int __meminit sparse_add_one_section(int nid, unsigned long start_pfn, set_section_nid(section_nr, nid); section_mark_present(ms); - sparse_init_one_section(ms, section_nr, memmap, usage); + sparse_init_one_section(ms, section_nr, memmap, usage, 0); out: if (ret < 0) { @@ -772,19 +773,16 @@ static inline void clear_hwpoisoned_pages(struct page *memmap, int nr_pages) } #endif -static void free_section_usage(struct page *memmap, +static void free_section_usage(struct mem_section *ms, struct page *memmap= , struct mem_section_usage *usage, struct vmem_altmap *altmap= ) { - struct page *usage_page; - if (!usage) return; - usage_page =3D virt_to_page(usage); /* * Check to see if allocation came from hot-plug-add */ - if (PageSlab(usage_page) || PageCompound(usage_page)) { + if (!early_section(ms)) { kfree(usage); if (memmap) __kfree_section_memmap(memmap, altmap); @@ -816,6 +814,6 @@ void sparse_remove_one_section(struct mem_section *ms, unsigned long map_offset, clear_hwpoisoned_pages(memmap + map_offset, PAGES_PER_SECTION - map_offset); - free_section_usage(memmap, usage, altmap); + free_section_usage(ms, memmap, usage, altmap); } #endif /* CONFIG_MEMORY_HOTPLUG */ --0000000000003f136b05a00a651c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I know a translator is required - trying... Mark - is this= better than typical?

Problem: kdump is not finishing, hangs twirlin= g ... iKVM
Found: Power failure. Qlogic/Cavium/Marvell driver crash= , but no kernel dump.=C2=A0 v5.3.8+local.
Reproduce: Boot, "echo = c > /proc/sysrq-trigger"
Last known working release: v5.2.x (any= of them).
First release failure: v5.3-rc1
Tried many versions up to = v5.6-rc4 (2020-03-01).

Repository: https://git.kernel.org/pub/scm/= linux/kernel/git/stable/linux.git
System: Supermicro X10 dual socket= x86_64, 64g/256g/512g (different systems/MB/CPUs).
UserLand: RedHat7.5<= br>Tried (did not fix) kexec-tools fetched Feb 25th, 2020 from:
=C2=A0 = =C2=A0 git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git
.config: No modules, except those listed below (only 10 "=3Dm&quo= t;).
No modules in initramfs, /etc/dracut.conf.d/xxxx:
=C2=A0 =C2=A0 = omit_drivers+=3D"qla2xxx nfs_layout_flexfiles"
=C2=A0 =C2=A0 o= mit_drivers+=3D" tcm_loop tcm_fc target_core_mod iscsi_target_mod targ= et_core_file"
=C2=A0 =C2=A0 omit_drivers+=3D" target_core_iblo= ck target_core_mod target_core_pscsi"

Commit where problem appe= ared (git bisect):
=C2=A0 =C2=A0 commit 326e1b8f83a4318b09033ef754f40c78= 5aed5e68
=C2=A0 =C2=A0 Author: Dan Williams <
dan.j.williams@intel.com>
=C2=A0 =C2=A0 Date:= =C2=A0 Thu Jul 18 15:58:00 2019 -0700
---------------------------------= ---------------------------------------------
-rw------- 1 root root 217= 4976 Feb 28 13:33 vmcore-incomplete
-rw-r--r-- 1 root root =C2=A0 87611 = Feb 28 13:33 vmcore-dmesg.txt
verses
-rw------- 1 root root 118692998= 6 Mar =C2=A03 18:57 vmcore
-rw-r--r-- 1 root root =C2=A0 =C2=A0 181709 M= ar =C2=A03 18:57 vmcore-dmesg.txt
--------------------------------------= ----------------------------------------
What am I breaking -- if I comm= ent out the usage of early_section(ms)
in file mm/sparse.c -- although k= dump's seems to work fine, etc.
// = =C2=A0 =C2=A0 =C2=A0bool section_is_early =3D early_section(ms);
...
= // =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (!section_is_early) {=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 kfree(ms->usage);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ms->usage =3D NULL;
= // =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
-------------= -----------------------------------------------------------------
Humor:=
=C2=A0 =C2=A0 commit 5f9e832c137075045d15cd6899ab0505cfb2ca4b (tag: v5.= 3-rc1)
=C2=A0 =C2=A0 Author: Linus Torvalds <torvalds@linux-foundation.org>
=C2=A0 = =C2=A0 Date: =C2=A0 Sun Jul 21 14:05:38 2019 -0700
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 Linus 5.3-rc1
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^
Horr= or:
=C2=A0 =C2=A0 No one else has run into this since the end of July?
--------------------------------------------------------------------= ----------
Full git show below:

commit 326e1b8f83a4318b090= 33ef754f40c785aed5e68
Author: Dan Williams <dan.j.williams@intel.com>
Date: =C2=A0 Thu Jul= 18 15:58:00 2019 -0700

=C2=A0 =C2=A0 mm/sparsemem: introduce a SECT= ION_IS_EARLY flag

=C2=A0 =C2=A0 In preparation for sub-section hotpl= ug, track whether a given section
=C2=A0 =C2=A0 was created during early= memory initialization, or later via memory
=C2=A0 =C2=A0 hotplug.=C2=A0= This distinction is needed to maintain the coarse expectation
=C2=A0 = =C2=A0 that pfn_valid() returns true for any pfn within a given section eve= n if
=C2=A0 =C2=A0 that section has pages that are reserved from the pag= e allocator.

=C2=A0 =C2=A0 For example one of the of goals of subsec= tion hotplug is to support
=C2=A0 =C2=A0 cases where the system physical= memory layout collides System RAM and
=C2=A0 =C2=A0 PMEM within a secti= on.=C2=A0 Several pfn_valid() users expect to just check
=C2=A0 =C2=A0 i= f a section is valid, but they are not careful to check if the given
=C2= =A0 =C2=A0 pfn is within a "System RAM" boundary and instead expe= ct pgdat
=C2=A0 =C2=A0 information to further validate the pfn.

= =C2=A0 =C2=A0 Rather than unwind those paths to make their pfn_valid() quer= ies more
=C2=A0 =C2=A0 precise a follow on patch uses the SECTION_IS_EAR= LY flag to maintain the
=C2=A0 =C2=A0 traditional expectation that pfn_v= alid() returns true for all early
=C2=A0 =C2=A0 sections.

=C2=A0 = =C2=A0 Link: https://lore.kernel.org/lkml/1560366952-10660-1-gi= t-send-email-cai@lca.pw/
=C2=A0 =C2=A0 Link: http://lkml.kernel.org/r/156092350358.979959.58172098755= 48072819.stgit@dwillia2-desk3.amr.corp.intel.com
=C2=A0 =C2=A0 Signe= d-off-by: Dan Williams <dan.= j.williams@intel.com>
=C2=A0 =C2=A0 Reported-by: Qian Cai <cai@lca.pw>
=C2=A0 =C2=A0 Tested-by: A= neesh Kumar K.V <aneesh.ku= mar@linux.ibm.com> =C2=A0 =C2=A0 =C2=A0 =C2=A0[ppc64]
=C2=A0 =C2= =A0 Reviewed-by: Oscar Salvador <os= alvador@suse.de>
=C2=A0 =C2=A0 Cc: Michal Hocko <mhocko@suse.com>
=C2=A0 =C2=A0 Cc: Logan Gu= nthorpe <logang@deltatee.com&= gt;
=C2=A0 =C2=A0 Cc: David Hildenbrand <david@redhat.com>
=C2=A0 =C2=A0 Cc: Pavel Tatashin <pasha.tatashin@soleen.com>= ;
=C2=A0 =C2=A0 Cc: Jane Chu <= jane.chu@oracle.com>
=C2=A0 =C2=A0 Cc: Jeff Moyer <jmoyer@redhat.com>
=C2=A0 =C2=A0 Cc: J= =C3=A9r=C3=B4me Glisse <jglisse@re= dhat.com>
=C2=A0 =C2=A0 Cc: Jonathan Corbet <corbet@lwn.net>
=C2=A0 =C2=A0 Cc: Mike Rapoport = <rppt@linux.ibm.com>
=C2= =A0 =C2=A0 Cc: Toshi Kani <toshi.k= ani@hpe.com>
=C2=A0 =C2=A0 Cc: Vlastimil Babka <vbabka@suse.cz>
=C2=A0 =C2=A0 Cc: Wei Yang &l= t;richardw.yang@linux.inte= l.com>
=C2=A0 =C2=A0 Cc: Jason Gunthorpe <jgg@mellanox.com>
=C2=A0 =C2=A0 Cc: Christoph Hel= lwig <hch@lst.de>
=C2=A0 =C2=A0 = Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
=C2=A0 =C2=A0 Signed-off-by: Linus = Torvalds <torvalds@linu= x-foundation.org>

diff --git a/include/linux/mmzone.h b/inclu= de/linux/mmzone.h
index 2520336bdfd1..4be40634238b 100644
--- a/inclu= de/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -1260,7 +1260,8 @@ = extern size_t mem_section_usage_size(void);
=C2=A0#define =C2=A0 =C2=A0 = =C2=A0 =C2=A0SECTION_MARKED_PRESENT =C2=A0(1UL<<0)
=C2=A0#define S= ECTION_HAS_MEM_MAP =C2=A0 =C2=A0(1UL<<1)
=C2=A0#define SECTION_IS_= ONLINE =C2=A0 =C2=A0 =C2=A0(1UL<<2)
-#define SECTION_MAP_LAST_BIT = =C2=A0 (1UL<<3)
+#define SECTION_IS_EARLY =C2=A0 =C2=A0 =C2=A0 (1U= L<<3)
+#define SECTION_MAP_LAST_BIT =C2=A0 (1UL<<4)
=C2= =A0#define SECTION_MAP_MASK =C2=A0 =C2=A0 =C2=A0 (~(SECTION_MAP_LAST_BIT-1)= )
=C2=A0#define SECTION_NID_SHIFT =C2=A0 =C2=A0 =C2=A03

@@ -1286,= 6 +1287,11 @@ static inline int valid_section(struct mem_section *section)<= br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 return (section && (section->sect= ion_mem_map & SECTION_HAS_MEM_MAP));
=C2=A0}

+static inline i= nt early_section(struct mem_section *section)
+{
+ =C2=A0 =C2=A0 =C2= =A0 return (section && (section->section_mem_map & SECTION_I= S_EARLY));
+}
+
=C2=A0static inline int valid_section_nr(unsigned = long nr)
=C2=A0{
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return valid_section(__n= r_to_section(nr));
diff --git a/mm/sparse.c b/mm/sparse.c
index 41bef= 8e1f65c..6d23a526279a 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@= @ -288,11 +288,11 @@ struct page *sparse_decode_mem_map(unsigned long coded= _mem_map, unsigned long pn

=C2=A0static void __meminit sparse_init_o= ne_section(struct mem_section *ms,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 unsigned long pnum, struct page *mem_map,
- =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct mem_section_usage *usage)<= br>+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct mem_section_us= age *usage, unsigned long flags)
=C2=A0{
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = ms->section_mem_map &=3D ~SECTION_MAP_MASK;
- =C2=A0 =C2=A0 =C2= =A0 ms->section_mem_map |=3D sparse_encode_mem_map(mem_map, pnum) |
-= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SECTION_HAS_MEM_MAP;
+ =C2=A0 = =C2=A0 =C2=A0 ms->section_mem_map |=3D sparse_encode_mem_map(mem_map, pn= um)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | SECTION_HAS_MEM= _MAP | flags;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ms->usage =3D usage;
=C2= =A0}

@@ -497,7 +497,8 @@ static void __init sparse_init_nid(int nid,= unsigned long pnum_begin,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto failed;
=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 check_usemap_section_nr(nid, usage);
- =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sparse_init_one_section(__nr_to_sect= ion(pnum), pnum, map, usage);
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 sparse_init_one_section(__nr_to_section(pnum), pnum, map, usage,=
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SECTION_IS_EARLY);
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 usage =3D (void *) usage + mem_secti= on_usage_size();
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 sparse_buffer_fini();
@@ -732,7 +733,7 @@ int __meminit sparse_ad= d_one_section(int nid, unsigned long start_pfn,

=C2=A0 =C2=A0 =C2=A0= =C2=A0 set_section_nid(section_nr, nid);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 se= ction_mark_present(ms);
- =C2=A0 =C2=A0 =C2=A0 sparse_init_one_section(m= s, section_nr, memmap, usage);
+ =C2=A0 =C2=A0 =C2=A0 sparse_init_one_se= ction(ms, section_nr, memmap, usage, 0);

=C2=A0out:
=C2=A0 =C2=A0= =C2=A0 =C2=A0 if (ret < 0) {
@@ -772,19 +773,16 @@ static inl= ine void clear_hwpoisoned_pages(struct page *memmap, int nr_pages)
=C2= =A0}
=C2=A0#endif

-static void free_section_usage(struct page *me= mmap,
+static void free_section_usage(struct mem_section *ms, struct pag= e *memmap,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struc= t mem_section_usage *usage, struct vmem_altmap *altmap)
=C2=A0{
- =C2= =A0 =C2=A0 =C2=A0 struct page *usage_page;
-
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 if (!usage)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = return;

- =C2=A0 =C2=A0 =C2=A0 usage_page =3D virt_to_page(usage);=C2=A0 =C2=A0 =C2=A0 =C2=A0 /*
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* Che= ck to see if allocation came from hot-plug-add
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0*/
- =C2=A0 =C2=A0 =C2=A0 if (PageSlab(usage_page) || PageComp= ound(usage_page)) {
+ =C2=A0 =C2=A0 =C2=A0 if (!early_section(ms)) {
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 kfree(usage);
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (memmap)
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 __kfree_section_memmap(memmap, altmap);
@@ -816,6 +814,6 @@ void = sparse_remove_one_section(struct mem_section *ms, unsigned long map_offset,=

=C2=A0 =C2=A0 =C2=A0 =C2=A0 clear_hwpoisoned_pages(memmap + map_off= set,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 PAGES_PER_SECTION - map_offset);
- =C2=A0 =C2=A0 =C2= =A0 free_section_usage(memmap, usage, altmap);
+ =C2=A0 =C2=A0 =C2=A0 fr= ee_section_usage(ms, memmap, usage, altmap);
=C2=A0}
=C2=A0#endif /* = CONFIG_MEMORY_HOTPLUG */

--0000000000003f136b05a00a651c--