lkml.org 
[lkml]   [2021]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v1 4/4] coresight: etm3x: Don't trace contextID for non-root namespace in perf mode
Date
ETMv3 driver doesn't handle the case when programs run in non-root PID
namespace, so it allows the contextID tracing by directly using perf
config.

This patch changes to only enable contextID tracing for root PID
namespace. Note, the hardware supports VMID tracing from ETMv3.5, but
the driver never enables VMID trace, so this patch doesn't handle VMID
trace (bit 30 in ETMCR register) particularly.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
drivers/hwtracing/coresight/coresight-etm3x-core.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/hwtracing/coresight/coresight-etm3x-core.c b/drivers/hwtracing/coresight/coresight-etm3x-core.c
index cf64ce73a741..0621ab0c71d9 100644
--- a/drivers/hwtracing/coresight/coresight-etm3x-core.c
+++ b/drivers/hwtracing/coresight/coresight-etm3x-core.c
@@ -340,6 +340,10 @@ static int etm_parse_event_config(struct etm_drvdata *drvdata,

config->ctrl = attr->config;

+ /* Don't trace contextID when runs in non-root PID namespace */
+ if (task_active_pid_ns(current) != &init_pid_ns)
+ config->ctrl &= ~ETMCR_CTXID_SIZE;
+
/*
* Possible to have cores with PTM (supports ret stack) and ETM
* (never has ret stack) on the same SoC. So if we have a request
--
2.25.1
\
 
 \ /
  Last update: 2021-10-31 15:43    [W:0.114 / U:1.724 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site