From: Peter Zijlstra <peterz@infradead.org>
To: Max Filippov <jcmvbkbc@gmail.com>
Cc: linux-xtensa@linux-xtensa.org, linux-kernel@vger.kernel.org,
Chris Zankel <chris@zankel.net>, Marc Gauthier <marc@cadence.com>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>
Subject: Re: [PATCH 7/8] xtensa: implement counting and sampling perf events
Date: Mon, 6 Jul 2015 15:41:59 +0200 [thread overview]
Message-ID: <20150706134159.GH3644@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1436189569-28802-8-git-send-email-jcmvbkbc@gmail.com>
On Mon, Jul 06, 2015 at 04:32:48PM +0300, Max Filippov wrote:
> +static int xtensa_pmu_event_init(struct perf_event *event)
> +{
> + int ret;
> +
> + switch (event->attr.type) {
> + case PERF_TYPE_HARDWARE:
> + if (event->attr.config >= ARRAY_SIZE(xtensa_hw_ctl) ||
> + xtensa_hw_ctl[event->attr.config] == 0)
> + return -ENOENT;
> + event->hw.config = xtensa_hw_ctl[event->attr.config];
> + return 0;
> +
> + case PERF_TYPE_HW_CACHE:
> + ret = xtensa_pmu_cache_event(event->attr.config);
> + if (ret < 0)
> + return ret;
> + event->hw.config = ret;
> + return 0;
> +
> + case PERF_TYPE_RAW:
> + /* Not 'previous counter' select */
> + if ((event->attr.config & XTENSA_PMU_PMCTRL_SELECT) ==
> + (1 << XTENSA_PMU_PMCTRL_SELECT_SHIFT))
> + return -ENOENT;
> + event->hw.config = (event->attr.config &
> + (XTENSA_PMU_PMCTRL_KRNLCNT |
> + XTENSA_PMU_PMCTRL_TRACELEVEL |
> + XTENSA_PMU_PMCTRL_SELECT |
> + XTENSA_PMU_PMCTRL_MASK)) |
> + XTENSA_PMU_PMCTRL_INTEN;
> + return 0;
Since this PMU implements TYPE_HARDWARE/TYPE_HW_CACHE/TYPE_RAW,
returning -ENOENT for those is wrong.
If the configuration is invalid, return -EINVAL.
> +
> + default:
> + return -ENOENT;
> + }
> +}
next prev parent reply other threads:[~2015-07-06 13:42 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-06 13:32 [PATCH 0/8] Support hardware perf counters on xtensa Max Filippov
2015-07-06 13:32 ` [PATCH 1/8] xtensa: clean up Kconfig dependencies for custom cores Max Filippov
2015-07-07 9:18 ` Paul Bolle
2015-07-06 13:32 ` [PATCH 2/8] xtensa: keep exception/interrupt stack continuous Max Filippov
2015-07-07 18:47 ` Chris Zankel
2015-07-07 19:46 ` Max Filippov
2015-07-07 19:47 ` Max Filippov
2015-07-06 13:32 ` [PATCH 3/8] xtensa: move oprofile stack tracing to stacktrace.c Max Filippov
2015-07-06 13:32 ` [PATCH 4/8] xtensa: select PERF_USE_VMALLOC for cache-aliasing configurations Max Filippov
2015-07-06 13:32 ` [PATCH 5/8] xtensa: add profiling IRQ type to xtensa_irq_map Max Filippov
2015-07-06 13:32 ` [PATCH 6/8] xtensa: count software page fault perf events Max Filippov
2015-07-06 13:32 ` [PATCH 7/8] xtensa: implement counting and sampling " Max Filippov
2015-07-06 13:41 ` Peter Zijlstra [this message]
2015-07-06 13:49 ` Max Filippov
2015-07-06 13:47 ` Peter Zijlstra
2015-07-06 13:56 ` Max Filippov
2015-07-06 14:05 ` Peter Zijlstra
2015-07-06 14:22 ` Max Filippov
2015-07-07 3:56 ` Chris Zankel
2015-07-06 13:32 ` [PATCH 8/8] perf tools: xtensa: add DWARF register names Max Filippov
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=20150706134159.GH3644@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=acme@kernel.org \
--cc=chris@zankel.net \
--cc=jcmvbkbc@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xtensa@linux-xtensa.org \
--cc=marc@cadence.com \
--cc=mingo@redhat.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome