From: Jiri Olsa <jolsa@redhat.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: acme@kernel.org, jolsa@kernel.org, linux-kernel@vger.kernel.org,
Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH] perf, tools: Fall weak group back even for EBADF
Date: Wed, 6 Sep 2017 13:52:13 +0200 [thread overview]
Message-ID: <20170906115213.GA5546@krava> (raw)
In-Reply-To: <20170905211324.32427-1-andi@firstfloor.org>
On Tue, Sep 05, 2017 at 02:13:24PM -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> It's not possible to run a package event and a per cpu event in
> the same group. This is used by some of the power metrics.
> They work correctly when not using a group.
>
> Normally weak groups should handle that, but in this case EBADF
> is returned instead of the normal EINVAL.
>
> strace -e perf_event_open ./perf stat -v -e '{cstate_pkg/c2-residency/,msr/tsc/}:W' -a sleep 1
> Using CPUID GenuineIntel-6-3E
> perf_event_open({type=0x17 /* PERF_TYPE_??? */, size=PERF_ATTR_SIZE_VER5, config=0, ...}, -1, 0, -1, PERF_FLAG_FD_CLOEXEC) = -1 EINVAL (Invalid argument)
> perf_event_open({type=0x17 /* PERF_TYPE_??? */, size=PERF_ATTR_SIZE_VER5, config=0, ...}, -1, 0, -1, 0) = -1 EINVAL (Invalid argument)
> perf_event_open({type=0x17 /* PERF_TYPE_??? */, size=PERF_ATTR_SIZE_VER5, config=0, ...}, -1, 0, -1, 0) = -1 EINVAL (Invalid argument)
> perf_event_open({type=0x17 /* PERF_TYPE_??? */, size=PERF_ATTR_SIZE_VER5, config=0, ...}, -1, 0, -1, 0) = -1 EINVAL (Invalid argument)
> perf_event_open({type=0x17 /* PERF_TYPE_??? */, size=PERF_ATTR_SIZE_VER5, config=0, ...}, -1, 0, -1, 0) = 3
> perf_event_open({type=0x7 /* PERF_TYPE_??? */, size=PERF_ATTR_SIZE_VER5, config=0, ...}, -1, 0, 3, 0) = 4
> perf_event_open({type=0x7 /* PERF_TYPE_??? */, size=PERF_ATTR_SIZE_VER5, config=0, ...}, -1, 1, 0, 0) = -1 EBADF (Bad file descriptor)
>
> and perf errors out.
>
> Make weak groups trigger a fall back for EBADF too. Then this case works correctly:
>
> $ ./perf stat -v -e '{cstate_pkg/c2-residency/,msr/tsc/}:W' -a sleep 1
> Using CPUID GenuineIntel-6-3E
> Weak group for cstate_pkg/c2-residency//2 failed
> cstate_pkg/c2-residency/: 476709882 1000598460 1000598460
> msr/tsc/: 39625837911 12007369110 12007369110
>
> Performance counter stats for 'system wide':
>
> 476,709,882 cstate_pkg/c2-residency/
> 39,625,837,911 msr/tsc/
>
> 1.000697588 seconds time elapsed
>
> This fixes perf stat -M Power ...
>
> $ ./perf stat -M Power --metric-only -a sleep 1
>
> Performance counter stats for 'system wide':
>
> Turbo_Utilization C3_Core_Residency C6_Core_Residency C7_Core_Residency C2_Pkg_Residency C3_Pkg_Residency C6_Pkg_Residency C7_Pkg_Residency
> 1.0 0.7 30.0 0.0 0.9 0.1 0.4 0.0
>
> 1.001240740 seconds time elapsed
>
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
seems ok me
Acked-by: Jiri Olsa <jolsa@kernel.org>
thanks,
jirka
next prev parent reply other threads:[~2017-09-06 11:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-05 21:13 [PATCH] perf, tools: Fall weak group back even for EBADF Andi Kleen
2017-09-06 11:52 ` Jiri Olsa [this message]
2017-09-22 16:37 ` [tip:perf/core] perf stat: " tip-bot for Andi Kleen
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=20170906115213.GA5546@krava \
--to=jolsa@redhat.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=andi@firstfloor.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.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.