From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52050) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxkUv-0006vi-7z for qemu-devel@nongnu.org; Thu, 19 Jun 2014 18:08:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WxkUq-000789-80 for qemu-devel@nongnu.org; Thu, 19 Jun 2014 18:07:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44385) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxkUp-00077z-Vf for qemu-devel@nongnu.org; Thu, 19 Jun 2014 18:07:52 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5JM7nVS005758 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 19 Jun 2014 18:07:50 -0400 Message-ID: <53A35F33.9070705@redhat.com> Date: Thu, 19 Jun 2014 16:07:47 -0600 From: Eric Blake MIME-Version: 1.0 References: <1401972839-25213-1-git-send-email-pbonzini@redhat.com> <1401972839-25213-3-git-send-email-pbonzini@redhat.com> In-Reply-To: <1401972839-25213-3-git-send-email-pbonzini@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="1fl3wbFtGmjDFIt128MfNCSSjkxbPBWeq" Subject: Re: [Qemu-devel] [PATCH v2 2/2] block: asynchronously stop the VM on I/O errors List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Cc: kwolf@redhat.com, famz@redhat.com, stefanha@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --1fl3wbFtGmjDFIt128MfNCSSjkxbPBWeq Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 06/05/2014 06:53 AM, Paolo Bonzini wrote: > With virtio-blk dataplane, I/O errors might occur while QEMU is > not in the main I/O thread. However, it's invalid to call vm_stop > when we're neither in a VCPU thread nor in the main I/O thread, > even if we were to take the iothread mutex around it. >=20 > To avoid this problem, we can raise a request to the main I/O thread, > similar to what QEMU does when vm_stop is called from a CPU thread. > We know that bdrv_error_action is called from an AIO callback, and > the moment at which the callback will fire is not well-defined; it > depends on the moment at which the disk or OS finishes the operation, > which can happen at any time. Note that QEMU is certainly not in a CPU= > thread and we do not need to call cpu_stop_current() like vm_stop() doe= s. >=20 > However, we need to ensure that any action taken by management will > result in correct detection of the error _and_ a running VM. In partic= ular: >=20 > - the event must be raised after the iostatus has been set, so that > "info block" will return an iostatus that matches the event. >=20 > - the VM must be stopped after the iostatus has been set, so that > "info block" will return an iostatus that matches the runstate. >=20 > The ordering between the STOP and BLOCK_IO_ERROR events is preserved; > BLOCK_IO_ERROR is documented to come first. >=20 > This makes bdrv_error_action() thread safe (assuming QMP events are, > which is attacked by a separate series). >=20 > Signed-off-by: Paolo Bonzini > --- > block.c | 20 ++++++++++++++++++-- > docs/qmp/qmp-events.txt | 2 +- > stubs/vm-stop.c | 7 ++++++- > 3 files changed, 25 insertions(+), 4 deletions(-) This may need to be rebased, since events are now QAPI. Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --1fl3wbFtGmjDFIt128MfNCSSjkxbPBWeq Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTo18zAAoJEKeha0olJ0Nqa4kH/2mJNaiV/MATXHNWVu9uOzkn +9LDox7URODSRQXMVB/e91HgvfajPMKYpv0OhvQch/qv4e4Ea83IAsSxqi1Sb5Uv ydzy/7P08vUWIAU/xn2dsVIwVApM893siGobn4lc15DXKaMyRmskpkiduiPne1hY LutxHI4pbnECOXL03HduPqTl1yQgl43Th8RKojSarjKJr5eP+RRQD+mDAi0zGIBo e33P49dMWX/CmGOD1Z03tAD4/2iP/5nMIQRJsTFGq6ql81Xenu5IN469lAfTveps Mc5Cm3c7Gxv7ngjaVrdUge74n4HKu1zEKRG4QtkveUWUZnRkyMKM278hRds4/K8= =MU4I -----END PGP SIGNATURE----- --1fl3wbFtGmjDFIt128MfNCSSjkxbPBWeq--