aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2011-06-23 08:49:18 -0400
committerIngo Molnar <mingo@elte.hu>2011-07-01 05:06:34 -0400
commit1880c4ae182afb5650c5678949ecfe7ff66a724e (patch)
tree57306c05aca1e2a2ce5d07e8c29ad76b6b403879 /kernel
parent0d6412085b7ff58612af52e51ffa864f0df4b8fd (diff)
perf, x86: Add hw_watchdog_set_attr() in a sake of nmi-watchdog on P4
Due to restriction and specifics of Netburst PMU we need a separated event for NMI watchdog. In particular every Netburst event consumes not just a counter and a config register, but also an additional ESCR register. Since ESCR registers are grouped upon counters (i.e. if ESCR is occupied for some event there is no room for another event to enter until its released) we need to pick up the "least" used ESCR (or the most available one) for nmi-watchdog purposes -- so MSR_P4_CRU_ESCR2/3 was chosen. With this patch nmi-watchdog and perf top should be able to run simultaneously. Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> CC: Lin Ming <ming.m.lin@intel.com> CC: Arnaldo Carvalho de Melo <acme@redhat.com> CC: Frederic Weisbecker <fweisbec@gmail.com> Tested-and-reviewed-by: Don Zickus <dzickus@redhat.com> Tested-and-reviewed-by: Stephane Eranian <eranian@google.com> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/20110623124918.GC13050@sun Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/watchdog.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 3d0c56ad4792..752b75ba662b 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -200,6 +200,8 @@ static int is_softlockup(unsigned long touch_ts)
200} 200}
201 201
202#ifdef CONFIG_HARDLOCKUP_DETECTOR 202#ifdef CONFIG_HARDLOCKUP_DETECTOR
203void __weak hw_nmi_watchdog_set_attr(struct perf_event_attr *wd_attr) { }
204
203static struct perf_event_attr wd_hw_attr = { 205static struct perf_event_attr wd_hw_attr = {
204 .type = PERF_TYPE_HARDWARE, 206 .type = PERF_TYPE_HARDWARE,
205 .config = PERF_COUNT_HW_CPU_CYCLES, 207 .config = PERF_COUNT_HW_CPU_CYCLES,
@@ -368,9 +370,11 @@ static int watchdog_nmi_enable(int cpu)
368 if (event != NULL) 370 if (event != NULL)
369 goto out_enable; 371 goto out_enable;
370 372
371 /* Try to register using hardware perf events */
372 wd_attr = &wd_hw_attr; 373 wd_attr = &wd_hw_attr;
373 wd_attr->sample_period = hw_nmi_get_sample_period(watchdog_thresh); 374 wd_attr->sample_period = hw_nmi_get_sample_period(watchdog_thresh);
375 hw_nmi_watchdog_set_attr(wd_attr);
376
377 /* Try to register using hardware perf events */
374 event = perf_event_create_kernel_counter(wd_attr, cpu, NULL, watchdog_overflow_callback); 378 event = perf_event_create_kernel_counter(wd_attr, cpu, NULL, watchdog_overflow_callback);
375 if (!IS_ERR(event)) { 379 if (!IS_ERR(event)) {
376 printk(KERN_INFO "NMI watchdog enabled, takes one hw-pmu counter.\n"); 380 printk(KERN_INFO "NMI watchdog enabled, takes one hw-pmu counter.\n");