Re: [PATCH 04/13] Always expose MAP_UNINITIALIZED to userspace

2015-09-14 Thread Kirill A. Shutemov
have single ABI for MMU and MMU-less systems anyway. And we can avoid conflict with MAP_HUGE_SHIFT this way. P.S. MAP_UNINITIALIZED itself looks very broken to me. I probably need dig mailing list on why it was allowed. But that's other topic. -- Kirill A. Shutemov ___

Re: [PATCH 04/13] Always expose MAP_UNINITIALIZED to userspace

2015-09-16 Thread Kirill A. Shutemov
On Mon, Sep 14, 2015 at 10:19:19PM -0700, Josh Triplett wrote: > On Tue, Sep 15, 2015 at 03:23:58AM +0300, Kirill A. Shutemov wrote: > > On Mon, Sep 14, 2015 at 03:50:38PM -0700, Palmer Dabbelt wrote: > > > This used to be hidden behind CONFIG_MMAP_ALLOW_UNINITIALIZED, so > &

Re: [RFC PATCH] x86_64/mm/boot: Fix kernel_ident_mapping_init() failure for kexec

2017-03-24 Thread Kirill A. Shutemov
;Part 2" of 5-level paging changes[1] would help you? Making the code work with both and would make it even uglier. Not sure if it makes sense to address it on its own if second part fixes the situation. [1] http://lkml.kernel.org/r/20170317185515.8636-1-kirill.shute...

Re: [PATCH 4.14 023/159] mm/sparsemem: Allocate mem_section at runtime for CONFIG_SPARSEMEM_EXTREME=y

2018-01-08 Thread Kirill A. Shutemov
On Mon, Jan 08, 2018 at 08:46:53PM +0300, Kirill A. Shutemov wrote: > On Mon, Jan 08, 2018 at 04:04:44PM +, Ingo Molnar wrote: > > > > hi Kirill, > > > > As Mike reported it below, your 5-level paging related upstream commit > > 83e3c4

Re: [PATCH 4.14 023/159] mm/sparsemem: Allocate mem_section at runtime for CONFIG_SPARSEMEM_EXTREME=y

2018-01-10 Thread Kirill A. Shutemov
On Wed, Jan 10, 2018 at 03:08:04AM +, Dave Young wrote: > On Tue, Jan 09, 2018 at 12:05:52PM +0300, Kirill A. Shutemov wrote: > > On Tue, Jan 09, 2018 at 03:24:40PM +0800, Dave Young wrote: > > > On 01/09/18 at 01:41pm, Baoquan He wrote: > > > > On 01/09/1

Re: [PATCH 4.14 023/159] mm/sparsemem: Allocate mem_section at runtime for CONFIG_SPARSEMEM_EXTREME=y

2018-01-09 Thread Kirill A. Shutemov
, either change all array uses or just introduce > the macro and start to use it from now on if we have similar array > symbols. Do you need some action on my side or will you folks take care about this? -- Kirill A. Shutemov ___ kexec mailin

Re: [PATCH] kdump: Write a correct address of mem_section into vmcoreinfo

2018-01-13 Thread Kirill A. Shutemov
On Sat, Jan 13, 2018 at 11:48:38AM +0100, Ingo Molnar wrote: > > * Kirill A. Shutemov <kirill.shute...@linux.intel.com> wrote: > > > Depending on configuration mem_section can now be an array or a pointer > > to an array allocated dynamically. In most case

Re: [PATCH 4.14 023/159] mm/sparsemem: Allocate mem_section at runtime for CONFIG_SPARSEMEM_EXTREME=y

2018-01-25 Thread Kirill A. Shutemov
ng, if enabled */ movl$X86_CR4_PAE, %eax +#ifdef CONFIG_X86_5LEVEL + orl $X86_CR4_LA57, %eax +#endif movq %rax, %cr4 jmp 1f -- Kirill A. Shutemov ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec

[PATCH] kdump: Write a correct address of mem_section into vmcoreinfo

2018-01-12 Thread Kirill A. Shutemov
situation correctly for both cases. Signed-off-by: Kirill A. Shutemov <kirill.shute...@linux.intel.com> Fixes: 83e3c48729d9 ("mm/sparsemem: Allocate mem_section at runtime for CONFIG_SPARSEMEM_EXTREME=y") Cc: sta...@vger.kernel.org Acked-by: Baoquan He <b...@redhat.com&g

Re: [PATCH 4.14 023/159] mm/sparsemem: Allocate mem_section at runtime for CONFIG_SPARSEMEM_EXTREME=y

2018-02-07 Thread Kirill A. Shutemov
patch fixed? -- Kirill A. Shutemov ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec

Re: [PATCH 0/3] Add restrictions for kexec/kdump jumping between 5-level and 4-level kernel

2018-08-30 Thread Kirill A. Shutemov
On Thu, Aug 30, 2018 at 02:12:02PM +, Baoquan He wrote: > On 08/30/18 at 04:58pm, Kirill A. Shutemov wrote: > > On Wed, Aug 29, 2018 at 10:16:21PM +0800, Baoquan He wrote: > > > This was suggested by Kirill several months ago, I worked out several > > > patch

Re: [PATCH 0/3] Add restrictions for kexec/kdump jumping between 5-level and 4-level kernel

2018-08-30 Thread Kirill A. Shutemov
ot entirely sure that 64TiB is the limit here. Technically, 4-level paging allows to address 256TiB in 1-to-1 mapping. We just don't have machines with that wide physical address space (which don't support 5-level paging too). What is your reasoning about 64TiB limit? -- Kirill A. Shutemov

Re: [PATCH 3/3] x86/kdump/64: Change the upper limit of crashkernel reservation

2018-08-30 Thread Kirill A. Shutemov
reservation is done during the 1st kernel bootup, there's > no way to detect the paging mode of kdump kernel at that time. > > Hence change the upper limmit of crashkernel reservation to 64TB s/limmit/limit/ -- Kirill A. Shutemov ___ kex

Re: [PATCH 0/3] Add restrictions for kexec/kdump jumping between 5-level and 4-level kernel

2018-09-02 Thread Kirill A. Shutemov
On Thu, Aug 30, 2018 at 10:57:51PM +0800, Baoquan He wrote: > On 08/30/18 at 05:27pm, Kirill A. Shutemov wrote: > > On Thu, Aug 30, 2018 at 02:12:02PM +, Baoquan He wrote: > > > On 08/30/18 at 04:58pm, Kirill A. Shutemov wrote: > > > > On Wed, Aug 29, 2018 at 10:1

Re: [PATCH 1/3] x86/boot: Add bit fields into xloadflags for 5-level kernel checking

2018-09-04 Thread Kirill A. Shutemov
mpression code, but not on kexec caller side. XLF_5LEVEL indicates that kernel decompression code can deal with switching between paging modes and it's safe to jump there in 5-level paging mode. As an alternative we can change kexec to switch to 4-level paging mode before starting the new kernel. Not sure how hard it will be. -- Kirill A. Shutemov ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec

Re: [PATCH RESEND 0/3] Add restrictions for kexec/kdump jumping between 5-level and 4-level kernel

2019-01-25 Thread Kirill A. Shutemov
t; So resend this patchset. Changes look good to me: Acked-by: Kirill A. Shutemov -- Kirill A. Shutemov ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec

Re: [PATCH 07/11] treewide: Replace the use of mem_encrypt_active() with prot_guest_has()

2021-08-12 Thread Kirill A. Shutemov
On Wed, Aug 11, 2021 at 10:52:55AM -0500, Tom Lendacky wrote: > On 8/11/21 7:19 AM, Kirill A. Shutemov wrote: > > On Tue, Aug 10, 2021 at 02:48:54PM -0500, Tom Lendacky wrote: > >> On 8/10/21 1:45 PM, Kuppuswamy, Sathyanarayanan wrote: > >>> > >>> &g

Re: [PATCH 07/11] treewide: Replace the use of mem_encrypt_active() with prot_guest_has()

2021-08-11 Thread Kirill A. Shutemov
ared/unencrypted > area, though? Or since it is shared, there's actually nothing you need to > do (the bss decrpyted section exists even if CONFIG_AMD_MEM_ENCRYPT is not > configured)? AFAICS, only kvmclock uses __bss_decrypted. We don't enable kvmclock in TDX at the moment. It may change in the future. -- Kirill A. Shutemov ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec

Re: [PATCH v3 5/8] x86/sme: Replace occurrences of sme_active() with cc_platform_has()

2021-09-21 Thread Kirill A. Shutemov
On Tue, Sep 21, 2021 at 11:27:17PM +0200, Borislav Petkov wrote: > On Wed, Sep 22, 2021 at 12:20:59AM +0300, Kirill A. Shutemov wrote: > > I still believe calling cc_platform_has() from __startup_64() is totally > > broken as it lacks proper wrapping while accessing global varia

Re: [PATCH v3 5/8] x86/sme: Replace occurrences of sme_active() with cc_platform_has()

2021-09-21 Thread Kirill A. Shutemov
rypt_identity.c @@ -288,7 +288,7 @@ void __init sme_encrypt_kernel(struct boot_params *bp) unsigned long pgtable_area_len; unsigned long decrypted_base; - if (!cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT)) + if (1 || !cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT))

Re: [PATCH v3 5/8] x86/sme: Replace occurrences of sme_active() with cc_platform_has()

2021-09-21 Thread Kirill A. Shutemov
On Tue, Sep 21, 2021 at 04:43:59PM -0500, Tom Lendacky wrote: > On 9/21/21 4:34 PM, Kirill A. Shutemov wrote: > > On Tue, Sep 21, 2021 at 11:27:17PM +0200, Borislav Petkov wrote: > > > On Wed, Sep 22, 2021 at 12:20:59AM +0300, Kirill A. Shutemov wrote: > > >

Re: [PATCH v3 5/8] x86/sme: Replace occurrences of sme_active() with cc_platform_has()

2021-09-20 Thread Kirill A. Shutemov
have a special version of the helper). Note that only AMD requires these cc_platform_has() to return true. -- Kirill A. Shutemov ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec

Re: [PATCH v3 5/8] x86/sme: Replace occurrences of sme_active() with cc_platform_has()

2021-09-22 Thread Kirill A. Shutemov
On Wed, Sep 22, 2021 at 08:40:43AM -0500, Tom Lendacky wrote: > On 9/21/21 4:58 PM, Kirill A. Shutemov wrote: > > On Tue, Sep 21, 2021 at 04:43:59PM -0500, Tom Lendacky wrote: > > > On 9/21/21 4:34 PM, Kirill A. Shutemov wrote: > > > > On Tue, Sep 21, 2021 at 11:

Re: [PATCH v3 5/8] x86/sme: Replace occurrences of sme_active() with cc_platform_has()

2021-09-22 Thread Kirill A. Shutemov
On Wed, Sep 22, 2021 at 09:52:07PM +0200, Borislav Petkov wrote: > On Wed, Sep 22, 2021 at 05:30:15PM +0300, Kirill A. Shutemov wrote: > > Not fine, but waiting to blowup with random build environment change. > > Why is it not fine? > > Are you suspecting that the co

Re: [PATCH v3 5/8] x86/sme: Replace occurrences of sme_active() with cc_platform_has()

2021-09-24 Thread Kirill A. Shutemov
On Thu, Sep 23, 2021 at 08:21:03PM +0200, Borislav Petkov wrote: > On Thu, Sep 23, 2021 at 12:05:58AM +0300, Kirill A. Shutemov wrote: > > Unless we find other way to guarantee RIP-relative access, we must use > > fixup_pointer() to access any global variables. > > Yah, I've

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

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

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

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: 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

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

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

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

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

[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

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

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-23 Thread Kirill A. Shutemov
On Thu, Jun 23, 2022 at 04:48:59PM -0500, Eric W. Biederman wrote: > Dave Hansen writes: > > > ... adding kexec folks > > > > On 6/14/22 05:02, Kirill A. Shutemov wrote: > >> On kexec, the target kernel has to know what memory has been accepted. > >

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

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 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-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] 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

[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

[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

Re: [PATCH 1/2] x86/mm: Do not zap PMD entry mapping unaccepted memory table during kdump.

2024-02-20 Thread Kirill A. Shutemov
> + E820_TYPE_ACPI)) > set_pmd_init(pmd, __pmd(0), init); > continue; Why do you single out phys_pmd_init()? I think it has to be addressed for all page table levels as we do for E820_TYPE_RAM and E820_TYPE_RESERVED_KERN. --

Re: [PATCHv7 07/16] x86/mm: Return correct level from lookup_address() if pte is none

2024-02-20 Thread Kirill A. Shutemov
pud and pmd either when the entry is marked + * large or when the present bit is not set. Otherwise it returns NULL. */ pte_t *lookup_address(unsigned long address, unsigned int *level) { -- Kiryl Shutsemau / Kirill A. Shutemov ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec

Re: [PATCHv7 07/16] x86/mm: Return correct level from lookup_address() if pte is none

2024-02-21 Thread Kirill A. Shutemov
> > * > > - * Note: We return pud and pmd either when the entry is marked large > > - * or when the present bit is not set. Otherwise we would return a > > - * pointer to a nonexisting mapping. > > + * Note: the function returns p4d, pud and pmd either when the entry

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

2024-02-19 Thread Kirill A. Shutemov
viewed-by: Baoquan He Thanks! >From 23b7f9856a3d6b91c702def1e03872a60ae07d0e Mon Sep 17 00:00:00 2001 From: "Kirill A. Shutemov" Date: Mon, 19 Feb 2024 11:58:19 +0200 Subject: [PATCH] ACPI: tables: Print MULTIPROC_WAKEUP when MADT is parse When MADT is parsed, print MULTIPROC_WAKEU

Re: [PATCHv7 07/16] x86/mm: Return correct level from lookup_address() if pte is none

2024-02-19 Thread Kirill A. Shutemov
On Mon, Feb 19, 2024 at 01:12:32PM +0800, Baoquan He wrote: > On 02/12/24 at 12:44pm, Kirill A. Shutemov wrote: > > lookup_address() only returns correct page table level for the entry if > > the entry is not none. > > > > Make the helper to always return correct 'lev

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

2023-12-22 Thread Kirill A. Shutemov
ve addressed all your feedback, but this gave me pause. Looks like none of kernel_ident_mapping_init() users frees memory on failure. Is it okay to get this part as is and I will follow up with patchset that fixes memory handling for all kernel_ident_mapping_init() users? -- Kiryl Shutsemau

  1   2   3   >