5.11.7-rc1 review
Subsystems (4)
[email protected]
maintainerPATCH 305/306 mm/page_alloc.c: refactor initialization of struct page for holes in memory layout
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Mike Rapoport <[email protected]>
commit 0740a50b9baa4472cfb12442df4b39e2712a64a4 upstream.
There could be struct pages that are not backed by actual physical memory. This can happen when the actual memory bank is not a multiple of SECTION_SIZE or when an architecture does not register memory holes reserved by the firmware as memblock.memory.
Such pages are currently initialized using init_unavailable_mem() function that iterates through PFNs in holes in memblock.memory and if there is a struct page corresponding to a PFN, the fields of this page are set to default values and it is marked as Reserved.
init_unavailable_mem() does not take into account zone and node the page belongs to and sets both zone and node links in struct page to zero.
Before commit 73a6e474cb37 ("mm: memmap_init: iterate over memblock regions rather that check each PFN") the holes inside a zone were re-initialized during memmap_init() and got their zone/node links right. However, after that commit nothing updates the struct pages representing such holes.
On a system that has firmware reserved holes in a zone above ZONE_DMA, for instance in a configuration below:
# grep -A1 E820 /proc/iomem 7a17b000-7a216fff : Unknown E820 type 7a217000-7bffffff : System RAM
unset zone link in struct page will trigger
VM_BUG_ON_PAGE(!zone_spans_pfn(page_zone(page), pfn), page);
in set_pfnblock_flags_mask() when called with a struct page from a range other than E820_TYPE_RAM because there are pages in the range of ZONE_DMA32 but the unset zone link in struct page makes them appear as a part of ZONE_DMA.
Interleave initialization of the unavailable pages with the normal initialization of memory map, so that zone and node information will be properly set on struct pages that are not backed by the actual memory.
With this change the pages for holes inside a zone will get proper zone/node links and the pages that are not spanned by any node will get links to the adjacent zone/node. The holes between nodes will be prepended to the zone/node above the hole and the trailing pages in the last section that will be appended to the zone/node below.
[[email protected]: don't initialize static to zero, use %llu for u64]
--- mm/page_alloc.c | 158 ++++++++++++++++++++++++++------------------------------ 1 file changed, 75 insertions(+), 83 deletions(-)
mm/page_alloc.c +75 -83
@@ -6262,13 +6262,66 @@ static void __meminit zone_init_free_lis } } +#if !defined(CONFIG_FLAT_NODE_MEM_MAP ) +/* +* Only struct pages that correspond to ranges defined by memblock.memory +* are zeroed and initialized by going through __init_single_page() during +* memmap_init_zone(). +* +* But, there could be struct pages that correspond to holes in +* memblock.memory. This can happen because of the following reasons: +* - physical memory bank size is not necessarily the exact multiple of the +* arbitrary section size +* - early reserved memory may not be listed in memblock.memory +* - memory layouts defined with memmap= kernel parameter may not align +* nicely with memmap sections +* +* Explicitly initialize those struct pages so that: +* - PG_Reserved is set +* - zone and node links point to zone and node that span the page if the +* hole is in the middle of a zone +* - zone and node links point to adjacent zone/node if the hole falls on +* the zone boundary; the pages in such holes will be prepended to the +* zone/node above the hole except for the trailing pages in the last +* section that will be appended to the zone/node below. +*/ +static u64 __meminit init_unavailable_range (unsigned long spfn, +unsigned long epfn, +int zone,int node) +{ +unsigned long pfn; +u64 pgcnt =0 ; + +for (pfn = spfn; pfn < epfn; pfn++) { +if (!pfn_valid (ALIGN_DOWN (pfn, pageblock_nr_pages))) { + pfn =ALIGN_DOWN (pfn, pageblock_nr_pages) + + pageblock_nr_pages -1 ; +continue ; + } +__init_single_page (pfn_to_page (pfn), pfn, zone, node); +__SetPageReserved (pfn_to_page (pfn)); + pgcnt++; + } + +return pgcnt; +} +#else +static inline u64 init_unavailable_range (unsigned long spfn,unsigned long epfn, +int zone,int node) +{ +return 0 ; +} +#endif +void __meminit __weak memmap_init (unsigned long size,int nid,unsigned long zone,unsigned long range_start_pfn) { +static unsigned long hole_pfn;unsigned long start_pfn, end_pfn;unsigned long range_end_pfn = range_start_pfn + size;int i; +u64 pgcnt =0 ;for_each_mem_pfn_range (i, nid, &start_pfn, &end_pfn,NULL ) { start_pfn =clamp (start_pfn, range_start_pfn, range_end_pfn);
@@ -6279,7 +6332,29 @@ void __meminit __weak memmap_init(unsignmemmap_init_zone (size, nid, zone, start_pfn, range_end_pfn,MEMINIT_EARLY ,NULL ,MIGRATE_MOVABLE ); } + +if (hole_pfn < start_pfn) + pgcnt +=init_unavailable_range (hole_pfn, start_pfn, + zone, nid); + hole_pfn = end_pfn; } + +#ifdef CONFIG_SPARSEMEM +/* +* Initialize the hole in the range [zone_end_pfn, section_end]. +* If zone boundary falls in the middle of a section, this hole +* will be re-initialized during the call to this function for the +* higher zone. +*/ + end_pfn =round_up (range_end_pfn,PAGES_PER_SECTION ); +if (hole_pfn < end_pfn) + pgcnt +=init_unavailable_range (hole_pfn, end_pfn, + zone, nid); +#endif + +if (pgcnt) +pr_info (" %s zone: %llu pages in unavailable ranges\n" , + zone_names[zone], pgcnt); }static int zone_batchsize (struct zone *zone)
@@ -7080,88 +7155,6 @@ void __init free_area_init_memoryless_nofree_area_init_node (nid); } -#if !defined(CONFIG_FLAT_NODE_MEM_MAP ) -/* -* Initialize all valid struct pages in the range [spfn, epfn) and mark them -* PageReserved(). Return the number of struct pages that were initialized. -*/ -static u64 __init init_unavailable_range (unsigned long spfn,unsigned long epfn) -{ -unsigned long pfn; -u64 pgcnt =0 ; - -for (pfn = spfn; pfn < epfn; pfn++) { -if (!pfn_valid (ALIGN_DOWN (pfn, pageblock_nr_pages))) { - pfn =ALIGN_DOWN (pfn, pageblock_nr_pages) - + pageblock_nr_pages -1 ; -continue ; - } -/* -* Use a fake node/zone (0) for now. Some of these pages -* (in memblock.reserved but not in memblock.memory) will -* get re-initialized via reserve_bootmem_region() later. -*/ -__init_single_page (pfn_to_page (pfn), pfn,0 ,0 ); -__SetPageReserved (pfn_to_page (pfn)); - pgcnt++; - } - -return pgcnt; -} - -/* -* Only struct pages that are backed by physical memory are zeroed and -* initialized by going through __init_single_page(). But, there are some -* struct pages which are reserved in memblock allocator and their fields -* may be accessed (for example page_to_pfn() on some configuration accesses -* flags). We must explicitly initialize those struct pages. -* -* This function also addresses a similar issue where struct pages are left -* uninitialized because the physical address range is not covered by -* memblock.memory or memblock.reserved. That could happen when memblock -* layout is manually configured via memmap=, or when the highest physical -* address (max_pfn) does not end on a section boundary. -*/ -static void __init init_unavailable_mem (void ) -{ -phys_addr_t start, end; -u64 i, pgcnt; -phys_addr_t next =0 ; - -/* -* Loop through unavailable ranges not covered by memblock.memory. -*/ - pgcnt =0 ; -for_each_mem_range (i, &start, &end) { -if (next < start) - pgcnt +=init_unavailable_range (PFN_DOWN (next), -PFN_UP (start)); - next = end; - } - -/* -* Early sections always have a fully populated memmap for the whole -* section - see pfn_valid(). If the last section has holes at the -* end and that section is marked "online", the memmap will be -* considered initialized. Make sure that memmap has a well defined -* state. -*/ - pgcnt +=init_unavailable_range (PFN_DOWN (next), -round_up (max_pfn,PAGES_PER_SECTION )); - -/* -* Struct pages that do not have backing memory. This could be because -* firmware is using some of this memory, or for some other reasons. -*/ -if (pgcnt) -pr_info ("Zeroed struct page in unavailable ranges: %lld pages" , pgcnt); -} -#else -static inline void __init init_unavailable_mem (void ) -{ -} -#endif /* !CONFIG_FLAT_NODE_MEM_MAP */ -#if MAX_NUMNODES >1 /* * Figure out the number of possible node ids.
@@ -7585,7 +7578,6 @@ void __init free_area_init(unsigned long/* Initialise every node */ mminit_verify_pageflags_layout ();setup_nr_node_ids (); -init_unavailable_mem ();for_each_online_node (nid) {pg_data_t *pgdat =NODE_DATA (nid);free_area_init_node (nid);
[email protected]
maintainerPATCH 306/306 KVM: arm64: Fix nVHE hyp panic host context restore
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Andrew Scull <[email protected]>
Commit c4b000c3928d4f20acef79dccf3a65ae3795e0b0 upstream.
When panicking from the nVHE hyp and restoring the host context, x29 is expected to hold a pointer to the host context. This wasn't being done so fix it to make sure there's a valid pointer the host context being used.
Rather than passing a boolean indicating whether or not the host context should be restored, instead pass the pointer to the host context. NULL is passed to indicate that no context should be restored.
--- arch/arm64/include/asm/kvm_hyp.h | 3 ++- arch/arm64/kvm/hyp/nvhe/host.S | 20 ++++++++++---------- arch/arm64/kvm/hyp/nvhe/switch.c | 3 +-- 3 files changed, 13 insertions(+), 13 deletions(-)
arch/arm64/include/asm/kvm_hyp.h +2 -1
@@ -102,7 +102,8 @@ bool kvm_host_psci_handler(struct kvm_cpvoid __noreturn hyp_panic (void );#ifdef __KVM_NVHE_HYPERVISOR__ -void __noreturn __hyp_do_panic (bool restore_host,u64 spsr,u64 elr,u64 par); +void __noreturn __hyp_do_panic (struct kvm_cpu_context *host_ctxt,u64 spsr, +u64 elr,u64 par);#endif #endif /* __ARM64_KVM_HYP_H__ */
arch/arm64/kvm/hyp/nvhe/host.S +10 -10
@@ -71,10 +71,15 @@ SYM_FUNC_START(__host_enter) SYM_FUNC_END(__host_enter) /* - * void __noreturn __hyp_do_panic(bool restore_host, u64 spsr, u64 elr, u64 par); + * void __noreturn __hyp_do_panic(struct kvm_cpu_context *host_ctxt, u64 spsr, + * u64 elr, u64 par); */ SYM_FUNC_START(__hyp_do_panic) - /* Load the format arguments into x1-7 */ + mov x29, x0 + + /* Load the format string into x0 and arguments into x1-7 */ + ldr x0, =__hyp_panic_string + mov x6, x3 get_vcpu_ptr x7, x3
@@ -89,13 +94,8 @@ SYM_FUNC_START(__hyp_do_panic) ldr lr, =panic msr elr_el2, lr - /* - * Set the panic format string and enter the host, conditionally - * restoring the host context. - */ - cmp x0, xzr - ldr x0, =__hyp_panic_string - b.eq __host_enter_without_restoring + /* Enter the host, conditionally restoring the host context. */ + cbz x29, __host_enter_without_restoring b __host_enter_for_panic SYM_FUNC_END(__hyp_do_panic)
@@ -150,7 +150,7 @@ SYM_FUNC_END(__hyp_do_panic) .macro invalid_host_el1_vect .align 7 - mov x0, xzr /* restore_host = false */ + mov x0, xzr /* host_ctxt = NULL */ mrs x1, spsr_el2 mrs x2, elr_el2 mrs x3, par_el1
arch/arm64/kvm/hyp/nvhe/switch.c +1 -2
@@ -266,7 +266,6 @@ void __noreturn hyp_panic(void)u64 spsr =read_sysreg_el2 (SYS_SPSR );u64 elr =read_sysreg_el2 (SYS_ELR );u64 par =read_sysreg_par (); -bool restore_host = true;struct kvm_cpu_context *host_ctxt;struct kvm_vcpu *vcpu;
@@ -280,7 +279,7 @@ void __noreturn hyp_panic(void)__sysreg_restore_state_nvhe (host_ctxt); } -__hyp_do_panic (restore_host, spsr, elr, par); +__hyp_do_panic (host_ctxt, spsr, elr, par);unreachable (); }
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Quoted 11 lines · On Mon, 15 Mar 2021 14:51:03 +0100, [email protected] wrote:
From: Greg Kroah-Hartman <[email protected]>
This is the start of the stable review cycle for the 5.11.7 release. There are 306 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 Mar 2021 13:54:26 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.11.7-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.11.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v5.11:
12 builds: 12 pass, 0 fail
28 boots: 28 pass, 0 fail
65 tests: 65 pass, 0 failLinux version: 5.11.7-rc1-gb87703cf6c9b
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Jon
Quoted 3 lines · On Mon, 15 Mar 2021 14:51:03 +0100 [email protected] wrote:
From: Greg Kroah-Hartman <[email protected]>
This is the start of the stable review cycle for the 5.11.7 release.
Tested on amd64, arm64, armhf, i386, m68k, or1k, powerpc, ppc64, ppc64el, riscv64, s390x, sparc64. No problems detected.
Quoted 12 lines · On Mon, 15 Mar 2021 at 19:27, <[email protected]> wrote:
From: Greg Kroah-Hartman <[email protected]>
This is the start of the stable review cycle for the 5.11.7 release. There are 306 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 Mar 2021 13:54:26 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.11.7-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.11.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
Summary
------------------------------------------------------------------------
kernel: 5.11.7-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-5.11.y
git commit: f109baa2424b2523fbb975de996fedc7a53ef531
git describe: v5.11.6-307-gf109baa2424b
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.11.y/build/v5.11.6-307-gf109baa2424b
No regressions (compared to build v5.11.6)
No fixes (compared to build v5.11.6)
Ran 55999 total tests in the following environments and test suites.
Environments
--------------
- arc
- arm
- arm64
- dragonboard-410c
- hi6220-hikey
- i386
- juno-64k_page_size
- juno-r2
- juno-r2-compat
- juno-r2-kasan
- mips
- nxp-ls2088
- nxp-ls2088-64k_page_size
- parisc
- powerpc
- qemu-arm-clang
- qemu-arm64-clang
- qemu-arm64-kasan
- qemu-i386-clang
- qemu-x86_64-clang
- qemu-x86_64-kasan
- qemu-x86_64-kcsan
- qemu_arm
- qemu_arm64
- qemu_arm64-compat
- qemu_i386
- qemu_x86_64
- qemu_x86_64-compat
- riscv
- s390
- sh
- sparc
- x15
- x86
- x86-kasan
- x86_64
Test Suites
-----------
* build
* linux-log-parser
* install-android-platform-tools-r2600
* kselftest-
* kselftest-efivarfs
* kselftest-filesystems
* kselftest-firmware
* kselftest-fpu
* kselftest-futex
* kselftest-gpio
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-lib
* kselftest-lkdtm
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-tc-testing
* ltp-cap_bounds-tests
* ltp-containers-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-dio-tests
* ltp-fs-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-syscalls-tests
* perf
* v4l2-compliance
* fwts
* kselftest-android
* kselftest-bpf
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-zram
* ltp-commands-tests
* ltp-cve-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-math-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-tracing-tests
* network-basic-tests
* kselftest-intel_pstate
* kselftest-kexec
* kselftest-kvm
* kselftest-livepatch
* kselftest-ptrace
* kselftest-vm
* kselftest-x86
* libhugetlbfs
* ltp-controllers-tests
* ltp-mm-tests
* ltp-open-posix-tests
* kvm-unit-tests
* rcutorture
* kunit
* kselftest-vsyscall-mode-native-
* kselftest-vsyscall-mode-none-
* ssuite
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Greg Kroah-Hartman
maintainerQuoted 20 lines · Naresh Kamboju
Quoted 19 lines · On Mon, 15 Mar 2021 at 19:27, <[email protected]> wrote:
From: Greg Kroah-Hartman <[email protected]>
This is the start of the stable review cycle for the 5.11.7 release. There are 306 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 Mar 2021 13:54:26 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.11.7-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.11.y
and the diffstat can be found below.thanks,
Quoted 7 lines
Quoted 1 line
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm,x86_64, and i386.
Thanks for testing them all and letting me know.
greg k-h
Quoted 10 lines · On Mon, Mar 15, 2021 at 02:51:03PM +0100, [email protected] wrote:
From: Greg Kroah-Hartman <[email protected]>
This is the start of the stable review cycle for the 5.11.7 release. There are 306 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 Mar 2021 13:54:26 +0000. Anything received after that time might be too late.
Build results:
total: 155 pass: 155 fail: 0 Qemu test results: total: 436 pass: 436 fail: 0
Guenter
Greg KH
maintainerQuoted 12 lines · Guenter Roeck
Quoted 10 lines · On Mon, Mar 15, 2021 at 02:51:03PM +0100, [email protected] wrote:
From: Greg Kroah-Hartman <[email protected]>
This is the start of the stable review cycle for the 5.11.7 release. There are 306 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 Mar 2021 13:54:26 +0000. Anything received after that time might be too late.
Quoted 6 lines
Build results:
total: 155 pass: 155 fail: 0 Qemu test results: total: 436 pass: 436 fail: 0Tested-by Guenter Roeck <[email protected]>
Thanks for testing them all and letting me know.
greg k-h
Quoted 7 lines · On Mon, Mar 15, 2021 at 02:51:03PM +0100, [email protected] wrote:
From: Greg Kroah-Hartman <[email protected]>
This is the start of the stable review cycle for the 5.11.7 release. There are 306 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Compiled and booted with no regressions on x86_64.
thanks,
Ross