From: zhang.chunyan@linaro.org (Chunyan Zhang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/5] Coresight: Add an interface for supporting ETM3/4 Context ID tracing
Date: Tue, 7 Jul 2015 16:41:56 +0800 [thread overview]
Message-ID: <1436258518-9339-4-git-send-email-zhang.chunyan@linaro.org> (raw)
In-Reply-To: <1436258518-9339-1-git-send-email-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>
---
include/linux/coresight.h | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/include/linux/coresight.h b/include/linux/coresight.h
index 3486b90..626da69 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
next prev parent reply other threads:[~2015-07-07 8:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-07 8:41 [PATCH 0/5] coresight: Support context-ID tracing when PID namespace is enabled Chunyan Zhang
2015-07-07 8:41 ` [PATCH 1/5] coresight-etm3x: Change the name of the ctxid_val to ctxid_pid Chunyan Zhang
2015-07-07 8:41 ` [PATCH 2/5] coresight-etm4x: " Chunyan Zhang
2015-08-26 17:57 ` Christopher Covington
2015-08-27 15:12 ` Mathieu Poirier
2015-08-27 15:33 ` Christopher Covington
2015-08-27 15:54 ` Mathieu Poirier
2015-07-07 8:41 ` Chunyan Zhang [this message]
2015-07-07 8:41 ` [PATCH 4/5] coresight-etm3x: Support context-ID tracing when PID namespace is enabled Chunyan Zhang
2015-07-07 8:41 ` [PATCH 5/5] coresight-etm4x: " Chunyan Zhang
2015-07-13 17:26 ` [PATCH 0/5] coresight: " Mathieu Poirier
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=1436258518-9339-4-git-send-email-zhang.chunyan@linaro.org \
--to=zhang.chunyan@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/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).