Re: [PATCH 4/6] kvm tools: Add rwlock wrapper

Avi Kivity
2011-05-28T18:15:01Z

On 05/27/2011 04:31 PM, Ingo Molnar wrote:
> One furthr optimization would be possible: in case you think we can
> write the signal handler in assembly or build it with gcc flags that
> does not use SSE we might also add a 'lightweight signal handler'
> kind of flag to the kernel, which does not save FPU/vector-CPU(SSE)
> state. In this case signals become *really* fast on x86, almost as
> fast as interrupts.
>

My old fpu rewrite had the potential to do this without a flag. We
simply allocate two fpu contexts per thread (main_fpu and signal_fpu);
when we deliver a signal we clear cr0.ts. If the signal touches the
fpu, we save the fpu state to main_fpu and initialize the fpu; we then
save/restore to signal_fpu until the signal handler exits.

--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.