From: Ingo Molnar <mingo@kernel.org>
To: Jiri Olsa <jolsa@kernel.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
Andi Kleen <andi@firstfloor.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Paul Mackerras <paulus@samba.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH] perf/x86/intel: Add cpu_(prepare|starting|dying) for core_pmu
Date: Tue, 21 Apr 2015 12:52:40 +0200 [thread overview]
Message-ID: <20150421105239.GA26455@gmail.com> (raw)
In-Reply-To: <1429606465-10271-1-git-send-email-jolsa@kernel.org>
* Jiri Olsa <jolsa@kernel.org> wrote:
> The core_pmu does not define cpu_* callbacks, which handles
> allocation of 'struct cpu_hw_events::shared_regs' data,
> initialization of debug store and PMU_FL_EXCL_CNTRS counters.
>
> While this probably won't happen on bare metal, virtual CPU can
> define x86_pmu.extra_regs together with PMU version 1 and thus
> be using core_pmu -> using shared_regs data without it being
> allocated. That could could leave to following panic:
>
> BUG: unable to handle kernel NULL pointer dereference at (null)
> IP: [<ffffffff8152cd4f>] _spin_lock_irqsave+0x1f/0x40
ok.
> diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
> index 9da2400c2ec3..0a61a9a021de 100644
> --- a/arch/x86/kernel/cpu/perf_event_intel.c
> +++ b/arch/x86/kernel/cpu/perf_event_intel.c
> @@ -2533,6 +2533,10 @@ ssize_t intel_event_sysfs_show(char *page, u64 config)
> return x86_event_sysfs_show(page, config, event);
> }
>
> +static int intel_pmu_cpu_prepare(int cpu);
> +static void intel_pmu_cpu_starting(int cpu);
> +static void intel_pmu_cpu_dying(int cpu);
> +
> static __initconst const struct x86_pmu core_pmu = {
> .name = "core",
> .handle_irq = x86_pmu_handle_irq,
> @@ -2559,6 +2563,9 @@ static __initconst const struct x86_pmu core_pmu = {
> .guest_get_msrs = core_guest_get_msrs,
> .format_attrs = intel_arch_formats_attr,
> .events_sysfs_show = intel_event_sysfs_show,
> + .cpu_prepare = intel_pmu_cpu_prepare,
> + .cpu_starting = intel_pmu_cpu_starting,
> + .cpu_dying = intel_pmu_cpu_dying,
> };
Instead of adding prototype declarations, please arrange the x86_pmu
definition's position so that it comes after the required functions -
so that no prototypes are needed.
Thanks,
Ingo
next prev parent reply other threads:[~2015-04-21 10:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-21 8:54 [PATCH] perf/x86/intel: Add cpu_(prepare|starting|dying) for core_pmu Jiri Olsa
2015-04-21 10:52 ` Ingo Molnar [this message]
2015-04-21 15:14 ` [PATCHv2] " Jiri Olsa
2015-04-21 15:12 ` [PATCH] " Peter Zijlstra
2015-04-21 15:18 ` Jiri Olsa
2015-04-21 15:26 ` [PATCHv3] " Jiri Olsa
2015-04-21 21:00 ` Peter Zijlstra
2015-04-22 14:10 ` [tip:perf/urgent] perf/x86/intel: Add cpu_(prepare|starting|dying ) " tip-bot for Jiri Olsa
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=20150421105239.GA26455@gmail.com \
--to=mingo@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=andi@firstfloor.org \
--cc=eranian@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulus@samba.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 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.