linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: 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>
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,
	Shuai Xue <xueshuai@linux.alibaba.com>
Subject: [PATCH 01/10] perf/alibaba_uncore_drw: Use correct CPU affinity
Date: Tue, 12 Mar 2024 17:34:03 +0000	[thread overview]
Message-ID: <ed30ed57584e09b8492c0ceab20c1a7f16d27726.1710257512.git.robin.murphy@arm.com> (raw)
In-Reply-To: <cover.1710257512.git.robin.murphy@arm.com>

Although this driver is trying to use the IRQ-multiplexing mechanism to
handle context migration correctly, it's failing to make events follow
the IRQ instance, instead forcing them onto a per-PMU CPU which is set
once at probe time then never maintained. Fix this by using the correct
CPU from the IRQ instance, and remove the erroneous per-PMU data plus
the redundant check which does not mean what it thinks it means.

CC: Shuai Xue <xueshuai@linux.alibaba.com>
Fixes: cf7b61073e45 ("drivers/perf: add DDR Sub-System Driveway PMU driver for Yitian 710 SoC")
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
 drivers/perf/alibaba_uncore_drw_pmu.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/perf/alibaba_uncore_drw_pmu.c b/drivers/perf/alibaba_uncore_drw_pmu.c
index 19d459a36be5..b37e9794823a 100644
--- a/drivers/perf/alibaba_uncore_drw_pmu.c
+++ b/drivers/perf/alibaba_uncore_drw_pmu.c
@@ -96,8 +96,6 @@ struct ali_drw_pmu {
 
 	struct list_head pmus_node;
 	struct ali_drw_pmu_irq *irq;
-	int irq_num;
-	int cpu;
 	DECLARE_BITMAP(used_mask, ALI_DRW_PMU_COMMON_MAX_COUNTERS);
 	struct perf_event *events[ALI_DRW_PMU_COMMON_MAX_COUNTERS];
 	int evtids[ALI_DRW_PMU_COMMON_MAX_COUNTERS];
@@ -221,7 +219,7 @@ static ssize_t ali_drw_pmu_cpumask_show(struct device *dev,
 {
 	struct ali_drw_pmu *drw_pmu = to_ali_drw_pmu(dev_get_drvdata(dev));
 
-	return cpumap_print_to_pagebuf(true, buf, cpumask_of(drw_pmu->cpu));
+	return cpumap_print_to_pagebuf(true, buf, cpumask_of(drw_pmu->irq->cpu));
 }
 
 static struct device_attribute ali_drw_pmu_cpumask_attr =
@@ -550,11 +548,7 @@ static int ali_drw_pmu_event_init(struct perf_event *event)
 		return -EOPNOTSUPP;
 	}
 
-	event->cpu = drw_pmu->cpu;
-	if (event->cpu < 0) {
-		dev_err(dev, "Per-task mode not supported!\n");
-		return -EOPNOTSUPP;
-	}
+	event->cpu = drw_pmu->irq->cpu;
 
 	if (event->group_leader != event &&
 	    !is_software_event(event->group_leader)) {
@@ -701,8 +695,6 @@ static int ali_drw_pmu_probe(struct platform_device *pdev)
 	/* clearing interrupt status */
 	writel(0xffffff, drw_pmu->cfg_base + ALI_DRW_PMU_OV_INTR_CLR);
 
-	drw_pmu->cpu = smp_processor_id();
-
 	ret = ali_drw_pmu_init_irq(drw_pmu, pdev);
 	if (ret)
 		return ret;
-- 
2.39.2.101.g768bb238c484.dirty


  reply	other threads:[~2024-03-12 17:34 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 ` Robin Murphy [this message]
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
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=ed30ed57584e09b8492c0ceab20c1a7f16d27726.1710257512.git.robin.murphy@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=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 \
    --cc=xueshuai@linux.alibaba.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;
as well as URLs for NNTP newsgroup(s).