From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753003AbdAZOoR (ORCPT ); Thu, 26 Jan 2017 09:44:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33244 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752158AbdAZOoP (ORCPT ); Thu, 26 Jan 2017 09:44:15 -0500 Message-ID: <1485441852.15964.49.camel@redhat.com> Subject: Re: [PATCH 5/7] x86/fpu: Change fpu->fpregs_active users to fpu->fpstate_active From: Rik van Riel To: Ingo Molnar , linux-kernel@vger.kernel.org Cc: Andrew Morton , Andy Lutomirski , Borislav Petkov , Dave Hansen , Fenghua Yu , "H . Peter Anvin" , Linus Torvalds , Oleg Nesterov , Peter Zijlstra , Thomas Gleixner , Yu-cheng Yu Date: Thu, 26 Jan 2017 09:44:12 -0500 In-Reply-To: <1485429989-23340-6-git-send-email-mingo@kernel.org> References: <1485429989-23340-1-git-send-email-mingo@kernel.org> <1485429989-23340-6-git-send-email-mingo@kernel.org> Organization: Red Hat, Inc Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 26 Jan 2017 14:44:16 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2017-01-26 at 12:26 +0100, Ingo Molnar wrote: > We want to simplify the FPU state machine by eliminating fpu- > >fpregs_active, > and we can do that because the two state flags (::fpregs_active and > ::fpstate_active) are set essentially together. > > The old lazy FPU switching code used to make a distinction - but > there's > no lazy switching code anymore, we always switch in an 'eager' > fashion. I've been working for a while now to fix that for KVM VCPU threads. Currently when we switch to a VCPU thread, we first load that thread's userspace FPU context, and then soon after we save that, and load the guest side FPU context. When a VCPU thread goes idle, we also go through two FPU context transitions. In order to skip the unnecessary FPU context switches for VCPU threads, I have been relying on separate fpstate_active and fpregs_active states. Do you have any ideas on how I could implement that kind of change without separate fpstate_active and fpregs_active states?