From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34409) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQE8j-00084X-5c for qemu-devel@nongnu.org; Thu, 11 Apr 2013 05:49:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQE8i-0006e0-2V for qemu-devel@nongnu.org; Thu, 11 Apr 2013 05:49:57 -0400 Received: from mail-ee0-f49.google.com ([74.125.83.49]:61351) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQE8h-0006dq-Rk for qemu-devel@nongnu.org; Thu, 11 Apr 2013 05:49:55 -0400 Received: by mail-ee0-f49.google.com with SMTP id l10so651077eei.22 for ; Thu, 11 Apr 2013 02:49:55 -0700 (PDT) Date: Thu, 11 Apr 2013 11:49:52 +0200 From: Stefan Hajnoczi Message-ID: <20130411094952.GB9165@stefanha-thinkpad.redhat.com> References: <1364804434-7980-1-git-send-email-qemulist@gmail.com> <1364804434-7980-2-git-send-email-qemulist@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1364804434-7980-2-git-send-email-qemulist@gmail.com> Subject: Re: [Qemu-devel] [PATCH 1/5] memory: add ref/unref interface for MemroyRegionOps List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liu Ping Fan Cc: Peter Maydell , Anthony Liguori , Jan Kiszka , Marcelo Tosatti , qemu-devel@nongnu.org, Vasilis Liaskovitis , Paolo Bonzini On Mon, Apr 01, 2013 at 04:20:30PM +0800, Liu Ping Fan wrote: > From: Liu Ping Fan > > 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.