All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org, alexander.shishkin@linux.intel.com
Subject: Re: [PATCH 2/2] perf: Disallow aux_output for kernel events
Date: Thu, 31 Oct 2019 08:31:59 +0200	[thread overview]
Message-ID: <87h83pfmsg.fsf@ashishki-desk.ger.corp.intel.com> (raw)
In-Reply-To: <20191030134731.5437-3-alexander.shishkin@linux.intel.com>

Alexander Shishkin <alexander.shishkin@linux.intel.com> writes:

> +	/*
> +	 * Grouping is not supported for kernel events, neither is 'AUX',
> +	 * make sure the caller's intentions are adjusted.
> +	 */
> +	if (attr->aux_output)
> +		return -EINVAL;

Should have been ERR_PTR(-EINVAL).

From 72e1839403cb10da589873e1e529778e1f087b96 Mon Sep 17 00:00:00 2001
From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Date: Wed, 30 Oct 2019 15:27:35 +0200
Subject: [PATCH] perf: Disallow aux_output for kernel events

Commit

  ab43762ef0109 ("perf: Allow normal events to output AUX data")

added 'aux_output' bit to the attribute structure, which relies on AUX
events and grouping, neither of which is supported for the kernel events.
This notwithstanding, attempts have been made to use it in the kernel
code, suggesting the necessity of an explicit hard -EINVAL.

Fix this by rejecting attributes with aux_output set for kernel events.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
---
 kernel/events/core.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 6d0d4b14f11c..b1aa5237052b 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -11555,6 +11555,13 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu,
 	struct perf_event *event;
 	int err;
 
+	/*
+	 * Grouping is not supported for kernel events, neither is 'AUX',
+	 * make sure the caller's intentions are adjusted.
+	 */
+	if (attr->aux_output)
+		return ERR_PTR(-EINVAL);
+
 	event = perf_event_alloc(attr, cpu, task, NULL, NULL,
 				 overflow_handler, context, -1);
 	if (IS_ERR(event)) {
-- 
2.24.0.rc1


  reply	other threads:[~2019-10-31  6:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-30 13:47 [PATCH 0/2] perf: Small fixes for the kernel counters Alexander Shishkin
2019-10-30 13:47 ` [PATCH 1/2] perf: Reattach a misplaced comment Alexander Shishkin
2019-11-13 10:06   ` [tip: perf/urgent] perf/core: " tip-bot2 for Alexander Shishkin
2019-10-30 13:47 ` [PATCH 2/2] perf: Disallow aux_output for kernel events Alexander Shishkin
2019-10-31  6:31   ` Alexander Shishkin [this message]
2019-11-13 10:06   ` [tip: perf/urgent] perf/aux: " tip-bot2 for Alexander Shishkin

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=87h83pfmsg.fsf@ashishki-desk.ger.corp.intel.com \
    --to=alexander.shishkin@linux.intel.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@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 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.