From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C1B5C48BD1 for ; Fri, 11 Jun 2021 19:42:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0C8F3613B8 for ; Fri, 11 Jun 2021 19:42:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230452AbhFKTo0 (ORCPT ); Fri, 11 Jun 2021 15:44:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:54366 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229530AbhFKToW (ORCPT ); Fri, 11 Jun 2021 15:44:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7957C613CA; Fri, 11 Jun 2021 19:42:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623440543; bh=Qb74JVhJmTo2KtoO23vug6MfjvG20FaF6nExXjA1uwE=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=WzXiWAmhgUWi9FuYDbK4q2gXDRAeM3ZhpZkyCghFX1Jqm2LYd79j9OIwy0zavI8jx DwQn+opLK5HQds29cv+x5M7VvENu5ui1B3izd6qfSdU1Q6MGNPWsQs89rusvjdlIdA a+7Fk5Rz04Nk5MqSbIfKmA2KLODwhiS2htXr2hDbNWnIuk+hEIp1cFHNFkJMoYI7RZ F4WN//L4ngr8pK3IFgABRUYqWHsiGibqVKYuzE3kmhyiWP38+/2HyEheX5aXNHAIMu WxgfznxcjqmbwBYN9Zujfa11Oo3pYwa6H0x0U5kecNvqRRfY93IV3SKAeFweeOpTvh EmfOhR1rjrXlw== Subject: Re: [patch 11/41] x86/fpu: Get rid of copy_supervisor_to_kernel() To: Thomas Gleixner , LKML Cc: Dave Hansen , Fenghua Yu , Tony Luck , Yu-cheng Yu , Sebastian Andrzej Siewior , Borislav Petkov , Peter Zijlstra , Kan Liang References: <20210611161523.508908024@linutronix.de> <20210611163112.153392869@linutronix.de> From: Andy Lutomirski Message-ID: Date: Fri, 11 Jun 2021 12:42:22 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210611163112.153392869@linutronix.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/11/21 9:15 AM, Thomas Gleixner wrote: > If the fast path of restoring the FPU state on sigreturn fails or is not > taken and the current task's FPU is active then the FPU has to be > deactivated for the slow path to allow a safe update of the tasks FPU > memory state. > > With supervisor states enabled, this requires to save the supervisor state > in the memory state first. Supervisor states require XSAVES so saving only > the supervisor state requires to reshuffle the memory buffer because XSAVES > uses the compacted format and therefore stores the supervisor states at the > beginning of the memory state. That's just an overengineered optimization. > > Get rid of it and save the full state for this case. Hallelujah. Reviewed-by: Andy Lutomirski