From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49480) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbWtf-0006kb-DN for qemu-devel@nongnu.org; Mon, 14 Sep 2015 12:46:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZbWtb-0002PQ-1c for qemu-devel@nongnu.org; Mon, 14 Sep 2015 12:46:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57590) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbWta-0002Ol-TX for qemu-devel@nongnu.org; Mon, 14 Sep 2015 12:46:22 -0400 Date: Mon, 14 Sep 2015 17:46:18 +0100 From: Stefan Hajnoczi Message-ID: <20150914164618.GD15536@stefanha-thinkpad.redhat.com> References: <1441699228-25767-1-git-send-email-den@openvz.org> <1441699228-25767-3-git-send-email-den@openvz.org> <20150910085149.GB13094@stefanha-thinkpad.redhat.com> <55F1D788.8070908@openvz.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55F1D788.8070908@openvz.org> Subject: Re: [Qemu-devel] [PATCH 2/5] disk_deadlines: add request to resume Virtual Machine List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Denis V. Lunev" Cc: Kevin Wolf , Stefan Hajnoczi , qemu-devel@nongnu.org, Raushaniya Maksudova , Paolo Bonzini On Thu, Sep 10, 2015 at 10:18:32PM +0300, Denis V. Lunev wrote: > On 09/10/2015 11:51 AM, Stefan Hajnoczi wrote: > >On Tue, Sep 08, 2015 at 11:00:25AM +0300, Denis V. Lunev wrote: > >>From: Raushaniya Maksudova > >> > >>In some cases one needs to pause and resume a Virtual Machine from inside > >>of Qemu. Currently there are request functions to pause VM (vmstop), but > >>there are no respective ones to resume VM. > >> > >>Signed-off-by: Raushaniya Maksudova > >>Signed-off-by: Denis V. Lunev > >>CC: Stefan Hajnoczi > >>CC: Kevin Wolf > >>CC: Paolo Bonzini > >>--- > >> include/sysemu/sysemu.h | 1 + > >> stubs/vm-stop.c | 5 +++++ > >> vl.c | 18 ++++++++++++++++++ > >> 3 files changed, 24 insertions(+) > >Why can't vm_start() be used? > > > > we do fear about correct thread to perform this operation. > this code eventually redirect state changing code into > main event loop. The code isn't thread-safe though: There is a race condition if qemu_vmstart_requested() is called while qemu_vmstart_request() is called. qemu_vmstart_requested() might return false and the qemu_vmstart_request() is missed. Please add doc comments to these functions explaining assumptions about thread-safety and environment. If the guest is resumed in an I/O completion handler function it probably needs to be truly thread-safe.