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


Groups > linux.kernel > #1533550 > unrolled thread

[PATCH 2/4] Revert "x86/boot: Fail the boot if !M486 and CPUID is missing"

Started byAndy Lutomirski <luto@kernel.org>
First post2016-11-30 21:40 +0100
Last post2016-12-01 18:10 +0100
Articles 8 — 5 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/4] Revert "x86/boot: Fail the boot if !M486 and CPUID is missing" Andy Lutomirski <luto@kernel.org> - 2016-11-30 21:40 +0100
    Re: [PATCH 2/4] Revert "x86/boot: Fail the boot if !M486 and CPUID  is missing" Peter Zijlstra <peterz@infradead.org> - 2016-12-01 07:00 +0100
      Re: [PATCH 2/4] Revert "x86/boot: Fail the boot if !M486 and CPUID  is missing" Borislav Petkov <bp@alien8.de> - 2016-12-01 10:10 +0100
        Re: [PATCH 2/4] Revert "x86/boot: Fail the boot if !M486 and CPUID  is missing" Thomas Gleixner <tglx@linutronix.de> - 2016-12-01 11:20 +0100
          [PATCH] x86/CPU: Add X86_FEATURE_CPUID Borislav Petkov <bp@alien8.de> - 2016-12-01 12:20 +0100
            Re: [PATCH] x86/CPU: Add X86_FEATURE_CPUID Andy Lutomirski <luto@amacapital.net> - 2016-12-01 18:10 +0100
        Re: [PATCH 2/4] Revert "x86/boot: Fail the boot if !M486 and CPUID is missing" Andy Lutomirski <luto@amacapital.net> - 2016-12-02 01:40 +0100
      Re: [PATCH 2/4] Revert "x86/boot: Fail the boot if !M486 and CPUID is missing" Andy Lutomirski <luto@amacapital.net> - 2016-12-01 18:10 +0100

#1533550 — [PATCH 2/4] Revert "x86/boot: Fail the boot if !M486 and CPUID is missing"

FromAndy Lutomirski <luto@kernel.org>
Date2016-11-30 21:40 +0100
Subject[PATCH 2/4] Revert "x86/boot: Fail the boot if !M486 and CPUID is missing"
Message-ID<sJjPz-2oq-5@gated-at.bofh.it>
This reverts commit ed68d7e9b9cfb64f3045ffbcb108df03c09a0f98.

The patch wasn't quite correct -- there are non-Intel (and hence
non-486) CPUs that we support that don't have CPUID.  Since we no
longer require CPUID for sync_core(), just revert the patch.

In principle, we should try to do better at identifying CPUID-less
CPUs in early boot, but that's more complicated.

Reported-by: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Cc: Matthew Whitehead <tedheadster@gmail.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
 arch/x86/boot/cpu.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/arch/x86/boot/cpu.c b/arch/x86/boot/cpu.c
index 4224ede43b4e..26240dde081e 100644
--- a/arch/x86/boot/cpu.c
+++ b/arch/x86/boot/cpu.c
@@ -87,12 +87,6 @@ int validate_cpu(void)
 		return -1;
 	}
 
-	if (CONFIG_X86_MINIMUM_CPU_FAMILY <= 4 && !IS_ENABLED(CONFIG_M486) &&
-	    !has_eflag(X86_EFLAGS_ID)) {
-		printf("This kernel requires a CPU with the CPUID instruction.  Build with CONFIG_M486=y to run on this CPU.\n");
-		return -1;
-	}
-
 	if (err_flags) {
 		puts("This kernel requires the following features "
 		     "not present on the CPU:\n");
-- 
2.9.3

[toc] | [next] | [standalone]


#1533824 — Re: [PATCH 2/4] Revert "x86/boot: Fail the boot if !M486 and CPUID is missing"

FromPeter Zijlstra <peterz@infradead.org>
Date2016-12-01 07:00 +0100
SubjectRe: [PATCH 2/4] Revert "x86/boot: Fail the boot if !M486 and CPUID is missing"
Message-ID<sJszw-87u-3@gated-at.bofh.it>
In reply to#1533550
On Wed, Nov 30, 2016 at 12:34:53PM -0800, Andy Lutomirski wrote:
> This reverts commit ed68d7e9b9cfb64f3045ffbcb108df03c09a0f98.
> 
> The patch wasn't quite correct -- there are non-Intel (and hence
> non-486) CPUs that we support that don't have CPUID.  Since we no
> longer require CPUID for sync_core(), just revert the patch.

Might be useful to enumerate which special parts these are.

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


#1533904 — Re: [PATCH 2/4] Revert "x86/boot: Fail the boot if !M486 and CPUID is missing"

FromBorislav Petkov <bp@alien8.de>
Date2016-12-01 10:10 +0100
SubjectRe: [PATCH 2/4] Revert "x86/boot: Fail the boot if !M486 and CPUID is missing"
Message-ID<sJvxo-1QI-29@gated-at.bofh.it>
In reply to#1533824
On Thu, Dec 01, 2016 at 06:53:50AM +0100, Peter Zijlstra wrote:
> On Wed, Nov 30, 2016 at 12:34:53PM -0800, Andy Lutomirski wrote:
> > This reverts commit ed68d7e9b9cfb64f3045ffbcb108df03c09a0f98.
> > 
> > The patch wasn't quite correct -- there are non-Intel (and hence
> > non-486) CPUs that we support that don't have CPUID.  Since we no
> > longer require CPUID for sync_core(), just revert the patch.
>
> Might be useful to enumerate which special parts these are.

Right, and since we test for CPUID support at early boot, I think we
should use the X86_FEATURE_CPUID aspect from what I proposed earlier:

https://lkml.kernel.org/r/20161120111917.pw3alolx4fksfwbv@pd.tnic

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

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


#1533942 — Re: [PATCH 2/4] Revert "x86/boot: Fail the boot if !M486 and CPUID is missing"

FromThomas Gleixner <tglx@linutronix.de>
Date2016-12-01 11:20 +0100
SubjectRe: [PATCH 2/4] Revert "x86/boot: Fail the boot if !M486 and CPUID is missing"
Message-ID<sJwD7-2A3-1@gated-at.bofh.it>
In reply to#1533904
On Thu, 1 Dec 2016, Borislav Petkov wrote:
> On Thu, Dec 01, 2016 at 06:53:50AM +0100, Peter Zijlstra wrote:
> > On Wed, Nov 30, 2016 at 12:34:53PM -0800, Andy Lutomirski wrote:
> > > This reverts commit ed68d7e9b9cfb64f3045ffbcb108df03c09a0f98.
> > > 
> > > The patch wasn't quite correct -- there are non-Intel (and hence
> > > non-486) CPUs that we support that don't have CPUID.  Since we no
> > > longer require CPUID for sync_core(), just revert the patch.
> >
> > Might be useful to enumerate which special parts these are.
> 
> Right, and since we test for CPUID support at early boot, I think we
> should use the X86_FEATURE_CPUID aspect from what I proposed earlier:
> 
> https://lkml.kernel.org/r/20161120111917.pw3alolx4fksfwbv@pd.tnic

Yes, that makes a lot of sense.

Thanks,

	tglx

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


#1533973 — [PATCH] x86/CPU: Add X86_FEATURE_CPUID

FromBorislav Petkov <bp@alien8.de>
Date2016-12-01 12:20 +0100
Subject[PATCH] x86/CPU: Add X86_FEATURE_CPUID
Message-ID<sJxzc-38x-23@gated-at.bofh.it>
In reply to#1533942
On Thu, Dec 01, 2016 at 11:07:21AM +0100, Thomas Gleixner wrote:
> Yes, that makes a lot of sense.

Here it is:

---
From: Borislav Petkov <bp@suse.de>
Date: Thu, 1 Dec 2016 12:11:37 +0100
Subject: [PATCH] x86/CPU: Add X86_FEATURE_CPUID

Add a synthetic CPUID flag denoting whether the CPU sports the CPUID
instruction or not. This will come useful later when accomodating
CPUID-less CPUs.

Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/include/asm/cpufeatures.h | 2 +-
 arch/x86/kernel/cpu/common.c       | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
index 53e27a12ceb6..cb49dd31c3b2 100644
--- a/arch/x86/include/asm/cpufeatures.h
+++ b/arch/x86/include/asm/cpufeatures.h
@@ -100,7 +100,7 @@
 #define X86_FEATURE_XTOPOLOGY	( 3*32+22) /* cpu topology enum extensions */
 #define X86_FEATURE_TSC_RELIABLE ( 3*32+23) /* TSC is known to be reliable */
 #define X86_FEATURE_NONSTOP_TSC	( 3*32+24) /* TSC does not stop in C states */
-/* free, was #define X86_FEATURE_CLFLUSH_MONITOR ( 3*32+25) * "" clflush reqd with monitor */
+#define X86_FEATURE_CPUID	( 3*32+25) /* CPU has CPUID instruction itself */
 #define X86_FEATURE_EXTD_APICID	( 3*32+26) /* has extended APICID (8 bits) */
 #define X86_FEATURE_AMD_DCM     ( 3*32+27) /* multi-node processor */
 #define X86_FEATURE_APERFMPERF	( 3*32+28) /* APERFMPERF */
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 90c007447507..8dcdcdeec569 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -800,14 +800,12 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
 	memset(&c->x86_capability, 0, sizeof c->x86_capability);
 	c->extended_cpuid_level = 0;
 
-	if (!have_cpuid_p())
-		identify_cpu_without_cpuid(c);
-
 	/* cyrix could have cpuid enabled via c_identify()*/
 	if (have_cpuid_p()) {
 		cpu_detect(c);
 		get_cpu_vendor(c);
 		get_cpu_cap(c);
+		setup_force_cpu_cap(X86_FEATURE_CPUID);
 
 		if (this_cpu->c_early_init)
 			this_cpu->c_early_init(c);
@@ -817,6 +815,9 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
 
 		if (this_cpu->c_bsp_init)
 			this_cpu->c_bsp_init(c);
+	 } else {
+		identify_cpu_without_cpuid(c);
+		setup_clear_cpu_cap(X86_FEATURE_CPUID);
 	}
 
 	setup_force_cpu_cap(X86_FEATURE_ALWAYS);
-- 
2.10.0

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

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


#1534312 — Re: [PATCH] x86/CPU: Add X86_FEATURE_CPUID

FromAndy Lutomirski <luto@amacapital.net>
Date2016-12-01 18:10 +0100
SubjectRe: [PATCH] x86/CPU: Add X86_FEATURE_CPUID
Message-ID<sJD1V-70r-51@gated-at.bofh.it>
In reply to#1533973
On Thu, Dec 1, 2016 at 3:15 AM, Borislav Petkov <bp@alien8.de> wrote:
> On Thu, Dec 01, 2016 at 11:07:21AM +0100, Thomas Gleixner wrote:
>> Yes, that makes a lot of sense.
>
> Here it is:
>
> ---
> From: Borislav Petkov <bp@suse.de>
> Date: Thu, 1 Dec 2016 12:11:37 +0100
> Subject: [PATCH] x86/CPU: Add X86_FEATURE_CPUID
>
> Add a synthetic CPUID flag denoting whether the CPU sports the CPUID
> instruction or not. This will come useful later when accomodating
> CPUID-less CPUs.

Reviewed-by: Andy Lutomirski <luto@kernel.org>

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


#1534591

FromAndy Lutomirski <luto@amacapital.net>
Date2016-12-02 01:40 +0100
Message-ID<sJK3n-4BW-7@gated-at.bofh.it>
In reply to#1533904
On Thu, Dec 1, 2016 at 1:02 AM, Borislav Petkov <bp@alien8.de> wrote:
> On Thu, Dec 01, 2016 at 06:53:50AM +0100, Peter Zijlstra wrote:
>> On Wed, Nov 30, 2016 at 12:34:53PM -0800, Andy Lutomirski wrote:
>> > This reverts commit ed68d7e9b9cfb64f3045ffbcb108df03c09a0f98.
>> >
>> > The patch wasn't quite correct -- there are non-Intel (and hence
>> > non-486) CPUs that we support that don't have CPUID.  Since we no
>> > longer require CPUID for sync_core(), just revert the patch.
>>
>> Might be useful to enumerate which special parts these are.
>
> Right, and since we test for CPUID support at early boot, I think we
> should use the X86_FEATURE_CPUID aspect from what I proposed earlier:
>
> https://lkml.kernel.org/r/20161120111917.pw3alolx4fksfwbv@pd.tnic

Maybe we should just make the kernel work fully without CPUID.  There
isn't much to do on top of your patch -- I think we mainly want to
make the cpuid driver refuse to load.

--Andy

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


#1534303

FromAndy Lutomirski <luto@amacapital.net>
Date2016-12-01 18:10 +0100
Message-ID<sJD1U-70r-35@gated-at.bofh.it>
In reply to#1533824
On Wed, Nov 30, 2016 at 9:53 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Wed, Nov 30, 2016 at 12:34:53PM -0800, Andy Lutomirski wrote:
>> This reverts commit ed68d7e9b9cfb64f3045ffbcb108df03c09a0f98.
>>
>> The patch wasn't quite correct -- there are non-Intel (and hence
>> non-486) CPUs that we support that don't have CPUID.  Since we no
>> longer require CPUID for sync_core(), just revert the patch.
>
> Might be useful to enumerate which special parts these are.

Alan thought it was Geode and Elan, right?  I can add that to the
commit message if I do a v2.

--Andy

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web