Thread (14 messages) read the whole thread 14 messages, 2 authors, 2025-05-02

Re: [PATCH 1/4] coresight/etm4x: disallow altering config via sysfs while enabled

From: Suzuki K Poulose <suzuki.poulose@arm.com>
Date: 2025-01-09 11:46:47
Also in: lkml

Hi Levi,

On 21/12/2024 16:59, Yeoreum Yun wrote:
quoted hunk ↗ jump to hunk
When etm4x configuration is modified via sysfs while etm4x is being
enabled via perf, enabled etm4x could run with different configuration
from perf_event.

To address this, disallow altering config via sysfs while csdev is enabled.

Signed-off-by: Yeoreum Yun <redacted>
---
  .../coresight/coresight-etm4x-sysfs.c         | 132 +++++++++++++++++-
  1 file changed, 128 insertions(+), 4 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c
index 11e865b8e824..cc1f112921d7 100644
--- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c
+++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c
@@ -174,6 +174,9 @@ static ssize_t reset_store(struct device *dev,
  	if (kstrtoul(buf, 16, &val))
  		return -EINVAL;
  
+	if (coresight_get_mode(drvdata->csdev))
+		return -EBUSY;
+
Is it not better to have separate "configs" for perf and sysfs ?
And etmX driver can populate the "running" config, based on the
mode specific config. That way, the configs can be updated
independently without affecting the running config or the perf one.

Suzuki

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help