From: James Clark <james.clark@linaro.org>
To: Suzuki K Poulose <suzuki.poulose@arm.com>,
Mike Leach <mike.leach@arm.com>, Leo Yan <leo.yan@arm.com>,
Suyash Mahar <smahar@meta.com>,
Yeoreum Yun <yeoreum.yun@arm.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Qi Liu <liuqi115@huawei.com>, Junhao He <hejunhao3@huawei.com>,
coresight@lists.linaro.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
James Clark <james.clark@linaro.org>,
Jonathan Cameron <jic23@kernel.org>
Subject: [PATCH v4 02/10] coresight: etm-perf: Remove workqueue for freeing AUX data
Date: Fri, 16 Oct 2026 11:46:12 +0100 [thread overview]
Message-ID: <20261016-james-cs-multiple-per-threads-v4-2-dedf961aca0e@linaro.org> (raw)
In-Reply-To: <20261016-james-cs-multiple-per-threads-v4-0-dedf961aca0e@linaro.org>
AUX cleanup is deferred to a workqueue which is never flushed on module
unload. Pending work items can therefore run after coresight-config is
cleaned up or the module text is unloaded.
Since commit 95ff4ca26c49 ("perf/core: Free AUX pages in unmap path"), Perf
core stops AUX transactions and frees the PMU AUX data from the unmap
path in non-atomic context. Release the resources directly from the
free_aux() callback and remove the workqueue.
Fixes: 0bcbf2e30ff2 ("coresight: etm-perf: new PMU driver for ETM tracers")
Signed-off-by: James Clark <james.clark@linaro.org>
---
drivers/hwtracing/coresight/coresight-etm-perf.c | 14 ++------------
drivers/hwtracing/coresight/coresight-etm-perf.h | 2 --
2 files changed, 2 insertions(+), 14 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c
index 09b21a711a87..2323a68584d4 100644
--- a/drivers/hwtracing/coresight/coresight-etm-perf.c
+++ b/drivers/hwtracing/coresight/coresight-etm-perf.c
@@ -18,7 +18,6 @@
#include <linux/slab.h>
#include <linux/stringhash.h>
#include <linux/types.h>
-#include <linux/workqueue.h>
#include "coresight-config.h"
#include "coresight-etm-perf.h"
@@ -211,13 +210,12 @@ static void free_sink_buffer(struct etm_event_data *event_data)
sink_ops(sink)->free_buffer(event_data->snk_config);
}
-static void free_event_data(struct work_struct *work)
+static void etm_free_aux(void *data)
{
int cpu;
cpumask_t *mask;
- struct etm_event_data *event_data;
+ struct etm_event_data *event_data = data;
- event_data = container_of(work, struct etm_event_data, work);
mask = &event_data->mask;
/* Free the sink buffers, if there are any */
@@ -288,13 +286,6 @@ static void *alloc_event_data(int cpu)
return event_data;
}
-static void etm_free_aux(void *data)
-{
- struct etm_event_data *event_data = data;
-
- schedule_work(&event_data->work);
-}
-
/*
* Check if two given sinks are compatible with each other,
* so that they can use the same sink buffers, when an event
@@ -436,7 +427,6 @@ static void *etm_setup_aux(struct perf_event *event, void **pages,
event_data = alloc_event_data(cpu);
if (!event_data)
return NULL;
- INIT_WORK(&event_data->work, free_event_data);
/* First get the selected sink from user space. */
sink_hash = ATTR_CFG_GET_FLD(&event->attr, sinkid);
diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.h b/drivers/hwtracing/coresight/coresight-etm-perf.h
index 24d929428633..5e8d985522bd 100644
--- a/drivers/hwtracing/coresight/coresight-etm-perf.h
+++ b/drivers/hwtracing/coresight/coresight-etm-perf.h
@@ -84,7 +84,6 @@ struct etm_filters {
/**
* struct etm_event_data - Coresight specifics associated to an event
- * @work: Handle to free allocated memory outside IRQ context.
* @mask: Hold the CPU(s) this event was set for.
* @aux_hwid_done: Whether a CPU has emitted the TraceID packet or not.
* @snk_config: The sink configuration.
@@ -92,7 +91,6 @@ struct etm_filters {
* @path: An array of path, each slot for one CPU.
*/
struct etm_event_data {
- struct work_struct work;
cpumask_t mask;
cpumask_t aux_hwid_done;
void *snk_config;
--
2.43.0
next prev parent reply other threads:[~2026-10-16 10:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 10:46 [PATCH v4 00/10] coresight: Prevent per-thread events from sharing a sink James Clark
2026-10-16 10:46 ` [PATCH v4 01/10] coresight: configfs: Don't assume active until cscfg_mgr is set James Clark
2026-10-16 10:46 ` James Clark [this message]
2026-10-16 10:46 ` [PATCH v4 03/10] coresight: etm-perf: Serialize AUX topology access James Clark
2026-10-16 10:46 ` [PATCH v4 04/10] coresight: etm-perf: Reject event if building path fails James Clark
2026-10-16 10:46 ` [PATCH v4 05/10] coresight: etm-perf: Prevent sink sharing at setup time James Clark
2026-10-16 10:46 ` [PATCH v4 06/10] coresight: tmc-etr: Reflect new sharing rules in allocator James Clark
2026-10-16 10:46 ` [PATCH v4 07/10] coresight: tmc-etr: Remove sharing guards from ETR James Clark
2026-10-16 10:46 ` [PATCH v4 08/10] coresight: tmc-etf: Remove sharing guards from ETF James Clark
2026-10-16 10:46 ` [PATCH v4 09/10] coresight: etb10: Remove sharing guards from ETB10 James Clark
2026-10-16 10:46 ` [PATCH v4 10/10] coresight: ultrasoc-smb: Remove sharing guards from SMB 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=20261016-james-cs-multiple-per-threads-v4-2-dedf961aca0e@linaro.org \
--to=james.clark@linaro.org \
--cc=coresight@lists.linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=hejunhao3@huawei.com \
--cc=jic23@kernel.org \
--cc=leo.yan@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuqi115@huawei.com \
--cc=mike.leach@arm.com \
--cc=smahar@meta.com \
--cc=suzuki.poulose@arm.com \
--cc=yeoreum.yun@arm.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®