qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hostmem/shm: Allow shm memory backend serve as shared memory for coco-VMs
@ 2025-07-21  6:52 Xiaoyao Li
  2025-07-21  7:50 ` Stefano Garzarella
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Xiaoyao Li @ 2025-07-21  6:52 UTC (permalink / raw)
  To: David Hildenbrand, Igor Mammedov, Paolo Bonzini
  Cc: qemu-devel, Xiaoyao Li, Stefano Garzarella

shm can surely serve as the shared memory for coco-VMs. But currently it
doesn't check the backend->guest_memfd to pass down the RAM_GUEST_MEMFD
flag. It leads to failure when creating coco-VMs (e.g., TDX guest) which
require private mmeory.

Set and pass down RAM_GUEST_MEMFD when backend->guest_memfd is true, to
allow shm memory backend serve as shared memory for coco-VMs.

cc: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
 backends/hostmem-shm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/backends/hostmem-shm.c b/backends/hostmem-shm.c
index f66211a2ec92..806e2670e039 100644
--- a/backends/hostmem-shm.c
+++ b/backends/hostmem-shm.c
@@ -54,6 +54,7 @@ have_fd:
     /* Let's do the same as memory-backend-ram,share=on would do. */
     ram_flags = RAM_SHARED;
     ram_flags |= backend->reserve ? 0 : RAM_NORESERVE;
+    ram_flags |= backend->guest_memfd ? RAM_GUEST_MEMFD : 0;
 
     return memory_region_init_ram_from_fd(&backend->mr, OBJECT(backend),
                                               backend_name, backend->size,
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] hostmem/shm: Allow shm memory backend serve as shared memory for coco-VMs
  2025-07-21  6:52 [PATCH] hostmem/shm: Allow shm memory backend serve as shared memory for coco-VMs Xiaoyao Li
@ 2025-07-21  7:50 ` Stefano Garzarella
  2025-07-21  8:00 ` David Hildenbrand
  2025-08-14  9:45 ` Xiaoyao Li
  2 siblings, 0 replies; 7+ messages in thread
From: Stefano Garzarella @ 2025-07-21  7:50 UTC (permalink / raw)
  To: Xiaoyao Li; +Cc: David Hildenbrand, Igor Mammedov, Paolo Bonzini, qemu-devel

On Mon, Jul 21, 2025 at 02:52:20PM +0800, Xiaoyao Li wrote:
>shm can surely serve as the shared memory for coco-VMs. But currently it
>doesn't check the backend->guest_memfd to pass down the RAM_GUEST_MEMFD
>flag. It leads to failure when creating coco-VMs (e.g., TDX guest) which
>require private mmeory.
>
>Set and pass down RAM_GUEST_MEMFD when backend->guest_memfd is true, to
>allow shm memory backend serve as shared memory for coco-VMs.
>
>cc: Stefano Garzarella <sgarzare@redhat.com>
>Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
>---
> backends/hostmem-shm.c | 1 +
> 1 file changed, 1 insertion(+)

LGTM!

Acked-by: Stefano Garzarella <sgarzare@redhat.com>

Thanks,
Stefano

>
>diff --git a/backends/hostmem-shm.c b/backends/hostmem-shm.c
>index f66211a2ec92..806e2670e039 100644
>--- a/backends/hostmem-shm.c
>+++ b/backends/hostmem-shm.c
>@@ -54,6 +54,7 @@ have_fd:
>     /* Let's do the same as memory-backend-ram,share=on would do. */
>     ram_flags = RAM_SHARED;
>     ram_flags |= backend->reserve ? 0 : RAM_NORESERVE;
>+    ram_flags |= backend->guest_memfd ? RAM_GUEST_MEMFD : 0;
>
>     return memory_region_init_ram_from_fd(&backend->mr, OBJECT(backend),
>                                               backend_name, backend->size,
>-- 
>2.43.0
>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] hostmem/shm: Allow shm memory backend serve as shared memory for coco-VMs
  2025-07-21  6:52 [PATCH] hostmem/shm: Allow shm memory backend serve as shared memory for coco-VMs Xiaoyao Li
  2025-07-21  7:50 ` Stefano Garzarella
@ 2025-07-21  8:00 ` David Hildenbrand
  2025-08-14  9:45 ` Xiaoyao Li
  2 siblings, 0 replies; 7+ messages in thread
From: David Hildenbrand @ 2025-07-21  8:00 UTC (permalink / raw)
  To: Xiaoyao Li, Igor Mammedov, Paolo Bonzini; +Cc: qemu-devel, Stefano Garzarella

On 21.07.25 08:52, Xiaoyao Li wrote:
> shm can surely serve as the shared memory for coco-VMs. But currently it
> doesn't check the backend->guest_memfd to pass down the RAM_GUEST_MEMFD
> flag. It leads to failure when creating coco-VMs (e.g., TDX guest) which
> require private mmeory.
> 
> Set and pass down RAM_GUEST_MEMFD when backend->guest_memfd is true, to
> allow shm memory backend serve as shared memory for coco-VMs.
> 
> cc: Stefano Garzarella <sgarzare@redhat.com>
> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>

Acked-by: David Hildenbrand <david@redhat.com>

-- 
Cheers,

David / dhildenb



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] hostmem/shm: Allow shm memory backend serve as shared memory for coco-VMs
  2025-07-21  6:52 [PATCH] hostmem/shm: Allow shm memory backend serve as shared memory for coco-VMs Xiaoyao Li
  2025-07-21  7:50 ` Stefano Garzarella
  2025-07-21  8:00 ` David Hildenbrand
@ 2025-08-14  9:45 ` Xiaoyao Li
  2025-09-12  5:45   ` Xiaoyao Li
  2 siblings, 1 reply; 7+ messages in thread
From: Xiaoyao Li @ 2025-08-14  9:45 UTC (permalink / raw)
  To: David Hildenbrand, Igor Mammedov, Paolo Bonzini
  Cc: qemu-devel, Stefano Garzarella

On 7/21/2025 2:52 PM, Xiaoyao Li wrote:
> shm can surely serve as the shared memory for coco-VMs. But currently it
> doesn't check the backend->guest_memfd to pass down the RAM_GUEST_MEMFD
> flag. It leads to failure when creating coco-VMs (e.g., TDX guest) which
> require private mmeory.
> 
> Set and pass down RAM_GUEST_MEMFD when backend->guest_memfd is true, to
> allow shm memory backend serve as shared memory for coco-VMs.

ping...

Paolo, will you merge it for QEMU 10.1? I think it's worth it.

> cc: Stefano Garzarella <sgarzare@redhat.com>
> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
> ---
>   backends/hostmem-shm.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/backends/hostmem-shm.c b/backends/hostmem-shm.c
> index f66211a2ec92..806e2670e039 100644
> --- a/backends/hostmem-shm.c
> +++ b/backends/hostmem-shm.c
> @@ -54,6 +54,7 @@ have_fd:
>       /* Let's do the same as memory-backend-ram,share=on would do. */
>       ram_flags = RAM_SHARED;
>       ram_flags |= backend->reserve ? 0 : RAM_NORESERVE;
> +    ram_flags |= backend->guest_memfd ? RAM_GUEST_MEMFD : 0;
>   
>       return memory_region_init_ram_from_fd(&backend->mr, OBJECT(backend),
>                                                 backend_name, backend->size,



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] hostmem/shm: Allow shm memory backend serve as shared memory for coco-VMs
  2025-08-14  9:45 ` Xiaoyao Li
@ 2025-09-12  5:45   ` Xiaoyao Li
  2025-10-24  0:51     ` Xiaoyao Li
  0 siblings, 1 reply; 7+ messages in thread
From: Xiaoyao Li @ 2025-09-12  5:45 UTC (permalink / raw)
  To: David Hildenbrand, Igor Mammedov, Paolo Bonzini
  Cc: qemu-devel, Stefano Garzarella

On 8/14/2025 5:45 PM, Xiaoyao Li wrote:
> On 7/21/2025 2:52 PM, Xiaoyao Li wrote:
>> shm can surely serve as the shared memory for coco-VMs. But currently it
>> doesn't check the backend->guest_memfd to pass down the RAM_GUEST_MEMFD
>> flag. It leads to failure when creating coco-VMs (e.g., TDX guest) which
>> require private mmeory.
>>
>> Set and pass down RAM_GUEST_MEMFD when backend->guest_memfd is true, to
>> allow shm memory backend serve as shared memory for coco-VMs.
> 
> ping...
> 
> Paolo, will you merge it for QEMU 10.1? I think it's worth it.

ping again.

>> cc: Stefano Garzarella <sgarzare@redhat.com>
>> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
>> ---
>>   backends/hostmem-shm.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/backends/hostmem-shm.c b/backends/hostmem-shm.c
>> index f66211a2ec92..806e2670e039 100644
>> --- a/backends/hostmem-shm.c
>> +++ b/backends/hostmem-shm.c
>> @@ -54,6 +54,7 @@ have_fd:
>>       /* Let's do the same as memory-backend-ram,share=on would do. */
>>       ram_flags = RAM_SHARED;
>>       ram_flags |= backend->reserve ? 0 : RAM_NORESERVE;
>> +    ram_flags |= backend->guest_memfd ? RAM_GUEST_MEMFD : 0;
>>       return memory_region_init_ram_from_fd(&backend->mr, 
>> OBJECT(backend),
>>                                                 backend_name, backend- 
>> >size,
> 
> 



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] hostmem/shm: Allow shm memory backend serve as shared memory for coco-VMs
  2025-09-12  5:45   ` Xiaoyao Li
@ 2025-10-24  0:51     ` Xiaoyao Li
  2025-10-24 15:52       ` Peter Xu
  0 siblings, 1 reply; 7+ messages in thread
From: Xiaoyao Li @ 2025-10-24  0:51 UTC (permalink / raw)
  To: David Hildenbrand, Igor Mammedov, Paolo Bonzini, Peter Xu
  Cc: qemu-devel, Stefano Garzarella

On 9/12/2025 1:45 PM, Xiaoyao Li wrote:
> On 8/14/2025 5:45 PM, Xiaoyao Li wrote:
>> On 7/21/2025 2:52 PM, Xiaoyao Li wrote:
>>> shm can surely serve as the shared memory for coco-VMs. But currently it
>>> doesn't check the backend->guest_memfd to pass down the RAM_GUEST_MEMFD
>>> flag. It leads to failure when creating coco-VMs (e.g., TDX guest) which
>>> require private mmeory.
>>>
>>> Set and pass down RAM_GUEST_MEMFD when backend->guest_memfd is true, to
>>> allow shm memory backend serve as shared memory for coco-VMs.
>>
>> ping...
>>
>> Paolo, will you merge it for QEMU 10.1? I think it's worth it.
> 
> ping again.

ping++,

+ Peter,

Maybe you can queue it in case it gets missed from Paolo again?

>>> cc: Stefano Garzarella <sgarzare@redhat.com>
>>> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
>>> ---
>>>   backends/hostmem-shm.c | 1 +
>>>   1 file changed, 1 insertion(+)
>>>
>>> diff --git a/backends/hostmem-shm.c b/backends/hostmem-shm.c
>>> index f66211a2ec92..806e2670e039 100644
>>> --- a/backends/hostmem-shm.c
>>> +++ b/backends/hostmem-shm.c
>>> @@ -54,6 +54,7 @@ have_fd:
>>>       /* Let's do the same as memory-backend-ram,share=on would do. */
>>>       ram_flags = RAM_SHARED;
>>>       ram_flags |= backend->reserve ? 0 : RAM_NORESERVE;
>>> +    ram_flags |= backend->guest_memfd ? RAM_GUEST_MEMFD : 0;
>>>       return memory_region_init_ram_from_fd(&backend->mr, 
>>> OBJECT(backend),
>>>                                                 backend_name, 
>>> backend- >size,
>>
>>
> 
> 



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] hostmem/shm: Allow shm memory backend serve as shared memory for coco-VMs
  2025-10-24  0:51     ` Xiaoyao Li
@ 2025-10-24 15:52       ` Peter Xu
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Xu @ 2025-10-24 15:52 UTC (permalink / raw)
  To: Xiaoyao Li
  Cc: David Hildenbrand, Igor Mammedov, Paolo Bonzini, qemu-devel,
	Stefano Garzarella

On Fri, Oct 24, 2025 at 08:51:35AM +0800, Xiaoyao Li wrote:
> On 9/12/2025 1:45 PM, Xiaoyao Li wrote:
> > On 8/14/2025 5:45 PM, Xiaoyao Li wrote:
> > > On 7/21/2025 2:52 PM, Xiaoyao Li wrote:
> > > > shm can surely serve as the shared memory for coco-VMs. But currently it
> > > > doesn't check the backend->guest_memfd to pass down the RAM_GUEST_MEMFD
> > > > flag. It leads to failure when creating coco-VMs (e.g., TDX guest) which
> > > > require private mmeory.
> > > > 
> > > > Set and pass down RAM_GUEST_MEMFD when backend->guest_memfd is true, to
> > > > allow shm memory backend serve as shared memory for coco-VMs.
> > > 
> > > ping...
> > > 
> > > Paolo, will you merge it for QEMU 10.1? I think it's worth it.
> > 
> > ping again.
> 
> ping++,
> 
> + Peter,
> 
> Maybe you can queue it in case it gets missed from Paolo again?

Yep, queued now and I copied stable, let me know otherwise.  Thanks.

-- 
Peter Xu



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-10-24 15:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-21  6:52 [PATCH] hostmem/shm: Allow shm memory backend serve as shared memory for coco-VMs Xiaoyao Li
2025-07-21  7:50 ` Stefano Garzarella
2025-07-21  8:00 ` David Hildenbrand
2025-08-14  9:45 ` Xiaoyao Li
2025-09-12  5:45   ` Xiaoyao Li
2025-10-24  0:51     ` Xiaoyao Li
2025-10-24 15:52       ` Peter Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).