All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Stephane Eranian <eranian@google.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Don Zickus <dzickus@redhat.com>, Ingo Molnar <mingo@elte.hu>,
	Lin Ming <ming.m.lin@intel.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Vince Weaver <vweaver1@eecs.utk.edu>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [RFC -tip] perf, x86: Add PERF_COUNT_HW_NMI_WATCHDOG event v2
Date: Thu, 23 Jun 2011 15:07:06 +0400	[thread overview]
Message-ID: <20110623110706.GE10238@sun> (raw)
In-Reply-To: <20110623095439.GC10238@sun>

On Thu, Jun 23, 2011 at 01:54:39PM +0400, Cyrill Gorcunov wrote:
...
> > 
> > No new hidden event, just a x86_pmu + a per-arch callbacks.
> 
> Looks quite good for me, Don? (i'll cook some draft patch for review meanwhile).
> 
> 	Cyrill

Since we are going to make __weak linking anyway maybe something like below
fit even beter? (untested)

	Cyrill
---
 arch/x86/kernel/cpu/perf_event_p4.c |   26 ++++++++++++++++++++++++++
 kernel/watchdog.c                   |    3 +++
 2 files changed, 29 insertions(+)

Index: linux-2.6.git/arch/x86/kernel/cpu/perf_event_p4.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/cpu/perf_event_p4.c
+++ linux-2.6.git/arch/x86/kernel/cpu/perf_event_p4.c
@@ -705,6 +705,32 @@ static int p4_validate_raw_event(struct 
 	return 0;
 }
 
+void hw_nmi_watchdog_set_attr(struct perf_event_attr *wd_attr)
+{
+	/*
+	 * Watchdog ticks are special on Netburst, we use
+	 * that named "non-sleeping" ticks as recommended
+	 * by Intel SDM Vol3b.
+	 */
+	if (wd_attr->type	!= PERF_TYPE_HARDWARE ||
+	   wd_attr->attr.config	!= PERF_COUNT_HW_CPU_CYCLES)
+		return;
+
+	wd_attr->type	= PERF_TYPE_RAW;
+	wd_attr->config	=
+		p4_config_pack_escr(P4_ESCR_EVENT(P4_EVENT_EXECUTION_EVENT)		|
+			P4_ESCR_EMASK_BIT(P4_EVENT_EXECUTION_EVENT, NBOGUS0)		|
+			P4_ESCR_EMASK_BIT(P4_EVENT_EXECUTION_EVENT, NBOGUS1)		|
+			P4_ESCR_EMASK_BIT(P4_EVENT_EXECUTION_EVENT, NBOGUS2)		|
+			P4_ESCR_EMASK_BIT(P4_EVENT_EXECUTION_EVENT, NBOGUS3)		|
+			P4_ESCR_EMASK_BIT(P4_EVENT_EXECUTION_EVENT, BOGUS0)		|
+			P4_ESCR_EMASK_BIT(P4_EVENT_EXECUTION_EVENT, BOGUS1)		|
+			P4_ESCR_EMASK_BIT(P4_EVENT_EXECUTION_EVENT, BOGUS2)		|
+			P4_ESCR_EMASK_BIT(P4_EVENT_EXECUTION_EVENT, BOGUS3))		|
+		p4_config_pack_cccr(P4_CCCR_THRESHOLD(15) | P4_CCCR_COMPLEMENT		|
+			P4_CCCR_COMPARE);
+}
+
 static int p4_hw_config(struct perf_event *event)
 {
 	int cpu = get_cpu();
Index: linux-2.6.git/kernel/watchdog.c
===================================================================
--- linux-2.6.git.orig/kernel/watchdog.c
+++ linux-2.6.git/kernel/watchdog.c
@@ -355,6 +355,8 @@ static int watchdog(void *unused)
 
 
 #ifdef CONFIG_HARDLOCKUP_DETECTOR
+void __weak hw_nmi_watchdog_set_attr(struct perf_event_attr *wd_attr) { }
+
 static int watchdog_nmi_enable(int cpu)
 {
 	struct perf_event_attr *wd_attr;
@@ -371,6 +373,7 @@ static int watchdog_nmi_enable(int cpu)
 	/* Try to register using hardware perf events */
 	wd_attr = &wd_hw_attr;
 	wd_attr->sample_period = hw_nmi_get_sample_period(watchdog_thresh);
+	hw_nmi_watchdog_set_attr(wd_attr);
 	event = perf_event_create_kernel_counter(wd_attr, cpu, NULL, watchdog_overflow_callback);
 	if (!IS_ERR(event)) {
 		printk(KERN_INFO "NMI watchdog enabled, takes one hw-pmu counter.\n");

  reply	other threads:[~2011-06-23 11:07 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-28 15:37 [RFC -tip] perf, x86: Add PERF_COUNT_HW_NMI_WATCHDOG event v2 Cyrill Gorcunov
2011-06-21 15:23 ` Don Zickus
2011-06-21 15:40   ` Cyrill Gorcunov
2011-06-21 15:58     ` Peter Zijlstra
2011-06-21 16:13       ` Cyrill Gorcunov
2011-06-21 16:20         ` Stephane Eranian
2011-06-21 16:48           ` Cyrill Gorcunov
2011-06-21 17:02             ` Cyrill Gorcunov
2011-06-21 17:10             ` Stephane Eranian
2011-06-21 17:23               ` Cyrill Gorcunov
2011-06-21 17:26                 ` Stephane Eranian
2011-06-21 17:54                   ` Cyrill Gorcunov
2011-06-21 18:06                     ` Stephane Eranian
2011-06-21 18:32                       ` Cyrill Gorcunov
2011-06-22  8:27                         ` Cyrill Gorcunov
2011-06-22  9:21                           ` Cyrill Gorcunov
2011-06-23  6:48                             ` Cyrill Gorcunov
2011-06-23  9:40                               ` Stephane Eranian
2011-06-23  9:54                                 ` Cyrill Gorcunov
2011-06-23 11:07                                   ` Cyrill Gorcunov [this message]
2011-06-23 11:40                                     ` Don Zickus
2011-06-23 11:44                                       ` Stephane Eranian
2011-06-23 11:53                                         ` Cyrill Gorcunov
2011-06-23 12:03                                           ` Stephane Eranian
2011-06-23 12:07                                             ` Cyrill Gorcunov
2011-06-23 12:26                                               ` Cyrill Gorcunov
2011-06-23 12:31                                                 ` Stephane Eranian
2011-06-23 12:34                                                   ` Cyrill Gorcunov
2011-06-23 11:51                                       ` Cyrill Gorcunov

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=20110623110706.GE10238@sun \
    --to=gorcunov@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=dzickus@redhat.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.m.lin@intel.com \
    --cc=mingo@elte.hu \
    --cc=vweaver1@eecs.utk.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.