From: Paul Mackerras <paulus@samba.org>
To: Don Zickus <dzickus@redhat.com>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu,
peterz@infradead.org, gorcunov@gmail.com, aris@redhat.com
Subject: Re: [PATCH 3/4] nmi_watchdog: fallback to software events when no hardware pmu detected
Date: Mon, 15 Feb 2010 11:33:41 +1100 [thread overview]
Message-ID: <20100215003341.GH13769@brick.ozlabs.ibm.com> (raw)
In-Reply-To: <1266013161-31197-3-git-send-email-dzickus@redhat.com>
On Fri, Feb 12, 2010 at 05:19:20PM -0500, Don Zickus wrote:
> diff --git a/kernel/nmi_watchdog.c b/kernel/nmi_watchdog.c
> index 73c1954..4f23505 100644
> --- a/kernel/nmi_watchdog.c
> +++ b/kernel/nmi_watchdog.c
> @@ -166,8 +166,12 @@ cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
> wd_attr.sample_period = hw_nmi_get_sample_period();
> event = perf_event_create_kernel_counter(&wd_attr, hotcpu, -1, wd_overflow);
> if (IS_ERR(event)) {
> - printk(KERN_ERR "nmi watchdog failed to create perf event on %i: %p\n", hotcpu, event);
> - return NOTIFY_BAD;
> + wd_attr.type = PERF_TYPE_SOFTWARE;
> + event = perf_event_create_kernel_counter(&wd_attr, hotcpu, -1, wd_overflow);
Here you don't explicitly set wd_attr.config or wd_attr.sample_period
for the software event. So PERF_COUNT_HW_CPU_CYCLES (which is 0)
becomes PERF_COUNT_SW_CPU_CLOCK (also 0). Which is either a happy
accident or really really subtle. :) I suggest you either set
wd_attr.config or add a comment pointing out that you are using the
fact that PERF_COUNT_HW_CPU_CYCLES == PERF_COUNT_SW_CPU_CLOCK.
Also you don't explicitly set wd_attr.sample_period, so it will be
whatever hw_nmi_get_sample_period() returned, except now measured in
nanoseconds rather than (presumably) cpu clock cycles. Are you aiming
for 1 interrupt per second? If so you should set .sample_period to
NSEC_PER_SEC.
Paul.
next prev parent reply other threads:[~2010-02-15 0:33 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-12 22:19 [PATCH 1/4] nmi_watchdog: use a boolean config flag for compiling Don Zickus
2010-02-12 22:19 ` [PATCH 2/4] nmi_watchdog: compile and portability fixes Don Zickus
2010-02-14 9:13 ` [tip:perf/nmi] nmi_watchdog: Compile " tip-bot for Don Zickus
2010-02-12 22:19 ` [PATCH 3/4] nmi_watchdog: fallback to software events when no hardware pmu detected Don Zickus
2010-02-14 9:13 ` [tip:perf/nmi] nmi_watchdog: Fallback " tip-bot for Don Zickus
2010-02-15 0:33 ` Paul Mackerras [this message]
2010-02-15 15:38 ` [PATCH 3/4] nmi_watchdog: fallback " Don Zickus
2010-02-12 22:19 ` [PATCH 4/4] [RFC][powerpc] nmi_watchdog: support for powerpc Don Zickus
2010-02-14 9:12 ` [tip:perf/nmi] nmi_watchdog: Use a boolean config flag for compiling tip-bot for Don Zickus
2010-02-14 16:59 ` [PATCH 1/4] nmi_watchdog: use " Ingo Molnar
2010-02-14 18:12 ` Ingo Molnar
2010-02-15 23:02 ` Don Zickus
2010-02-15 17:51 ` Don Zickus
2010-02-15 18:13 ` Cyrill Gorcunov
2010-02-15 18:21 ` Cyrill Gorcunov
2010-02-15 18:45 ` Don Zickus
2010-02-16 14:30 ` Ingo Molnar
2010-02-18 19:27 ` Ingo Molnar
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=20100215003341.GH13769@brick.ozlabs.ibm.com \
--to=paulus@samba.org \
--cc=aris@redhat.com \
--cc=dzickus@redhat.com \
--cc=gorcunov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
/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
all inboxes | Powered by JetHome®