Re: [PATCH 2/2] s390x: uncouple virtual and physical address spaces

2023-12-04 Thread 萩尾 一仁
On 2023/11/29 21:50, Alexander Gordeev wrote: > Rework vaddr_to_paddr() and paddr_to_vaddr() macros to reflect > the future uncoupling of physical and virtual address spaces in > kernel. Existing versions are not affected. > > Signed-off-by: Alexander Gordeev > --- > arch/s390x.c | 134

Re: [PATCH 1/2] riscv, crash: don't export some symbols when CONFIG_MMU=n

2023-12-04 Thread Baoquan He
On 12/04/23 at 11:14am, Randy Dunlap wrote: .. > > --- > > arch/riscv/kernel/crash_core.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/arch/riscv/kernel/crash_core.c b/arch/riscv/kernel/crash_core.c > > index 55f1d7856b54..8706736fd4e2 100644 > > ---

[PATCHv4 11/14] x86/mm: Make e820_end_ram_pfn() cover E820_TYPE_ACPI ranges

2023-12-04 Thread Kirill A. Shutemov
e820__end_of_ram_pfn() is used to calculate max_pfn which, among other things, guides where direct mapping ends. Any memory above max_pfn is not going to be present in the direct mapping. e820__end_of_ram_pfn() finds the end of the ram based on the highest E820_TYPE_RAM range. But it doesn't

[PATCHv4 03/14] cpu/hotplug: Add support for declaring CPU offlining not supported

2023-12-04 Thread Kirill A. Shutemov
The ACPI MADT mailbox wakeup method doesn't allow to offline CPU after it got woke up. Currently offlining hotplug is prevented based on the confidential computing attribute which is set for Intel TDX. But TDX is not the only possible user of the wake up method. The MADT wakeup can be implemented

[PATCHv4 07/14] x86/mm: Make x86_platform.guest.enc_status_change_*() return errno

2023-12-04 Thread Kirill A. Shutemov
TDX is going to have more than one reason to fail enc_status_change_prepare(). Change the callback to return errno instead of assuming -EIO; enc_status_change_finish() changed too to keep the interface symmetric. Signed-off-by: Kirill A. Shutemov --- arch/x86/coco/tdx/tdx.c | 20

[PATCHv4 08/14] x86/mm: Return correct level from lookup_address() if pte is none

2023-12-04 Thread Kirill A. Shutemov
lookup_address() only returns correct page table level for the entry if the entry is not none. Make the helper to always return correct 'level'. It allows to implement iterator over kernel page tables using lookup_address(). Add one more entry into enum pg_level to indicate size of VA covered by

[PATCHv4 01/14] x86/acpi: Extract ACPI MADT wakeup code into a separate file

2023-12-04 Thread Kirill A. Shutemov
In order to prepare for the expansion of support for the ACPI MADT wakeup method, move the relevant code into a separate file. Introduce a new configuration option to clearly indicate dependencies without the use of ifdefs. There have been no functional changes. Signed-off-by: Kirill A.

[PATCHv4 14/14] x86/acpi: Add support for CPU offlining for ACPI MADT wakeup method

2023-12-04 Thread Kirill A. Shutemov
MADT Multiprocessor Wakeup structure version 1 brings support of CPU offlining: BIOS provides a reset vector where the CPU has to jump to offline itself. The new TEST mailbox command can be used to test the CPU offlined successfully and BIOS has control over it. Add CPU offling support for ACPI

[PATCHv4 05/14] x86/kvm: Do not try to disable kvmclock if it was not enabled

2023-12-04 Thread Kirill A. Shutemov
kvm_guest_cpu_offline() tries to disable kvmclock regardless if it is present in the VM. It leads to write to a MSR that doesn't exist on some configurations, namely in TDX guest: unchecked MSR access error: WRMSR to 0x12 (tried to write 0x) at rIP:

[PATCHv4 04/14] cpu/hotplug, x86/acpi: Disable CPU offlining for ACPI MADT wakeup

2023-12-04 Thread Kirill A. Shutemov
ACPI MADT doesn't allow to offline CPU after it got woke up. Currently hotplug prevented based on the confidential computing attribute which is set for Intel TDX. But TDX is not the only possible user of the wake up method. Disable CPU offlining on ACPI MADT wakeup enumeration. Signed-off-by:

[PATCHv4 12/14] x86/acpi: Rename fields in acpi_madt_multiproc_wakeup structure

2023-12-04 Thread Kirill A. Shutemov
To prepare for the addition of support for MADT wakeup structure version 1, it is necessary to provide more appropriate names for the fields in the structure. The field 'mailbox_version' renamed as 'version'. This field signifies the version of the structure and the related protocols, rather than

[PATCHv4 10/14] x86/tdx: Convert shared memory back to private on kexec

2023-12-04 Thread Kirill A. Shutemov
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(). The second kernel has no idea what memory is converted this way. It only sees E820_TYPE_RAM. Accessing shared memory via

[PATCHv4 06/14] x86/kexec: Keep CR4.MCE set during kexec for TDX guest

2023-12-04 Thread Kirill A. Shutemov
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-guest environments. Signed-off-by: Kirill A. Shutemov Reviewed-by: Kai Huang ---

[PATCHv4 00/14] x86/tdx: Add kexec support

2023-12-04 Thread Kirill A. Shutemov
The patchset adds bits and pieces to get kexec (and crashkernel) work on TDX guest. The last patch implements CPU offlining according to the approved ACPI spec change poposal[1]. It unlocks kexec with all CPUs visible in the target kernel. It requires BIOS-side enabling. If it missing we fallback

[PATCHv4 02/14] x86/apic: Mark acpi_mp_wake_* variables as __ro_after_init

2023-12-04 Thread Kirill A. Shutemov
acpi_mp_wake_mailbox_paddr and acpi_mp_wake_mailbox initialized once during ACPI MADT init and never changed. Signed-off-by: Kirill A. Shutemov Acked-by: Kai Huang --- arch/x86/kernel/acpi/madt_wakeup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

[PATCHv4 13/14] x86/acpi: Do not attempt to bring up secondary CPUs in kexec case

2023-12-04 Thread Kirill A. Shutemov
ACPI MADT doesn't allow to offline CPU after it got woke up. It limits kexec: the second kernel won't be able to use more than one CPU. Now acpi_mp_wake_mailbox_paddr already has the mailbox address. The acpi_wakeup_cpu() will use it to bring up secondary cpus. Zero out mailbox address in the

[PATCHv4 09/14] x86/tdx: Account shared memory

2023-12-04 Thread Kirill A. Shutemov
The kernel will convert all shared memory back to private during kexec. The direct mapping page tables will provide information on which memory is shared. It is extremely important to convert all shared memory. If a page is missed, it will cause the second kernel to crash when it accesses it.

Re: [PATCHv3 14/14] x86/acpi: Add support for CPU offlining for ACPI MADT wakeup method

2023-12-04 Thread Huang, Kai
> > > > + > > > int __init acpi_parse_mp_wake(union acpi_subtable_headers *header, > > > const unsigned long end) > > > { > > > struct acpi_madt_multiproc_wakeup *mp_wake; > > > > > > mp_wake = (struct acpi_madt_multiproc_wakeup *)header; > > > - if

Re: linux-next: Tree for Dec 1 (riscv, crash_core)

2023-12-04 Thread Randy Dunlap
Hi, On 12/3/23 18:10, Baoquan He wrote: > eric_devol...@yahoo.com, ig...@cloudflare.com, > Linux Next Mailing List , > Linux Kernel Mailing List , > linux-riscv , > kexec > Bcc: b...@redhat.com > Subject: Re: linux-next: Tree for Dec 1 (riscv, crash_core) > Reply-To: >

Re: [PATCH 2/2] riscv, kexec: fix dependency of two items

2023-12-04 Thread Randy Dunlap
On 12/3/23 18:23, Baoquan He wrote: > Drop the dependency on MMU from ARCH_SUPPORTS_KEXEC and > ARCH_SUPPORTS_KEXEC_FILE because CONFIG_MMU could be disabled while > people may still want to have KEXEC/KEXEC_FILE functionality. > > Signed-off-by: Baoquan He Tested-by: Randy Dunlap #

Re: [PATCH 1/2] riscv, crash: don't export some symbols when CONFIG_MMU=n

2023-12-04 Thread Randy Dunlap
On 12/3/23 18:19, Baoquan He wrote: > When dropping select of KEXEC and dependency on ARCH_SUPPORTS_KEXEC > from CRASH_DUMP, compiling error is reported when below config items are > set: > --- > CONFIG_CRASH_CORE=y > CONFIG_KEXEC_CORE=y > CONFIG_CRASH_DUMP=y > .. >

Re: [PATCH v3 5/7] kexec_file, ricv: print out debugging message if required

2023-12-04 Thread Conor Dooley
On Mon, Dec 04, 2023 at 11:38:05PM +0800, Baoquan He wrote: > On 12/01/23 at 10:38am, Conor Dooley wrote: > > On Thu, Nov 30, 2023 at 10:39:53AM +0800, Baoquan He wrote: > > > > $subject has a typo in the arch bit :) > > Indeed, will fix if need report. Thanks for careful checking. > > > > > >

Re: [PATCH v3 5/7] kexec_file, ricv: print out debugging message if required

2023-12-04 Thread Baoquan He
On 12/01/23 at 10:38am, Conor Dooley wrote: > On Thu, Nov 30, 2023 at 10:39:53AM +0800, Baoquan He wrote: > > $subject has a typo in the arch bit :) Indeed, will fix if need report. Thanks for careful checking. > > > Replace pr_debug() with the newly added kexec_dprintk() in kexec_file > >

[PATCH 1/2] [Crash-utility] RISCV64: Dump NT_PRSTATUS in 'help -n'

2023-12-04 Thread Song Shuai
With the patch we can get full dump of "struct elf_prstatus" in 'help -n': ``` crash> help -n Elf64_Nhdr: n_namesz: 5 ("CORE") n_descsz: 376 n_type: 1 (NT_PRSTATUS) si.signo: 0 si.code: 0 si.errno: 0

[PATCH 2/2] [Crash-utility] RISCV64: Fix 'bt' output when no ra on the stack top

2023-12-04 Thread Song Shuai
Same as the Linux commit f766f77a74f5 ("riscv/stacktrace: Fix stack output without ra on the stack top"). When a function doesn't have a callee, then it will not push ra into the stack, such as lkdtm functions, so correct the FP of the second frame and use pt_regs to get the right PC of the

Re: [PATCH 07/10] printk: Remove the now superfluous sentinel elements from ctl_table array

2023-12-04 Thread Joel Granados
Hey Petr I missed this message somehow On Tue, Nov 28, 2023 at 03:07:43PM +0100, Petr Mladek wrote: > On Tue 2023-11-07 14:45:07, Joel Granados via B4 Relay wrote: > > From: Joel Granados > > > > This commit comes at the tail end of a greater effort to remove the > > empty elements at the

Re: [PATCH v3 2/7] kexec_file: print out debugging message if required

2023-12-04 Thread Baoquan He
On 11/29/23 at 06:52pm, Joe Perches wrote: > On Thu, 2023-11-30 at 10:39 +0800, Baoquan He wrote: > > Replace pr_debug() with the newly added kexec_dprintk() in kexec_file > > loading related codes. > > trivia: > > > diff --git a/kernel/crash_core.c b/kernel/crash_core.c > [] > > @@ -551,9

Re: [PATCH] riscv, kexec: fix the ifdeffery for AFLAGS_kexec_relocate.o

2023-12-04 Thread Baoquan He
CC Andrew. On 12/01/23 at 02:25pm, Baoquan He wrote: > This was introduced in commit fba8a8674f68 ("RISC-V: Add kexec > support"). > > It should work on CONFIG_KEXEC_CORE, but not CONFIG_KEXEC only, since > we could set CONFIG_KEXEC_FILE=y and CONFIG_KEXEC=N, or only set > CONFIG_CRASH_DUMP=y