[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190620140614.GA238683@romley-ivt3.sc.intel.com>
Date: Thu, 20 Jun 2019 07:06:15 -0700
From: Fenghua Yu <fenghua.yu@...el.com>
To: Borislav Petkov <bp@...en8.de>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, H Peter Anvin <hpa@...or.com>,
Christopherson Sean J <sean.j.christopherson@...el.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Radim Krcmar <rkrcmar@...hat.com>,
Ravi V Shankar <ravi.v.shankar@...el.com>,
linux-kernel <linux-kernel@...r.kernel.org>, x86 <x86@...nel.org>
Subject: Re: [PATCH v2 2/2] x86/cpufeatures: Enumerate new AVX512 BFLOAT16
instructions
On Thu, Jun 20, 2019 at 12:37:20PM +0200, Borislav Petkov wrote:
> On Wed, Jun 19, 2019 at 02:34:04PM -0700, Fenghua Yu wrote:
> You need to test the sub-leaf index validity here before accessing
> subleaf 1:
>
> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
> index 4910cb421b82..dad20bc891d5 100644
> --- a/arch/x86/kernel/cpu/common.c
> +++ b/arch/x86/kernel/cpu/common.c
> @@ -848,8 +848,11 @@ void get_cpu_cap(struct cpuinfo_x86 *c)
> c->x86_capability[CPUID_7_ECX] = ecx;
> c->x86_capability[CPUID_7_EDX] = edx;
>
> - cpuid_count(0x00000007, 1, &eax, &ebx, &ecx, &edx);
> - c->x86_capability[CPUID_7_1_EAX] = eax;
> + /* Check valid sub-leaf index before accessing it */
> + if (eax >= 1) {
> + cpuid_count(0x00000007, 1, &eax, &ebx, &ecx, &edx);
> + c->x86_capability[CPUID_7_1_EAX] = eax;
> + }
You are right.
I tested the three patches in tip tree and they work as expected.
Thank you very much!
-Fenghua
Powered by blists - more mailing lists