mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: James Clark <james.clark@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, x86@kernel.org,
	linux-perf-users@vger.kernel.org, jialong.yang@shingroup.cn,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Will Deacon <will@kernel.org>
Subject: Re: [PATCH 05/10] drivers/perf: Use PERF_PMU_CAP_NO_SAMPLING consistently
Date: Wed, 13 Mar 2024 12:02:50 +0000	[thread overview]
Message-ID: <44587738-ad0f-4c7e-b1ca-230a62605724@arm.com> (raw)
In-Reply-To: <2ce4838e-7b5e-45ff-a78a-6363c57de5d9@arm.com>

On 2024-03-13 11:11 am, James Clark wrote:
> 
> 
> On 12/03/2024 17:34, Robin Murphy wrote:
>> Our system PMUs fundamentally cannot support the current notion of
>> sampling events, so now that the core capability has been clarified,
>> apply it consistently and purge yet more boilerplate.
>>
>> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
>> ---
>>   drivers/perf/alibaba_uncore_drw_pmu.c     |  6 +-----
>>   drivers/perf/amlogic/meson_ddr_pmu_core.c |  3 ++-
>>   drivers/perf/arm-cci.c                    |  3 ++-
>>   drivers/perf/arm-ccn.c                    | 12 +-----------
>>   drivers/perf/arm-cmn.c                    |  3 ++-
>>   drivers/perf/arm_cspmu/arm_cspmu.c        | 17 ++++-------------
>>   drivers/perf/arm_dmc620_pmu.c             |  4 ++--
>>   drivers/perf/arm_dsu_pmu.c                | 12 +-----------
>>   drivers/perf/arm_smmuv3_pmu.c             |  6 +-----
>>   drivers/perf/cxl_pmu.c                    |  3 ++-
>>   drivers/perf/dwc_pcie_pmu.c               |  5 +----
>>   drivers/perf/fsl_imx8_ddr_perf.c          |  3 ++-
>>   drivers/perf/fsl_imx9_ddr_perf.c          |  3 ++-
>>   drivers/perf/hisilicon/hisi_pcie_pmu.c    |  4 ++--
>>   drivers/perf/hisilicon/hisi_uncore_pmu.c  |  3 ++-
>>   drivers/perf/hisilicon/hns3_pmu.c         |  4 ++--
>>   drivers/perf/marvell_cn10k_ddr_pmu.c      |  6 +-----
>>   drivers/perf/qcom_l2_pmu.c                |  7 +------
>>   drivers/perf/qcom_l3_pmu.c                |  7 +------
>>   drivers/perf/thunderx2_pmu.c              |  4 ++--
>>   drivers/perf/xgene_pmu.c                  |  4 ++--
>>   21 files changed, 36 insertions(+), 83 deletions(-)
>>
> [...]
>>   
>> diff --git a/drivers/perf/arm-ccn.c b/drivers/perf/arm-ccn.c
>> index ce26bb773a56..4114349e62dd 100644
>> --- a/drivers/perf/arm-ccn.c
>> +++ b/drivers/perf/arm-ccn.c
>> @@ -713,7 +713,6 @@ static void arm_ccn_pmu_event_release(struct perf_event *event)
>>   static int arm_ccn_pmu_event_init(struct perf_event *event)
>>   {
>>   	struct arm_ccn *ccn;
>> -	struct hw_perf_event *hw = &event->hw;
>>   	u32 node_xp, type, event_id;
>>   	int valid;
>>   	int i;
>> @@ -721,16 +720,6 @@ static int arm_ccn_pmu_event_init(struct perf_event *event)
>>   
>>   	ccn = pmu_to_arm_ccn(event->pmu);
>>   
>> -	if (hw->sample_period) {
>> -		dev_dbg(ccn->dev, "Sampling not supported!\n");
>> -		return -EOPNOTSUPP;
>> -	}
>> -
>> -	if (has_branch_stack(event)) {
>> -		dev_dbg(ccn->dev, "Can't exclude execution levels!\n");
>> -		return -EINVAL;
>> -	}
>> -
> 
> [...]
> 
>> diff --git a/drivers/perf/arm_dsu_pmu.c b/drivers/perf/arm_dsu_pmu.c
>> index f5ea5acaf2f3..3424d165795c 100644
>> --- a/drivers/perf/arm_dsu_pmu.c
>> +++ b/drivers/perf/arm_dsu_pmu.c
>> @@ -544,23 +544,12 @@ static int dsu_pmu_event_init(struct perf_event *event)
>>   {
>>   	struct dsu_pmu *dsu_pmu = to_dsu_pmu(event->pmu);
>>   
>> -	/* We don't support sampling */
>> -	if (is_sampling_event(event)) {
>> -		dev_dbg(dsu_pmu->pmu.dev, "Can't support sampling events\n");
>> -		return -EOPNOTSUPP;
>> -	}
>> -
>>   	/* We cannot support task bound events */
>>   	if (event->cpu < 0 || event->attach_state & PERF_ATTACH_TASK) {
>>   		dev_dbg(dsu_pmu->pmu.dev, "Can't support per-task counters\n");
>>   		return -EINVAL;
>>   	}
>>   
>> -	if (has_branch_stack(event)) {
>> -		dev_dbg(dsu_pmu->pmu.dev, "Can't support filtering\n");
>> -		return -EINVAL;
>> -	}
>> -
> 
> I'm assuming that this and the other has_branch_stack() check were
> removed because branch stacks don't actually do anything unless sampling
> is enabled?
> 
> It's a small difference that there is now no error message if you ask
> for branch stacks, but it wouldn't have done anything anyway? I suppose
> this error message was also not applied very consistently across the
> different devices.

Right - the rarity of these checks, plus the fact that in both cases 
here they give a nonsensical debug message that has nothing whatsoever 
to do with the actual failing condition, seems to make it clear that 
they aren't realistically useful.

In general I don't see any good reason for a non-sampling event to be 
picky about the exact type of samples it isn't collecting.

Thanks,
Robin.

  reply	other threads:[~2024-03-13 12:02 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-12 17:34 [PATCH 00/10] perf: Clean up common uncore boilerplate Robin Murphy
2024-03-12 17:34 ` [PATCH 01/10] perf/alibaba_uncore_drw: Use correct CPU affinity Robin Murphy
2024-03-12 17:34 ` [PATCH 02/10] perf: Add capability for common event support Robin Murphy
2024-03-14  8:09   ` Yang Jialong 杨佳龙
2024-03-14 12:34     ` Robin Murphy
2024-03-12 17:34 ` [PATCH 03/10] drivers/perf: Use PERF_PMU_CAP_NO_COMMON_EVENTS Robin Murphy
2024-03-12 17:34 ` [PATCH 04/10] perf: Rename PERF_PMU_CAP_NO_INTERRUPT Robin Murphy
2024-03-13 12:05   ` kernel test robot
2024-03-13 15:44   ` kernel test robot
2024-03-12 17:34 ` [PATCH 05/10] drivers/perf: Use PERF_PMU_CAP_NO_SAMPLING consistently Robin Murphy
2024-03-13 11:11   ` James Clark
2024-03-13 12:02     ` Robin Murphy [this message]
2024-03-12 17:34 ` [PATCH 06/10] drivers/perf: Clean up redundant per-task checks Robin Murphy
2024-03-12 17:34 ` [PATCH 07/10] perf: Define common uncore capabilities Robin Murphy
2024-03-13 11:23   ` James Clark
2024-03-13 12:24     ` Robin Murphy
2024-03-12 17:34 ` [PATCH 08/10] drivers/perf: Use " Robin Murphy
2024-03-12 17:34 ` [PATCH 09/10] x86: Use common uncore PMU capabilities Robin Murphy
2024-03-12 17:34 ` [PATCH 10/10] ARM: " Robin Murphy
2024-03-30 14:59   ` Shawn Guo
2024-03-13 11:26 ` [PATCH 00/10] perf: Clean up common uncore boilerplate James Clark

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=44587738-ad0f-4c7e-b1ca-230a62605724@arm.com \
    --to=robin.murphy@arm.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=james.clark@arm.com \
    --cc=jialong.yang@shingroup.cn \
    --cc=jolsa@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=will@kernel.org \
    --cc=x86@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 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®