Re: [PATCH v17 00/15] arm64: MMU enabled kexec relocation

2021-09-29 Thread Pasha Tatashin
> FWIW, I'm fine with this series. I think the only concern raised by > James and not addressed is the possibility of the failure of the memory > allocation for copying the page tables during kexec. If anyone will > complain in the future, we can look into adding a fallback mechanism to > do the

Re: [PATCH v17 00/15] arm64: MMU enabled kexec relocation

2021-09-29 Thread Pasha Tatashin
On Wed, Sep 29, 2021 at 8:49 AM Will Deacon wrote: > > On Thu, Sep 16, 2021 at 07:13:10PM -0400, Pasha Tatashin wrote: > > Changelog: > > v17: > > - Merged with 5.15-rc1 as requested by Catalin Marinas > > - Added Tested-by: Pingfan Liu > > This looks pretty good to me. I've left

Re: [PATCH v17 15/15] arm64: trans_pgd: remove trans_pgd_map_page()

2021-09-29 Thread Pasha Tatashin
On Wed, Sep 29, 2021 at 12:43 PM Catalin Marinas wrote: > > On Thu, Sep 16, 2021 at 07:13:25PM -0400, Pasha Tatashin wrote: > > The intend of trans_pgd_map_page() was to map contiguous range of VA > > memory to the memory that is getting relocated during kexec. However, > > since we are now using

Re: [PATCH v17 10/15] arm64: kexec: use ld script for relocation function

2021-09-29 Thread Pasha Tatashin
Sorry, missed two comments: > > /* Flush the reloc_code in preparation for its execution. */ > > dcache_clean_inval_poc((unsigned long)reloc_code, > > -(unsigned long)reloc_code + > > -arm64_relocate_new_kernel_size); > > +

Re: [PATCH v17 10/15] arm64: kexec: use ld script for relocation function

2021-09-29 Thread Pasha Tatashin
On Wed, Sep 29, 2021 at 8:45 AM Will Deacon wrote: > > On Thu, Sep 16, 2021 at 07:13:20PM -0400, Pasha Tatashin wrote: > > Currently, relocation code declares start and end variables > > which are used to compute its size. > > > > The better way to do this is to use ld script incited, and put

Re: [PATCH v17 08/15] arm64: kexec: configure EL2 vectors for kexec

2021-09-29 Thread Pasha Tatashin
> > +/* Allocates pages for kexec page table */ > > +static void *kexec_page_alloc(void *arg) > > +{ > > + struct kimage *kimage = (struct kimage *)arg; > > + struct page *page = kimage_alloc_control_pages(kimage, 0); > > + > > + if (!page) > > + return NULL; > > + > > +

Re: [PATCH v17 05/15] arm64: kexec: skip relocation code for inplace kexec

2021-09-29 Thread Pasha Tatashin
Hi Will, > > + cpu_install_idmap(); > > + restart = (void > > *)__pa_symbol(function_nocfi(__cpu_soft_restart)); > > + restart(is_hyp_nvhe(), kimage->start, kimage->arch.dtb_mem, > > + 0, 0); > > Why can't you call: > >

Re: [PATCH v17 00/15] arm64: MMU enabled kexec relocation

2021-09-29 Thread Catalin Marinas
On Thu, Sep 16, 2021 at 07:13:10PM -0400, Pasha Tatashin wrote: > Pasha Tatashin (15): > arm64: kernel: add helper for booted at EL2 and not VHE > arm64: trans_pgd: hibernate: Add trans_pgd_copy_el2_vectors > arm64: hibernate: abstract ttrb0 setup function > arm64: kexec: flush image and

Re: [PATCH v1 3/4] memblock: add MEMBLOCK_DRIVER_MANAGED to mimic IORESOURCE_SYSRAM_DRIVER_MANAGED

2021-09-29 Thread David Hildenbrand
On 29.09.21 18:39, Mike Rapoport wrote: Hi, On Mon, Sep 27, 2021 at 05:05:17PM +0200, David Hildenbrand wrote: Let's add a flag that corresponds to IORESOURCE_SYSRAM_DRIVER_MANAGED. Similar to MEMBLOCK_HOTPLUG, most infrastructure has to treat such memory like ordinary MEMBLOCK_NONE memory --

Re: [PATCH v17 15/15] arm64: trans_pgd: remove trans_pgd_map_page()

2021-09-29 Thread Catalin Marinas
On Thu, Sep 16, 2021 at 07:13:25PM -0400, Pasha Tatashin wrote: > The intend of trans_pgd_map_page() was to map contiguous range of VA > memory to the memory that is getting relocated during kexec. However, > since we are now using linear map instead of contiguous range this > function is not

Re: [PATCH v1 3/4] memblock: add MEMBLOCK_DRIVER_MANAGED to mimic IORESOURCE_SYSRAM_DRIVER_MANAGED

2021-09-29 Thread Mike Rapoport
Hi, On Mon, Sep 27, 2021 at 05:05:17PM +0200, David Hildenbrand wrote: > Let's add a flag that corresponds to IORESOURCE_SYSRAM_DRIVER_MANAGED. > Similar to MEMBLOCK_HOTPLUG, most infrastructure has to treat such memory > like ordinary MEMBLOCK_NONE memory -- for example, when selecting memory >

Re: [PATCH v1 2/4] memblock: allow to specify flags with memblock_add_node()

2021-09-29 Thread David Hildenbrand
On 29.09.21 18:25, Mike Rapoport wrote: On Mon, Sep 27, 2021 at 05:05:16PM +0200, David Hildenbrand wrote: We want to specify flags when hotplugging memory. Let's prepare to pass flags to memblock_add_node() by adjusting all existing users. Note that when hotplugging memory the system is

Re: [PATCH v1 2/4] memblock: allow to specify flags with memblock_add_node()

2021-09-29 Thread Mike Rapoport
On Mon, Sep 27, 2021 at 05:05:16PM +0200, David Hildenbrand wrote: > We want to specify flags when hotplugging memory. Let's prepare to pass > flags to memblock_add_node() by adjusting all existing users. > > Note that when hotplugging memory the system is already up and running > and we don't

Re: [PATCH 2/2] arm64: kexec_file: use more system keyrings to verify kernel image signature

2021-09-29 Thread Will Deacon
On Mon, Sep 27, 2021 at 08:50:04AM +0800, Coiby Xu wrote: > From: Coiby Xu > > This allows to verify arm64 kernel image signature using not only > .builtin_trusted_keys but also .secondary_trusted_keys and .platform keyring. > > Signed-off-by: Coiby Xu > --- > arch/arm64/kernel/kexec_image.c

Re: [PATCH v1 2/8] x86/xen: simplify xen_oldmem_pfn_is_ram()

2021-09-29 Thread David Hildenbrand
On 29.09.21 16:22, Boris Ostrovsky wrote: On 9/29/21 5:03 AM, David Hildenbrand wrote: On 29.09.21 10:45, David Hildenbrand wrote: Can we go one step further and do @@ -20,24 +20,11 @@ static int xen_oldmem_pfn_is_ram(unsigned long pfn)   struct xen_hvm_get_mem_type a = {    

Re: [PATCH v1 2/8] x86/xen: simplify xen_oldmem_pfn_is_ram()

2021-09-29 Thread Boris Ostrovsky
On 9/29/21 5:03 AM, David Hildenbrand wrote: > On 29.09.21 10:45, David Hildenbrand wrote: >>> >> Can we go one step further and do >> >> >> @@ -20,24 +20,11 @@ static int xen_oldmem_pfn_is_ram(unsigned long pfn) >>   struct xen_hvm_get_mem_type a = { >>   .domid =

Re: [PATCH v17 00/15] arm64: MMU enabled kexec relocation

2021-09-29 Thread Will Deacon
On Thu, Sep 16, 2021 at 07:13:10PM -0400, Pasha Tatashin wrote: > Changelog: > v17: > - Merged with 5.15-rc1 as requested by Catalin Marinas > - Added Tested-by: Pingfan Liu This looks pretty good to me. I've left some minor comments on a few of the patches, but other than those I'd

Re: [PATCH v17 10/15] arm64: kexec: use ld script for relocation function

2021-09-29 Thread Will Deacon
On Thu, Sep 16, 2021 at 07:13:20PM -0400, Pasha Tatashin wrote: > Currently, relocation code declares start and end variables > which are used to compute its size. > > The better way to do this is to use ld script incited, and put relocation > function in its own section. "incited"? I don't

Re: [PATCH v17 08/15] arm64: kexec: configure EL2 vectors for kexec

2021-09-29 Thread Will Deacon
On Thu, Sep 16, 2021 at 07:13:18PM -0400, Pasha Tatashin wrote: > 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 hypervisor privileges. > > In preparation to MMU enabled relocation, configure our EL2 table now. > > Kexec uses

Re: [PATCH v17 05/15] arm64: kexec: skip relocation code for inplace kexec

2021-09-29 Thread Will Deacon
On Thu, Sep 16, 2021 at 07:13:15PM -0400, Pasha Tatashin wrote: > In case of kdump or when segments are already in place the relocation > is not needed, therefore the setup of relocation function and call to > it can be skipped. > > Signed-off-by: Pasha Tatashin > Suggested-by: James Morse >

Re: [PATCH v1 2/8] x86/xen: simplify xen_oldmem_pfn_is_ram()

2021-09-29 Thread David Hildenbrand
On 29.09.21 10:45, David Hildenbrand wrote: How about     return a.mem_type != HVMMEM_mmio_dm; Ha, how could I have missed that :) Result should be promoted to int and this has added benefit of not requiring changes in patch 4. Can we go one step further and do @@ -20,24 +20,11

Re: [PATCH v1 2/8] x86/xen: simplify xen_oldmem_pfn_is_ram()

2021-09-29 Thread David Hildenbrand
How about     return a.mem_type != HVMMEM_mmio_dm; Ha, how could I have missed that :) Result should be promoted to int and this has added benefit of not requiring changes in patch 4. Can we go one step further and do @@ -20,24 +20,11 @@ static int xen_oldmem_pfn_is_ram(unsigned

Re: [PATCH v1 8/8] virtio-mem: kdump mode to sanitize /proc/vmcore access

2021-09-29 Thread David Hildenbrand
[...] + +static bool virtio_mem_vmcore_pfn_is_ram(struct vmcore_cb *cb, +unsigned long pfn) +{ + struct virtio_mem *vm = container_of(cb, struct virtio_mem, +vmcore_cb); + uint64_t addr =

[PATCH] kexec-tools:Add some necessary free() calls

2021-09-29 Thread Kai Song
free should be called before the function exit abnormally. Signed-off-by: Kai Song --- kexec/kexec-uImage.c | 10 -- util_lib/elf_info.c | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/kexec/kexec-uImage.c b/kexec/kexec-uImage.c index 4be..016be10 100644

[PATCH] kexec:Add some necessary fclose() calls

2021-09-29 Thread Kai Song
fclose should be called before function exits Signed-off-by: Kai Song --- kexec/arch/ppc/fixup_dtb.c | 2 ++ kexec/arch/ppc64/crashdump-ppc64.c | 1 + kexec/arch/ppc64/kexec-ppc64.c | 4 +++- kexec/symbols.c| 2 ++ 4 files changed, 8 insertions(+), 1 deletion(-)