hostmem/shm: Allow shm memory backend serve as shared memory for coco-VMs
PATCH 1/1 hostmem/shm: Allow shm memory backend serve as shared memory for coco-VMs
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.
--- backends/hostmem-shm.c | 1 + 1 file changed, 1 insertion(+)
backends/hostmem-shm.c +1 -0
@@ -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,
Signature · 1 line
2.43.0
Quoted 5 lines · Xiaoyao Li
shm can surely serve as the shared memory for coco-VMs. But currently it doesn't check the
backend->guest_memfdto pass down theRAM_GUEST_MEMFDflag. It leads to failure when creating coco-VMs (e.g., TDX guest) which require private mmeory.
Quoted 8 lines
Set and pass down
RAM_GUEST_MEMFDwhenbackend->guest_memfdis true, to allow shm memory backend serve as shared memory for coco-VMs.cc Stefano Garzarella <[email protected]>Signed-off-by Xiaoyao Li <[email protected]>---
backends/hostmem-shm.c| 1 +1 file changed, 1 insertion(+)
LGTM!
Thanks,
Stefano
Quoted 16 lines
backends/hostmem-shm.c +1
-0@@ -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,Signature · 1 line
2.43.0
Quoted 10 lines · Xiaoyao Li
shm can surely serve as the shared memory for coco-VMs. But currently it doesn't check the
backend->guest_memfdto pass down theRAM_GUEST_MEMFDflag. It leads to failure when creating coco-VMs (e.g., TDX guest) which require private mmeory.Set and pass down
RAM_GUEST_MEMFDwhenbackend->guest_memfdis true, to allow shm memory backend serve as shared memory for coco-VMs.cc Stefano Garzarella <[email protected]>Signed-off-by Xiaoyao Li <[email protected]>
Signature · 3 lines
Cheers, David / dhildenb
Quoted 7 lines · Xiaoyao Li
shm can surely serve as the shared memory for coco-VMs. But currently it doesn't check the
backend->guest_memfdto pass down theRAM_GUEST_MEMFDflag. It leads to failure when creating coco-VMs (e.g., TDX guest) which require private mmeory.Set and pass down
RAM_GUEST_MEMFDwhenbackend->guest_memfdis 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.
Quoted 18 lines
cc Stefano Garzarella <[email protected]>Signed-off-by Xiaoyao Li <[email protected]>--- backends/hostmem-shm.c | 1 + 1 file changed, 1 insertion(+)backends/hostmem-shm.c +1
-0@@ -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,
Quoted 6 lines · Xiaoyao Li
Quoted 5 lines · Xiaoyao Li
shm can surely serve as the shared memory for coco-VMs. But currently it doesn't check the
backend->guest_memfdto pass down theRAM_GUEST_MEMFDflag. It leads to failure when creating coco-VMs (e.g., TDX guest) which require private mmeory.
Quoted 6 lines
Quoted 2 lines
Set and pass down
RAM_GUEST_MEMFDwhenbackend->guest_memfdis 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.
Quoted 20 lines
Quoted 18 lines
cc Stefano Garzarella <[email protected]>Signed-off-by Xiaoyao Li <[email protected]>---
backends/hostmem-shm.c| 1 +1 file changed, 1 insertion(+)backends/hostmem-shm.c +1
-0@@ -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-Quoted 1 line
size,
Quoted 7 lines · Xiaoyao Li
Quoted 6 lines · Xiaoyao Li
Quoted 5 lines · Xiaoyao Li
shm can surely serve as the shared memory for coco-VMs. But currently it doesn't check the
backend->guest_memfdto pass down theRAM_GUEST_MEMFDflag. It leads to failure when creating coco-VMs (e.g., TDX guest) which require private mmeory.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Set and pass down
RAM_GUEST_MEMFDwhenbackend->guest_memfdis 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?
Quoted 21 lines
Quoted 19 lines
Quoted 17 lines
cc Stefano Garzarella <[email protected]>Signed-off-by Xiaoyao Li <[email protected]>---
backends/hostmem-shm.c| 1 +1 file changed, 1 insertion(+)backends/hostmem-shm.c +1
-0@@ -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,
Quoted 15 lines · Xiaoyao Li
Quoted 14 lines · Xiaoyao Li
Quoted 12 lines · Xiaoyao Li
Quoted 7 lines · Xiaoyao Li
shm can surely serve as the shared memory for coco-VMs. But currently it doesn't check the
backend->guest_memfdto pass down theRAM_GUEST_MEMFDflag. It leads to failure when creating coco-VMs (e.g., TDX guest) which require private mmeory.Set and pass down
RAM_GUEST_MEMFDwhenbackend->guest_memfdis 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.
Quoted 7 lines
Quoted 1 line
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.
Signature · 1 line
Peter Xu