Re: [RFCv2 0/9] UEFI emulator for kexec

2024-09-09 Thread Pingfan Liu
Hi Lennart, I spent some time understanding the systemd-pcrlock and TPM stuff, and got some idea about it. Could you correct me if I'm wrong? Please see the following comments inlined. On Mon, Aug 26, 2024 at 9:40 PM Lennart Poettering wrote: > > On Do, 22.08.24 22:29, Ping

Re: [RFCv2 0/9] UEFI emulator for kexec

2024-09-01 Thread Pingfan Liu
On Thu, Aug 29, 2024 at 1:08 AM Ard Biesheuvel wrote: > [...] Hi Ard, Thanks for sharing your insight and thoughts. > > Thanks for putting this RFC together. This is useful work, and gives > us food for thought and discussion. > > There are a few problems that become apparent when going through

Re: [RFCv2 0/9] UEFI emulator for kexec

2024-08-22 Thread Pingfan Liu
On Thu, Aug 22, 2024 at 4:23 PM Lennart Poettering wrote: > > On Do, 22.08.24 13:42, Pingfan Liu (pi...@redhat.com) wrote: > > > On Wed, Aug 21, 2024 at 10:27 PM Lennart Poettering > > wrote: > > > > > > On Mo, 19.08.24 22:53, Pingfan Liu (pi...@redhat.c

Re: [RFCv2 0/9] UEFI emulator for kexec

2024-08-22 Thread Pingfan Liu
On Thu, Aug 22, 2024 at 2:17 PM Dave Young wrote: > > On Thu, 22 Aug 2024 at 13:42, Pingfan Liu wrote: > > > > On Wed, Aug 21, 2024 at 10:27 PM Lennart Poettering > > wrote: > > > > > > On Mo, 19.08.24 22:53, Pingfan Liu (pi...@redha

Re: [RFCv2 0/9] UEFI emulator for kexec

2024-08-22 Thread Pingfan Liu
On Thu, Aug 22, 2024 at 4:23 PM Lennart Poettering wrote: > > On Do, 22.08.24 13:42, Pingfan Liu (pi...@redhat.com) wrote: > > > On Wed, Aug 21, 2024 at 10:27 PM Lennart Poettering > > wrote: > > > > > > On Mo, 19.08.24 22:53, Pingfan Liu (pi...@redhat.c

Re: [RFCv2 0/9] UEFI emulator for kexec

2024-08-21 Thread Pingfan Liu
On Wed, Aug 21, 2024 at 10:27 PM Lennart Poettering wrote: > > On Mo, 19.08.24 22:53, Pingfan Liu (pi...@redhat.com) wrote: > > > *** Background *** > > > > As more PE format kernel images are introduced, it post challenge to kexec > > to > > cope with t

[RFCv2 3/9] efi/emulator: Initial rountines to emulate EFI boot time service

2024-08-21 Thread Pingfan Liu
From: Pingfan Liu efi emulator aims to serve the kexec if the kernel wrapped by efistub. It is paired with efistub, so only implements the minimus set of EFI boot service which merely enough boots up efistub. To simplify the code, the task such as the building of page table etc is shift to the

[RFC 3/7] efi/emulator: Initial rountines to emulate EFI boot time service

2024-08-21 Thread Pingfan Liu
From: Pingfan Liu efi emulator aims to serve the kexec if the kernel wrapped by efistub. It is paired with efistub, so only implements the minimus set of EFI boot service which merely enough boots up efistub. To simplify the code, the task such as the building of page table etc is shift to the

Re: [RFC 3/7] efi/emulator: Initial rountines to emulate EFI boot time service

2024-08-21 Thread Pingfan Liu
On Thu, Jul 18, 2024 at 4:58 PM Pingfan Liu wrote: > > From: Pingfan Liu > > efi emulator aims to serve the kexec if the kernel wrapped by efistub. > It is paired with efistub, so only implements the minimus set of EFI boot > service which merely enough boots up efistub. > &

Re: [RFCv2 1/9] efi/libstub: Ask efi_random_alloc() to skip unusable memory

2024-08-19 Thread Pingfan Liu
On Tue, Aug 20, 2024 at 2:00 AM Jarkko Sakkinen wrote: > > On Mon Aug 19, 2024 at 5:53 PM EEST, Pingfan Liu wrote: > > efi_random_alloc() demands EFI_ALLOCATE_ADDRESS when allocate_pages(), > > but the current implement can not ensure the selected target locates > > insi

[RFCv2 9/9] arm64: kexec: Enable kexec_pe_image

2024-08-19 Thread Pingfan Liu
Now, anything is ready, enable PE image loading on arm64 Signed-off-by: Pingfan Liu Cc: Ard Biesheuvel Cc: Mark Rutland Cc: Will Deacon Cc: Catalin Marinas To: linux-arm-ker...@lists.infradead.org --- arch/arm64/Kconfig | 4 arch/arm64/kernel/machine_kexec_file.c

[RFCv2 8/9] arm64: kexec: Prepare page table for emulator

2024-08-19 Thread Pingfan Liu
kexec segments and efi runtime service. This reduces the memory consumption of page table. Signed-off-by: Pingfan Liu Cc: Ard Biesheuvel Cc: Mark Rutland Cc: Will Deacon Cc: Catalin Marinas To: linux-arm-ker...@lists.infradead.org --- arch/arm64/kernel/machine_kexec.c | 101

[RFCv2 7/9] arm64: mm: Change to prototype of

2024-08-19 Thread Pingfan Liu
allocator and hence of the __create_pgd_mapping_locked(). Signed-off-by: Pingfan Liu Cc: Ard Biesheuvel Cc: Mark Rutland Cc: Will Deacon Cc: Catalin Marinas To: linux-arm-ker...@lists.infradead.org --- arch/arm64/include/asm/mmu.h | 6 arch/arm64/mm/mmu.c | 67

[RFCv2 6/9] arm64: kexec: Introduce a new member param_mem to kimage_arch

2024-08-19 Thread Pingfan Liu
->dtb_mem as scratch and introduce another member 'param_mem' When booting vmlinux, param_mem equals dtb_mem. Signed-off-by: Pingfan Liu Cc: Catalin Marinas Cc: Will Deacon Cc: Mark Rutland Cc: Ard Biesheuvel To: linux-arm-ker...@lists.infradead.org --- arch/arm64/include/asm/kexec.

[RFCv2 4/9] efi/emulator: Turn on mmu for arm64

2024-08-19 Thread Pingfan Liu
]. After that, this patch can be drop. But let us focus on emulator itself and keep things simple for the time being. [1]: https://lore.kernel.org/linux-arm-kernel/20240328115656.24090-1-pi...@redhat.com/ Signed-off-by: Pingfan Liu Cc: Ard Biesheuvel Cc: Mark Rutland Cc: linux-arm-ker

[RFCv2 5/9] kexec: Introduce kexec_pe_image to parse and load PE file

2024-08-19 Thread Pingfan Liu
ne to set up identity map for all memory used in 'efi emulator' To do: This is a POC version, at present, it aims for arm64, later, it needs abstraction to cope with x86 Signed-off-by: Pingfan Liu Cc: Baoquan He Cc: Dave Young Cc: Eric Biederman Cc: Ard Biesheuvel Cc: lin

[RFCv2 1/9] efi/libstub: Ask efi_random_alloc() to skip unusable memory

2024-08-19 Thread Pingfan Liu
efi_random_alloc() demands EFI_ALLOCATE_ADDRESS when allocate_pages(), but the current implement can not ensure the selected target locates inside free area, that is to exclude EFI_BOOT_SERVICES_*, EFI_RUNTIME_SERVICES_* etc. Fix the issue by checking md->type. Signed-off-by: Pingfan Liu

[RFCv2 2/9] efi/libstub: Complete efi_simple_text_output_protocol

2024-08-19 Thread Pingfan Liu
Some uefi applications e.g systemd-stub uses more members in efi_simple_text_output_protocol, hence extending its members as UEFI specification. Signed-off-by: Pingfan Liu Cc: Ard Biesheuvel To: linux-...@vger.kernel.org --- drivers/firmware/efi/libstub/efistub.h | 7 +++ 1 file changed, 7

[RFCv2 0/9] UEFI emulator for kexec

2024-08-19 Thread Pingfan Liu
er.kernel.org Pingfan Liu (9): efi/libstub: Ask efi_random_alloc() to skip unusable memory efi/libstub: Complete efi_simple_text_output_protocol efi/emulator: Initial rountines to emulate EFI boot time service efi/emulator: Turn on mmu for arm64 kexec: Introduce kexec_pe_image to parse and

Re: [RFC 1/7] efi/libstub: Ask efi_random_alloc() to skip unusable memory

2024-07-19 Thread Pingfan Liu
On Fri, Jul 19, 2024 at 1:20 AM Jarkko Sakkinen wrote: > > On Thu, 2024-07-18 at 16:57 +0800, Pingfan Liu wrote: > > efi_random_alloc() demands EFI_ALLOCATE_ADDRESS when allocate_pages(), > > but the current implement can not ensure the selected target locates > > insi

Re: [RFC 0/7] UEFI emulator for kexec

2024-07-19 Thread Pingfan Liu
On Thu, Jul 18, 2024 at 4:58 PM Pingfan Liu wrote: > > > *** Background *** > > As more PE format kernel images are introduced, it post challenge to kexec to > cope with the new format. > > In my attempt to add support for arm64 zboot image in the kernel [1], > Ard sug

[RFC 5/7] arm64: mm: Change to prototype of

2024-07-18 Thread Pingfan Liu
allocator and hence of the __create_pgd_mapping_locked(). Signed-off-by: Pingfan Liu Cc: Ard Biesheuvel Cc: Jan Hendrik Farr Cc: Philipp Rudo Cc: Lennart Poettering Cc: Jarkko Sakkinen Cc: Baoquan He Cc: Dave Young Cc: Mark Rutland Cc: Will Deacon Cc: Catalin Marinas To: linux-arm-ker

[RFC 6/7] arm64: kexec: Prepare page table for emulator

2024-07-18 Thread Pingfan Liu
kexec segments, and this reduces the memory consumption of page table. Signed-off-by: Pingfan Liu Cc: Ard Biesheuvel Cc: Jan Hendrik Farr Cc: Philipp Rudo Cc: Lennart Poettering Cc: Jarkko Sakkinen Cc: Baoquan He Cc: Dave Young Cc: Mark Rutland Cc: Will Deacon Cc: Catalin Marinas To: linux

[RFC 4/7] efi/emulator: Turn on mmu for arm64

2024-07-18 Thread Pingfan Liu
]. After that, this patch can be drop. But let us focus on emulator itself and keep things simple for the time being. [1]: https://lore.kernel.org/linux-arm-kernel/20240328115656.24090-1-pi...@redhat.com/ Signed-off-by: Pingfan Liu Cc: Ard Biesheuvel Cc: Jan Hendrik Farr Cc: Philipp Rudo Cc

[RFC 2/7] debug/libstub: cheats to step around some boot service

2024-07-18 Thread Pingfan Liu
For POC, step around these four function, hence the corresponding boot services. Later those services should be implemented and this patch should be drop. Signed-off-by: Pingfan Liu Cc: Ard Biesheuvel Cc: Jan Hendrik Farr Cc: Philipp Rudo Cc: Lennart Poettering Cc: Jarkko Sakkinen Cc

[RFC 1/7] efi/libstub: Ask efi_random_alloc() to skip unusable memory

2024-07-18 Thread Pingfan Liu
efi_random_alloc() demands EFI_ALLOCATE_ADDRESS when allocate_pages(), but the current implement can not ensure the selected target locates inside free area, that is to exclude EFI_BOOT_SERVICES_*, EFI_RUNTIME_SERVICES_* etc. Fix the issue by checking md->type. Signed-off-by: Pingfan Liu

[RFC 0/7] UEFI emulator for kexec

2024-07-18 Thread Pingfan Liu
m-ker...@lists.infradead.org To: kexec@lists.infradead.org To: linux-...@vger.kernel.org Pingfan Liu (7): efi/libstub: Ask efi_random_alloc() to skip unusable memory debug/libstub: cheats to step around some boot service efi/emulator: Initial rountines to emulate EFI boot time service

Re: [PATCH v6 (proposal)] powerpc/cpu: enable nr_cpus for crash kernel

2024-01-29 Thread Pingfan Liu
26, 2024 at 3:40 AM Christophe Leroy wrote: > > Hi, > > Le 22/05/2018 à 10:23, Pingfan Liu a écrit : > > For kexec -p, the boot cpu can be not the cpu0, this causes the problem > > to alloc paca[]. In theory, there is no requirement to assign cpu's logical > > i

[PATCHv10 3/3] powerpc/smp: Allow hole in paca_ptrs to accommodate boot_cpu

2023-12-26 Thread Pingfan Liu
From: Pingfan Liu This patch always forces the first core onlined due to some subsystem needs cpu0. After core0, a hole may follow, then comes the crashed core. Signed-off-by: Pingfan Liu Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: Mahesh Salgaonkar Cc: Wen Xiong Cc

[PATCHv10 2/3] powerpc/kernel: Extend arrays' size to make room for a hole in cpu_possible_mask

2023-12-26 Thread Pingfan Liu
From: Pingfan Liu This patch aims to mark all the arrays which size is decided by nr_cpu_ids or num_possible_cpus(). Later if a hole is allowed in cpu_possible_mask, the corresponding array should extend to hold the last bit number in cpu_possible_mask. Signed-off-by: Pingfan Liu Cc: Michael

[PATCHv10 1/3] powerpc/kernel: Remove check on paca_ptrs_size

2023-12-26 Thread Pingfan Liu
From: Pingfan Liu Between early_setup()->allocate_paca_ptrs() and smp_setup_cpu_maps()->free_unused_pacas(), there is no call to set_nr_cpu_ids(), which means nr_cpu_ids is unchanged. Hence removing the check. Signed-off-by: Pingfan Liu Cc: Michael Ellerman Cc: Nicholas Pigg

[PATCHv10 0/3] enable nr_cpus for powerpc without re-ordering cpu number

2023-12-26 Thread Pingfan Liu
From: Pingfan Liu This series addresses the nr_cpus issue for PowerPC without re-ordering cpu number. To save the memory used by percpu area, it also limits the possible cpu numbers by allowing hole in cpu_possible_mask. Because the last cpu number will bigger than nr_cpu_ids in this way, some

[RFC 0/3] kdump: Check mem_map of CMA area in kdump

2023-12-17 Thread Pingfan Liu
From: Pingfan Liu First of all, this series is only for proof of concept. It only passes compilation. For years, CMA is proposed to be used as crashkernel reserved memory. But DIO prevent us to follow it since DMA may be in-flight and ruin the kdump kernel. This series exports the crash

[RFC 2/3] of: kexec: Set up properties for reusing CMA in kdump

2023-12-17 Thread Pingfan Liu
From: Pingfan Liu Signed-off-by: Pingfan Liu Cc: Jiri Bohac Cc: Michal Hocko Cc: Philipp Rudo Cc: Baoquan He Cc: Dave Young To: kexec@lists.infradead.org --- drivers/of/kexec.c| 14 ++ include/linux/kexec.h | 4 2 files changed, 18 insertions(+) diff --git a/drivers

[RFC 3/3] of: fdt: Parse properties of reusing CMA in kdump

2023-12-17 Thread Pingfan Liu
From: Pingfan Liu Signed-off-by: Pingfan Liu Cc: Jiri Bohac Cc: Michal Hocko Cc: Philipp Rudo Cc: Baoquan He Cc: Dave Young To: kexec@lists.infradead.org --- drivers/of/fdt.c | 43 +++ 1 file changed, 43 insertions(+) diff --git a/drivers/of/fdt.c

[RFC 1/3] crash_dump: Parse the CMA's mem_map in kdump

2023-12-17 Thread Pingfan Liu
From: Pingfan Liu Signed-off-by: Pingfan Liu Cc: Jiri Bohac Cc: Michal Hocko Cc: Philipp Rudo Cc: Baoquan He Cc: Dave Young To: kexec@lists.infradead.org --- include/linux/kexec.h | 1 + init/main.c | 4 +++ kernel/crash_dump.c | 80

[PATCH] Documentation: kdump: Clarify the default size of memory reserved by crashkernel low

2023-12-17 Thread Pingfan Liu
From: Pingfan Liu The default size reserved for crashkernel=,low is decided by the macro DEFAULT_CRASH_KERNEL_LOW_SIZE, which is based on arch. Signed-off-by: Pingfan Liu Cc: Baoquan He Cc: Dave Young To: kexec@lists.infradead.org To: linux-...@vger.kernel.org --- Documentation/admin-guide

Re: [PATCH 0/4] kdump: crashkernel reservation from CMA

2023-11-30 Thread Pingfan Liu
On Thu, Nov 30, 2023 at 9:43 PM Michal Hocko wrote: > > On Thu 30-11-23 21:33:04, Pingfan Liu wrote: > > On Thu, Nov 30, 2023 at 9:29 PM Michal Hocko wrote: > > > > > > On Thu 30-11-23 20:04:59, Baoquan He wrote: > > > > On 11/30/23 at 11:16am, Michal Ho

Re: [PATCH 0/4] kdump: crashkernel reservation from CMA

2023-11-30 Thread Pingfan Liu
On Thu, Nov 30, 2023 at 9:29 PM Michal Hocko wrote: > > On Thu 30-11-23 20:04:59, Baoquan He wrote: > > On 11/30/23 at 11:16am, Michal Hocko wrote: > > > On Thu 30-11-23 11:00:48, Baoquan He wrote: > > > [...] > > > > Now, we are worried if there's risk if the CMA area is retaken into > > > > kdu

Re: [PATCHv9 2/2] powerpc/setup: Loosen the mapping between cpu logical id and its seq in dt

2023-11-28 Thread Pingfan Liu
Hi Hari, On Mon, Nov 27, 2023 at 12:30 PM Hari Bathini wrote: > > Hi Pingfan, Michael, > > On 17/10/23 4:03 pm, Hari Bathini wrote: > > > > > > On 17/10/23 7:58 am, Pingfan Liu wrote: > >> *** Idea *** > >> For kexec -p, the boot cpu can

Re: [PATCH 0/4] kdump: crashkernel reservation from CMA

2023-11-27 Thread Pingfan Liu
On Sun, Nov 26, 2023 at 5:24 AM Jiri Bohac wrote: > > Hi Tao, > > On Sat, Nov 25, 2023 at 09:51:54AM +0800, Tao Liu wrote: > > Thanks for the idea of using CMA as part of memory for the 2nd kernel. > > However I have a question: > > > > What if there is on-going DMA/RDMA access on the CMA range wh

Re: [PATCHv9 2/2] powerpc/setup: Loosen the mapping between cpu logical id and its seq in dt

2023-10-18 Thread Pingfan Liu
On Tue, Oct 17, 2023 at 6:39 PM Hari Bathini wrote: > > > > On 17/10/23 7:58 am, Pingfan Liu wrote: > > *** Idea *** > > For kexec -p, the boot cpu can be not the cpu0, this causes the problem > > of allocating memory for paca_ptrs[]. However, in theory, there i

[PATCHv9 2/2] powerpc/setup: Loosen the mapping between cpu logical id and its seq in dt

2023-10-16 Thread Pingfan Liu
s, at this phase, all threads in the boot core are forced to be onlined. This restriction will be lifted in a later patch with extra effort. Signed-off-by: Pingfan Liu Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: Mahesh Salgaonkar Cc: Wen Xiong Cc: Baoquan He Cc: Ming Lei C

[PATCHv9 0/2] enable nr_cpus for powerpc

2023-10-16 Thread Pingfan Liu
From: Pingfan Liu Since my last v4 [1], the code has undergone great changes. The paca[] array has been reorganized and indexed by paca_ptrs[], which dramatically decreases the memory consumption even if there are many unpresent cpus in the middle. However, reordering the logical cpu numbers

[PATCHv9 1/2] powerpc/setup : Enable boot_cpu_hwid for PPC32

2023-10-16 Thread Pingfan Liu
carry that information for PPC32 in the coming patch. Signed-off-by: Pingfan Liu Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: Mahesh Salgaonkar Cc: Wen Xiong Cc: Baoquan He Cc: Ming Lei Cc: Sourabh Jain Cc: Hari Bathini Cc: kexec@lists.infradead.org To: linuxppc

Re: [PATCHv8 1/5] powerpc/setup : Enable boot_cpu_hwid for PPC32

2023-10-16 Thread Pingfan Liu
On Mon, Oct 16, 2023 at 12:13:53PM +0530, Sourabh Jain wrote: > Hello Pingfan, > > > > > > > With this patch series applied, the kdump kernel fails to boot on > > > > > > powerpc with nr_cpus=1. > > > > > > > > > > > > Console logs: > > > > > > --- > > > > > > [root]# echo c > /pr

Re: [PATCHv8 1/5] powerpc/setup : Enable boot_cpu_hwid for PPC32

2023-10-12 Thread Pingfan Liu
On Wed, Oct 11, 2023 at 6:53 PM Sourabh Jain wrote: > > Hello Pingfan, > >>> With this patch series applied, the kdump kernel fails to boot on > >>> powerpc with nr_cpus=1. > >>> > >>> Console logs: > >>> --- > >>> [root]# echo c > /proc/sysrq-trigger > >>> [ 74.783235] sysrq: Tr

Re: [PATCHv8 2/5] powerpc/setup: Loosen the mapping between cpu logical id and its seq in dt

2023-10-10 Thread Pingfan Liu
On Tue, Oct 10, 2023 at 04:07:00PM +0530, Hari Bathini wrote: > > > On 09/10/23 5:00 pm, Pingfan Liu wrote: > > *** Idea *** > > For kexec -p, the boot cpu can be not the cpu0, this causes the problem > > of allocating memory for paca_ptrs[]. However, in theory, the

Re: [PATCHv8 3/5] powerpc/setup: Handle the case when boot_cpuid greater than nr_cpus

2023-10-10 Thread Pingfan Liu
On Tue, Oct 10, 2023 at 01:56:13PM +0530, Hari Bathini wrote: > > > On 09/10/23 5:00 pm, Pingfan Liu wrote: > > If the boot_cpuid is smaller than nr_cpus, it requires extra effort to > > ensure the boot_cpu is in cpu_present_mask. This can be achieved by > > reserving

Re: [PATCHv8 1/5] powerpc/setup : Enable boot_cpu_hwid for PPC32

2023-10-10 Thread Pingfan Liu
On Tue, Oct 10, 2023 at 02:38:40PM +0530, Sourabh Jain wrote: > Hello Pingfan, > > > > > With this patch series applied, the kdump kernel fails to boot on > > powerpc with nr_cpus=1. > > > > Console logs: > > --- > > [root]# echo c > /proc/sysrq-trigger > > [   74.783235] sysrq:

[PATCHv8 2/5] powerpc/setup: Loosen the mapping between cpu logical id and its seq in dt

2023-10-09 Thread Pingfan Liu
s, at this phase, all threads in the boot core are forced to be onlined. This restriction will be lifted in a later patch with extra effort. Signed-off-by: Pingfan Liu Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: Mahesh Salgaonkar Cc: Wen Xiong Cc: Baoquan He Cc: Ming Lei

[PATCHv8 1/5] powerpc/setup : Enable boot_cpu_hwid for PPC32

2023-10-09 Thread Pingfan Liu
carry that information for PPC32 in the coming patch. Signed-off-by: Pingfan Liu Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: Mahesh Salgaonkar Cc: Wen Xiong Cc: Baoquan He Cc: Ming Lei Cc: kexec@lists.infradead.org To: linuxppc-...@lists.ozlabs.org --- arch/powerpc

[PATCHv8 3/5] powerpc/setup: Handle the case when boot_cpuid greater than nr_cpus

2023-10-09 Thread Pingfan Liu
If the boot_cpuid is smaller than nr_cpus, it requires extra effort to ensure the boot_cpu is in cpu_present_mask. This can be achieved by reserving the last quota for the boot cpu. Note: the restriction on nr_cpus will be lifted with more effort in the successive patches Signed-off-by: Pingfan

[PATCHv8 5/5] powerpc/setup: alloc extra paca_ptrs to hold boot_cpuid

2023-10-09 Thread Pingfan Liu
x27; the kdump kernel brings up two cpus. While when taskset -c 4 bash -c 'echo c > /proc/sysrq-trigger', the kdump kernel brings up one cpu. Signed-off-by: Pingfan Liu Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: Mahesh Salgaonkar Cc: Wen Xiong Cc: Baoquan He

[PATCHv8 4/5] powerpc/cpu: Skip impossible cpu during iteration on a core

2023-10-09 Thread Pingfan Liu
ing the mask. In this way, the unpopulated pcpu struct can be skipped and left unaccessed. Signed-off-by: Pingfan Liu Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: Mahesh Salgaonkar Cc: Wen Xiong Cc: Baoquan He Cc: Ming Lei Cc: kexec@lists.infradead.org To: linux

[PATCHv8 0/5] enable nr_cpus for powerpc

2023-10-09 Thread Pingfan Liu
he Leroy Cc: Mahesh Salgaonkar Cc: Wen Xiong Cc: Baoquan He Cc: Ming Lei Cc: kexec@lists.infradead.org To: linuxppc-...@lists.ozlabs.org Pingfan Liu (5): powerpc/setup : Enable boot_cpu_hwid for PPC32 powerpc/setup: Loosen the mapping between cpu logical id and its seq in dt power

Re: [PATCHv7 4/4] powerpc/setup: alloc extra paca_ptrs to hold boot_cpuid

2023-10-06 Thread Pingfan Liu
On Wed, Oct 4, 2023 at 2:07 AM Mahesh J Salgaonkar wrote: > > On 2023-09-25 15:53:48 Mon, Pingfan Liu wrote: > > paca_ptrs should be large enough to hold the boot_cpuid, hence, its > > lower boundary is set to the bigger one between boot_cpuid+1 and > > nr_cpus. > &g

Re: [PATCHv7 2/4] powerpc/setup: Loosen the mapping between cpu logical id and its seq in dt

2023-09-28 Thread Pingfan Liu
on the DBG macro and not catch this bug. Thanks, Pingfan > cpu++; > } > + } > > -Original Message- > From: Pingfan Liu > Sent: Monday, September 25, 2023 2:54 AM > To: linuxppc-...@lists.ozlabs.org > Cc: Pingfan Liu ; Michael Ellerman ; > Nicholas

[PATCHv7 4/4] powerpc/setup: alloc extra paca_ptrs to hold boot_cpuid

2023-09-25 Thread Pingfan Liu
x27; the kdump kernel brings up two cpus. While when taskset -c 4 bash -c 'echo c > /proc/sysrq-trigger', the kdump kernel brings up one cpu. Signed-off-by: Pingfan Liu Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: Mahesh Salgaonkar Cc: Wen Xiong Cc: Baoquan He

[PATCHv7 1/4] powerpc/setup : Enable boot_cpu_hwid for PPC32

2023-09-25 Thread Pingfan Liu
carry that information for PPC32 in the coming patch. Signed-off-by: Pingfan Liu Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: Mahesh Salgaonkar Cc: Wen Xiong Cc: Baoquan He Cc: Ming Lei Cc: kexec@lists.infradead.org To: linuxppc-...@lists.ozlabs.org Reported-by: kernel

[PATCHv7 2/4] powerpc/setup: Loosen the mapping between cpu logical id and its seq in dt

2023-09-25 Thread Pingfan Liu
s, at this phase, all threads in the boot core are forced to be onlined. This restriction will be lifted in a later patch with extra effort. Signed-off-by: Pingfan Liu Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: Mahesh Salgaonkar Cc: Wen Xiong Cc: Baoquan He Cc: Ming Lei

[PATCHv7 3/4] powerpc/setup: Handle the case when boot_cpuid greater than nr_cpus

2023-09-25 Thread Pingfan Liu
If the boot_cpuid is smaller than nr_cpus, it requires extra effort to ensure the boot_cpu is in cpu_present_mask. This can be achieved by reserving the last quota for the boot cpu. Note: the restriction on nr_cpus will be lifted with more effort in the next patch Signed-off-by: Pingfan Liu Cc

[PATCHv7 0/4] enable nr_cpus for powerpc

2023-09-25 Thread Pingfan Liu
linuxppc-...@lists.ozlabs.org Pingfan Liu (4): powerpc/setup : Enable boot_cpu_hwid for PPC32 powerpc/setup: Loosen the mapping between cpu logical id and its seq in dt powerpc/setup: Handle the case when boot_cpuid greater than nr_cpus powerpc/setup: alloc extra paca_ptrs to hold boot_cpuid arch

Re: [PATCH 0/2] Sign the Image which is zboot's payload

2023-09-24 Thread Pingfan Liu
On Fri, Sep 22, 2023 at 1:19 PM Jan Hendrik Farr wrote: > > Hi Pingfan! > > On 21 21:37:01, Pingfan Liu wrote: > > From: Pingfan Liu > > > > > For security boot, the vmlinuz.efi will be signed so UEFI boot loader > > can check against it. But at present, t

[PATCH 1/2] zboot: Signing the payload

2023-09-21 Thread Pingfan Liu
From: Pingfan Liu Emulate the scheme of module signing to sign the zboot's payload i.e. Image before it is compressed. And overall, the signature on vmlinuz.efi will be used by UEFI boot loader and the signature on Image will be used by kexec file load. Signed-off-by: Pingfan Liu Cc:

[PATCH 0/2] Sign the Image which is zboot's payload

2023-09-21 Thread Pingfan Liu
From: Pingfan Liu I hesitate to post this series, since Ard has recommended using an emulated UEFI boot service to resolve the UKI kexec load problem [1]. since on aarch64, vmlinuz.efi has faced the similar issue at present. But anyway, I have a crude outline of it and am sending it out for

[PATCH 2/2] arm64: Enable signing on the kernel image loaded by kexec file load

2023-09-21 Thread Pingfan Liu
From: Pingfan Liu Enable the signing on the kernel image if both KEXEC_SIG and EFI_ZBOOT are configured. Signed-off-by: Pingfan Liu Cc: "Ard Biesheuvel " Cc: "Jan Hendrik Farr" Cc: "Baoquan He" Cc: "Dave Young" Cc: "Philipp Rudo" Cc: Ard

Re: [PATCH v1 1/2] zboot: enable arm64 kexec_load for zboot image

2023-09-14 Thread Pingfan Liu
kexec/kexec.h > +++ b/kexec/kexec.h > @@ -267,6 +267,7 @@ extern void die(const char *fmt, ...) > __attribute__ ((format (printf, 1, 2))); > extern void *xmalloc(size_t size); > extern void *xrealloc(void *ptr, size_t size); > +extern char *slurp_fd(int fd, const ch

Re: [PATCH 1/2] zboot: enable arm64 kexec_load for zboot image

2023-09-12 Thread Pingfan Liu
a/kexec/kexec.h > +++ b/kexec/kexec.h > @@ -267,6 +267,7 @@ extern void die(const char *fmt, ...) > __attribute__ ((format (printf, 1, 2))); > extern void *xmalloc(size_t size); > extern void *xrealloc(void *ptr, size_t size); > +extern char *slurp_fd(int fd, const cha

[PATCHv6 3/3] powerpc/setup: alloc extra paca_ptrs to hold boot_cpuid

2023-09-11 Thread Pingfan Liu
t initialized to a proper present cpu. -2. power9_idle_stop() assumes the primary thread's paca is allocated. Hence lift nr_cpu_ids from one to two to ensure cpu0 is onlined, if the boot cpu is not cpu0. Signed-off-by: Pingfan Liu Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe

[PATCHv6 0/3] enable nr_cpus for powerpc

2023-09-11 Thread Pingfan Liu
o tackle with the issue if nr_cpu_ids is configured as a constant Pingfan Liu (3): powerpc/setup: Loosen the mapping between cpu logical id and its seq in dt powerpc/setup: Handle the case when boot_cpuid greater than nr_cpus powerpc/setup: alloc extra paca_ptrs to hold boot_cpuid arch

[PATCHv6 2/3] powerpc/setup: Handle the case when boot_cpuid greater than nr_cpus

2023-09-11 Thread Pingfan Liu
If the boot_cpuid is smaller than nr_cpus, it requires extra effort to ensure the boot_cpu is in cpu_present_mask. This can be achieved by reserving the last quota for the boot cpu. Note: the restriction on nr_cpus will be lifted with more effort in the next patch Signed-off-by: Pingfan Liu Cc

[PATCHv6 1/3] powerpc/setup: Loosen the mapping between cpu logical id and its seq in dt

2023-09-11 Thread Pingfan Liu
sides this, at this phase, all threads in the boot core are forced to be onlined. This restriction will be lifted in a later patch with extra effort. Signed-off-by: Pingfan Liu Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: Mahesh Salgaonkar Cc: Wen Xiong Cc: Baoquan He Cc

[PATCHv5 2/3] powerpc/setup: Handle the case when boot_cpuid greater than nr_cpus

2023-09-08 Thread Pingfan Liu
If the boot_cpuid is smaller than nr_cpus, it requires extra effort to ensure the boot_cpu is in cpu_present_mask. This can be achieved by reserving the last quota for the boot cpu. Note: the restriction on nr_cpus will be lifted with more effort in the next patch Signed-off-by: Pingfan Liu Cc

[PATCHv5 3/3] powerpc/setup: alloc extra paca_ptrs to hold boot_cpuid

2023-09-08 Thread Pingfan Liu
t initialized to a proper present cpu. -2. power9_idle_stop() assumes the primary thread's paca is allocated. Hence lift nr_cpu_ids from one to two to ensure cpu0 is onlined, if the boot cpu is not cpu0. Signed-off-by: Pingfan Liu Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe

[PATCHv5 1/3] powerpc/setup: Loosen the mapping between cpu logical id and its seq in dt

2023-09-08 Thread Pingfan Liu
s, at this phase, all threads in the boot core are forced to be onlined. This restriction will be lifted in a later patch with extra effort. Signed-off-by: Pingfan Liu Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: Mahesh Salgaonkar Cc: Wen Xiong Cc: Baoquan He Cc: Ming Lei

[PATCHv5 0/3] enable nr_cpus for powerpc

2023-09-08 Thread Pingfan Liu
uxppc-dev/1520829790-14029-1-git-send-email-kernelf...@gmail.com/ Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: Mahesh Salgaonkar Cc: Wen Xiong Cc: Baoquan He Cc: Ming Lei Cc: kexec@lists.infradead.org To: linuxppc-...@lists.ozlabs.org Pingfan Liu (3): powerpc/setup: L

Re: [PATCH] aarch64: kern_paddr_start calculation makes more accurate legacy check

2023-08-28 Thread Pingfan Liu
On Sun, Aug 27, 2023 at 4:23 AM Alexander Kamensky wrote: > > Hi Pingfan, > > Please see inline > > On Thu, Aug 24, 2023 at 11:17 PM Pingfan Liu wrote: > > > > On Sun, Aug 20, 2023 at 3:16 AM Alexander Kamensky > > wrote: > > > > > > In the

Re: [PATCH] aarch64: kern_paddr_start calculation makes more accurate legacy check

2023-08-24 Thread Pingfan Liu
On Sun, Aug 20, 2023 at 3:16 AM Alexander Kamensky wrote: > > In the latest openembedded with aarch64 image that uses 6.4.3 kernel on qemu I > tried to run makedumpfile in secondary kernel with /proc/vmcore. It failed as > follows: > > > root@qemuarm64:~# makedumpfile -c -F /proc/vmcore > /dev/nul

Re: [PATCHv7 3/5] kexec/zboot: Add arch independent zboot support

2023-08-07 Thread Pingfan Liu
On Mon, Aug 7, 2023 at 9:23 PM Simon Horman wrote: > > On Thu, Aug 03, 2023 at 10:41:50AM +0800, Pingfan Liu wrote: > > From: Jeremy Linton > > > > The linux kernel CONFIG_ZBOOT option creates > > self decompressing PE kernel images. So this means > &

[PATCHv7 5/5] arm64: Hook up the ZBOOT support as vmlinuz

2023-08-02 Thread Pingfan Liu
essed to a temporary file. Signed-off-by: Jeremy Linton Signed-off-by: Pingfan Liu To: kexec@lists.infradead.org Cc: ho...@verge.net.au Cc: a...@kernel.org Cc: jeremy.lin...@arm.com --- kexec/arch/arm64/Makefile | 3 ++- kexec/arch/arm64/kexec-arm64.c | 1 + kexec/arch/arm64/kexec-arm64.h

[PATCHv7 0/5] arm64: zboot support

2023-08-02 Thread Pingfan Liu
roduce kexec_info.kernel_fd and return the fd through image load interface. Jeremy Linton (3): kexec/zboot: Add arch independent zboot support arm64: Add ZBOOT PE containing compressed image support arm64: Hook up the ZBOOT support as vmlinuz Pingfan Liu (2): kexec/arm64: Simplify the code for

[PATCHv7 1/5] kexec/arm64: Simplify the code for zImage

2023-08-02 Thread Pingfan Liu
a memfd based on the result produced by slurp_decompress_file(), and finally simplify the logical of the probe for aarch64. The credit goes to the Dave Young, who contributes the original code. Signed-off-by: Pingfan Liu Co-authored-by: Dave Young To: kexec@lists.infradead.org Cc: ho

[PATCHv7 4/5] arm64: Add ZBOOT PE containing compressed image support

2023-08-02 Thread Pingfan Liu
alternate kernel image around. This patch adds a the _probe(), _load() and usage() routines needed for kexec to understand this format. Signed-off-by: Jeremy Linton [Modified by Pingfan to export kernel fd with load method] Signed-off-by: Pingfan Liu To: kexec@lists.infradead.org Cc: ho

[PATCHv7 3/5] kexec/zboot: Add arch independent zboot support

2023-08-02 Thread Pingfan Liu
-off-by: Jeremy Linton [Modified by Pingfan to export kernel fd] Signed-off-by: Pingfan Liu To: kexec@lists.infradead.org Cc: ho...@verge.net.au Cc: a...@kernel.org Cc: jeremy.lin...@arm.com --- include/Makefile | 1 + include/kexec-pe-zboot.h | 15 + kexec/Makefile | 1

[PATCHv7 2/5] kexec: Introduce a member kernel_fd in kexec_info

2023-08-02 Thread Pingfan Liu
Utilize the image load interface to export the kernel fd, which points to the uncompressed kernel and will be passed to kexec_file_load. The credit goes to the Dave Young, who contributes the original code. Signed-off-by: Pingfan Liu Co-authored-by: Dave Young To: kexec@lists.infradead.org Cc

Re: [PATCHv6 3/5] kexec/zboot: Add arch independent zboot support

2023-08-02 Thread Pingfan Liu
On Wed, Aug 2, 2023 at 8:33 PM Simon Horman wrote: > > On Wed, Aug 02, 2023 at 02:17:57PM +0200, Simon Horman wrote: > > On Wed, Aug 02, 2023 at 02:16:33PM +0200, Simon Horman wrote: > > > On Wed, Aug 02, 2023 at 05:53:59PM +0800, Pingfan Liu wrote: > > > > Hi

Re: [PATCHv6 3/5] kexec/zboot: Add arch independent zboot support

2023-08-02 Thread Pingfan Liu
Hi Simon, Thanks for the try. Please see the comment below. On Tue, Aug 1, 2023 at 3:00 PM Simon Horman wrote: > > On Mon, Jul 24, 2023 at 10:21:40AM +0800, Pingfan Liu wrote: > > From: Jeremy Linton > > > > The linux kernel CONFIG_ZBOOT option creates > > self

[PATCHv6 3/5] kexec/zboot: Add arch independent zboot support

2023-07-23 Thread Pingfan Liu
-off-by: Jeremy Linton [Modified by Pingfan to export kernel fd] Signed-off-by: Pingfan Liu To: kexec@lists.infradead.org Cc: ho...@verge.net.au Cc: a...@kernel.org Cc: jeremy.lin...@arm.com --- include/kexec-pe-zboot.h | 15 + kexec/Makefile | 1 + kexec/kexec-pe-zboot.c | 131

[PATCHv6 4/5] arm64: Add ZBOOT PE containing compressed image support

2023-07-23 Thread Pingfan Liu
alternate kernel image around. This patch adds a the _probe(), _load() and usage() routines needed for kexec to understand this format. Signed-off-by: Jeremy Linton [Modified by Pingfan to export kernel fd with load method] Signed-off-by: Pingfan Liu To: kexec@lists.infradead.org Cc: ho

[PATCHv6 0/5] arm64: zboot support

2023-07-23 Thread Pingfan Liu
ace. Jeremy Linton (3): kexec/zboot: Add arch independent zboot support arm64: Add ZBOOT PE containing compressed image support arm64: Hook up the ZBOOT support as vmlinuz Pingfan Liu (2): kexec/arm64: Simplify the code for zImage kexec: Introduce a member kernel_fd in kexec_info include/kexec

[PATCHv6 5/5] arm64: Hook up the ZBOOT support as vmlinuz

2023-07-23 Thread Pingfan Liu
essed to a temporary file. Signed-off-by: Jeremy Linton Signed-off-by: Pingfan Liu To: kexec@lists.infradead.org Cc: ho...@verge.net.au Cc: a...@kernel.org Cc: jeremy.lin...@arm.com --- kexec/arch/arm64/Makefile | 3 ++- kexec/arch/arm64/kexec-arm64.c | 1 + kexec/arch/arm64/kexec-arm64.h

[PATCHv6 2/5] kexec: Introduce a member kernel_fd in kexec_info

2023-07-23 Thread Pingfan Liu
Utilize the image load interface to export the kernel fd, which points to the uncompressed kernel and will be passed to kexec_file_load. The credit goes to the Dave Young, who contributes the original code. Signed-off-by: Pingfan Liu Co-authored-by: Dave Young To: kexec@lists.infradead.org Cc

[PATCHv6 1/5] kexec/arm64: Simplify the code for zImage

2023-07-23 Thread Pingfan Liu
a memfd based on the result produced by slurp_decompress_file(), and finally simplify the logical of the probe for aarch64. The credit goes to the Dave Young, who contributes the original code. Signed-off-by: Pingfan Liu Co-authored-by: Dave Young To: kexec@lists.infradead.org Cc: ho

Re: [PATCHv5 0/8] arm64: zboot support

2023-07-20 Thread Pingfan Liu
On Thu, Jul 20, 2023 at 3:27 PM Dave Young wrote: > > Hi Pingfan, > > On Thu, 20 Jul 2023 at 10:05, Pingfan Liu wrote: > > > > Hi Dave, > > > > Thanks for your insight. Please see the comments inline below. > > > > On Wed, Jul 19, 2023 at 11:00 AM

Re: [PATCHv5 0/8] arm64: zboot support

2023-07-19 Thread Pingfan Liu
Hi Dave, Thanks for your insight. Please see the comments inline below. On Wed, Jul 19, 2023 at 11:00 AM Dave Young wrote: > > Hi Pingfan, Simon, > > On 07/17/23 at 09:07pm, Pingfan Liu wrote: > > As more complicated capsule kernel format occurs like zboot, where the > &

[PATCHv5 8/8] arm64: Hook up the ZBOOT support as vmlinuz

2023-07-17 Thread Pingfan Liu
essed to a temporary file. Signed-off-by: Jeremy Linton Signed-off-by: Pingfan Liu To: kexec@lists.infradead.org Cc: ho...@verge.net.au Cc: a...@kernel.org Cc: jeremy.lin...@arm.com --- kexec/arch/arm64/Makefile | 3 ++- kexec/arch/arm64/kexec-arm64.c | 1 + kexec/arch/arm64/kexec-arm64.h | 3

[PATCHv5 7/8] arm64: Add ZBOOT PE containing compressed image support

2023-07-17 Thread Pingfan Liu
alternate kernel image around. This patch adds a the _probe() and usage() routines needed for kexec to understand this format. Signed-off-by: Jeremy Linton [Modified by Pingfan to adapt the new probe interface] Signed-off-by: Pingfan Liu To: kexec@lists.infradead.org Cc: ho...@verge.net.au Cc: a

[PATCHv5 6/8] kexec/zboot: Add arch independent zboot support

2023-07-17 Thread Pingfan Liu
-off-by: Jeremy Linton [Modified by Pingfan to adapt the new probe interface] Signed-off-by: Pingfan Liu To: kexec@lists.infradead.org Cc: ho...@verge.net.au Cc: a...@kernel.org Cc: jeremy.lin...@arm.com --- include/kexec-pe-zboot.h | 15 + kexec/Makefile | 1 + kexec/kexec-pe

[PATCHv5 5/8] kexec: Drop condition macro for aarch64

2023-07-17 Thread Pingfan Liu
Since all arm64 images have transfer from the interface probe() to probe2(), the snippet dedicated for aarch64 to call probe() can be dropped now. Signed-off-by: Pingfan Liu To: kexec@lists.infradead.org Cc: ho...@verge.net.au Cc: a...@kernel.org Cc: jeremy.lin...@arm.com --- kexec/kexec.c | 10

  1   2   3   4   >