Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1044918imm; Wed, 11 Jul 2018 16:06:49 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfxXz7t0+L3ahShCDi9G4Dhwy3vlEj8US8wkslegAb0mmnN6ZDUkcF0dsPAFOu4iDe5LT6S X-Received: by 2002:a17:902:9687:: with SMTP id n7-v6mr485586plp.33.1531350409533; Wed, 11 Jul 2018 16:06:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531350409; cv=none; d=google.com; s=arc-20160816; b=W8R0oAWReUkLqpI4LvFd8UqLMKtPCVrbX0VooG4kei9Vqw14adGC6p9Z6UwCmYFxtl bWKT/RyawwL+C9w4qQC4tyVszDaQe7H4RoFA8QG8zrguJEAoPxwsZsUy+J4sd2uPRfgg 4T3l/JGTbaVJ8GGMgvKyU+5E7Ykmhq4DaM+f+MJhjqvFXxMPCjIRxgmGygZNJRBipd8A nY+ijoqQTwoBCP42HApwk8rME8//6YrPkLW9yaEu5VR8ABwQR4we2ujhPcqFkNDwxRu2 KFLfCPG8Y/3lFNOlZcs2dIADRWsSLetPGDC3vWmJ5j/XRnD4+Nx/AWV6SLkce2HqKl2M VdnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=8lJUmgXogGWPrlFO3it8lnGCqzM0syS6qtIU9m/LCwE=; b=LO1Od0ZeOTbmWOvSDWQlx8o10uq4FIwKlP+ksGAvZlNDRWAfsJcVIO8kwmZEhcmBec NNJNrLZ/i2A696fQJRINUGqSK4A9bV7x5H37ltoZgCCUhXkWbmpMtZqpmtqHH47qDaCH mcQwGr2DbpaUJJVmWeE2Ro5StYWxOoH9lm+ATMrY9Jk3rtUh8sW+ZtjLRA37UPqu9h2g ESxZPSaBwQ+rVzCJ5CTewDQkkZXqR8XntJ6vpjoxwz/vuiUSH/z9nkWfzmXA2y2j1pvY GlXPdKEDY8F1ftlRszkC8Nev22Z6lqhGwIT0S8dwh1IYViuhTb4diS32kLn39rNq0qhU bD4g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c13-v6si18666671pgq.316.2018.07.11.16.06.33; Wed, 11 Jul 2018 16:06:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389341AbeGKQeD (ORCPT + 99 others); Wed, 11 Jul 2018 12:34:03 -0400 Received: from Chamillionaire.breakpoint.cc ([146.0.238.67]:45358 "EHLO Chamillionaire.breakpoint.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726609AbeGKQeD (ORCPT ); Wed, 11 Jul 2018 12:34:03 -0400 Received: from bigeasy by Chamillionaire.breakpoint.cc with local (Exim 4.89) (envelope-from ) id 1fdHz1-0003vn-3V; Wed, 11 Jul 2018 18:28:51 +0200 Date: Wed, 11 Jul 2018 18:28:51 +0200 From: Sebastian Andrzej Siewior To: "Jason A. Donenfeld" Cc: Andrew Lutomirski , riel@surriel.com, dave.hansen@linux.intel.com, LKML , X86 ML Subject: Re: Lazy FPU restoration / moving kernel_fpu_end() to context switch Message-ID: <20180711162850.52jmzsuwegpk7rag@breakpoint.cc> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180622 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-06-15 22:33:47 [+0200], Jason A. Donenfeld wrote: > On Fri, Jun 15, 2018 at 8:32 PM Andy Lutomirski wrote: > > quite in the form you imagined. The idea that we've tossed around is > > to restore FPU state on return to user mode. Roughly, we'd introduce > > a new thread flag TIF_FPU_UNLOADED (name TBD). > > prepare_exit_to_usermode() would notice this flag, copy the fpstate to > > fpregs, and clear the flag. (Or maybe exit_to_usermode_loop() -- No > > one has quite thought it through, but I think it should be outside the > > loop.) We'd update all the FPU accessors to understand the flag. > > Yes! This is exactly what I was thinking. Then those calls to begin() > and end() could be placed as close to the actual FPU usage as > possible. I was thinking about this myself. Did anyone try to hack something in the meantime? I might want to look into this, too :) Sebastian