Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1739020imu; Wed, 28 Nov 2018 14:23:26 -0800 (PST) X-Google-Smtp-Source: AFSGD/VJUzZ7qefd0YeGC5S6xunN5C44CDC08eqAURGyH9/hAeA52J5t0ApRTgKEN5DtMyOMjZl5 X-Received: by 2002:a17:902:6bc4:: with SMTP id m4mr22931377plt.93.1543443806226; Wed, 28 Nov 2018 14:23:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543443806; cv=none; d=google.com; s=arc-20160816; b=PiWIgVeQQ/Skfm+66qpanXsBqvaJfGf8a4r84jKKmu6AQvWBl7wM5xS8Xt0y//t8lz 3EaY0uY6iEbH+tudSkzHnBzp+9TCed0h23TFHGEcXhi/re8AzA0QkHrfgxAfMIrFoGbH P2ORzBORSnHDzBj8jafr1I98wCbpgZXSXhCBD5rOrE7ipctwLxlc5Tu1G1YMLTnbEA7m bYkJ9mgae9AssmvFn1ydZNCzcJp1IUW/5pxJAWIfX2YOPZXcdVT/57O8MvYpb3ejhoNi SM98jLnLaeXo49fiD0ttYn0dW+4V30syR3loVs1J2a9b2L69KQ0jaWBuFd8Spz2/j1Ay yDYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=1S78/1fMWj2bvYOcxVLnUEnwpjhMEvsC2N6P/Yerrqs=; b=JJv4EE1Bi6EOl9heCgrcSwhLvXmu3+ZUxcrtomnzpOQ8gEGFQ60iqrMZ1F4qBSX1jC avm/qC/u5u3Ysg9coS4Lvob928cuzp6BdbYODdzX6qQZDiUGwNdbLfToy+ylOE2zJ3Qc EAi2T75K8lfBIJX2DKXJlF8WXhe6o5WDFhUwG1FtMDxMlEWtzW7muQ0vGPc8Io+ITlNH nrUuxQYCWE2caWxE180xSlw6NAoQHg6S03Pos2p6091wSzNPUKjroanbJuamxsmNGJxX +QNZ/CzmRpQv7Wf+RsbOWMvOrlcGibfcv8YV2aaAwcXCIo5PJhAacC46ReAGSGFEoANk 0GrQ== 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 k20si9377888pfb.215.2018.11.28.14.23.11; Wed, 28 Nov 2018 14:23:26 -0800 (PST) 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 S1726966AbeK2JYT (ORCPT + 99 others); Thu, 29 Nov 2018 04:24:19 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:33128 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726870AbeK2JYS (ORCPT ); Thu, 29 Nov 2018 04:24:18 -0500 Received: from localhost ([127.0.0.1] helo=bazinga.breakpoint.cc) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1gS8Ce-0001GX-Te; Wed, 28 Nov 2018 23:21:05 +0100 From: Sebastian Andrzej Siewior To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, Andy Lutomirski , Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , kvm@vger.kernel.org, "Jason A. Donenfeld" , Rik van Riel , Dave Hansen , Sebastian Andrzej Siewior Subject: [PATCH 13/29] x86/fpu: Don't save fxregs for ia32 frames in copy_fpstate_to_sigframe() Date: Wed, 28 Nov 2018 23:20:19 +0100 Message-Id: <20181128222035.2996-14-bigeasy@linutronix.de> X-Mailer: git-send-email 2.20.0.rc1 In-Reply-To: <20181128222035.2996-1-bigeasy@linutronix.de> References: <20181128222035.2996-1-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Why does copy_fpstate_to_sigframe() do copy_fxregs_to_kernel() in the ia32_fxstate case? I don't know. It just does. Maybe it was required at some point, maybe it was added by accident and nobody noticed it because it makes no difference. In copy_fpstate_to_sigframe() we stash the FPU state into the task's stackframe. Then the CPU's FPU registers (and its fpu->state) are cleared (handle_signal() does fpu__clear()). So it makes *no* difference what happens to fpu->state after copy_fpregs_to_sigframe(). Remove copy_fxregs_to_kernel() since it does not matter what it does and save a few cycles. Signed-off-by: Sebastian Andrzej Siewior --- arch/x86/kernel/fpu/signal.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/x86/kernel/fpu/signal.c b/arch/x86/kernel/fpu/signal.c index 42e0f98f34f54..3a59c578440e2 100644 --- a/arch/x86/kernel/fpu/signal.c +++ b/arch/x86/kernel/fpu/signal.c @@ -174,9 +174,6 @@ int copy_fpstate_to_sigframe(void __user *buf, void __user *buf_fx, int size) /* Save the live register state to the user directly. */ if (copy_fpregs_to_sigframe(buf_fx)) return -1; - /* Update the thread's fxstate to save the fsave header. */ - if (ia32_fxstate) - copy_fxregs_to_kernel(fpu); /* Save the fsave header for the 32-bit frames. */ if ((ia32_fxstate || !use_fxsr()) && save_fsave_header(tsk, buf)) -- 2.20.0.rc1