Re: [PATCH v4 7/8] linux/log2.h: Fix 64bit calculations in roundup/down_pow_two()

2019-12-04 Thread Lu Baolu
Hi, On 12/3/19 7:47 PM, Nicolas Saenz Julienne wrote: Some users need to make sure their rounding function accepts and returns 64bit long variables regardless of the architecture. Sadly roundup/rounddown_pow_two() takes and returns unsigned longs. It turns out ilog2() already handles 32/64bit

RE: [PATCH] makedumpfile/Makefile: remove -lebl from LIBS

2019-12-04 Thread Kazuhito Hagio
Hi Pingfan, Thank you for the patch. > -Original Message- > since the following commit, -lebl has been removed from elfutils. > commit b833c731359af12af9f16bcb621b3cdc170eafbc > Author: Mark Wielaard > Date: Thu Aug 29 23:34:11 2019 +0200 > > libebl: Don't install libebl.a,

Re: [PATCH v2 3/3] arm64: kexec_file: add crash dump support

2019-12-04 Thread Bhupesh Sharma
On 11/14/2019 10:45 AM, AKASHI Takahiro wrote: Enabling crash dump (kdump) includes * prepare contents of ELF header of a core dump file, /proc/vmcore, using crash_prepare_elf64_headers(), and * add two device tree properties, "linux,usable-memory-range" and "linux,elfcorehdr", which

Re: [PATCH v2 1/3] libfdt: define UINT32_MAX in libfdt_env.h

2019-12-04 Thread Bhupesh Sharma
Hi Akashi, On 11/14/2019 10:45 AM, AKASHI Takahiro wrote: In the implementation of kexec_file_load-based kdump for arm64, fdt_appendprop_addrrange() will be used, but fdt_addresses.c will fail to compile due to missing UINT32_MAX. So just define it in libfdt_env.h. Signed-off-by: AKASHI

Re: [PATCH v2 0/3] arm64: kexec_file: add kdump

2019-12-04 Thread Bhupesh Sharma
Hi Akashi, Thanks for the patchset. On 11/14/2019 10:45 AM, AKASHI Takahiro wrote: This is the last piece of my kexec_file_load implementation for arm64. It is now ready for being merged as some relevant patch to dtc/libfdt[1] has finally been integrated in v5.3-rc1. (Nothing changed since

Re: [PATCH] efi/memreserve: register reservations as 'reserved' in /proc/iomem

2019-12-04 Thread Bhupesh SHARMA
Hello Masa, (+Cc Simon) On Thu, Dec 5, 2019 at 12:27 AM Masayoshi Mizuma wrote: > > On Wed, Dec 04, 2019 at 06:17:59PM +, James Morse wrote: > > Hi Masa, > > > > On 04/12/2019 17:17, Masayoshi Mizuma wrote: > > > Thank you for sending the patch, but unfortunately it doesn't work for > > >

Re: [PATCH] efi/memreserve: register reservations as 'reserved' in /proc/iomem

2019-12-04 Thread Masayoshi Mizuma
On Wed, Dec 04, 2019 at 06:17:59PM +, James Morse wrote: > Hi Masa, > > On 04/12/2019 17:17, Masayoshi Mizuma wrote: > > Thank you for sending the patch, but unfortunately it doesn't work for the > > issue... > > > > After applied your patch, the LPI tables are marked as reserved in > >

Re: [PATCH] efi/memreserve: register reservations as 'reserved' in /proc/iomem

2019-12-04 Thread James Morse
Hi Masa, On 04/12/2019 17:17, Masayoshi Mizuma wrote: > Thank you for sending the patch, but unfortunately it doesn't work for the > issue... > > After applied your patch, the LPI tables are marked as reserved in > /proc/iomem like as: > > 8030-a1fd : System RAM > 8048-8134 :

RE: [PATCH v4 4/4] makedumpfile: Mark --mem-usage option unsupported for arm64

2019-12-04 Thread Kazuhito Hagio
> -Original Message- > This patch marks '--mem-usage' option as unsupported for arm64 > architecture. > > With the newer arm64 kernels supporting 48-bit/52-bit VA address spaces > and keeping a single binary for supporting the same, the address of > kernel symbols like _stext which could

RE: [PATCH v4 3/4] makedumpfile/arm64: Add support for ARMv8.2-LVA (52-bit kernel VA support)

2019-12-04 Thread Kazuhito Hagio
> -Original Message- > With ARMv8.2-LVA architecture extension availability, arm64 hardware > which supports this extension can support upto 52-bit virtual > addresses. It is specially useful for having a 52-bit user-space virtual > address space while the kernel can still retain

RE: [PATCH v4 2/4] makedumpfile/arm64: Add support for ARMv8.2-LPA (52-bit PA support)

2019-12-04 Thread Kazuhito Hagio
> -Original Message- > ARMv8.2-LPA architecture extension (if available on underlying hardware) > can support 52-bit physical addresses, while the kernel virtual > addresses remain 48-bit. > > Make sure that we read the 52-bit PA address capability from > 'MAX_PHYSMEM_BITS' variable (if

RE: [PATCH v4 1/4] tree-wide: Retrieve 'MAX_PHYSMEM_BITS' from vmcoreinfo (if available)

2019-12-04 Thread Kazuhito Hagio
Hi Bhupesh, Sorry for the late reply. > -Original Message- > This patch adds a common feature for archs (except arm64, for which > similar support is added via subsequent patch) to retrieve > 'MAX_PHYSMEM_BITS' from vmcoreinfo (if available). We already have the calibrate_machdep_info()

Re: [PATCH] efi/memreserve: register reservations as 'reserved' in /proc/iomem

2019-12-04 Thread Masayoshi Mizuma
Hello Ard, Thank you for sending the patch, but unfortunately it doesn't work for the issue... After applied your patch, the LPI tables are marked as reserved in /proc/iomem like as: 8030-a1fd : System RAM 8048-8134 : Kernel code 8135-817b : reserved

[PATCH v8 23/25] arm64: kexec: configure trans_pgd page table for kexec

2019-12-04 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. identity mapping for argument for relocation function. 3. linear mappings for all source ranges 4. linear mappings for all

[PATCH v8 20/25] arm64: kexec: add expandable argument to relocation function

2019-12-04 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

[PATCH v8 22/25] arm64: kexec: kexec EL2 vectors

2019-12-04 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 +

[PATCH v8 19/25] arm64: kexec: arm64_relocate_new_kernel don't use x0 as temp

2019-12-04 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

[PATCH v8 25/25] arm64: kexec: remove head from relocation argument

2019-12-04 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

[PATCH v8 24/25] arm64: kexec: enable MMU during kexec relocation

2019-12-04 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

[PATCH v8 21/25] arm64: kexec: offset for relocation function

2019-12-04 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 v8 18/25] arm64: kexec: arm64_relocate_new_kernel clean-ups

2019-12-04 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

[PATCH v8 15/25] arm64: kexec: move relocation function setup

2019-12-04 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

[PATCH v8 17/25] arm64: kexec: cpu_soft_restart change argument types

2019-12-04 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

[PATCH v8 16/25] arm64: kexec: call kexec_image_info only once

2019-12-04 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 ---

[PATCH v8 13/25] arm64: trans_pgd: pass allocator trans_pgd_create_copy

2019-12-04 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

[PATCH v8 12/25] arm64: trans_pgd: make trans_pgd_map_page generic

2019-12-04 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 ---

[PATCH v8 14/25] arm64: trans_pgd: pass NULL instead of init_mm to *_populate functions

2019-12-04 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

[PATCH v8 11/25] arm64: hibernate: move page handling function to new trans_pgd.c

2019-12-04 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 | 20 +++

[PATCH v8 10/25] arm64: hibernate: add trans_pgd public functions

2019-12-04 Thread Pavel Tatashin
trans_pgd_create_copy() and trans_pgd_map_page() are going to be the basis for new shared code that handles page tables for cases which are between kernels: kexec, and hibernate. Note: Eventually, get_safe_page() will be moved into a function pointer passed via argument, but for now keep it as

[PATCH v8 08/25] arm64: hibernate: rename dst to page in create_safe_exec_page

2019-12-04 Thread Pavel Tatashin
create_safe_exec_page() allocates a safe page and maps it at a specific location, also this function returns the physical address of newly allocated page. The destination VA, and PA are specified in arguments: dst_addr, phys_dst_addr However, within the function it uses "dst" which has unsigned

[PATCH v8 09/25] arm64: hibernate: add PUD_SECT_RDONLY

2019-12-04 Thread Pavel Tatashin
There is PMD_SECT_RDONLY that is used in pud_* function which is confusing. Signed-off-by: Pavel Tatashin Acked-by: James Morse --- arch/arm64/include/asm/pgtable-hwdef.h | 1 + arch/arm64/kernel/hibernate.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git

[PATCH v8 05/25] arm64: hibernate: pass the allocated pgdp to ttbr0

2019-12-04 Thread Pavel Tatashin
ttbr0 should be set to the beginning of pgdp, however, currently in create_safe_exec_page it is set to pgdp after pgd_offset_raw(), which works by accident. Signed-off-by: Pavel Tatashin Reviewed-by: James Morse --- arch/arm64/kernel/hibernate.c | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH v8 06/25] arm64: hibernate: use get_safe_page directly

2019-12-04 Thread Pavel Tatashin
create_safe_exec_page() uses hibernate's allocator to create a set of page table to map a single page that will contain the relocation code. Remove the allocator related arguments, and use get_safe_page directly, as it is done in other local functions in this file to simplify function prototype.

[PATCH v8 04/25] arm64: kexec: make dtb_mem always enabled

2019-12-04 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 v8 07/25] arm64: hibernate: remove gotos as they are not needed

2019-12-04 Thread Pavel Tatashin
Usually, gotos are used to handle cleanup after exception, but in case of create_safe_exec_page and swsusp_arch_resume there are no clean-ups. So, simply return the errors directly. Signed-off-by: Pavel Tatashin Reviewed-by: James Morse --- arch/arm64/kernel/hibernate.c | 49

[PATCH v8 00/25] arm64: MMU enabled kexec relocation

2019-12-04 Thread Pavel Tatashin
Many changes compared to version 6, so I decided to send it out now. James Morse raised an important issue to which I do not have a solution yet. But would like to discuss it. --- https://lore.kernel.org/lkml/45a2f0b8-5bac-8b5d-d595-f92e9acb2...@arm.com > + /* Map relocation function va == pa

[PATCH v8 02/25] kexec: add machine_kexec_post_load()

2019-12-04 Thread Pavel Tatashin
It is the same as machine_kexec_prepare(), but is called after segments are loaded. This way, can do processing work with already loaded relocation segments. One such example is arm64: it has to have segments loaded in order to create a page table, but it cannot do it during kexec time, because at

[PATCH v8 03/25] arm64: kexec: remove unnecessary debug prints

2019-12-04 Thread Pavel Tatashin
The kexec_image_info() outputs all the necessary information about the upcoming kexec. The extra debug printfs in machine_kexec() are not needed. Signed-off-by: Pavel Tatashin --- arch/arm64/kernel/machine_kexec.c | 12 1 file changed, 12 deletions(-) diff --git

[PATCH v8 01/25] kexec: quiet down kexec reboot

2019-12-04 Thread Pavel Tatashin
Here is a regular kexec command sequence and output: = $ kexec --reuse-cmdline -i --load Image $ kexec -e [ 161.342002] kexec_core: Starting new kernel Welcome to Buildroot buildroot login: = Even when "quiet" kernel parameter is specified, "kexec_core: Starting new kernel" is printed.

[PATCH] efi/memreserve: register reservations as 'reserved' in /proc/iomem

2019-12-04 Thread Ard Biesheuvel
Memory regions that are reserved using efi_mem_reserve_persistent() are recorded in a special EFI config table which survives kexec, allowing the incoming kernel to honour them as well. However, such reservations are not visible in /proc/iomem, and so the kexec tools that load the incoming kernel

Re: [RFC PATCH v5 2/3] printk-rb: new printk ringbuffer implementation (reader)

2019-12-04 Thread John Ogness
On 2019-12-04, Petr Mladek wrote: >> +} else if ((DATA_WRAPS(data_ring, blk_lpos->begin) + 1 == >> +DATA_WRAPS(data_ring, blk_lpos->next)) || >> + ((DATA_WRAPS(data_ring, blk_lpos->begin) == >> + DATA_WRAPS(data_ring, -1UL)) && >> +

Re: [RFC PATCH v5 2/3] printk-rb: new printk ringbuffer implementation (reader)

2019-12-04 Thread Petr Mladek
On Tue 2019-12-03 14:46:07, John Ogness wrote: > On 2019-12-03, Petr Mladek wrote: > >> Add the reader implementation for the new ringbuffer. > >> > >> Signed-off-by: John Ogness > >> --- > >> kernel/printk/printk_ringbuffer.c | 234 ++ > >>

Re: [PATCH] x86/efi: update e820 about reserved EFI boot services data to fix kexec breakage

2019-12-04 Thread Michael Weiser
Hello Dave, On Wed, Dec 04, 2019 at 03:59:17PM +0800, Dave Young wrote: > > Signed-off-by: Dave Young > > --- > > arch/x86/platform/efi/quirks.c |6 ++ > > 1 file changed, 2 insertions(+), 4 deletions(-) > > > > --- linux-x86.orig/arch/x86/platform/efi/quirks.c > > +++

Re: [PATCH v4 7/8] linux/log2.h: Fix 64bit calculations in roundup/down_pow_two()

2019-12-04 Thread Martin Habets
For the changes under drivers/net/ethernet/sfc: Reviewed-by: Martin Habets On 03/12/2019 11:47, Nicolas Saenz Julienne wrote: > Some users need to make sure their rounding function accepts and returns > 64bit long variables regardless of the architecture. Sadly > roundup/rounddown_pow_two()

Re: [PATCH] x86/efi: update e820 about reserved EFI boot services data to fix kexec breakage

2019-12-04 Thread Ard Biesheuvel
On Wed, 4 Dec 2019 at 10:14, Ingo Molnar wrote: > > > * Dave Young wrote: > > > On 12/04/19 at 03:52pm, Dave Young wrote: > > > Michael Weiser reported he got below error during a kexec rebooting: > > > esrt: Unsupported ESRT version 2904149718861218184. > > > > > > The ESRT memory stays in EFI

[tip: x86/urgent] x86/efi: Update e820 with reserved EFI boot services data to fix kexec breakage

2019-12-04 Thread tip-bot2 for Dave Young
The following commit has been merged into the x86/urgent branch of tip: Commit-ID: af164898482817a1d487964b68f3c21bae7a1beb Gitweb: https://git.kernel.org/tip/af164898482817a1d487964b68f3c21bae7a1beb Author:Dave Young AuthorDate:Wed, 04 Dec 2019 15:52:33 +08:00 Committer:

Re: [PATCH] x86/efi: update e820 about reserved EFI boot services data to fix kexec breakage

2019-12-04 Thread Ingo Molnar
* Dave Young wrote: > On 12/04/19 at 03:52pm, Dave Young wrote: > > Michael Weiser reported he got below error during a kexec rebooting: > > esrt: Unsupported ESRT version 2904149718861218184. > > > > The ESRT memory stays in EFI boot services data, and it was reserved > > in kernel via

Re: [PATCH] x86/efi: update e820 about reserved EFI boot services data to fix kexec breakage

2019-12-04 Thread Ingo Molnar
* Dave Young wrote: > On 12/04/19 at 03:52pm, Dave Young wrote: > > Michael Weiser reported he got below error during a kexec rebooting: > > esrt: Unsupported ESRT version 2904149718861218184. > > > > The ESRT memory stays in EFI boot services data, and it was reserved > > in kernel via

Re: [PATCH v2 0/2] efi: arm64: Introduce /proc/efi/memreserve to tell the persistent pages

2019-12-04 Thread Ard Biesheuvel
On Tue, 3 Dec 2019 at 20:14, Masayoshi Mizuma wrote: > > From: Masayoshi Mizuma > > kexec reboot sometime fails in early boot sequence on aarch64 machine. > That is because kexec overwrites the LPI property tables and pending > tables with the initrd. > > To avoid the overwrite, introduce

RE: [PATCH v2 2/2] efi: arm64: Introduce /proc/efi/memreserve to tell the persistent pages

2019-12-04 Thread d.hatay...@fujitsu.com
> -Original Message- > From: linux-kernel-ow...@vger.kernel.org > [mailto:linux-kernel-ow...@vger.kernel.org] On Behalf Of Masayoshi Mizuma > Sent: Wednesday, December 4, 2019 5:14 AM > To: Ard Biesheuvel ; > linux-arm-ker...@lists.infradead.org; linux-...@vger.kernel.org > Cc:

Re: [PATCH] x86/efi: update e820 about reserved EFI boot services data to fix kexec breakage

2019-12-04 Thread Dave Young
On 12/04/19 at 03:52pm, Dave Young wrote: > Michael Weiser reported he got below error during a kexec rebooting: > esrt: Unsupported ESRT version 2904149718861218184. > > The ESRT memory stays in EFI boot services data, and it was reserved > in kernel via efi_mem_reserve(). The initial purpose