qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC PATCH 0/8] MemoryRegion and FlatView refcounting,


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [RFC PATCH 0/8] MemoryRegion and FlatView refcounting, replace hostmem with memory_region_find
Date: Wed, 8 May 2013 11:18:40 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, May 06, 2013 at 04:25:13PM +0200, Paolo Bonzini wrote:
> 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.

Agreed.  I want to drop vring.c and have virtio.c use thread-safe APIs
so it can be used from dataplane.  VirtQueueElement can hide the
MemoryRegion reference so the virtio device caller (net, block, etc)
doesn't need to juggle references manually.

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

Are you hoping that Ping Fan will pick up this RFC or will you push it
yourself?

Either way, I'm very interested in a thread-safe memory API.

Stefan



reply via email to

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