lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue,  4 Oct 2016 20:34:38 -0400
From:   riel@...hat.com
To:     linux-kernel@...r.kernel.org
Cc:     dave.hansen@...ux.intel.com, x86@...nel.org, tglx@...utronix.de,
        pbonzini@...hat.com, mingo@...hat.com, luto@...nel.org,
        pa@...or.com, bp@...e.de
Subject: [PATCH 9/9] x86/fpu: split old & new fpu code paths

From: Rik van Riel <riel@...hat.com>

Now that CR0.TS is no longer being manipulated, we can simplify
switch_fpu_prepare by no longer nesting the handling of the new
fpu inside the two branches for the old FPU.

Signed-off-by: Rik van Riel <riel@...hat.com>
---
 arch/x86/include/asm/fpu/internal.h | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h
index aa7a117b43f8..ef52935f8a17 100644
--- a/arch/x86/include/asm/fpu/internal.h
+++ b/arch/x86/include/asm/fpu/internal.h
@@ -581,23 +581,17 @@ switch_fpu_prepare(struct fpu *old_fpu, struct fpu *new_fpu, int cpu)
 		/* But leave fpu_fpregs_owner_ctx! */
 		old_fpu->fpregs_active = 0;
 		trace_x86_fpu_regs_deactivated(old_fpu);
+	} else
+		old_fpu->last_cpu = -1;
 
-		/* Don't change CR0.TS if we just switch! */
-		if (fpu.preload) {
-			fpregs_activate(new_fpu);
-			trace_x86_fpu_regs_activated(new_fpu);
+	if (fpu.preload) {
+		if (fpregs_state_valid(new_fpu, cpu))
+			fpu.preload = 0;
+		else
 			prefetch(&new_fpu->state);
-		}
-	} else {
-		old_fpu->last_cpu = -1;
-		if (fpu.preload) {
-			if (fpregs_state_valid(new_fpu, cpu))
-				fpu.preload = 0;
-			else
-				prefetch(&new_fpu->state);
-			fpregs_activate(new_fpu);
-		}
+		fpregs_activate(new_fpu);
 	}
+
 	return fpu;
 }
 
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ