Re: [RFC PATCH v2 0/3] meminfo_extra: introduce meminfo extra

2020-03-25 Thread Alexey Dobriyan
On Mon, Mar 23, 2020 at 05:05:00PM +0900, Jaewon Kim wrote: > /proc/meminfo or show_free_areas does not show full system wide memory > usage status because memory stats do not track all memory allocations. > There seems to be huge hidden memory especially on embedded system. It > is because some HW

Re: [RFC PATCH v2 1/3] meminfo_extra: introduce meminfo extra

2020-03-25 Thread Alexey Dobriyan
On Tue, Mar 24, 2020 at 12:46:45PM +0100, Greg KH wrote: > On Tue, Mar 24, 2020 at 08:37:38PM +0900, Jaewon Kim wrote: > > I don't know other cases in other platform. > > Not desperately needed but I think we need one userspace knob to see > > overall hidden huge memory. > > Why? Who wants tha

Re: [PATCH v7 0/4] support reserving crashkernel above 4G on arm64 kdump

2020-03-25 Thread Chen Zhou
Hi all, Friendly ping... On 2019/12/23 23:23, Chen Zhou wrote: > This patch series enable reserving crashkernel above 4G in arm64. > > There are following issues in arm64 kdump: > 1. We use crashkernel=X to reserve crashkernel below 4G, which will fail > when there is no enough low memory. > 2.

[PATCH v9 00/18] arm64: MMU enabled kexec relocation

2020-03-25 Thread Pavel Tatashin
Changelog: v9: - 9 patches from previous series landed in upstream, so now series is smaller - Added two patches from James Morse to address idmap issues for machines with high physical addresses. - Addressed comments from Selin Dag about compiling issues.

[PATCH v9 01/18] arm64: kexec: make dtb_mem always enabled

2020-03-25 Thread Pavel Tatashin
Currently, dtb_mem is enabled only when CONFIG_KEXEC_FILE is enabled. This adds ugly ifdefs to c files. Always enabled dtb_mem, when it is not used, it is NULL. Change the dtb_mem to phys_addr_t, as it is a physical address. Signed-off-by: Pavel Tatashin --- arch/arm64/include/asm/kexec.h|

[PATCH v9 02/18] arm64: hibernate: move page handling function to new trans_pgd.c

2020-03-25 Thread Pavel Tatashin
Now, that we abstracted the required functions move them to a new home. Later, we will generalize these function in order to be useful outside of hibernation. Signed-off-by: Pavel Tatashin --- arch/arm64/Kconfig | 4 + arch/arm64/include/asm/trans_pgd.h | 21 +++ arch/arm64/ke

[PATCH v9 03/18] arm64: trans_pgd: make trans_pgd_map_page generic

2020-03-25 Thread Pavel Tatashin
kexec is going to use a different allocator, so make trans_pgd_map_page to accept allocator as an argument, and also kexec is going to use a different map protection, so also pass it via argument. Signed-off-by: Pavel Tatashin Reviewed-by: Matthias Brugger --- arch/arm64/include/asm/trans_pgd.h

[PATCH v9 04/18] arm64: trans_pgd: pass allocator trans_pgd_create_copy

2020-03-25 Thread Pavel Tatashin
Make trans_pgd_create_copy and its subroutines to use allocator that is passed as an argument Signed-off-by: Pavel Tatashin --- arch/arm64/include/asm/trans_pgd.h | 4 +-- arch/arm64/kernel/hibernate.c | 7 - arch/arm64/mm/trans_pgd.c | 44 ++ 3 fi

[PATCH v9 07/18] arm64: trans_pgd: hibernate: idmap the single page that holds the copy page routines

2020-03-25 Thread Pavel Tatashin
From: James Morse To resume from hibernate, the contents of memory are restored from the swap image. This may overwrite any page, including the running kernel and its page tables. Hibernate copies the code it uses to do the restore into a single page that it knows won't be overwritten, and maps

[PATCH v9 06/18] arm64: mm: Always update TCR_EL1 from __cpu_set_tcr_t0sz()

2020-03-25 Thread Pavel Tatashin
From: James Morse Because only the idmap sets a non-standard T0SZ, __cpu_set_tcr_t0sz() can check for platforms that need to do this using __cpu_uses_extended_idmap() before doing its work. The idmap is only built with enough levels, (and T0SZ bits) to map its single page. To allow hibernate, a

[PATCH v9 05/18] arm64: trans_pgd: pass NULL instead of init_mm to *_populate functions

2020-03-25 Thread Pavel Tatashin
trans_pgd_* should be independent from mm context because the tables that are created by this code are used when there are no mm context around, as it is between kernels. Simply replace mm_init's with NULL. Signed-off-by: Pavel Tatashin --- arch/arm64/mm/trans_pgd.c | 12 ++-- 1 file cha

[PATCH v9 09/18] arm64: kexec: call kexec_image_info only once

2020-03-25 Thread Pavel Tatashin
Currently, kexec_image_info() is called during load time, and right before kernel is being kexec'ed. There is no need to do both. So, call it only once when segments are loaded and the physical location of page with copy of arm64_relocate_new_kernel is known. Signed-off-by: Pavel Tatashin --- ar

[PATCH v9 08/18] arm64: kexec: move relocation function setup

2020-03-25 Thread Pavel Tatashin
Currently, kernel relocation function is configured in machine_kexec() at the time of kexec reboot by using control_code_page. This operation, however, is more logical to be done during kexec_load, and thus remove from reboot time. Move, setup of this function to newly added machine_kexec_post_loa

[PATCH v9 11/18] arm64: kexec: arm64_relocate_new_kernel clean-ups

2020-03-25 Thread Pavel Tatashin
Remove excessive empty lines from arm64_relocate_new_kernel. Also, use comments on the same lines with instructions where appropriate. Change ENDPROC to END it never returns. copy_page(dest, src, tmps...) Increments dest and src by PAGE_SIZE, so no need to store dest prior to calling copy_page an

[PATCH v9 10/18] arm64: kexec: cpu_soft_restart change argument types

2020-03-25 Thread Pavel Tatashin
Change argument types from unsigned long to a more descriptive phys_addr_t. Signed-off-by: Pavel Tatashin --- arch/arm64/kernel/cpu-reset.h | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/arm64/kernel/cpu-reset.h b/arch/arm64/kernel/cpu-reset.h index ed50e

[PATCH v9 14/18] arm64: kexec: offset for relocation function

2020-03-25 Thread Pavel Tatashin
Soon, relocation function will share the same page with EL2 vectors. Add offset within this page to arm64_relocate_new_kernel, and also the total size of relocation code which will include both the function and the EL2 vectors. Signed-off-by: Pavel Tatashin --- arch/arm64/include/asm/kexec.h

[PATCH v9 13/18] arm64: kexec: add expandable argument to relocation function

2020-03-25 Thread Pavel Tatashin
Currently, kexec relocation function (arm64_relocate_new_kernel) accepts the following arguments: head: start of array that contains relocation information. entry: entry point for new kernel or purgatory. dtb_mem:first and only argument to entry. The number of arguments

[PATCH v9 12/18] arm64: kexec: arm64_relocate_new_kernel don't use x0 as temp

2020-03-25 Thread Pavel Tatashin
x0 will contain the only argument to arm64_relocate_new_kernel; don't use it as a temp. Reassigned registers to free-up x0. Signed-off-by: Pavel Tatashin --- arch/arm64/kernel/relocate_kernel.S | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/ar

[PATCH v9 15/18] arm64: kexec: kexec EL2 vectors

2020-03-25 Thread Pavel Tatashin
If we have a EL2 mode without VHE, the EL2 vectors are needed in order to switch to EL2 and jump to new world with hyperivsor privileges. Signed-off-by: Pavel Tatashin --- arch/arm64/include/asm/kexec.h | 5 + arch/arm64/kernel/asm-offsets.c | 1 + arch/arm64/kernel/machine_kexec.

[PATCH v9 17/18] arm64: kexec: enable MMU during kexec relocation

2020-03-25 Thread Pavel Tatashin
Now, that we have transitional page tables configured, temporarily enable MMU to allow faster relocation of segments to final destination. The performance data: for a moderate size kernel + initramfs: 25M the relocation was taking 0.382s, with enabled MMU it now takes 0.019s only or x20 improvemen

[PATCH v9 18/18] arm64: kexec: remove head from relocation argument

2020-03-25 Thread Pavel Tatashin
Now, that relocation is done using virtual addresses, reloc_arg->head is not needed anymore. Signed-off-by: Pavel Tatashin --- arch/arm64/include/asm/kexec.h| 2 -- arch/arm64/kernel/asm-offsets.c | 1 - arch/arm64/kernel/machine_kexec.c | 1 - 3 files changed, 4 deletions(-) diff --git a

[PATCH v9 16/18] arm64: kexec: configure trans_pgd page table for kexec

2020-03-25 Thread Pavel Tatashin
Configure a page table located in kexec-safe memory that has the following mappings: 1. identity mapping for text of relocation function with executable permission. 2. linear mappings for all source ranges 3. linear mappings for all destination ranges. Signed-off-by: Pavel Tatashin --- arch/