Re: [RFC PATCH v2] tools/x86: add kcpuid tool to show raw CPU features

2020-09-28 Thread Feng Tang
On Mon, Sep 28, 2020 at 10:34:20AM +0200, Borislav Petkov wrote: > On Mon, Sep 28, 2020 at 03:07:23PM +0800, Feng Tang wrote: > > Thanks, it looks good to me. One thing is in v2 we supported ',' in the > > long name field, but that's minor as we could avoid using it in .csv > > We can always use

Re: [RFC PATCH v2] tools/x86: add kcpuid tool to show raw CPU features

2020-09-28 Thread Borislav Petkov
On Mon, Sep 28, 2020 at 03:07:23PM +0800, Feng Tang wrote: > Thanks, it looks good to me. One thing is in v2 we supported ',' in the > long name field, but that's minor as we could avoid using it in .csv We can always use ';' or some other symbol as divider if we wanna use ',' in the long name

Re: [RFC PATCH v2] tools/x86: add kcpuid tool to show raw CPU features

2020-09-28 Thread Feng Tang
On Fri, Sep 25, 2020 at 07:24:37PM +0200, Borislav Petkov wrote: > On Tue, Sep 22, 2020 at 01:27:50PM +0800, Feng Tang wrote: > > +++ b/tools/arch/x86/kcpuid/cpuid.txt > > @@ -0,0 +1,58 @@ > > +# Leaf 00H > > + > > +LEAF[],SUBLEAF[00],EAX[ 31:0],max_basic_leafs, Max input value for > >

Re: [RFC PATCH v2] tools/x86: add kcpuid tool to show raw CPU features

2020-09-25 Thread Borislav Petkov
On Fri, Sep 25, 2020 at 04:40:47PM -0400, Arvind Sankar wrote: > They're not the same, but aren't there going to be quite a few common > flags between the definitions in cpufeatures.h and the definitions in > cpuid.txt? If they're both living in the kernel repo, it would be nice > for them to not

Re: [RFC PATCH v2] tools/x86: add kcpuid tool to show raw CPU features

2020-09-25 Thread Arvind Sankar
On Fri, Sep 25, 2020 at 10:17:07PM +0200, Borislav Petkov wrote: > On Fri, Sep 25, 2020 at 03:48:04PM -0400, Arvind Sankar wrote: > > Ok. Another suggestion: while designing the format for the cpuid.txt > > file, would it be possible to include enough information for > > cpufeatures.h to be

Re: [RFC PATCH v2] tools/x86: add kcpuid tool to show raw CPU features

2020-09-25 Thread Arvind Sankar
On Fri, Sep 25, 2020 at 07:16:31PM +0200, Borislav Petkov wrote: > On Wed, Sep 23, 2020 at 10:45:29AM +0800, Feng Tang wrote: > > > Rather than a tool, would additional file(s) in, say, > > > /sys/devices/system/cpu/cpu be nicer? They could show the raw CPUID > > > features, one file per leaf or

Re: [RFC PATCH v2] tools/x86: add kcpuid tool to show raw CPU features

2020-09-25 Thread Borislav Petkov
On Fri, Sep 25, 2020 at 03:48:04PM -0400, Arvind Sankar wrote: > Ok. Another suggestion: while designing the format for the cpuid.txt > file, would it be possible to include enough information for > cpufeatures.h to be auto-generated from it? I think you're missing the previous discussion on this

Re: [RFC PATCH v2] tools/x86: add kcpuid tool to show raw CPU features

2020-09-25 Thread Borislav Petkov
On Tue, Sep 22, 2020 at 12:38:30PM -0700, Dave Hansen wrote: > or something. It also needs a "-f" argument to override this default > location. Yah, the -f thing is almost mandatory. I can imagine simply downloading the latest cpuid.leafs or so and then running kcpuid on it. Can't get any better

Re: [RFC PATCH v2] tools/x86: add kcpuid tool to show raw CPU features

2020-09-25 Thread Dave Hansen
On 9/25/20 10:24 AM, Borislav Petkov wrote: > # LEAF,SUBLEAF,register, bits,short name, long name > 1,0, EBX, 7:0,brand,Brand Index > 1,0, EBX, 15:8,clflush_size,CLFLUSH line size (value * 8) > in bytes >1, 0, EBX, 23:16,max_cpu_id,Maxim

Re: [RFC PATCH v2] tools/x86: add kcpuid tool to show raw CPU features

2020-09-25 Thread Borislav Petkov
On Tue, Sep 22, 2020 at 01:27:50PM +0800, Feng Tang wrote: > +++ b/tools/arch/x86/kcpuid/cpuid.txt > @@ -0,0 +1,58 @@ > +# Leaf 00H > + > +LEAF[],SUBLEAF[00],EAX[ 31:0],max_basic_leafs, Max input value for > supported subleafs > + > + > +# Leaf 01H > + > +LEAF[0001],SUBLEAF[00],EAX[

Re: [RFC PATCH v2] tools/x86: add kcpuid tool to show raw CPU features

2020-09-25 Thread Borislav Petkov
On Wed, Sep 23, 2020 at 10:45:29AM +0800, Feng Tang wrote: > > Rather than a tool, would additional file(s) in, say, > > /sys/devices/system/cpu/cpu be nicer? They could show the raw CPUID > > features, one file per leaf or sub-leaf, maybe even along with whether > > they were disabled at

Re: [RFC PATCH v2] tools/x86: add kcpuid tool to show raw CPU features

2020-09-25 Thread Feng Tang
On Tue, Sep 22, 2020 at 12:38:30PM -0700, Dave Hansen wrote: > On 9/21/20 10:27 PM, Feng Tang wrote: > > +static void parse_text(void) > > +{ > > + FILE *file; > > + char *line = NULL; > > + size_t len = 0; > > + int ret; > > + > > + file = fopen("cpuid.txt", "r"); > > + if (!file) { >

Re: [RFC PATCH v2] tools/x86: add kcpuid tool to show raw CPU features

2020-09-22 Thread Feng Tang
Hi Arvind, On Tue, Sep 22, 2020 at 06:15:23PM -0400, Arvind Sankar wrote: > On Tue, Sep 22, 2020 at 10:10:24PM +0200, Borislav Petkov wrote: > > + AMD folks. > > > > On Tue, Sep 22, 2020 at 01:27:50PM +0800, Feng Tang wrote: > > > End users frequently want to know what features their processor >

Re: [RFC PATCH v2] tools/x86: add kcpuid tool to show raw CPU features

2020-09-22 Thread Arvind Sankar
On Tue, Sep 22, 2020 at 10:10:24PM +0200, Borislav Petkov wrote: > + AMD folks. > > On Tue, Sep 22, 2020 at 01:27:50PM +0800, Feng Tang wrote: > > End users frequently want to know what features their processor > > supports, independent of what the kernel supports. > > > > /proc/cpuinfo is

Re: [RFC PATCH v2] tools/x86: add kcpuid tool to show raw CPU features

2020-09-22 Thread Borislav Petkov
+ AMD folks. On Tue, Sep 22, 2020 at 01:27:50PM +0800, Feng Tang wrote: > End users frequently want to know what features their processor > supports, independent of what the kernel supports. > > /proc/cpuinfo is great. It is omnipresent and since it is provided by > the kernel it is always as up

Re: [RFC PATCH v2] tools/x86: add kcpuid tool to show raw CPU features

2020-09-22 Thread Dave Hansen
On 9/21/20 10:27 PM, Feng Tang wrote: > +static void parse_text(void) > +{ > + FILE *file; > + char *line = NULL; > + size_t len = 0; > + int ret; > + > + file = fopen("cpuid.txt", "r"); > + if (!file) { > + printf("Error in opening 'cpuid.txt'\n"); > +

[RFC PATCH v2] tools/x86: add kcpuid tool to show raw CPU features

2020-09-21 Thread Feng Tang
End users frequently want to know what features their processor supports, independent of what the kernel supports. /proc/cpuinfo is great. It is omnipresent and since it is provided by the kernel it is always as up to date as the kernel. But, it could be ambiguous about processor features which