diff options
author | Markus Metzger <markus.t.metzger@intel.com> | 2009-03-13 05:45:07 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-03-13 06:57:20 -0400 |
commit | 8a327f6d1b05f5ce16572b4413a5df1d0e872283 (patch) | |
tree | 7903a0b4725bea86dba942003d5f6048077271d0 /arch/x86/kernel/ds.c | |
parent | bc44fb5f7d3e764ed7698c835a1a0f35aba2eb3d (diff) |
x86, bts: add selftest for BTS
Perform a selftest of branch trace store when a cpu is initialized.
WARN and disable branch trace store support if the selftest fails.
Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
LKML-Reference: <20090313104507.A30125@sedona.ch.intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/ds.c')
-rw-r--r-- | arch/x86/kernel/ds.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/x86/kernel/ds.c b/arch/x86/kernel/ds.c index 6e5ec679a0cd..51c936c1a390 100644 --- a/arch/x86/kernel/ds.c +++ b/arch/x86/kernel/ds.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/mm.h> | 29 | #include <linux/mm.h> |
30 | #include <linux/kernel.h> | 30 | #include <linux/kernel.h> |
31 | 31 | ||
32 | #include "ds_selftest.h" | ||
32 | 33 | ||
33 | /* | 34 | /* |
34 | * The configuration for a particular DS hardware implementation. | 35 | * The configuration for a particular DS hardware implementation. |
@@ -940,6 +941,26 @@ ds_configure(const struct ds_configuration *cfg, | |||
940 | printk(KERN_INFO "[ds] pebs not available\n"); | 941 | printk(KERN_INFO "[ds] pebs not available\n"); |
941 | } | 942 | } |
942 | 943 | ||
944 | if (ds_cfg.sizeof_rec[ds_bts]) { | ||
945 | int error; | ||
946 | |||
947 | error = ds_selftest_bts(); | ||
948 | if (error) { | ||
949 | WARN(1, "[ds] selftest failed. disabling bts.\n"); | ||
950 | ds_cfg.sizeof_rec[ds_bts] = 0; | ||
951 | } | ||
952 | } | ||
953 | |||
954 | if (ds_cfg.sizeof_rec[ds_pebs]) { | ||
955 | int error; | ||
956 | |||
957 | error = ds_selftest_pebs(); | ||
958 | if (error) { | ||
959 | WARN(1, "[ds] selftest failed. disabling pebs.\n"); | ||
960 | ds_cfg.sizeof_rec[ds_pebs] = 0; | ||
961 | } | ||
962 | } | ||
963 | |||
943 | printk(KERN_INFO "[ds] sizes: address: %u bit, ", | 964 | printk(KERN_INFO "[ds] sizes: address: %u bit, ", |
944 | 8 * ds_cfg.sizeof_ptr_field); | 965 | 8 * ds_cfg.sizeof_ptr_field); |
945 | printk("bts/pebs record: %u/%u bytes\n", | 966 | printk("bts/pebs record: %u/%u bytes\n", |