From: Namhyung Kim <namhyung@kernel.org>
To: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
Kan Liang <kan.liang@linux.intel.com>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Stephane Eranian <eranian@google.com>,
Ananth Narayan <ananth.narayan@amd.com>,
Sandipan Das <sandipan.das@amd.com>
Subject: Re: [PATCH 5/5] perf/x86: Relax privilege filter restriction on AMD IBS
Date: Tue, 22 Oct 2024 15:25:41 -0700 [thread overview]
Message-ID: <ZxgmZd0Hryqr6BoN@google.com> (raw)
In-Reply-To: <49fd4eb5-ee7b-45f5-a40f-dbfd793cdff4@amd.com>
On Tue, Oct 15, 2024 at 07:06:24PM +0530, Ravi Bangoria wrote:
> Hi Namhyung,
>
> On 05-Sep-24 8:40 AM, Namhyung Kim wrote:
> > While IBS is available for per-thread profiling, still regular users
> > cannot open an event due to the default paranoid setting (2) which
> > doesn't allow unprivileged users to get kernel samples. That means
> > it needs to set exclude_kernel bit in the attribute but IBS driver
> > would reject it since it has PERF_PMU_CAP_NO_EXCLUDE. This is not what
> > we want and I've been getting requests to fix this issue.
> >
> > This should be done in the hardware, but until we get the HW fix we may
> > allow exclude_{kernel,user} in the attribute and silently drop the
> > samples in the PMU IRQ handler. It won't guarantee the sampling
> > frequency or even it'd miss some with fixed period too. Not ideal,
> > but that'd still be helpful to regular users.
> >
> > To minimize the confusion, let's add 'swfilt' bit to attr.config2 which
> > is exposed in the sysfs format directory so that users can figure out
> > if the kernel support the privilege filters by software.
> >
> > $ perf record -e ibs_op/swfilt=1/uh true
>
> Shall we add an example in tools/perf/Documentation/perf-amd-ibs.txt?
Yep, I'll update the document when I send the tooling changes.
>
>
> > +static struct attribute *swfilt_attrs[] = {
> > + &format_attr_swfilt.attr,
> > + NULL,
> > +};
> > +
> > static struct attribute *fetch_l3missonly_attrs[] = {
> > &fetch_l3missonly.attr.attr,
> > NULL,
> > @@ -598,6 +604,11 @@ static struct attribute_group group_rand_en = {
> > .attrs = rand_en_attrs,
> > };
> >
> > +static struct attribute_group group_swfilt = {
> > + .name = "format",
> > + .attrs = swfilt_attrs,
> > +};
> > +
> > static struct attribute_group group_fetch_l3missonly = {
> > .name = "format",
> > .attrs = fetch_l3missonly_attrs,
> > @@ -612,6 +623,7 @@ static struct attribute_group group_zen4_ibs_extensions = {
> >
> > static const struct attribute_group *fetch_attr_groups[] = {
> > &group_rand_en,
> > + &group_swfilt,
> > &empty_caps_group,
> > NULL,
> > };
>
> Causes:
>
> # dmesg
> sysfs: cannot create duplicate filename '/devices/ibs_fetch/format'
> Failed to register pmu: ibs_fetch, reason -17
>
> Rename rand_en_attrs[] to fetch_attrs[], add &format_attr_swfilt.attr
> to it and remove &group_swfilt from fetch_attr_groups[]. And I guess
> it should work.
Thanks for the review, I'll update the code as you suggested.
Namhyung
next prev parent reply other threads:[~2024-10-22 22:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-05 3:10 [RFC/PATCH 0/5] perf: Relax privilege restriction on AMD IBS (v3) Namhyung Kim
2024-09-05 3:10 ` [PATCH 1/5] perf/core: Add PERF_FORMAT_DROPPED Namhyung Kim
2024-09-05 3:10 ` [PATCH 2/5] perf/core: Export perf_exclude_event() Namhyung Kim
2024-09-05 3:10 ` [PATCH 3/5] perf/core: Account dropped samples from BPF Namhyung Kim
2024-09-05 4:17 ` Kyle Huey
2024-09-05 3:10 ` [PATCH 4/5] perf/powerpc: Count dropped samples in core-book3s PMU Namhyung Kim
2024-09-13 4:46 ` Madhavan Srinivasan
2024-09-05 3:10 ` [PATCH 5/5] perf/x86: Relax privilege filter restriction on AMD IBS Namhyung Kim
2024-09-23 10:33 ` Ravi Bangoria
2024-10-22 22:24 ` Namhyung Kim
2024-10-15 13:36 ` Ravi Bangoria
2024-10-22 22:25 ` Namhyung Kim [this message]
2024-09-09 18:16 ` [RFC/PATCH 0/5] perf: Relax privilege restriction on AMD IBS (v3) Namhyung Kim
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=ZxgmZd0Hryqr6BoN@google.com \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=ananth.narayan@amd.com \
--cc=eranian@google.com \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=ravi.bangoria@amd.com \
--cc=sandipan.das@amd.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.