[RFC PATCH v1 0/8] Look Ma! We made a XenStore

David Woodhouse posted 8 patches 1 year, 2 months ago
hw/i386/kvm/meson.build     |    1 +
hw/i386/kvm/trace-events    |   14 +
hw/i386/kvm/xen_xenstore.c  |  844 ++++++++++++++++++++-
hw/i386/kvm/xenstore_impl.c | 1724 +++++++++++++++++++++++++++++++++++++++++++
hw/i386/kvm/xenstore_impl.h |   68 ++
tests/unit/meson.build      |    1 +
tests/unit/test-xs-node.c   |  705 ++++++++++++++++++
7 files changed, 3347 insertions(+), 10 deletions(-)
[RFC PATCH v1 0/8] Look Ma! We made a XenStore
Posted by David Woodhouse 1 year, 2 months ago
Starts fairly simple; a node tree with some basic refcounting and copy
on write semantics.

Add in watches to fire when a given subtree gets modified, then 
transactions which *would* have been a fairly trivial case of keeping 
the new one and unreffing the old if it wasn't for the fact that we need 
to fire watches on anything that changes as we commit the transaction.

So on commit, we walk the parts of the tree with a refcount of one, 
since those by definition are the parts which are new and unique to this 
transaction. And fire watches on the ones which have the appropriate 
flag to show that *they* were modified, and they weren't just part of
the CoW bubbling up to the root of the tree.

Watches on nodes that were *deleted* in a transaction are even more fun
since they mean we have to *keep* those nodes with a 'deleted_in_tx' flag
so that we can fire watches on them when we commit. But it all works out
fairly simply in the end.

I'd be particularly interested in thoughts on the way I've handled 
serialization/deserialization, by generating and consuming a GByteArray
and using VMSTATE_VARRAY_UINT32_ALLOC(…vmstate_info_uint8…). It seems
to work.

As we hook up the actual PV back ends to work with this XenStore (which
is fully functional in the part of the tree I haven't posted yet), there
will be a bit more work to ensure a seamless handover on resume from
migration. We *might* end up serializing only the guest nodes under
/local/domain/${domid} and letting the rest be recreated on the QEMU
side just as they were created the first time. But there's plenty here
to heckle even before we tweak those details... 

https://git.infradead.org/users/dwmw2/qemu.git/shortlog/refs/heads/xenfv-kvm-10-xenstore

David Woodhouse (6):
      hw/xen: Add xenstore wire implementation and implementation stubs
      hw/xen: Add basic XenStore tree walk and write/read/directory support
      hw/xen: Implement XenStore watches
      hw/xen: Implement XenStore transactions
      hw/xen: Watches on XenStore transactions
      hw/xen: Implement core serialize/deserialize methods for xenstore_impl

Paul Durrant (2):
      xenstore perms WIP
      hw/xen: Create initial XenStore nodes


 hw/i386/kvm/meson.build     |    1 +
 hw/i386/kvm/trace-events    |   14 +
 hw/i386/kvm/xen_xenstore.c  |  844 ++++++++++++++++++++-
 hw/i386/kvm/xenstore_impl.c | 1724 +++++++++++++++++++++++++++++++++++++++++++
 hw/i386/kvm/xenstore_impl.h |   68 ++
 tests/unit/meson.build      |    1 +
 tests/unit/test-xs-node.c   |  705 ++++++++++++++++++
 7 files changed, 3347 insertions(+), 10 deletions(-)