From: Johannes Weiner <hannes@saeurebad.de>
To: Vegard Nossum <vegard.nossum@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>, Philippe Elie <phil.el@wanadoo.fr>,
oprofile-list@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/oprofile: disable preemption in nmi_shutdown
Date: Sun, 22 Jun 2008 09:30:28 +0200 [thread overview]
Message-ID: <878wwylyej.fsf@skyscraper.fehenstaub.lan> (raw)
In-Reply-To: <20080621215518.GA5715@damson.getinternet.no> (Vegard Nossum's message of "Sat, 21 Jun 2008 23:55:18 +0200")
Hi Vegard,
Vegard Nossum <vegard.nossum@gmail.com> writes:
> Hi,
>
> Does this look correct? I didn't really play with preemption before, but
> as far as I can tell, this is the right thing to do.
>
> I don't really get why model->shutdown(msrs) is done only for one of the
> CPUs, but my patch assumes that this is correct. (If that had been done
> from inside nmi_shutdown() for each CPU, we wouldn't have had to get the
> cpu var, and not needed to disable preemption.)
>
> Please comment :-)
>
>
> Vegard
>
>
> From: Vegard Nossum <vegard.nossum@gmail.com>
> Date: Sat, 21 Jun 2008 23:44:19 +0200
> Subject: [PATCH] x86/oprofile: disable preemption in nmi_shutdown
>
> BUG: using smp_processor_id() in preemptible [00000000] code: oprofiled/27301
> caller is nmi_shutdown+0x11/0x60
> Pid: 27301, comm: oprofiled Not tainted 2.6.26-rc7 #25
> [<c028a90d>] debug_smp_processor_id+0xbd/0xc0
> [<c045fba1>] nmi_shutdown+0x11/0x60
> [<c045dd4a>] oprofile_shutdown+0x2a/0x60
>
> Note that we don't need this for the other functions, since they are all
> called with on_each_cpu() (which disables preemption for us anyway).
>
> Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
> ---
> arch/x86/oprofile/nmi_int.c | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
> index cc48d3f..4a177b4 100644
> --- a/arch/x86/oprofile/nmi_int.c
> +++ b/arch/x86/oprofile/nmi_int.c
> @@ -269,12 +269,16 @@ static void nmi_cpu_shutdown(void *dummy)
>
> static void nmi_shutdown(void)
> {
> - struct op_msrs *msrs = &__get_cpu_var(cpu_msrs);
> + struct op_msrs *msrs;
> +
> + preempt_disable();
> + msrs = &__get_cpu_var(cpu_msrs);
> nmi_enabled = 0;
> on_each_cpu(nmi_cpu_shutdown, NULL, 0, 1);
> unregister_die_notifier(&profile_exceptions_nb);
> model->shutdown(msrs);
> free_msrs();
> + preempt_enable();
Have a look at get_cpu_var() and put_cpu_var(), that is exactly the
pattern.
Hannes
next prev parent reply other threads:[~2008-06-22 7:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-21 18:28 v2.6.26-rc7/oprofile: BUG: using smp_processor_id() in preemptible Vegard Nossum
2008-06-21 21:55 ` [PATCH] x86/oprofile: disable preemption in nmi_shutdown Vegard Nossum
2008-06-22 7:30 ` Johannes Weiner [this message]
2008-06-22 7:40 ` Vegard Nossum
2008-06-24 11:49 ` 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=878wwylyej.fsf@skyscraper.fehenstaub.lan \
--to=hannes@saeurebad.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=oprofile-list@lists.sourceforge.net \
--cc=phil.el@wanadoo.fr \
--cc=vegard.nossum@gmail.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 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.