Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1197140

[PATCH 06/10] Coresight: Add an interface for supporting ETM3/4 Context ID tracing

From Mathieu Poirier <mathieu.poirier@linaro.org>
Newsgroups linux.kernel
Subject [PATCH 06/10] Coresight: Add an interface for supporting ETM3/4 Context ID tracing
Date 2015-07-31 17:40 +0200
Message-ID <pSkzF-1wQ-31@gated-at.bofh.it> (permalink)
References <pSkzE-1wQ-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Chunyan Zhang <zhang.chunyan@linaro.org>

If PID namespace is enabled, everytime users configure the Context ID
register to trace the specific process, there needs to be a translation
between the real PID seen from the kernel and VPID seen from the
namespace in which the user's process resides .

This patch just adds the translation interface for ETMs.

Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
 include/linux/coresight.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/include/linux/coresight.h b/include/linux/coresight.h
index 3486b9082adb..626da6948ca2 100644
--- a/include/linux/coresight.h
+++ b/include/linux/coresight.h
@@ -248,4 +248,24 @@ static inline struct coresight_platform_data *of_get_coresight_platform_data(
 	struct device *dev, struct device_node *node) { return NULL; }
 #endif
 
+#ifdef CONFIG_PID_NS
+static inline unsigned long
+coresight_vpid_to_pid(unsigned long vpid)
+{
+	struct task_struct *task = NULL;
+	unsigned long pid = 0;
+
+	rcu_read_lock();
+	task = find_task_by_vpid(vpid);
+	if (task)
+		pid = task_pid_nr(task);
+	rcu_read_unlock();
+
+	return pid;
+}
+#else
+static inline unsigned long
+coresight_vpid_to_pid(unsigned long vpid) { return vpid; }
+#endif
+
 #endif
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/10] coresight: next v4.2-rc4 Mathieu Poirier <mathieu.poirier@linaro.org> - 2015-07-31 17:40 +0200
  [PATCH 06/10] Coresight: Add an interface for supporting ETM3/4 Context ID tracing Mathieu Poirier <mathieu.poirier@linaro.org> - 2015-07-31 17:40 +0200
  [PATCH 07/10] coresight-etm3x: Support context-ID tracing when PID namespace is enabled Mathieu Poirier <mathieu.poirier@linaro.org> - 2015-07-31 17:40 +0200
  [PATCH 08/10] coresight-etm4x: Support context-ID tracing when PID namespace is enabled Mathieu Poirier <mathieu.poirier@linaro.org> - 2015-07-31 17:40 +0200
  [PATCH 02/10] coresight-etm3x: Add Qualcomm PTM v1.1 peripheral ID Mathieu Poirier <mathieu.poirier@linaro.org> - 2015-07-31 17:40 +0200
  [PATCH 01/10] coresight: binding for ETMv4 coresight drivers Mathieu Poirier <mathieu.poirier@linaro.org> - 2015-07-31 17:50 +0200
  [PATCH 03/10] coresight: replicator: Use builtin_platform_driver() Mathieu Poirier <mathieu.poirier@linaro.org> - 2015-07-31 17:50 +0200

csiph-web