Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030307Ab2B1T0k (ORCPT ); Tue, 28 Feb 2012 14:26:40 -0500 Received: from mail-we0-f174.google.com ([74.125.82.174]:44661 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030277Ab2B1T0i convert rfc822-to-8bit (ORCPT ); Tue, 28 Feb 2012 14:26:38 -0500 MIME-Version: 1.0 In-Reply-To: <4F4D25A2.70307@redhat.com> References: <4F42FE08.5020309@zytor.com> <4F43DB69.9060509@zytor.com> <4F440945.1020904@zytor.com> <4F4CB89C.4060500@redhat.com> <4F4D0D18.4060409@redhat.com> <4F4D1857.4010706@redhat.com> <4F4D25A2.70307@redhat.com> From: Linus Torvalds Date: Tue, 28 Feb 2012 11:26:17 -0800 X-Google-Sender-Auth: amIZjeORwhhfEkx50tWEcJr_y4I Message-ID: Subject: Re: [PATCH 2/2] i387: split up into exported and internal interfaces To: Avi Kivity Cc: "H. Peter Anvin" , Josh Boyer , Jongman Heo , Thomas Gleixner , Ingo Molnar , x86@kernel.org, Linux Kernel Mailing List , KVM list Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1288 Lines: 29 On Tue, Feb 28, 2012 at 11:06 AM, Avi Kivity wrote: > > No, the scheduler saves the state into task_struct. ?I need it saved > into the vcpu structure. ?We have two fpu states, the user state, and > the guest state. ?APIs that take a task_struct as a parameter, or > reference current implicitly, aren't going to work. As far as I can tell, you should do the saving into the vcpu structure when you actually switch the thing around. In fact, you can do it these days by just playing around with the "tsk->thread.fpu.state" pointer, I guess. But it all boils down to the fact that your code is not just ugly, it's *buggy*. If you play around with setting TS, you *will* be hit by interrupts etc that will start to use the FP code that you "don't use". And there is no excuse for you touching the host TS. The kernel does that for you, and does it better. And caches the end result in TS_USEDFPU (old) or in some variable that you shouldn't look at but can access with the user_has_fpu() helpers. Linus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/