mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ravi Bangoria <ravi.bangoria@amd.com>
To: Namhyung Kim <namhyung@kernel.org>
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>,
	Ravi Bangoria <ravi.bangoria@amd.com>
Subject: Re: [PATCH 5/5] perf/x86: Relax privilege filter restriction on AMD IBS
Date: Mon, 23 Sep 2024 16:03:47 +0530	[thread overview]
Message-ID: <e9ddcfb1-b3d3-4ac7-a21a-b7543f449547@amd.com> (raw)
In-Reply-To: <20240905031027.2567913-6-namhyung@kernel.org>

Hi Namhyung,

> 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.

I'm working on some IBS improvements that impacts this change as well.
Is it be possible to hold off this patch for some time. I'll try to
post my patches soon.

> @@ -1111,6 +1127,12 @@ static int perf_ibs_handle_irq(struct perf_ibs *perf_ibs, struct pt_regs *iregs)
>  		regs.flags |= PERF_EFLAGS_EXACT;
>  	}
>  
> +	if ((event->attr.config2 & IBS_SW_FILTER_MASK) &&
> +	    perf_exclude_event(event, &regs)) {
> +		throttle = perf_event_account_interrupt(event);
> +		goto out;
> +	}

Throttling can give surprises when the sample period is very small.
For ex,

  $ ./perf record -e cycles:uh -c 192 -- make
  [ perf record: Woken up 52 times to write data ]
  [ perf record: Captured and wrote 23.016 MB perf.data (705634 samples) ]

  $ ./perf record -e ibs_op/swfilt=1/uh -c 192 -- make
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 1.608 MB perf.data (19 samples) ]

It seems like the IBS event gets throttled (and disabled) before the
cpu get a chance to go back to userspace), hence we end up with very
few samples.

Thanks,
Ravi

  reply	other threads:[~2024-09-23 10:34 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 [this message]
2024-10-22 22:24     ` Namhyung Kim
2024-10-15 13:36   ` Ravi Bangoria
2024-10-22 22:25     ` Namhyung Kim
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=e9ddcfb1-b3d3-4ac7-a21a-b7543f449547@amd.com \
    --to=ravi.bangoria@amd.com \
    --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=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --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 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®