RE: [patch v6 12/12] btrace, x86: disable on some processors

Metzger, Markus T
2012-12-19T16:13:13Z

> -----Original Message-----
> From: Mark Kettenis [mailto:mark.kettenis@xs4all.nl]
> Sent: Monday, December 17, 2012 6:11 PM

Thanks for your review.

> > LBR, BTM, or BTS records may have incorrect branch "from" information afer an
> > EIST transition, T-states, C1E, or Adaptive Thermal Throttling (AAJ122).
> >
> > This results in sporadic test fails. Disable btrace on those processors.
> >
> > 2012-12-17 Markus Metzger <markus.t.metzger@intel.com>
> >
> > * common/linux-btrace.c (linux_supports_btrace): Add cpuid check.
>
> I think this approach is a reasonable compromise. However, AFAICT the
> linux_supports_btrace() is called unconditionally. Therefore this
> will break GDB on old CPUs that don't implement the cpuid
> instructions. And AFAIK the family/model values are specific to
> Intel, so you should check that you're on an Intel CPU before
> interpreting these values. And I still think you should check whether
> the kernel supports BTS on the CPU you're running on first before
> disabling it on certain CPUs.

This function is only called if the kernel provides a perf_event.h header file, which requires a recent enough kernel. Will a recent kernel run on those old cpu's that don't implement cpuid?

In order to check whether the kernel supports BTS, I would need to enable tracing. Let's see if I can use the gdb or gdbserver process for this, since I don't necessarily have an inferior. If you think that it is necessary, I could try to add such a check.

I added a vendor check.

Regards,
Markus.
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052