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

2023-10-09 Thread Sourabh Jain
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: Trigger a crash [   74.783244] Kernel panic - not syncing: sysrq triggered crash [   74.783252]

Re: [PATCH] kexec: Fix reboot race during device_shutdown()

2023-10-09 Thread Eric W. Biederman
Joel Fernandes writes: > On Mon, Oct 2, 2023 at 2:18 PM Joel Fernandes wrote: > [..] >> > > Such freezing is already being done if kernel supports KEXEC_JUMP and >> > > kexec_image->preserve_context is true. However, doing it if either of >> > > these are >> > > not true prevents crashes/races.

Re: [PATCH 00/13] x86/tdx: Add kexec support

2023-10-09 Thread Baoquan He
On 10/09/23 at 04:36pm, Kirill A. Shutemov wrote: > On Mon, Oct 09, 2023 at 07:49:35AM +0800, Baoquan He wrote: > > On 10/05/23 at 04:13pm, Kirill A. Shutemov wrote: > > > The patchset adds bits and pieces to get kexec (and crashkernel) work on > > > TDX guest. > > > > > > They bring kexec support

Re: [PATCH] kexec: Fix reboot race during device_shutdown()

2023-10-09 Thread Steven Rostedt
On Sat, 7 Oct 2023 21:30:42 -0400 Joel Fernandes wrote: > Just checking how we want to proceed, is the consensus that we should > prevent kernel crashes without relying on userspace stopping all > processes? Should we fix regular reboot syscall as well and not just > kexec reboot? If you can sho

Re: [PATCH 10/13] x86/tdx: Convert shared memory back to private on kexec

2023-10-09 Thread Kirill A. Shutemov
On Sun, Oct 08, 2023 at 04:35:27PM +0800, Baoquan He wrote: > On 10/05/23 at 04:13pm, Kirill A. Shutemov wrote: > > TDX guests allocate shared buffers to perform I/O. It is done by > > allocating pages normally from the buddy allocator and converting them > > to shared with set_memory_decrypted().

Re: [PATCH 00/13] x86/tdx: Add kexec support

2023-10-09 Thread Kirill A. Shutemov
On Mon, Oct 09, 2023 at 07:49:35AM +0800, Baoquan He wrote: > On 10/05/23 at 04:13pm, Kirill A. Shutemov wrote: > > The patchset adds bits and pieces to get kexec (and crashkernel) work on > > TDX guest. > > > > They bring kexec support to the point when we can start the new kernel, > > but it wil

Re: [PATCH 01/13] x86/acpi: Extract ACPI MADT wakeup code into a separate file

2023-10-09 Thread Kirill A. Shutemov
On Fri, Oct 06, 2023 at 11:33:47AM -0700, Kuppuswamy Sathyanarayanan wrote: > Hi Kirill, > > On 10/5/2023 6:13 AM, Kirill A. Shutemov wrote: > > In order to prepare for the expansion of support for the ACPI MADT > > wakeup method, the relevant code has been moved into a separate file. > > A new co

Re: [PATCH 05/13] x86/kexec: Keep CR4.MCE set during kexec for TDX guest

2023-10-09 Thread kirill.shute...@linux.intel.com
On Mon, Oct 09, 2023 at 12:30:55PM +, Huang, Kai wrote: > On Thu, 2023-10-05 at 16:13 +0300, Kirill A. Shutemov wrote: > > TDX guests are not allowed to clear CR4.MCE. Attempt to clear it leads > > to #VE. > > > > Use alternatives to keep the flag during kexec for TDX guests. > > > > The chan

Re: [PATCH 05/13] x86/kexec: Keep CR4.MCE set during kexec for TDX guest

2023-10-09 Thread Huang, Kai
On Thu, 2023-10-05 at 16:13 +0300, Kirill A. Shutemov wrote: > TDX guests are not allowed to clear CR4.MCE. Attempt to clear it leads > to #VE. > > Use alternatives to keep the flag during kexec for TDX guests. > > The change doesn't affect non-TDX environments. Nit: non-TDX-guest environments.

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

2023-10-09 Thread Pingfan Liu
*** 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 is no requirement to assign cpu's logical id as its present sequence in the device tree. But there is something like cpu_first_thread_sibling(), which

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

2023-10-09 Thread Pingfan Liu
In order to identify the boot cpu, its intserv[] should be recorded and checked in smp_setup_cpu_maps(). smp_setup_cpu_maps() is shared between PPC64 and PPC32. Since PPC64 has already used boot_cpu_hwid to carry that information, enabling this variable on PPC32 so later it can also be used to car

[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 L

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

2023-10-09 Thread Pingfan Liu
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. On the other hand, some kernel component: -1. the timer assumes cpu0 online since the timer_list->flags subfield 'TIMER_CPUMASK' is zero if not initialized

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

2023-10-09 Thread Pingfan Liu
The threads in a core have equal status, so the code introduces a for loop pattern to execute the same task on each thread: for (i = first_thread; i < first_thread + threads_per_core; i++) Now that some threads may not be in the cpu_possible_mask, the iteration skips those threads by checking

[PATCHv8 0/5] enable nr_cpus for powerpc

2023-10-09 Thread 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 can further decrease th

[kexec-tools] Archive file is missed iomem.h file under loongarch architecture.

2023-10-09 Thread Ming Wang
Hi,  maintainers, I get the kexec-tools 2.0.27 from http://kernel.org/pub/linux/utils/kernel/kexec/kexec-tools-2.0.27.tar.gz,  But I noticed that the kexec-tools-2.0.27/kexec/arch/loongarch/iomem.h file was missing from this archive. This causes build errors in many distributions, like debi