From: Ingo Molnar <mingo@elte.hu>
To: Aristeu Rozanski <aris@redhat.com>
Cc: linux-kernel@vger.kernel.org, dzickus@redhat.com,
prarit@redhat.com, vgoyal@redhat.com
Subject: Re: [PATCH] NMI watchdog: setup before enabling NMI watchdog
Date: Mon, 22 Sep 2008 19:47:09 +0200 [thread overview]
Message-ID: <20080922174709.GB10535@elte.hu> (raw)
In-Reply-To: <20080922171347.GI16840@redhat.com>
* Aristeu Rozanski <aris@redhat.com> wrote:
> There's a small window when NMI watchdog is being set up that if any NMIs
> are triggered, the NMI code will make make use of not initalized wd_ops
> elements:
> void setup_apic_nmi_watchdog(void *unused)
> {
> if (__get_cpu_var(wd_enabled))
> return;
>
> /* cheap hack to support suspend/resume */
> /* if cpu0 is not active neither should the other cpus */
> if (smp_processor_id() != 0 && atomic_read(&nmi_active) <= 0)
> return;
>
> switch (nmi_watchdog) {
> case NMI_LOCAL_APIC:
> /* enable it before to avoid race with handler */
> --> __get_cpu_var(wd_enabled) = 1;
> --> if (lapic_watchdog_init(nmi_hz) < 0) {
> (...)
> asmlinkage notrace __kprobes void default_do_nmi(struct pt_regs *regs)
> {
> (...)
> if (nmi_watchdog_tick(regs, reason))
> return;
> (...)
> notrace __kprobes int
> nmi_watchdog_tick(struct pt_regs *regs, unsigned reason)
> {
> (...)
> if (!__get_cpu_var(wd_enabled))
> return rc;
> switch (nmi_watchdog) {
> case NMI_LOCAL_APIC:
> rc |= lapic_wd_event(nmi_hz);
> (...)
> int lapic_wd_event(unsigned nmi_hz)
> {
> struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk);
> u64 ctr;
>
> --> rdmsrl(wd->perfctr_msr, ctr);
>
> and wd->*_msr will be initialized on each processor type specific setup, after
> enabling NMIs for PMIs. Since the counter was just set, the chances of an
> performance counter generated NMI is minimal, but any other unknown NMI would
> trigger the problem. This patch fixes the problem by setting everything up
> before enabling performance counter generated NMIs and will set wd_enabled
> using a callback function.
>
> Signed-off-by: Aristeu Rozanski <aris@redhat.com>
> Acked-by: Don Zickus <dzickus@redhat.com>
> Acked-by: Prarit Bhargava <prarit@redhat.com>
> Acked-by: Vivek Goyal <vgoyal@redhat.com>
applied to tip/x86/nmi-watchdog, thanks Aristeu!
Ingo
next prev parent reply other threads:[~2008-09-22 17:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-22 17:13 Aristeu Rozanski
2008-09-22 17:47 ` Ingo Molnar [this message]
2008-09-22 17:59 ` Ingo Molnar
2008-09-22 18:12 ` Aristeu Rozanski
2008-09-22 18:05 ` Cyrill Gorcunov
2008-09-22 18:35 ` Aristeu Rozanski
2008-09-22 18:48 ` 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=20080922174709.GB10535@elte.hu \
--to=mingo@elte.hu \
--cc=aris@redhat.com \
--cc=dzickus@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=prarit@redhat.com \
--cc=vgoyal@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
all inboxes | Powered by JetHome®