mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kim Phillips <kim.phillips@arm.com>
To: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: peterz@infradead.org, acme@kernel.org, mark.rutland@arm.com,
	linux-s390@vger.kernel.org, alexander.shishkin@linux.intel.com,
	will.deacon@arm.com, hpa@zytor.com, heiko.carstens@de.ibm.com,
	adrian.hunter@intel.com, ast@kernel.org, mingo@redhat.com,
	linux-arm-kernel@lists.infradead.org, gregkh@linuxfoundation.org,
	schwidefsky@de.ibm.com, namhyung@kernel.org, tglx@linutronix.de,
	jolsa@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/7] perf/core: Use ioctl to communicate driver configuration to kernel
Date: Fri, 6 Jul 2018 18:22:22 -0500	[thread overview]
Message-ID: <20180706182222.8af97a96d613c90415cb202f@arm.com> (raw)
In-Reply-To: <1530828827-11604-3-git-send-email-mathieu.poirier@linaro.org>

On Thu,  5 Jul 2018 16:13:42 -0600
Mathieu Poirier <mathieu.poirier@linaro.org> wrote:

Hi Mathieu,

> This patch adds the mechanic needed for user space to send PMU specific
                      ^^^^^^^^
I think you meant 'mechanism' here:  mechanics fix cars :)

> +static void perf_drv_config_replace(struct perf_event *event, void *drv_data)
> +{
> +	unsigned long flags;
> +	void *old_drv_data;
> +	struct pmu_drv_config *drv_config = &event->hw.drv_config;
> +
> +	if (!has_drv_config(event))
> +		return;
> +
> +	/* Children take their configuration from their parent */
> +	if (event->parent)
> +		return;
> +
> +	/* Make sure the PMU doesn't get a handle on the data */
> +	raw_spin_lock_irqsave(&drv_config->lock, flags);
> +
> +	old_drv_data = drv_config->config;
> +	drv_config->config = drv_data;
> +
> +	raw_spin_unlock_irqrestore(&drv_config->lock, flags);
> +
> +	/* Free PMU private data allocated by pmu::drv_config_validate() */
> +	event->pmu->drv_config_free(old_drv_data);
> +}

I got this stacktrace whilst testing a perf tool *without* this series
applied, running on a kernel *with* this series applied:

[  132.942054] INFO: trying to register non-static key.
[  132.946964] the code is fine but needs lockdep annotation.
[  132.952389] turning off the locking correctness validator.
[  132.957818] CPU: 2 PID: 2835 Comm: perf64-sans Not tainted 4.18.0-rc3-00196-g5b5d957532a8-dirty #146
[  132.966856] Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Jan 23 2017
[  132.977527] Call trace:
[  132.979947]  dump_backtrace+0x0/0x1c0
[  132.983567]  show_stack+0x24/0x30
[  132.986845]  dump_stack+0x90/0xb4
[  132.990122]  register_lock_class+0x57c/0x580
[  132.994343]  __lock_acquire.isra.12+0x6c/0x980
[  132.998736]  lock_acquire+0x100/0x1e8
[  133.002357]  _raw_spin_lock_irqsave+0x58/0x78
[  133.006667]  perf_drv_config_replace+0x4c/0x80
[  133.011061]  _free_event+0xbc/0x460
[  133.014507]  put_event+0x2c/0x38
[  133.017697]  perf_event_release_kernel+0x1ac/0x300
[  133.022434]  perf_release+0x10/0x20
[  133.025883]  __fput+0xa8/0x1e0
[  133.028901]  ____fput+0x20/0x30
[  133.032006]  task_work_run+0xa0/0xd0
[  133.035539]  do_notify_resume+0x118/0x120
[  133.039503]  work_pending+0x8/0x10

Is a raw_spin_lock_init missing perhaps?

Thanks,

Kim

  reply	other threads:[~2018-07-06 23:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-05 22:13 [PATCH v2 0/7] perf: Add ioctl for PMU driver configuration Mathieu Poirier
2018-07-05 22:13 ` [PATCH v2 1/7] perf: Introduce ioctl to communicate driver configuration to kernel Mathieu Poirier
2018-07-05 22:13 ` [PATCH v2 2/7] perf/core: Use " Mathieu Poirier
2018-07-06 23:22   ` Kim Phillips [this message]
2018-07-09 16:49     ` Mathieu Poirier
2018-07-09 21:45       ` Mathieu Poirier
2018-07-05 22:13 ` [PATCH v2 3/7] perf/aux: Make perf_event accessible to setup_aux() Mathieu Poirier
2018-07-05 22:13 ` [PATCH v2 4/7] coresight: Use PMU driver configuration for sink selection Mathieu Poirier
2018-07-05 22:13 ` [PATCH v2 5/7] perf tools: Use ioctl to communicate driver configuration to kernel Mathieu Poirier
2018-07-05 22:13 ` [PATCH v2 6/7] perf tools: Make perf_evsel accessible to PMU driver configuration code Mathieu Poirier
2018-07-05 22:13 ` [PATCH v2 7/7] perf tools: Use ioctl function to send sink configuration to kernel Mathieu Poirier
2018-07-06 23:38 ` [PATCH v2 0/7] perf: Add ioctl for PMU driver configuration Kim Phillips
2018-07-09 19:21   ` Mathieu Poirier

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=20180706182222.8af97a96d613c90415cb202f@arm.com \
    --to=kim.phillips@arm.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=ast@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=heiko.carstens@de.ibm.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.poirier@linaro.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=will.deacon@arm.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®