qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC PATCH 0/8] MemoryRegion and FlatView refcounting, replace hostmem with memory_region_find
@ 2013-05-06 14:25 Paolo Bonzini
  2013-05-06 14:25 ` [Qemu-devel] [RFC PATCH 1/8] memory: add ref/unref calls Paolo Bonzini
                   ` (10 more replies)
  0 siblings, 11 replies; 16+ messages in thread
From: Paolo Bonzini @ 2013-05-06 14:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: jan.kiszka, qemulist, stefanha

Hi,

this is an alternative approach to refactoring of dataplane's HostMem
code.  Here, I take Ping Fan's idea of RCU-style updating of the
region list and apply it to the AddressSpace's FlatView.  With this
change, dataplane can simply use memory_region_find instead of
hostmem.

This is a somewhat larger change, but I prefer it for two reasons.

1) it splits the task of adding BQL-less memory dispatch in two parts,
   tacking memory_region_find first (which is simpler because locking
   is left to the caller).

2) HostMem duplicates a lot of the FlatView logic, and adding the
   RCU-style update in FlatView benefits everyone.

The missing ingredients here are:

1) remember and unreference the MemoryRegions that are used in
   a vring entry.  In order to implement this, it is probably simpler
   to change vring.c to use virtio.c's VirtQueueElement data structure.
   We want something like that anyway in order to support migration.

2) add an owner field to MemoryRegion, and set it for all MemoryRegions
   for hot-unpluggable devices.  In this series, ref/unref are stubs.

For simplicity I based the patches on my IOMMU rebase.  I placed the
tree at git://github.com/bonzini/qemu.git, branch iommu.

Paolo

Paolo Bonzini (8):
  memory: add ref/unref calls
  exec: check MRU in qemu_ram_addr_from_host
  memory: return MemoryRegion from qemu_ram_addr_from_host
  memory: ref/unref memory across address_space_map/unmap
  memory: access FlatView from a local variable
  memory: use a new FlatView pointer on every topology update
  memory: add reference counting to FlatView
  dataplane: replace hostmem with memory_region_find

 exec.c                                |   63 +++++++++---
 hw/core/loader.c                      |    1 +
 hw/display/exynos4210_fimd.c          |    6 +
 hw/display/framebuffer.c              |   10 +-
 hw/i386/kvm/ioapic.c                  |    2 +
 hw/i386/kvmvapic.c                    |    1 +
 hw/misc/vfio.c                        |    2 +
 hw/virtio/dataplane/Makefile.objs     |    2 +-
 hw/virtio/dataplane/hostmem.c         |  176 ---------------------------------
 hw/virtio/dataplane/vring.c           |   56 +++++++++--
 hw/virtio/vhost.c                     |    2 +
 hw/virtio/virtio-balloon.c            |    1 +
 hw/xen/xen_pt.c                       |    4 +
 include/exec/cpu-common.h             |    2 +-
 include/exec/memory.h                 |    9 ++
 include/hw/virtio/dataplane/hostmem.h |   57 -----------
 include/hw/virtio/dataplane/vring.h   |    3 +-
 kvm-all.c                             |    2 +
 memory.c                              |  142 +++++++++++++++++++++-----
 target-arm/kvm.c                      |    2 +
 target-i386/kvm.c                     |    4 +-
 target-sparc/mmu_helper.c             |    1 +
 xen-all.c                             |    2 +
 23 files changed, 253 insertions(+), 297 deletions(-)
 delete mode 100644 hw/virtio/dataplane/hostmem.c
 delete mode 100644 include/hw/virtio/dataplane/hostmem.h

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

end of thread, other threads:[~2013-05-10  0:23 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-06 14:25 [Qemu-devel] [RFC PATCH 0/8] MemoryRegion and FlatView refcounting, replace hostmem with memory_region_find Paolo Bonzini
2013-05-06 14:25 ` [Qemu-devel] [RFC PATCH 1/8] memory: add ref/unref calls Paolo Bonzini
2013-05-06 14:25 ` [Qemu-devel] [RFC PATCH 2/8] exec: check MRU in qemu_ram_addr_from_host Paolo Bonzini
2013-05-06 14:25 ` [Qemu-devel] [RFC PATCH 3/8] memory: return MemoryRegion from qemu_ram_addr_from_host Paolo Bonzini
2013-05-06 14:25 ` [Qemu-devel] [RFC PATCH 4/8] memory: ref/unref memory across address_space_map/unmap Paolo Bonzini
2013-05-06 14:25 ` [Qemu-devel] [RFC PATCH 5/8] memory: access FlatView from a local variable Paolo Bonzini
2013-05-06 14:25 ` [Qemu-devel] [RFC PATCH 6/8] memory: use a new FlatView pointer on every topology update Paolo Bonzini
2013-05-06 14:25 ` [Qemu-devel] [RFC PATCH 7/8] memory: add reference counting to FlatView Paolo Bonzini
2013-05-06 14:25 ` [Qemu-devel] [RFC PATCH 8/8] dataplane: replace hostmem with memory_region_find Paolo Bonzini
2013-05-08  6:20 ` [Qemu-devel] [RFC PATCH 0/8] MemoryRegion and FlatView refcounting, " liu ping fan
2013-05-08 15:44   ` Paolo Bonzini
2013-05-09  0:53     ` liu ping fan
2013-05-09 14:50       ` Paolo Bonzini
2013-05-10  0:23         ` liu ping fan
2013-05-08  9:18 ` Stefan Hajnoczi
2013-05-08  9:25 ` Stefan Hajnoczi

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).