Message ID | 20180808130306.32483-1-prarit@redhat.com (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Len Brown |
Headers | show |
Series | tools/power turbostat: Get APIC ID for all processors | expand |
- t->apic_id = (ebx >> 24) & 0xf; + t->apic_id = (ebx >> 24) & 0xff; Thanks for pointing out this bug in the existing code, something I moved, but did not fix in my patch yesterday. Both Intel and AMD use 8-bits 31-24 for legacy APIC-ID, not 4-bits 27-24. Didn't notice, since I only really look at XAPIC-id these days... On Wed, Aug 8, 2018 at 9:03 AM Prarit Bhargava <prarit@redhat.com> wrote: > > FWIW the kernel does the same thing on arch/x86/kernel/cpu/common.c:1194. > > P. > > ---8<--- > > turbostat shows apicid = 0 for all non-Intel processors. > > The APIC ID code can be run on all processors and must read bits 20-27. > > Signed-off-by: Prarit Bhargava <prarit@redhat.com> > --- > tools/power/x86/turbostat/turbostat.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c > index 980bd9d20646..2dc212b88651 100644 > --- a/tools/power/x86/turbostat/turbostat.c > +++ b/tools/power/x86/turbostat/turbostat.c > @@ -1671,13 +1671,10 @@ void get_apic_id(struct thread_data *t) > > eax = ebx = ecx = edx = 0; > > - if (!genuine_intel) > - return; > - > __cpuid(0, max_level, ebx, ecx, edx); > > __cpuid(1, eax, ebx, ecx, edx); > - t->apic_id = (ebx >> 24) & 0xf; > + t->apic_id = (ebx >> 24) & 0xff; > > if (max_level < 0xb) > return; > -- > 2.14.4 >
On 08/08/2018 04:10 PM, Len Brown wrote: > - t->apic_id = (ebx >> 24) & 0xf; > + t->apic_id = (ebx >> 24) & 0xff; > > Thanks for pointing out this bug in the existing code, something I > moved, but did not fix in my patch yesterday. > Both Intel and AMD use 8-bits 31-24 for legacy APIC-ID, not 4-bits > 27-24. Didn't notice, since I only really look at XAPIC-id these > days... Oh my math is wrong. Duh. I'll resend this as a v2. P. > > > On Wed, Aug 8, 2018 at 9:03 AM Prarit Bhargava <prarit@redhat.com> wrote: >> >> FWIW the kernel does the same thing on arch/x86/kernel/cpu/common.c:1194. >> >> P. >> >> ---8<--- >> >> turbostat shows apicid = 0 for all non-Intel processors. >> >> The APIC ID code can be run on all processors and must read bits 20-27. >> >> Signed-off-by: Prarit Bhargava <prarit@redhat.com> >> --- >> tools/power/x86/turbostat/turbostat.c | 5 +---- >> 1 file changed, 1 insertion(+), 4 deletions(-) >> >> diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c >> index 980bd9d20646..2dc212b88651 100644 >> --- a/tools/power/x86/turbostat/turbostat.c >> +++ b/tools/power/x86/turbostat/turbostat.c >> @@ -1671,13 +1671,10 @@ void get_apic_id(struct thread_data *t) >> >> eax = ebx = ecx = edx = 0; >> >> - if (!genuine_intel) >> - return; >> - >> __cpuid(0, max_level, ebx, ecx, edx); >> >> __cpuid(1, eax, ebx, ecx, edx); >> - t->apic_id = (ebx >> 24) & 0xf; >> + t->apic_id = (ebx >> 24) & 0xff; >> >> if (max_level < 0xb) >> return; >> -- >> 2.14.4 >> > >
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 980bd9d20646..2dc212b88651 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -1671,13 +1671,10 @@ void get_apic_id(struct thread_data *t) eax = ebx = ecx = edx = 0; - if (!genuine_intel) - return; - __cpuid(0, max_level, ebx, ecx, edx); __cpuid(1, eax, ebx, ecx, edx); - t->apic_id = (ebx >> 24) & 0xf; + t->apic_id = (ebx >> 24) & 0xff; if (max_level < 0xb) return;
FWIW the kernel does the same thing on arch/x86/kernel/cpu/common.c:1194. P. ---8<--- turbostat shows apicid = 0 for all non-Intel processors. The APIC ID code can be run on all processors and must read bits 20-27. Signed-off-by: Prarit Bhargava <prarit@redhat.com> --- tools/power/x86/turbostat/turbostat.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)