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

2024-01-27 Thread kirill.shute...@linux.intel.com
On Fri, Jan 26, 2024 at 02:21:30PM +, Huang, Kai wrote: > > +static int __init acpi_mp_setup_reset(u64 reset_vector) > > +{ > > + pgd_t *pgd; > > + struct x86_mapping_info info = { > > + .alloc_pgt_page = alloc_pgt_page, > > + .free_pgt_page = free_pgt_page, > > +

Re: [PATCHv5 15/16] x86/mm: Introduce kernel_ident_mapping_free()

2024-01-08 Thread kirill.shute...@linux.intel.com
On Mon, Jan 08, 2024 at 01:13:18PM +, Huang, Kai wrote: > On Mon, 2024-01-08 at 13:17 +0300, kirill.shute...@linux.intel.com wrote: > > On Mon, Jan 08, 2024 at 03:30:21AM +, Huang, Kai wrote: > > > On Mon, 2024-01-08 at 03:13 +, Huang, Kai wrote: > > > &g

Re: [PATCHv5 15/16] x86/mm: Introduce kernel_ident_mapping_free()

2024-01-08 Thread kirill.shute...@linux.intel.com
On Mon, Jan 08, 2024 at 03:30:21AM +, Huang, Kai wrote: > On Mon, 2024-01-08 at 03:13 +, Huang, Kai wrote: > > On Sat, 2023-12-23 at 02:52 +0300, Kirill A. Shutemov wrote: > > > The helper complements kernel_ident_mapping_init(): it frees the > > > identity mapping that was previously

Re: [PATCHv5.1 14/16] x86/smp: Add smp_ops.stop_this_cpu() callback

2024-01-08 Thread kirill.shute...@linux.intel.com
On Mon, Jan 08, 2024 at 03:04:31AM +, Huang, Kai wrote: > On Mon, 2023-12-25 at 11:05 +0300, Kirill A. Shutemov wrote: > > If the helper is defined, it is called instead of halt() to stop the CPU > > at the end of stop_this_cpu() and on crash CPU shutdown. > > > > ACPI MADT will use it to

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

2024-01-05 Thread kirill.shute...@linux.intel.com
On Fri, Jan 05, 2024 at 07:38:48PM +, Edgecombe, Rick P wrote: > The break apart looks good. > > On Sat, 2023-12-23 at 02:52 +0300, Kirill A. Shutemov wrote: > > +   while (addr < end) { > > +   unsigned long size; > > +   unsigned int level; > > +   

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

2023-12-22 Thread kirill.shute...@linux.intel.com
On Tue, Dec 05, 2023 at 11:36:55PM +, Huang, Kai wrote: > > > + > > +static void acpi_mp_stop_other_cpus(int wait) > > +{ > > + smp_shutdown_nonboot_cpus(smp_processor_id()); > > +} > > Is this and ... > > + smp_ops.stop_other_cpus = acpi_mp_stop_other_cpus; > > ... this below still

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

2023-12-06 Thread kirill.shute...@linux.intel.com
On Wed, Dec 06, 2023 at 01:28:08AM +, Edgecombe, Rick P wrote: > On Tue, 2023-12-05 at 03:45 +0300, Kirill A. Shutemov wrote:  > > +static void tdx_kexec_unshare_mem(bool crash) > > +{ > > +   unsigned long addr, end; > > +   long found = 0, shared; > > + > > +   /* Stop new

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

2023-12-06 Thread kirill.shute...@linux.intel.com
On Tue, Dec 05, 2023 at 11:58:45PM +, Huang, Kai wrote: > On Tue, 2023-12-05 at 03:45 +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

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

2023-12-01 Thread kirill.shute...@linux.intel.com
On Thu, Nov 23, 2023 at 09:38:13AM +, Huang, Kai wrote: > > > diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c > > index 171d86fe71ef..602b5d3982ff 100644 > > --- a/arch/x86/kernel/acpi/boot.c > > +++ b/arch/x86/kernel/acpi/boot.c > > @@ -22,6 +22,7 @@ > > #include > >

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

2023-11-23 Thread kirill.shute...@linux.intel.com
On Wed, Nov 22, 2023 at 10:07:44AM +, Huang, Kai wrote: > On Tue, 2023-11-21 at 12:58 +0300, kirill.shute...@linux.intel.com wrote: > > On Tue, Nov 21, 2023 at 03:46:41AM +, Huang, Kai wrote: > > > > > > > > > > > +static atomic_t con

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

2023-11-21 Thread kirill.shute...@linux.intel.com
On Tue, Nov 21, 2023 at 03:46:41AM +, Huang, Kai wrote: > > > > > +static atomic_t conversions_in_progress; > > +static bool conversion_allowed = true; > > > > [...] > > > /* Used while preparing memory map entries for second kernel */ > > struct crash_memmap_data { > > @@ -107,6

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

2023-11-21 Thread kirill.shute...@linux.intel.com
On Tue, Nov 21, 2023 at 12:42:20PM +0300, kirill.shute...@linux.intel.com wrote: > > That being said, I think perhaps you can separate the /sysfs part as a > > separate > > patch because it's not a mandatory part of this series but a nice to have. > > Then > > t

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

2023-11-21 Thread kirill.shute...@linux.intel.com
On Tue, Nov 21, 2023 at 02:47:29AM +, Huang, Kai wrote: > > > +static atomic_long_t nr_shared; > > + > > +static inline bool pte_decrypted(pte_t pte) > > +{ > > + return cc_mkdec(pte_val(pte)) == pte_val(pte); > > +} > > + > > /* Called from __tdx_hypercall() for unrecoverable failure */ >

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

2023-11-21 Thread kirill.shute...@linux.intel.com
On Tue, Nov 21, 2023 at 02:15:59AM +, Huang, Kai wrote: > On Wed, 2023-11-15 at 15:00 +0300, Kirill A. Shutemov wrote: > > 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 > >

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

2023-10-27 Thread kirill.shute...@linux.intel.com
On Tue, Oct 24, 2023 at 10:11:58AM +, Huang, Kai wrote: > > > --- /dev/null > > +++ b/arch/x86/kernel/acpi/madt.S > > I think the name 'madt.S' is too generic. How about something be more > specific > such as madt_reset.S, or madt_playdead.S, etc? Okay, madt_playdead.S sounds good. > >

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

2023-10-23 Thread kirill.shute...@linux.intel.com
On Mon, Oct 23, 2023 at 09:30:59AM +, Huang, Kai wrote: > IMHO it's a little bit odd to have two mechanisms in place, even in this > middle > state patch. Is it better to completely replace CC_ATTR_HOTPLUG_DISABLED with > the new cpu_hotplug_offline_disabled in this patch? You can explicitly

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

2023-10-20 Thread kirill.shute...@linux.intel.com
On Fri, Oct 20, 2023 at 11:58:58AM +, Huang, Kai wrote: > On Tue, 2023-10-10 at 10:24 +, Huang, Kai wrote: > > >  /* Physical address of the Multiprocessor Wakeup Structure mailbox */ > > > @@ -74,6 +75,9 @@ int __init acpi_parse_mp_wake(union > > > acpi_subtable_headers *header, > > >  

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

2023-10-20 Thread kirill.shute...@linux.intel.com
On Fri, Oct 20, 2023 at 11:21:34AM +, Huang, Kai wrote: > > > --- /dev/null > > +++ b/arch/x86/kernel/acpi/madt.S > > @@ -0,0 +1,28 @@ > > +#include > > +#include > > +#include > > +#include > > + > > + .text > > + .align PAGE_SIZE > > +SYM_FUNC_START(asm_acpi_mp_play_dead) > > + /*

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

2023-10-20 Thread kirill.shute...@linux.intel.com
On Fri, Oct 20, 2023 at 09:49:59AM +, Huang, Kai wrote: > On Thu, 2023-10-05 at 16:14 +0300, Kirill A. Shutemov wrote: > >  struct acpi_madt_multiproc_wakeup { > >   struct acpi_subtable_header header; > > - u16 mailbox_version; > > + u16 version; > >   u32 reserved; /*

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

2023-10-20 Thread kirill.shute...@linux.intel.com
On Fri, Oct 20, 2023 at 03:29:24AM +, Huang, Kai wrote: > On Thu, 2023-10-05 at 16:14 +0300, Kirill A. Shutemov wrote: > > ACPI MADT doesn't allow to offline CPU after it got woke up. It limits > > kexec: target kernel won't be able to use more than one CPU. > > > > Zero out mailbox address

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

2023-10-11 Thread kirill.shute...@linux.intel.com
On Tue, Oct 10, 2023 at 10:05:21AM +, Huang, Kai wrote: > > > +#ifdef CONFIG_DEBUG_FS > > +static int tdx_shared_memory_show(struct seq_file *m, void *p) > > +{ > > + unsigned long addr, end; > > + unsigned long found = 0; > > + > > + addr = PAGE_OFFSET; > > + end = PAGE_OFFSET +

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

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

2023-10-06 Thread kirill.shute...@linux.intel.com
On Fri, Oct 06, 2023 at 10:22:54AM +, Huang, Kai wrote: > On Thu, 2023-10-05 at 16:13 +0300, 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 configuration option