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: > > > > On 10/5/2023 4:28 PM, Kirill A.

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, 2023 at 01:41:38PM -0500, Kalra,

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

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

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

2023-10-08 Thread Baoquan He
On 10/05/23 at 04:13pm, Kirill A. Shutemov wrote: > TDX guests allocate shared buffers to perform I/O. It is done by > allocating pages normally from the buddy allocator and converting them > to shared with set_memory_decrypted(). > > The target kernel has no idea what memory is converted this

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

2023-10-06 Thread Kalra, Ashish
On 10/6/2023 10:11 AM, Kirill A. Shutemov wrote: 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 +++

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

2023-10-06 Thread Kalra, Ashish
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, 2023 at 01:41:38PM -0500, Kalra, Ashish wrote: +static void unshare_all_memory(bool unmap) +{ + unsigned long

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/Kconfig > > @@ -884,6 +884,7 @@

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

2023-10-06 Thread Sean Christopherson
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/Kconfig > @@ -884,6 +884,7 @@ config INTEL_TDX_GUEST > select X86_MEM_ENCRYPT > select X86_MCE >

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) > > > > +{ > > > > + unsigned long addr, end; > > > > +

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

2023-10-05 Thread Kalra, Ashish
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) +{ + unsigned long addr, end; + long found = 0, shared; + + /* +* Walk direct mapping and convert all shared

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 01:41:38PM -0500, Kalra, Ashish wrote: > > +static void unshare_all_memory(bool unmap) > > +{ > > + unsigned long addr, end; > > + long found = 0, shared; > > + > > + /* > > +* Walk direct mapping and convert all shared memory back to private, > > +*/ > > + >

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

2023-10-05 Thread Kalra, Ashish
Hello Kirill, On 10/5/2023 8:13 AM, Kirill A. Shutemov wrote: TDX guests allocate shared buffers to perform I/O. It is done by allocating pages normally from the buddy allocator and converting them to shared with set_memory_decrypted(). The target kernel has no idea what memory is converted

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

2023-10-05 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 target kernel has no idea what memory is converted this way. It only sees E820_TYPE_RAM. Accessing shared memory via