[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/5] memory: add ref/unref interface for MemroyR
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 1/5] memory: add ref/unref interface for MemroyRegionOps |
Date: |
Thu, 11 Apr 2013 11:49:52 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Mon, Apr 01, 2013 at 04:20:30PM +0800, Liu Ping Fan wrote:
> From: Liu Ping Fan <address@hidden>
>
> This pair of interface are optinal, except for those device which is
> used outside the biglock's protection for hot unplug.
Not sure if this comment is true. Memory unplug safety is not about the
big lock, it's about whether a reference to memory is held *across* a
hot unplug operation.
So even code that is under the big lock can use a guest RAM buffer
across the event loop, and therefore be exposed to a RAM unplug!
Therefore inc/dec must be used if guest RAM is held across event loop
handler calls. If the guest RAM access happens completely inside a
handler function, then it is not affected by hot plug and doesn't need
to do inc/dec.