[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH V4 08/19] hostmem-shm: preserve for cpr
From: |
Steve Sistare |
Subject: |
[PATCH V4 08/19] hostmem-shm: preserve for cpr |
Date: |
Mon, 2 Dec 2024 05:20:00 -0800 |
Preserve memory-backend-shm memory objects during cpr-transfer.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
---
backends/hostmem-shm.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/backends/hostmem-shm.c b/backends/hostmem-shm.c
index 837b9f1..0946f2a 100644
--- a/backends/hostmem-shm.c
+++ b/backends/hostmem-shm.c
@@ -13,6 +13,7 @@
#include "qemu/osdep.h"
#include "sysemu/hostmem.h"
#include "qapi/error.h"
+#include "migration/cpr.h"
#define TYPE_MEMORY_BACKEND_SHM "memory-backend-shm"
@@ -25,9 +26,9 @@ struct HostMemoryBackendShm {
static bool
shm_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)
{
- g_autofree char *backend_name = NULL;
+ g_autofree char *backend_name = host_memory_backend_get_name(backend);
uint32_t ram_flags;
- int fd;
+ int fd = cpr_find_fd(backend_name, 0);
if (!backend->size) {
error_setg(errp, "can't create shm backend with size 0");
@@ -39,13 +40,18 @@ shm_backend_memory_alloc(HostMemoryBackend *backend, Error
**errp)
return false;
}
+ if (fd >= 0) {
+ goto have_fd;
+ }
+
fd = qemu_shm_alloc(backend->size, errp);
if (fd < 0) {
return false;
}
+ cpr_save_fd(backend_name, 0, fd);
+have_fd:
/* Let's do the same as memory-backend-ram,share=on would do. */
- backend_name = host_memory_backend_get_name(backend);
ram_flags = RAM_SHARED;
ram_flags |= backend->reserve ? 0 : RAM_NORESERVE;
--
1.8.3.1
- [PATCH V4 02/19] physmem: fd-based shared memory, (continued)
- [PATCH V4 02/19] physmem: fd-based shared memory, Steve Sistare, 2024/12/02
- Re: [PATCH V4 02/19] physmem: fd-based shared memory, Peter Xu, 2024/12/09
- Re: [PATCH V4 02/19] physmem: fd-based shared memory, Steven Sistare, 2024/12/12
- Re: [PATCH V4 02/19] physmem: fd-based shared memory, Peter Xu, 2024/12/12
- Re: [PATCH V4 02/19] physmem: fd-based shared memory, Steven Sistare, 2024/12/13
- Re: [PATCH V4 02/19] physmem: fd-based shared memory, Steven Sistare, 2024/12/13
- Re: [PATCH V4 02/19] physmem: fd-based shared memory, Peter Xu, 2024/12/16
- Re: [PATCH V4 02/19] physmem: fd-based shared memory, Steven Sistare, 2024/12/17
- Re: [PATCH V4 02/19] physmem: fd-based shared memory, Peter Xu, 2024/12/17
- Re: [PATCH V4 02/19] physmem: fd-based shared memory, Steven Sistare, 2024/12/18
[PATCH V4 08/19] hostmem-shm: preserve for cpr,
Steve Sistare <=
[PATCH V4 12/19] migration: VMSTATE_FD, Steve Sistare, 2024/12/02
[PATCH V4 10/19] migration: cpr channel, Steve Sistare, 2024/12/02
- Re: [PATCH V4 10/19] migration: cpr channel, Markus Armbruster, 2024/12/05
- Re: [PATCH V4 10/19] migration: cpr channel, Steven Sistare, 2024/12/05
- Re: [PATCH V4 10/19] migration: cpr channel, Markus Armbruster, 2024/12/06
- Re: [PATCH V4 10/19] migration: cpr channel, Steven Sistare, 2024/12/18
- Re: [PATCH V4 10/19] migration: cpr channel, Peter Xu, 2024/12/18
- Re: [PATCH V4 10/19] migration: cpr channel, Steven Sistare, 2024/12/18
[PATCH V4 11/19] migration: SCM_RIGHTS for QEMUFile, Steve Sistare, 2024/12/02