From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 4/6] kvm tools: Add rwlock wrapper Date: Sat, 28 May 2011 21:14:37 +0300 Message-ID: <4DE13B8D.90502@redhat.com> References: <1306419950-19064-4-git-send-email-levinsasha928@gmail.com> <1306426743.3065.34.camel@lappy> <20110526180518.GA3572@elte.hu> <4DDE97CE.4000302@redhat.com> <20110526202531.GA2765@elte.hu> <20110526230508.GA15983@Krystal> <20110527102533.GA24608@elte.hu> <20110527132251.GD29744@Krystal> <20110527133128.GA23626@elte.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Mathieu Desnoyers , Pekka Enberg , Sasha Levin , john@jfloren.net, kvm@vger.kernel.org, asias.hejun@gmail.com, gorcunov@gmail.com, prasadjoshi124@gmail.com, "Paul E. McKenney" To: Ingo Molnar Return-path: Received: from mx1.redhat.com ([209.132.183.28]:47883 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754487Ab1E1SPB (ORCPT ); Sat, 28 May 2011 14:15:01 -0400 In-Reply-To: <20110527133128.GA23626@elte.hu> Sender: kvm-owner@vger.kernel.org List-ID: 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.