qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH RFC 2/2] tests/tcg: target/s390: Add test for VE


From: David Hildenbrand
Subject: Re: [Qemu-devel] [PATCH RFC 2/2] tests/tcg: target/s390: Add test for VECTOR LOAD GR FROM VR ELEMENT
Date: Thu, 28 Feb 2019 08:14:11 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

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) == SIG_ERR) { \
>>         check("SIGILL not registered", false);   \
>>     }                                            \
>>     if (setjmp(jmp_env) == 0) {                  \
>>         STATEMENT;                               \
>>         check("SIGILL not triggered", false);    \
>>     }                                            \
>>     if (signal(SIGILL, SIG_DFL) == 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 via
>> a longjump. So after the first signal, the signal is blocked.
> 
> And this is why we use sigaction not signal.
> 
> You can set action.sa_flags |= SA_RESETHAND to avoid needing the explicit 
> reset
> (or leave it clear to avoid the reset action that you are seeing).
> 
> You can set action.sa_flags |= SA_NODEFER to avoid having the signal added to
> the signal mask of the thread, to avoid neeing to use sigsetjmp/siglongjmp.  
> 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 once.

-- 

Thanks,

David / dhildenb



reply via email to

[Prev in Thread] Current Thread [Next in Thread]