From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH 07/18] kvm: Add MCE signal support for !CONFIG_IOTHREAD Date: Mon, 24 Jan 2011 13:36:36 +0100 Message-ID: <4D3D7254.1030102@web.de> References: <39b9c54e6cd122cb613f5fb79502eb053609d237.1294648329.git.jan.kiszka@web.de> <20110124111728.GA29184@amt.cnet> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigEB092284352DF431DCDF326D" Cc: Avi Kivity , kvm@vger.kernel.org, qemu-devel@nongnu.org, Huang Ying To: Marcelo Tosatti Return-path: Received: from fmmailgate03.web.de ([217.72.192.234]:40960 "EHLO fmmailgate03.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752316Ab1AXMgj (ORCPT ); Mon, 24 Jan 2011 07:36:39 -0500 In-Reply-To: <20110124111728.GA29184@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigEB092284352DF431DCDF326D Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2011-01-24 12:17, Marcelo Tosatti wrote: > On Mon, Jan 10, 2011 at 09:32:00AM +0100, Jan Kiszka wrote: >> From: Jan Kiszka >> >> Currently, we only configure and process MCE-related SIGBUS events if >> CONFIG_IOTHREAD is enabled. Fix this by factoring out the required >> handler registration and system configuration. Make sure that events >> happening over a VCPU context in non-threaded mode get dispatched as >> VCPU MCEs. >> >> We also need to call qemu_kvm_eat_signals in non-threaded mode now, so= >> move it (unmodified) and add the required Windows stub. >> >> Signed-off-by: Jan Kiszka >> CC: Huang Ying >> --- >> cpus.c | 200 +++++++++++++++++++++++++++++++++++++++----------------= -------- >> 1 files changed, 124 insertions(+), 76 deletions(-) >> >> diff --git a/cpus.c b/cpus.c >> index 6da0f8f..b6f1cfb 100644 >> --- a/cpus.c >> +++ b/cpus.c >> @@ -34,9 +34,6 @@ >> =20 >> #include "cpus.h" >> #include "compatfd.h" >> -#ifdef CONFIG_LINUX >> -#include >> -#endif >> =20 >> #ifdef SIGRTMIN >> #define SIG_IPI (SIGRTMIN+4) >> @@ -44,10 +41,24 @@ >> #define SIG_IPI SIGUSR1 >> #endif >> =20 >=20 >> @@ -912,6 +954,8 @@ static int qemu_cpu_exec(CPUState *env) >> =20 >> bool cpu_exec_all(void) >> { >> + int r; >> + >> if (next_cpu =3D=3D NULL) >> next_cpu =3D first_cpu; >> for (; next_cpu !=3D NULL && !exit_request; next_cpu =3D next_cpu= ->next_cpu) { >> @@ -923,7 +967,11 @@ bool cpu_exec_all(void) >> if (qemu_alarm_pending()) >> break; >> if (cpu_can_run(env)) { >> - if (qemu_cpu_exec(env) =3D=3D EXCP_DEBUG) { >> + r =3D qemu_cpu_exec(env); >> + if (kvm_enabled()) { >> + qemu_kvm_eat_signals(env); >> + } >> + if (r =3D=3D EXCP_DEBUG) { >> break; >> } >=20 > SIGBUS should be processed outside of vcpu execution context, think of = a > non MCE SIGBUS while vm is stopped. Could use signalfd for that. signalfd - that's the missing bit. I was thinking of how to handle SIGBUS events raised outside the vcpu context. We need to handle them synchronously, and signalfd should allow this. >=20 > But the SIGBUS handler for !IOTHREAD case should not ignore Action > Required, since it might have been generated in vcpu context. >=20 Yes, the sigbus handler will require some rework when we actually start using it for !IOTHREAD. Will have a look, thanks, Jan --------------enigEB092284352DF431DCDF326D Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/ iEYEARECAAYFAk09clQACgkQitSsb3rl5xTelACgy5BpdrBZ86S7yjT2QGkvqa1E j6oAniMr/SXh0pT1QEO3h6nMNzrfl3EA =xyh9 -----END PGP SIGNATURE----- --------------enigEB092284352DF431DCDF326D-- From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=41235 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PhLfK-0003oB-IT for qemu-devel@nongnu.org; Mon, 24 Jan 2011 07:37:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PhLey-0008Lx-8S for qemu-devel@nongnu.org; Mon, 24 Jan 2011 07:36:41 -0500 Received: from fmmailgate03.web.de ([217.72.192.234]:40957) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PhLex-0008Lh-Js for qemu-devel@nongnu.org; Mon, 24 Jan 2011 07:36:40 -0500 Message-ID: <4D3D7254.1030102@web.de> Date: Mon, 24 Jan 2011 13:36:36 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <39b9c54e6cd122cb613f5fb79502eb053609d237.1294648329.git.jan.kiszka@web.de> <20110124111728.GA29184@amt.cnet> In-Reply-To: <20110124111728.GA29184@amt.cnet> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigEB092284352DF431DCDF326D" Sender: jan.kiszka@web.de Subject: [Qemu-devel] Re: [PATCH 07/18] kvm: Add MCE signal support for !CONFIG_IOTHREAD List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcelo Tosatti Cc: Huang Ying , Avi Kivity , kvm@vger.kernel.org, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigEB092284352DF431DCDF326D Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2011-01-24 12:17, Marcelo Tosatti wrote: > On Mon, Jan 10, 2011 at 09:32:00AM +0100, Jan Kiszka wrote: >> From: Jan Kiszka >> >> Currently, we only configure and process MCE-related SIGBUS events if >> CONFIG_IOTHREAD is enabled. Fix this by factoring out the required >> handler registration and system configuration. Make sure that events >> happening over a VCPU context in non-threaded mode get dispatched as >> VCPU MCEs. >> >> We also need to call qemu_kvm_eat_signals in non-threaded mode now, so= >> move it (unmodified) and add the required Windows stub. >> >> Signed-off-by: Jan Kiszka >> CC: Huang Ying >> --- >> cpus.c | 200 +++++++++++++++++++++++++++++++++++++++----------------= -------- >> 1 files changed, 124 insertions(+), 76 deletions(-) >> >> diff --git a/cpus.c b/cpus.c >> index 6da0f8f..b6f1cfb 100644 >> --- a/cpus.c >> +++ b/cpus.c >> @@ -34,9 +34,6 @@ >> =20 >> #include "cpus.h" >> #include "compatfd.h" >> -#ifdef CONFIG_LINUX >> -#include >> -#endif >> =20 >> #ifdef SIGRTMIN >> #define SIG_IPI (SIGRTMIN+4) >> @@ -44,10 +41,24 @@ >> #define SIG_IPI SIGUSR1 >> #endif >> =20 >=20 >> @@ -912,6 +954,8 @@ static int qemu_cpu_exec(CPUState *env) >> =20 >> bool cpu_exec_all(void) >> { >> + int r; >> + >> if (next_cpu =3D=3D NULL) >> next_cpu =3D first_cpu; >> for (; next_cpu !=3D NULL && !exit_request; next_cpu =3D next_cpu= ->next_cpu) { >> @@ -923,7 +967,11 @@ bool cpu_exec_all(void) >> if (qemu_alarm_pending()) >> break; >> if (cpu_can_run(env)) { >> - if (qemu_cpu_exec(env) =3D=3D EXCP_DEBUG) { >> + r =3D qemu_cpu_exec(env); >> + if (kvm_enabled()) { >> + qemu_kvm_eat_signals(env); >> + } >> + if (r =3D=3D EXCP_DEBUG) { >> break; >> } >=20 > SIGBUS should be processed outside of vcpu execution context, think of = a > non MCE SIGBUS while vm is stopped. Could use signalfd for that. signalfd - that's the missing bit. I was thinking of how to handle SIGBUS events raised outside the vcpu context. We need to handle them synchronously, and signalfd should allow this. >=20 > But the SIGBUS handler for !IOTHREAD case should not ignore Action > Required, since it might have been generated in vcpu context. >=20 Yes, the sigbus handler will require some rework when we actually start using it for !IOTHREAD. Will have a look, thanks, Jan --------------enigEB092284352DF431DCDF326D Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/ iEYEARECAAYFAk09clQACgkQitSsb3rl5xTelACgy5BpdrBZ86S7yjT2QGkvqa1E j6oAniMr/SXh0pT1QEO3h6nMNzrfl3EA =xyh9 -----END PGP SIGNATURE----- --------------enigEB092284352DF431DCDF326D--