[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

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

2023-12-04 Thread Kirill A. Shutemov
-off-by: Kirill A. Shutemov Link: https://lore.kernel.org/all/13356251.uLZWGnKmhe@kreacher --- arch/x86/include/asm/smp.h | 1 + arch/x86/kernel/acpi/Makefile| 2 +- arch/x86/kernel/acpi/madt_playdead.S | 21 ++ arch/x86/kernel/acpi/madt_wakeup.c | 295

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

2023-12-04 Thread Kirill A. Shutemov
: 0x8110687c (kvmclock_disable+0x1c/0x30) kvmclock enabling is gated by CLOCKSOURCE and CLOCKSOURCE2 KVM paravirt features. Do not disable kvmclock if it was not enabled. Signed-off-by: Kirill A. Shutemov Fixes: c02027b5742b ("x86/kvm: Disable kvmclock on all CPUs on shutdown") Reviewe

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

2023-12-04 Thread Kirill A. Shutemov
-by: Kirill A. Shutemov --- arch/x86/coco/core.c | 1 - arch/x86/kernel/acpi/madt_wakeup.c | 3 +++ include/linux/cc_platform.h| 10 -- kernel/cpu.c | 3 +-- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/arch/x86/coco/core.c b/arch

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

2023-12-04 Thread Kirill A. Shutemov
confusion. Signed-off-by: Kirill A. Shutemov Reviewed-by: Kai Huang Reviewed-by: Kuppuswamy Sathyanarayanan --- arch/x86/kernel/acpi/madt_wakeup.c | 2 +- include/acpi/actbl2.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/acpi/madt_wakeup.c

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

2023-12-04 Thread Kirill A. Shutemov
private mapping is fatal. It leads to unrecoverable TD exit. On kexec walk direct mapping and convert all shared memory back to private. It makes all RAM private again and second kernel may use it normally. Signed-off-by: Kirill A. Shutemov --- arch/x86/coco/tdx/kexec.c | 0 arch/x86

[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 --- arch/x86/kernel/relocate_kernel_64

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

2023-12-04 Thread Kirill A. Shutemov
org/all/13356251.uLZWGnKmhe@kreacher Kirill A. Shutemov (14): x86/acpi: Extract ACPI MADT wakeup code into a separate file x86/apic: Mark acpi_mp_wake_* variables as __ro_after_init cpu/hotplug: Add support for declaring CPU offlining not supported cpu/hotplug, x86/acpi: Disable CPU offlin

[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 a/arch/x86/kernel

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

2023-12-04 Thread Kirill A. Shutemov
kernel with signle CPU is enough to cover the most common case for kexec -- kdump. Signed-off-by: Kirill A. Shutemov Reviewed-by: Kai Huang Reviewed-by: Kuppuswamy Sathyanarayanan --- arch/x86/kernel/acpi/madt_wakeup.c | 22 ++ 1 file changed, 22 insertions(+) diff --git

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

2023-12-04 Thread Kirill A. Shutemov
it. Keep track of the number of shared pages. This will allow for cross-checking against the shared information in the direct mapping and reporting if the shared bit is lost. Include a debugfs interface that allows for the check to be performed at any point. Signed-off-by: Kirill A. Shutemov --- arch

Re: [PATCHv3 00/14] x86/tdx: Add kexec support

2023-11-21 Thread Kirill A. Shutemov
cause > cpus are not resettable like kexec reboot does. Not sure if this is seen > in your test. Yes. It is the same reboot limitation I've mentioned before. -- Kiryl Shutsemau / Kirill A. Shutemov ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec

Re: [PATCHv3 00/14] x86/tdx: Add kexec support

2023-11-21 Thread Kirill A. Shutemov
t.github.com/kiryl/e1dc1719e0c990b3ceee5d8de8dbf332 > > > Thanks a lot for providing the BIOS patch. One more question, is the > patched BIOS image for the host physical machine or for the tdx guest > vm? For the guest. -- Kiryl Shutsemau / Kirill A. Shutemov

Re: [PATCHv3 00/14] x86/tdx: Add kexec support

2023-11-21 Thread Kirill A. Shutemov
d you to tested before, right? If not, failure is expected. > 3) not sure if this is particular case on the system we tested on. -- Kiryl Shutsemau / Kirill A. Shutemov ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec

Re: [PATCHv3 00/14] x86/tdx: Add kexec support

2023-11-17 Thread Kirill A. Shutemov
On Thu, Nov 16, 2023 at 10:45:23PM +0800, Baoquan He wrote: > On 11/16/23 at 10:17pm, Baoquan He wrote: > > On 11/16/23 at 03:56pm, Kirill A. Shutemov wrote: > > > On Thu, Nov 16, 2023 at 08:10:47PM +0800, Baoquan He wrote: > > > > On 11/15/23 at 03:

Re: [PATCHv3 00/14] x86/tdx: Add kexec support

2023-11-16 Thread Kirill A. Shutemov
On Thu, Nov 16, 2023 at 08:10:47PM +0800, Baoquan He wrote: > On 11/15/23 at 03:00pm, Kirill A. Shutemov wrote: > > The patchset adds bits and pieces to get kexec (and crashkernel) work on > > TDX guest. > > I finally got a machine of intel-eaglestream-spr as host and built

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

2023-11-15 Thread Kirill A. Shutemov
: 0x8110687c (kvmclock_disable+0x1c/0x30) kvmclock enabling is gated by CLOCKSOURCE and CLOCKSOURCE2 KVM paravirt features. Do not disable kvmclock if it was not enabled. Signed-off-by: Kirill A. Shutemov Fixes: c02027b5742b ("x86/kvm: Disable kvmclock on all CPUs on shutdown") Reviewe

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

2023-11-15 Thread Kirill A. Shutemov
On Wed, Nov 15, 2023 at 01:23:43PM +0100, Peter Zijlstra wrote: > On Wed, Nov 15, 2023 at 03:00:36PM +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

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

2023-11-15 Thread Kirill A. Shutemov
by one PGD entry in 5-level paging mode. Signed-off-by: Kirill A. Shutemov Reviewed-by: Rick Edgecombe --- arch/x86/include/asm/pgtable_types.h | 1 + arch/x86/mm/pat/set_memory.c | 8 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm

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

2023-11-15 Thread Kirill A. Shutemov
private mapping is fatal. It leads to unrecoverable TD exit. On kexec walk direct mapping and convert all shared memory back to private. It makes all RAM private again and second kernel may use it normally. Signed-off-by: Kirill A. Shutemov --- arch/x86/coco/tdx/kexec.c | 0 arch/x86

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

2023-11-15 Thread Kirill A. Shutemov
-off-by: Kirill A. Shutemov Link: https://lore.kernel.org/all/13356251.uLZWGnKmhe@kreacher --- arch/x86/kernel/acpi/Makefile| 2 +- arch/x86/kernel/acpi/boot.c | 2 + arch/x86/kernel/acpi/madt_playdead.S | 21 ++ arch/x86/kernel/acpi/madt_wakeup.c | 332

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

2023-11-15 Thread Kirill A. Shutemov
it. Keep track of the number of shared pages. This will allow for cross-checking against the shared information in the direct mapping and reporting if the shared bit is lost. Include a debugfs interface that allows for the check to be performed at any point. Signed-off-by: Kirill A. Shutemov --- arch

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

2023-11-15 Thread Kirill A. Shutemov
kernel with signle CPU is enough to cover the most common case for kexec -- kdump. Signed-off-by: Kirill A. Shutemov Reviewed-by: Kai Huang --- arch/x86/kernel/acpi/madt_wakeup.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/arch/x86/kernel/acpi/madt_wakeup.c b/arch

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

2023-11-15 Thread Kirill A. Shutemov
confusion. Signed-off-by: Kirill A. Shutemov Reviewed-by: Kai Huang Reviewed-by: Kuppuswamy Sathyanarayanan --- arch/x86/kernel/acpi/madt_wakeup.c | 2 +- include/acpi/actbl2.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/acpi/madt_wakeup.c

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

2023-11-15 Thread Kirill A. Shutemov
-by: Kirill A. Shutemov --- arch/x86/coco/core.c | 1 - arch/x86/kernel/acpi/madt_wakeup.c | 3 +++ include/linux/cc_platform.h| 10 -- kernel/cpu.c | 3 +-- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/arch/x86/coco/core.c b/arch

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

2023-11-15 Thread Kirill A. Shutemov
guest. TDX guest uses E820_TYPE_ACPI to store the unaccepted memory bitmap and pass it between the kernels on kexec. Signed-off-by: Kirill A. Shutemov --- arch/x86/kernel/e820.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820

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

2023-11-15 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 --- arch/x86/kernel/acpi/madt_wakeup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/acpi/madt_wakeup.c b

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

2023-11-15 Thread Kirill A. Shutemov
for ACPI MADT. Signed-off-by: Kirill A. Shutemov --- include/linux/cpu.h | 2 ++ kernel/cpu.c| 13 - 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/include/linux/cpu.h b/include/linux/cpu.h index fc8094419084..46f2e34a0c5e 100644 --- a/include/linux/cpu.h

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

2023-11-15 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

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

2023-11-15 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

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

2023-11-15 Thread Kirill A. Shutemov
ent acpi_mp_play_dead(); - cond_resched() in tdx_shared_memory_show(); - s/target kernel/second kernel/; - Update commit messages and comments; [1] https://lore.kernel.org/all/13356251.uLZWGnKmhe@kreacher Kirill A. Shutemov (14): x86/acpi: Extract ACPI MADT wakeup code into a separate file

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

2023-11-15 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 --- arch/x86/kernel/relocate_kernel_64

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

2023-11-01 Thread Kirill A. Shutemov
On Sun, Oct 29, 2023 at 06:31:36PM +0100, Thomas Gleixner wrote: > On Fri, Oct 20 2023 at 18:12, Kirill A. Shutemov wrote: > > > MADT Multiprocessor Wakeup structure version 1 brings support of CPU > > offlining: BIOS provides a reset vector where the CPU has to jump to

Re: [PATCHv2 02/13] kernel/cpu: Add support for declaring CPU offlining not supported

2023-10-29 Thread Kirill A. Shutemov
On Sat, Oct 28, 2023 at 04:12:10PM +0200, Thomas Gleixner wrote: > On Fri, Oct 20 2023 at 18:12, Kirill A. Shutemov wrote: > > Subject: cpu/hotplug: ... > > > ACPI MADT doesn't allow to offline CPU after it got woke up. > > ACPI MADT is a table ... > > This is

Re: [PATCHv2 11/13] x86/acpi: Do not attempt to bring up secondary CPUs in kexec case

2023-10-27 Thread Kirill A. Shutemov
On Tue, Oct 24, 2023 at 06:59:58AM -0700, Kuppuswamy Sathyanarayanan wrote: > > > On 10/20/2023 8:12 AM, Kirill A. Shutemov wrote: > > 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

[PATCHv2 00/13] x86/tdx: Add kexec support

2023-10-20 Thread Kirill A. Shutemov
() to implement acpi_mp_play_dead(); - cond_resched() in tdx_shared_memory_show(); - s/target kernel/second kernel/; - Update commit messages and comments; [1] https://lore.kernel.org/all/13356251.uLZWGnKmhe@kreacher Kirill A. Shutemov (13): x86/acpi: Extract ACPI MADT wakeup code into a separate

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

2023-10-20 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 --- arch/x86/kernel/relocate_kernel_64

[PATCHv2 06/13] x86/mm: Make x86_platform.guest.enc_status_change_*() return errno

2023-10-20 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

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

2023-10-20 Thread Kirill A. Shutemov
kernel with signle CPU is enough to cover the most common case for kexec -- kdump. Signed-off-by: Kirill A. Shutemov --- arch/x86/kernel/acpi/madt_wakeup.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/arch/x86/kernel/acpi/madt_wakeup.c b/arch/x86/kernel/acpi

[PATCHv2 08/13] x86/tdx: Account shared memory

2023-10-20 Thread Kirill A. Shutemov
it. Keep track of the number of shared pages. This will allow for cross-checking against the shared information in the direct mapping and reporting if the shared bit is lost. Include a debugfs interface that allows for the check to be performed at any point. Signed-off-by: Kirill A. Shutemov --- arch

[PATCHv2 07/13] x86/mm: Return correct level from lookup_address() if pte is none

2023-10-20 Thread Kirill A. Shutemov
by one PGD entry in 5-level paging mode. Signed-off-by: Kirill A. Shutemov Reviewed-by: Rick Edgecombe --- arch/x86/include/asm/pgtable_types.h | 1 + arch/x86/mm/pat/set_memory.c | 8 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm

[PATCHv2 13/13] x86/acpi: Add support for CPU offlining for ACPI MADT wakeup method

2023-10-20 Thread Kirill A. Shutemov
-off-by: Kirill A. Shutemov Link: https://lore.kernel.org/all/13356251.uLZWGnKmhe@kreacher --- arch/x86/kernel/acpi/Makefile | 2 +- arch/x86/kernel/acpi/boot.c| 2 + arch/x86/kernel/acpi/madt.S| 24 arch/x86/kernel/acpi/madt_wakeup.c | 197

[PATCHv2 12/13] x86/acpi: Rename fields in acpi_madt_multiproc_wakeup structure

2023-10-20 Thread Kirill A. Shutemov
confusion. Signed-off-by: Kirill A. Shutemov --- arch/x86/kernel/acpi/madt_wakeup.c | 4 ++-- include/acpi/actbl2.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/acpi/madt_wakeup.c b/arch/x86/kernel/acpi/madt_wakeup.c index 9bbe829737e7

[PATCHv2 02/13] kernel/cpu: Add support for declaring CPU offlining not supported

2023-10-20 Thread Kirill A. Shutemov
to indicate that CPU offlining should be disabled. This function is going to replace CC_ATTR_HOTPLUG_DISABLED for ACPI MADT. Signed-off-by: Kirill A. Shutemov --- include/linux/cpu.h | 2 ++ kernel/cpu.c| 13 - 2 files changed, 14 insertions(+), 1 deletion(-) diff --git

[PATCHv2 09/13] x86/tdx: Convert shared memory back to private on kexec

2023-10-20 Thread Kirill A. Shutemov
private mapping is fatal. It leads to unrecoverable TD exit. On kexec walk direct mapping and convert all shared memory back to private. It makes all RAM private again and second kernel may use it normally. Signed-off-by: Kirill A. Shutemov --- arch/x86/coco/tdx/kexec.c | 0 arch/x86

[PATCHv2 10/13] x86/mm: Make e820_end_ram_pfn() cover E820_TYPE_ACPI ranges

2023-10-20 Thread Kirill A. Shutemov
guest. TDX guest uses E820_TYPE_ACPI to store the unaccepted memory bitmap and pass it between the kernels on kexec. Signed-off-by: Kirill A. Shutemov --- arch/x86/kernel/e820.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820

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

2023-10-20 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

[PATCHv2 04/13] x86/kvm: Do not try to disable kvmclock if it was not enabled

2023-10-20 Thread Kirill A. Shutemov
: 0x8110687c (kvmclock_disable+0x1c/0x30) kvmclock enabling is gated by CLOCKSOURCE and CLOCKSOURCE2 KVM paravirt features. Do not disable kvmclock if it was not enabled. Signed-off-by: Kirill A. Shutemov Fixes: c02027b5742b ("x86/kvm: Disable kvmclock on all CPUs on shutdown") Cc: Paolo B

[PATCHv2 03/13] cpu/hotplug, x86/acpi: Disable CPU offlining for ACPI MADT wakeup

2023-10-20 Thread Kirill A. Shutemov
-by: Kirill A. Shutemov --- arch/x86/coco/core.c | 1 - arch/x86/kernel/acpi/madt_wakeup.c | 3 +++ include/linux/cc_platform.h| 10 -- kernel/cpu.c | 3 +-- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/arch/x86/coco/core.c b/arch

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

2023-10-20 Thread Kirill A. Shutemov
On Fri, Oct 20, 2023 at 12:21:11PM +0300, Kirill A. Shutemov wrote: > On Fri, Oct 06, 2023 at 02:24:11PM -0500, Kalra, Ashish wrote: > > > > On 10/5/2023 5:28 PM, Kirill A. Shutemov wrote: > > > On Thu, Oct 05, 2023 at 05:01:23PM -0500, Kalra, Ashish wrote: > > &g

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

2023-10-20 Thread Kirill A. Shutemov
On Fri, Oct 06, 2023 at 02:24:11PM -0500, Kalra, Ashish wrote: > > On 10/5/2023 5:28 PM, Kirill A. Shutemov wrote: > > On Thu, Oct 05, 2023 at 05:01:23PM -0500, Kalra, Ashish wrote: > > > On 10/5/2023 4:28 PM, Kirill A. Shutemov wrote: > > > > On Thu, Oct 05

Re: [PATCH 04/13] x86/kvm: Do not try to disable kvmclock if it was not enabled

2023-10-11 Thread Kirill A. Shutemov
On Tue, Oct 10, 2023 at 06:53:27AM -0700, Kuppuswamy Sathyanarayanan wrote: > > > On 10/5/2023 6:13 AM, Kirill A. Shutemov wrote: > > kvm_guest_cpu_offline() tries to disable kvmclock regardless if it is > > present in the VM. It leads to write to a MSR that

Re: [PATCH 02/13] kernel/cpu: Add support for declaring CPU hotplug not supported

2023-10-11 Thread Kirill A. Shutemov
On Tue, Oct 10, 2023 at 06:35:59AM -0700, Kuppuswamy Sathyanarayanan wrote: > > > On 10/5/2023 6:13 AM, Kirill A. Shutemov wrote: > > The function cpu_hotplug_not_supported() can be called to indicate that > > CPU hotplug should be disabled. It does not prevent

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

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

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 sep

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

2023-10-06 Thread Kirill A. Shutemov
On Fri, Oct 06, 2023 at 07:58:03AM -0700, Sean Christopherson wrote: > On Thu, Oct 05, 2023, Kirill A. Shutemov wrote: > > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > > index 7368d254d01f..b5acf9fb4c70 100644 > > --- a/arch/x86/Kconfig > > +++ b/arch/x86/K

Re: [PATCH 04/13] x86/kvm: Do not try to disable kvmclock if it was not enabled

2023-10-06 Thread Kirill A. Shutemov
On Fri, Oct 06, 2023 at 07:36:54AM -0700, Sean Christopherson wrote: > +Paolo > > Please use get_maintainers... Will do, sorry. > On Thu, Oct 05, 2023, Kirill A. Shutemov wrote: > > kvm_guest_cpu_offline() tries to disable kvmclock regardless if it is > > present in t

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

2023-10-05 Thread Kirill A. Shutemov
On Thu, Oct 05, 2023 at 05:01:23PM -0500, Kalra, Ashish wrote: > On 10/5/2023 4:28 PM, Kirill A. Shutemov wrote: > > On Thu, Oct 05, 2023 at 01:41:38PM -0500, Kalra, Ashish wrote: > > > > +static void unshare_all_memory(bool unmap) > > > > +{ > &

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

2023-10-05 Thread Kirill A. Shutemov
Bypass unmapping for crash scenario. Unmapping > > +* requires sleepable context, but in crash case kernel > > +* hits the code path with interrupts disabled. > > In case of SNP we will need to temporarily enable interrupts during this >

[PATCH 02/13] kernel/cpu: Add support for declaring CPU hotplug not supported

2023-10-05 Thread Kirill A. Shutemov
The function cpu_hotplug_not_supported() can be called to indicate that CPU hotplug should be disabled. It does not prevent the initial bring up of the CPU, but it stops subsequent offlining. This function is intended to replace CC_ATTR_HOTPLUG_DISABLED. Signed-off-by: Kirill A. Shutemov

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

2023-10-05 Thread Kirill A. Shutemov
-by: Kirill A. Shutemov --- arch/x86/Kconfig | 7 +++ arch/x86/include/asm/acpi.h| 5 ++ arch/x86/kernel/acpi/Makefile | 11 ++-- arch/x86/kernel/acpi/boot.c| 86 +- arch/x86/kernel/acpi/madt_wakeup.c | 80

[PATCH 07/13] x86/mm: Return correct level from lookup_address() if pte is none

2023-10-05 Thread Kirill A. Shutemov
by one PGD entry in 5-level paging mode. Signed-off-by: Kirill A. Shutemov Reviewed-by: Rick Edgecombe --- arch/x86/include/asm/pgtable_types.h | 1 + arch/x86/mm/pat/set_memory.c | 8 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm

[PATCH 04/13] x86/kvm: Do not try to disable kvmclock if it was not enabled

2023-10-05 Thread Kirill A. Shutemov
: 0x8110687c (kvmclock_disable+0x1c/0x30) kvmclock enabling is gated by CLOCKSOURCE and CLOCKSOURCE2 KVM paravirt features. Do not disable kvmclock if it was not enumerated or disabled by user from kernel command line. Signed-off-by: Kirill A. Shutemov Fixes: c02027b5742b ("x86/kvm: Disable kvm

[PATCH 13/13] x86/acpi: Add support for CPU offlining for ACPI MADT wakeup method

2023-10-05 Thread Kirill A. Shutemov
by implementing custom cpu_die, play_dead and stop_other_cpus SMP operations. CPU offlining makes possible to hand over secondary CPUs over kexec, not limiting the target kernel with single CPU. The change conforms to the approved ACPI spec change proposal. See the Link. Signed-off-by: Kirill

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

2023-10-05 Thread Kirill A. Shutemov
offlining according to the approved ACPI spec change poposal[1]. It unlocks kexec with all CPUs visible in the target kernel. Please review. I would be glad for any feedback. [1] https://lore.kernel.org/all/13356251.uLZWGnKmhe@kreacher Kirill A. Shutemov (13): x86/acpi: Extract ACPI MADT wakeup

[PATCH 08/13] KVM: x86: Add config option to gate emergency virt callback support

2023-10-05 Thread Kirill A. Shutemov
. Signed-off-by: Kirill A. Shutemov --- arch/x86/include/asm/reboot.h | 4 ++-- arch/x86/kernel/reboot.c | 4 ++-- arch/x86/kvm/Kconfig | 5 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/reboot.h b/arch/x86/include/asm/reboot.h index

[PATCH 11/13] x86/mm: Make e820_end_ram_pfn() cover E820_TYPE_ACPI ranges

2023-10-05 Thread Kirill A. Shutemov
guest. TDX guest uses E820_TYPE_ACPI to store the unaccepted memory bitmap and pass it between the kernels on kexec. Signed-off-by: Kirill A. Shutemov --- arch/x86/kernel/e820.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820

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

2023-10-05 Thread Kirill A. Shutemov
spec. Booting the target kernel with signle CPU is enough to cover the most common case for kexec -- kdump. Signed-off-by: Kirill A. Shutemov --- arch/x86/kernel/acpi/madt_wakeup.c | 17 + 1 file changed, 17 insertions(+) diff --git a/arch/x86/kernel/acpi/madt_wakeup.c b/arch/x86

[PATCH 09/13] x86/tdx: Account shared memory

2023-10-05 Thread Kirill A. Shutemov
it. Keep track of the number of shared pages. This will allow for cross-checking against the shared information in the direct mapping and reporting if the shared bit is lost. Include a debugfs interface that allows for the check to be performed at any point. Signed-off-by: Kirill A. Shutemov --- arch

[PATCH 03/13] cpu/hotplug, x86/acpi: Disable CPU hotplug for ACPI MADT wakeup

2023-10-05 Thread Kirill A. Shutemov
numeration. Signed-off-by: Kirill A. Shutemov --- arch/x86/coco/core.c | 1 - arch/x86/kernel/acpi/madt_wakeup.c | 4 include/linux/cc_platform.h| 10 -- kernel/cpu.c | 2 +- 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/arc

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

2023-10-05 Thread Kirill A. Shutemov
private mapping is fatal. It leads to unrecoverable TD exit. On TD shutdown (also covers kexec), walk direct mapping and convert all shared memory back to private. It makes all RAM private again and target kernel may use it normally. Signed-off-by: Kirill A. Shutemov --- arch/x86/Kconfig

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

2023-10-05 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 environments. Signed-off-by: Kirill A. Shutemov --- arch/x86/kernel/relocate_kernel_64.S | 5 + 1 file changed, 5

[PATCH 06/13] x86/mm: Make x86_platform.guest.enc_status_change_*() return errno

2023-10-05 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

Re: kexec reboot failed due to commit 75d090fd167ac

2023-09-21 Thread Kirill A. Shutemov
On Thu, Sep 21, 2023 at 11:54:15AM +0200, Linux regression tracking (Thorsten Leemhuis) wrote: > On 13.09.23 16:24, Kirill A. Shutemov wrote: > > On Mon, Sep 11, 2023 at 05:57:07PM +0300, Kirill A. Shutemov wrote: > >> On Mon, Sep 11, 2023 at 10:56:36PM +0800, Dave Young w

[PATCHv2] x86/boot/compressed: Reserve more memory for page tables

2023-09-15 Thread Kirill A. Shutemov
can be simplified by using a single value for all kernel configurations. Signed-off-by: Kirill A. Shutemov Reported-by: Aaron Lu Fixes: 34bbb0009f3b ("x86/boot/compressed: Enable 5-level paging during decompression stage") --- arch/x86/boot/compressed/ident_map_64.c | 8 + arch/x

Re: [PATCH] x86/boot/compressed: Reserve more memory for page tables

2023-09-14 Thread Kirill A. Shutemov
On Thu, Sep 14, 2023 at 08:51:50AM -0700, Dave Hansen wrote: > On 9/14/23 05:30, Kirill A. Shutemov wrote: > > +/* > > + * Total number of page table kernel_add_identity_map() can allocate, > > + * including page tables consumed by startup_32(). > > + */ > > +# def

[PATCH] x86/boot/compressed: Reserve more memory for page tables

2023-09-14 Thread Kirill A. Shutemov
configurations. Signed-off-by: Kirill A. Shutemov Reported-by: Aaron Lu Fixes: 34bbb0009f3b ("x86/boot/compressed: Enable 5-level paging during decompression stage") --- arch/x86/include/asm/boot.h | 27 --- 1 file changed, 12 insertions(+), 15 deletions(-)

Re: kexec reboot failed due to commit 75d090fd167ac

2023-09-13 Thread Kirill A. Shutemov
On Mon, Sep 11, 2023 at 05:57:07PM +0300, Kirill A. Shutemov wrote: > On Mon, Sep 11, 2023 at 10:56:36PM +0800, Dave Young wrote: > > > early console in extract_kernel > > > input_data: 0x00807eb433a8 > > > input_len: 0x00d26271 > > > outp

Re: kexec reboot failed due to commit 75d090fd167ac

2023-09-11 Thread Kirill A. Shutemov
On Mon, Sep 11, 2023 at 10:33:01AM -0500, Tom Lendacky wrote: > On 9/11/23 09:57, Kirill A. Shutemov wrote: > > On Mon, Sep 11, 2023 at 10:56:36PM +0800, Dave Young wrote: > > > > early console in extract_kernel > > > > input_data: 0x00807eb433a8 >

Re: kexec reboot failed due to commit 75d090fd167ac

2023-09-11 Thread Kirill A. Shutemov
am not sure I saw all users. Some of them could silently handled with pagefault handler in some setups. And it is hard to catch new users during code review. Also I'm not sure why do we need pagefault handler there. Looks like it just masking problems. I think everything has to be mapped e

Re: [PATCH 1/3] proc/vmcore: Do not map unaccepted memory

2023-09-11 Thread Kirill A. Shutemov
On Mon, Sep 11, 2023 at 11:50:31AM +0200, David Hildenbrand wrote: > On 11.09.23 11:27, Kirill A. Shutemov wrote: > > On Mon, Sep 11, 2023 at 10:42:51AM +0200, David Hildenbrand wrote: > > > On 11.09.23 10:41, Kirill A. Shutemov wrote: > > > > On Mon, Sep 11, 2

Re: [PATCH 1/3] proc/vmcore: Do not map unaccepted memory

2023-09-11 Thread Kirill A. Shutemov
On Mon, Sep 11, 2023 at 10:42:51AM +0200, David Hildenbrand wrote: > On 11.09.23 10:41, Kirill A. Shutemov wrote: > > On Mon, Sep 11, 2023 at 10:03:36AM +0200, David Hildenbrand wrote: > > > On 06.09.23 09:39, Adrian Hunter wrote: > > > > Support for unaccepted me

Re: [PATCH 1/3] proc/vmcore: Do not map unaccepted memory

2023-09-11 Thread Kirill A. Shutemov
e, but generally, yes, the information is available to the target kernel via EFI configuration table. -- Kiryl Shutsemau / Kirill A. Shutemov ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec

Re: [PATCH 3/3] /dev/mem: Do not map unaccepted memory

2023-09-07 Thread Kirill A. Shutemov
this really worth patching? Is it better to let TD die silently? I don't think so. -- Kiryl Shutsemau / Kirill A. Shutemov ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec

Re: [PATCH 0/3] Do not map unaccepted memory

2023-09-07 Thread Kirill A. Shutemov
gt; > Plug a few gaps where RAM is exposed without checking if it is > unaccepted memory. Thanks for catching this. Looks good to me. Reviewed-by: Kirill A. Shutemov -- Kiryl Shutsemau / Kirill A. Shutemov ___ kexec mailing l

Re: [PATCH 3/3] /dev/mem: Do not map unaccepted memory

2023-09-07 Thread Kirill A. Shutemov
at this point. -- Kiryl Shutsemau / Kirill A. Shutemov ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec

Re: [PATCH] x86: Disable kexec for TDX guests

2023-03-27 Thread Kirill A. Shutemov
On Mon, Mar 27, 2023 at 09:35:54AM +0800, Baoquan He wrote: > On 03/26/23 at 10:01am, Dave Hansen wrote: > > On 3/25/23 12:25, Kirill A. Shutemov wrote: > > > On Sat, Mar 25, 2023 at 09:25:36AM -0700, Dave Hansen wrote: > > >> On 3/25/23 09:01, Kirill A. Shutemo

Re: [PATCH] x86: Disable kexec for TDX guests

2023-03-27 Thread Kirill A. Shutemov
IDT/TSS and/or not having a safe stack to service the event. I tend to agree with him, but maybe I miss bigger picture. Based on that I adjusted the patch to only affect TDX guests: >From edbef5f1e6c31929ae1249c58b29c38f86e676c0 Mon Sep 17 00:00:00 2001 From: "Kirill A. Shutemov&q

Re: [PATCH] x86: Disable kexec for TDX guests

2023-03-25 Thread Kirill A. Shutemov
On Sat, Mar 25, 2023 at 09:25:36AM -0700, Dave Hansen wrote: > On 3/25/23 09:01, Kirill A. Shutemov wrote: > > The last item is tricky. TDX guests use ACPI MADT MPWK to bring up > > secondary CPUs. The mechanism doesn't allow to put a CPU back offline if > > it has wok

[PATCH] x86: Disable kexec for TDX guests

2023-03-25 Thread Kirill A. Shutemov
-kirill.shute...@linux.intel.com Signed-off-by: Kirill A. Shutemov --- arch/x86/include/asm/kexec.h | 3 +++ arch/x86/kernel/machine_kexec_64.c | 10 ++ include/linux/kexec.h | 7 +++ kernel/kexec.c | 4 kernel/kexec_file.c| 4

Re: [PATCH 0/2] Kexec enabling in TDX guest

2023-02-24 Thread Kirill A. Shutemov
On Fri, Feb 24, 2023 at 07:22:18AM -0800, Dave Hansen wrote: > On 2/24/23 06:30, Kirill A. Shutemov wrote: > > Ideally, it has to be addressed on BIOS level: it has to provide a way to > > offline CPUs, putting it back to pre-wakeup state. > > Is there anything stopping

Re: [PATCH 0/2] Kexec enabling in TDX guest

2023-02-24 Thread Kirill A. Shutemov
On Wed, Feb 22, 2023 at 10:26:22AM +, David Woodhouse wrote: > On Tue, 2023-02-14 at 02:48 +0300, Kirill A. Shutemov wrote: > > The patch brings basic enabling of kexec in TDX guests. > > > > By "basic enabling" I mean, kexec in the guests with a single CPU. &g

Re: [PATCH 0/2] Kexec enabling in TDX guest

2023-02-16 Thread Kirill A. Shutemov
On Thu, Feb 16, 2023 at 09:50:32AM -0800, Dave Hansen wrote: > On 2/13/23 15:48, Kirill A. Shutemov wrote: > > The patch brings basic enabling of kexec in TDX guests. > > > > By "basic enabling" I mean, kexec in the guests with a single CPU. > > TDX guests use

Re: [PATCH 1/2] x86/kexec: Preserve CR4.MCE during kexec

2023-02-16 Thread Kirill A. Shutemov
On Thu, Feb 16, 2023 at 01:49:39AM +, Edgecombe, Rick P wrote: > On Tue, 2023-02-14 at 02:48 +0300, Kirill A. Shutemov wrote: > > TDX guests are not allowed to clear CR4.MCE. Attempt to clear it > > leads > > to #VE. > > > > Preserve the flag during kexe

[PATCH 0/2] Kexec enabling in TDX guest

2023-02-13 Thread Kirill A. Shutemov
t it might take time. Kirill A. Shutemov (2): x86/kexec: Preserve CR4.MCE during kexec x86/tdx: Convert shared memory back to private on kexec arch/x86/coco/tdx/Makefile | 1 + arch/x86/coco/tdx/kexec.c| 82 arch/x86/include/asm/tdx.h

[PATCH 2/2] x86/tdx: Convert shared memory back to private on kexec

2023-02-13 Thread Kirill A. Shutemov
allocate from the memory the first kernel made shared. For crash investigation, it might be useful to access data in the shared buffers. Signed-off-by: Kirill A. Shutemov --- arch/x86/coco/tdx/Makefile | 1 + arch/x86/coco/tdx/kexec.c | 82 ++ arch/x86

[PATCH 1/2] x86/kexec: Preserve CR4.MCE during kexec

2023-02-13 Thread Kirill A. Shutemov
TDX guests are not allowed to clear CR4.MCE. Attempt to clear it leads to #VE. Preserve the flag during kexec. Signed-off-by: Kirill A. Shutemov --- arch/x86/kernel/relocate_kernel_64.S | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/relocate_kernel_64

Re: [PATCHv7 11/14] x86: Disable kexec if system has unaccepted memory

2022-06-28 Thread Kirill A. Shutemov
On Tue, Jun 28, 2022 at 05:10:56PM -0700, Dave Hansen wrote: > On 6/28/22 16:51, Kirill A. Shutemov wrote: > > On Fri, Jun 24, 2022 at 05:00:05AM +0300, Kirill A. Shutemov wrote: > >>> If there is some deep and fundamental why this can not be supported > >>> th

Re: [PATCHv7 11/14] x86: Disable kexec if system has unaccepted memory

2022-06-28 Thread Kirill A. Shutemov
On Fri, Jun 24, 2022 at 05:00:05AM +0300, Kirill A. Shutemov wrote: > > If there is some deep and fundamental why this can not be supported > > then it probably makes sense to put some code in the arch_kexec_load > > hook that verifies that deep and fundamental reason is pr

<    1   2   3   >