From: markus.t.metzger@intel.com
To: gdb-patches@sourceware.org
Cc: markus.t.metzger@gmail.com, jan.kratochvil@redhat.com,
palves@redhat.com, tromey@redhat.com, kettenis@gnu.org,
Markus Metzger <markus.t.metzger@intel.com>
Subject: [patch v5 12/12] btrace, x86: disable on some processors
Date: Fri, 07 Dec 2012 10:38:00 -0000 [thread overview]
Message-ID: <1354876644-25749-13-git-send-email-markus.t.metzger@intel.com> (raw)
In-Reply-To: <1354876644-25749-1-git-send-email-markus.t.metzger@intel.com>
From: Markus Metzger <markus.t.metzger@intel.com>
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-07 Markus Metzger <markus.t.metzger@intel.com>
* common/linux-btrace.c (linux_supports_btrace): Add cpuid check.
---
gdb/common/linux-btrace.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/gdb/common/linux-btrace.c b/gdb/common/linux-btrace.c
index 2441816..c703dc2 100644
--- a/gdb/common/linux-btrace.c
+++ b/gdb/common/linux-btrace.c
@@ -247,7 +247,50 @@ perf_event_read_bts (struct btrace_target_info* tinfo, const uint8_t *begin,
int
linux_supports_btrace (void)
{
+#if defined(__i386__) || defined(__x86_64__)
+ {
+ unsigned int cpuid, model, family;
+
+ __asm__ __volatile__ ("movl $1, %%eax;"
+ "cpuid;"
+ : "=a" (cpuid)
+ :: "%ebx", "%ecx", "%edx");
+
+ family = (cpuid >> 8) & 0xf;
+ model = (cpuid >> 4) & 0xf;
+
+ switch (family)
+ {
+ case 6:
+ model += (cpuid >> 12) & 0xf0;
+
+ switch (model)
+ {
+ case 26: /* Nehalem */
+ case 30:
+ case 46:
+ case 37: /* Westmere */
+ case 44:
+ case 47:
+ case 42: /* Sandy Bridge */
+ case 45:
+ case 58: /* Ivy Bridge */
+
+ /* AAJ122: LBR, BTM, or BTS records may have incorrect branch
+ "from" information afer an EIST transition, T-states, C1E, or
+ Adaptive Thermal Throttling. */
+ return 0;
+ }
+ }
+ }
+
return 1;
+
+#else /* defined(__i386__) || defined(__x86_64__) */
+
+ return 0;
+
+#endif /* defined(__i386__) || defined(__x86_64__) */
}
/* See linux-btrace.h. */
--
1.7.1
next prev parent reply other threads:[~2012-12-07 10:37 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-07 10:37 [patch v5 00/12] branch tracing support for Atom markus.t.metzger
2012-12-07 10:37 ` [patch v5 09/12] gdbserver, linux, btrace: add btrace support for linux-low markus.t.metzger
2012-12-07 10:37 ` [patch v5 06/12] remote, btrace: add branch trace remote ops markus.t.metzger
2012-12-07 10:38 ` [patch v5 08/12] gdbserver, btrace: add generic btrace support markus.t.metzger
2012-12-07 10:38 ` [patch v5 10/12] test, btrace: add branch tracing tests markus.t.metzger
2012-12-07 10:38 ` markus.t.metzger [this message]
2012-12-07 10:38 ` [patch v5 07/12] btrace, doc: document remote serial protocol markus.t.metzger
2012-12-07 15:09 ` Eli Zaretskii
2012-12-13 8:43 ` Metzger, Markus T
2012-12-13 17:02 ` Eli Zaretskii
2012-12-13 17:09 ` Pedro Alves
2012-12-14 7:53 ` Metzger, Markus T
2012-12-07 10:38 ` [patch v5 04/12] linux, i386, amd64: enable btrace for 32bit and 64bit linux native markus.t.metzger
2012-12-07 10:38 ` [patch v5 05/12] xml, btrace: define btrace xml document style markus.t.metzger
2012-12-07 10:38 ` [patch v5 03/12] linux, btrace: perf_event based branch tracing markus.t.metzger
2012-12-07 10:38 ` [patch v5 01/12] thread, btrace: add generic branch trace support markus.t.metzger
2012-12-07 10:38 ` [patch v5 02/12] cli, btrace: add btrace cli markus.t.metzger
2012-12-07 15:16 ` Eli Zaretskii
2012-12-13 9:14 ` Metzger, Markus T
2012-12-07 10:39 ` [patch v5 11/12] test, btrace: more branch tracing tests markus.t.metzger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1354876644-25749-13-git-send-email-markus.t.metzger@intel.com \
--to=markus.t.metzger@intel.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
--cc=kettenis@gnu.org \
--cc=markus.t.metzger@gmail.com \
--cc=palves@redhat.com \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox