Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1539607 > unrolled thread

[PATCH v4 0/4] CPUID-less CPU/sync_core fixes and improvements

Started byAndy Lutomirski <luto@kernel.org>
First post2016-12-09 19:30 +0100
Last post2016-12-15 19:10 +0100
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v4 0/4] CPUID-less CPU/sync_core fixes and improvements Andy Lutomirski <luto@kernel.org> - 2016-12-09 19:30 +0100
    [PATCH v4 1/4] x86/asm/32: Make sync_core() handle missing CPUID on all 32-bit kernels Andy Lutomirski <luto@kernel.org> - 2016-12-09 19:30 +0100
      [tip:x86/urgent] x86/asm/32: Make sync_core() handle missing CPUID  on all 32-bit kernels tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2016-12-19 12:10 +0100
    Re: [PATCH v4 0/4] CPUID-less CPU/sync_core fixes and improvements Andy Lutomirski <luto@amacapital.net> - 2016-12-15 19:10 +0100

#1539607 — [PATCH v4 0/4] CPUID-less CPU/sync_core fixes and improvements

FromAndy Lutomirski <luto@kernel.org>
Date2016-12-09 19:30 +0100
Subject[PATCH v4 0/4] CPUID-less CPU/sync_core fixes and improvements
Message-ID<sMy5H-6DX-9@gated-at.bofh.it>
*** PATCHES 1 and 2 MAY BE 4.9 MATERIAL ***

Alan Cox pointed out that the 486 isn't the only supported CPU that
doesn't have CPUID.  Let's clean up the mess and make everything
faster while we're at it.

Patch 1 is intended to be an easy fix: it makes sync_core() work
without CPUID on all 32-bit kernels.  It should be quite safe.  This
will have a negligible performance cost during boot on kernels built
for newer CPUs.  With this in place, patch 2 reverts the buggy 486
check I added.

Patches 3-4 are meant to improve the situation.  Patch 3 cleans up
the Intel microcode loader and the patch 4 (which depends on patch 3
to work correctly) stops using CPUID in sync_core() altogether.

Changes from v3:
 - Improve sync_core() comments.
 - Tidy up sync_core() asm.

Changes from v2:
 - Switch to IRET-to-self and get rid of all the paravirt code.
 - Further immprove the sync_core() comment.

Changes from v1:
 - Fix Xen
 - Add timing info to the changelog (hint: 2x speedup)
 - Document patch 1 a bit better.

Andy Lutomirski (4):
  x86/asm/32: Make sync_core() handle missing CPUID on all 32-bit
    kernels
  Revert "x86/boot: Fail the boot if !M486 and CPUID is missing"
  x86/microcode/intel: Replace sync_core() with native_cpuid()
  x86/asm: Rewrite sync_core() to use IRET-to-self

 arch/x86/boot/cpu.c                   |  6 ---
 arch/x86/include/asm/processor.h      | 80 +++++++++++++++++++++++++----------
 arch/x86/kernel/cpu/microcode/intel.c | 26 ++++++++++--
 3 files changed, 81 insertions(+), 31 deletions(-)

-- 
2.9.3

[toc] | [next] | [standalone]


#1539608 — [PATCH v4 1/4] x86/asm/32: Make sync_core() handle missing CPUID on all 32-bit kernels

FromAndy Lutomirski <luto@kernel.org>
Date2016-12-09 19:30 +0100
Subject[PATCH v4 1/4] x86/asm/32: Make sync_core() handle missing CPUID on all 32-bit kernels
Message-ID<sMy5I-6DX-39@gated-at.bofh.it>
In reply to#1539607
We support various non-Intel CPUs that don't have the CPUID
instruction, so the M486 test was wrong.  For now, fix it with a big
hammer: handle missing CPUID on all 32-bit CPUs.

Reported-by: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
 arch/x86/include/asm/processor.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 984a7bf17f6a..64fbc937d586 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -595,7 +595,7 @@ static inline void sync_core(void)
 {
 	int tmp;
 
-#ifdef CONFIG_M486
+#ifdef CONFIG_X86_32
 	/*
 	 * Do a CPUID if available, otherwise do a jump.  The jump
 	 * can conveniently enough be the jump around CPUID.
-- 
2.9.3

[toc] | [prev] | [next] | [standalone]


#1544460 — [tip:x86/urgent] x86/asm/32: Make sync_core() handle missing CPUID on all 32-bit kernels

Fromtip-bot for Andy Lutomirski <tipbot@zytor.com>
Date2016-12-19 12:10 +0100
Subject[tip:x86/urgent] x86/asm/32: Make sync_core() handle missing CPUID on all 32-bit kernels
Message-ID<sQ3Zo-6VK-27@gated-at.bofh.it>
In reply to#1539608
Commit-ID:  1c52d859cb2d417e7216d3e56bb7fea88444cec9
Gitweb:     http://git.kernel.org/tip/1c52d859cb2d417e7216d3e56bb7fea88444cec9
Author:     Andy Lutomirski <luto@kernel.org>
AuthorDate: Fri, 9 Dec 2016 10:24:05 -0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 19 Dec 2016 11:54:20 +0100

x86/asm/32: Make sync_core() handle missing CPUID on all 32-bit kernels

We support various non-Intel CPUs that don't have the CPUID
instruction, so the M486 test was wrong.  For now, fix it with a big
hammer: handle missing CPUID on all 32-bit CPUs.

Reported-by: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Cc: Juergen Gross <jgross@suse.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Matthew Whitehead <tedheadster@gmail.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: xen-devel <Xen-devel@lists.xen.org>
Link: http://lkml.kernel.org/r/685bd083a7c036f7769510b6846315b17d6ba71f.1481307769.git.luto@kernel.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 arch/x86/include/asm/processor.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 6aa741f..b934871 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -607,7 +607,7 @@ static inline void sync_core(void)
 {
 	int tmp;
 
-#ifdef CONFIG_M486
+#ifdef CONFIG_X86_32
 	/*
 	 * Do a CPUID if available, otherwise do a jump.  The jump
 	 * can conveniently enough be the jump around CPUID.

[toc] | [prev] | [next] | [standalone]


#1542954

FromAndy Lutomirski <luto@amacapital.net>
Date2016-12-15 19:10 +0100
Message-ID<sOIDD-CX-3@gated-at.bofh.it>
In reply to#1539607
On Fri, Dec 9, 2016 at 10:24 AM, Andy Lutomirski <luto@kernel.org> wrote:
> *** PATCHES 1 and 2 MAY BE 4.9 MATERIAL ***
>
> Alan Cox pointed out that the 486 isn't the only supported CPU that
> doesn't have CPUID.  Let's clean up the mess and make everything
> faster while we're at it.
>

Ping?  Any chance of getting these in for 4.10?

--Andy

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web