From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:46810) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzFtX-0002SG-N8 for qemu-devel@nongnu.org; Thu, 28 Feb 2019 02:14:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gzFtW-0006Kp-W8 for qemu-devel@nongnu.org; Thu, 28 Feb 2019 02:14:15 -0500 References: <20190227111411.22890-1-david@redhat.com> <20190227111411.22890-3-david@redhat.com> From: David Hildenbrand Message-ID: <18326ade-4b6b-04f9-f34b-9bd7ff39bd2c@redhat.com> Date: Thu, 28 Feb 2019 08:14:11 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH RFC 2/2] tests/tcg: target/s390: Add test for VECTOR LOAD GR FROM VR ELEMENT List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson , qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Thomas Huth , Cornelia Huck , =?UTF-8?Q?Alex_Benn=c3=a9e?= , =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= On 28.02.19 01:17, Richard Henderson wrote: > On 2/27/19 11:37 AM, David Hildenbrand wrote: >> #define CHECK_SIGILL(STATEMENT) \ >> do { \ >> if (signal(SIGILL, sig_sigill) =3D=3D SIG_ERR) { \ >> check("SIGILL not registered", false); \ >> } \ >> if (setjmp(jmp_env) =3D=3D 0) { \ >> STATEMENT; \ >> check("SIGILL not triggered", false); \ >> } \ >> if (signal(SIGILL, SIG_DFL) =3D=3D SIG_ERR) { \ >> check("SIGILL not registered", false); \ >> } \ >> } while (0) >> >> >> However it only works once. During the second signal, QEMU decides to >> set the default handler. >> >> 1. In a signal handler that signal is blocked. We leave that handler v= ia >> a longjump. So after the first signal, the signal is blocked. >=20 > And this is why we use sigaction not signal. >=20 > You can set action.sa_flags |=3D SA_RESETHAND to avoid needing the expl= icit reset > (or leave it clear to avoid the reset action that you are seeing). >=20 > You can set action.sa_flags |=3D SA_NODEFER to avoid having the signal = added to > the signal mask of the thread, to avoid neeing to use sigsetjmp/siglong= jmp. Or > you can just use sigsetjmp/siglongjmp. ;-) You might tell at this point that it is my first time hacking on signals and I already learned a lot, thanks ;) I guess signal + sigsetjmp/siglongjmp is the one with the smalles LOC? Will give it a try. BTW: I got the idea of using setjml/longjmp from tests/tcg/multiarch/linux-test.c - we're also not caring about blocked signals there, but I guess it doesn't matter as we trigger SISEGV only on= ce. --=20 Thanks, David / dhildenb