[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] vmstate: Add VMSTATE_OPAQUE to save/load comple

From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] vmstate: Add VMSTATE_OPAQUE to save/load complex data structures
Date: Fri, 24 May 2019 10:03:51 +0100

On Thu, 23 May 2019 at 18:02, Roman Kiryanov via Qemu-devel
<address@hidden> wrote:
> Hi Dave, thank you for looking.
> > Can you give me an example of where you would use it?
> We use it in our host memory sharing device. I used the existing
> macros for all fields I could, but unfortunately some state does not fit
> into them. We use this new macro to save/load memory
> allocators (for now we have malloc, but we are working on adding
> Vulkan calls). For now the state looks this way:
> class Allocator;
> unordered_map<int, Allocator *> state;
> class MallocAllocator: public Allocator {
>     unordered_map<int, vector<char>> state;
> };
> class VulkanAllocator: public Allocator {
>     // TBD
> };

This is all C++, so it's not relevant for upstream QEMU...

In any case, migration state on the wire needs to be
so you can't just send raw complex data structures -- you
need to marshal these into something else (by having
pre-load/post-save functions in whatever device is using
these to marshal between the complex data structures and a
plain-old-array-of-whatevers, or by having the migration
code specifically support migration of the complex data

-- PMM

reply via email to

[Prev in Thread] Current Thread [Next in Thread]