All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chunyan Zhang <zhang.chunyan@linaro.org>
To: mathieu.poirier@linaro.org, gregkh@linuxfoundation.org
Cc: broonie@kernel.org, serge.broslavsky@linaro.org,
	zhang.lyra@gmail.com, linux-arm-kernel@lists.infradead.org,
	linux-api@vger.kernel.org, linux-kernel@vger.kernel.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


WARNING: multiple messages have this Message-ID (diff)
From: Chunyan Zhang <zhang.chunyan-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: mathieu.poirier-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org
Cc: broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	serge.broslavsky-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	zhang.lyra-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.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-QSEj5FYQhm4dnm+yROfE0A@public.gmane.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-QSEj5FYQhm4dnm+yROfE0A@public.gmane.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

WARNING: multiple messages have this Message-ID (diff)
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

  parent reply	other threads:[~2015-07-07  8:44 UTC|newest]

Thread overview: 33+ 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 ` Chunyan Zhang
2015-07-07  8:41 ` 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   ` Chunyan Zhang
2015-07-07  8:41   ` Chunyan Zhang
2015-07-07  8:41 ` [PATCH 2/5] coresight-etm4x: " Chunyan Zhang
2015-07-07  8:41   ` Chunyan Zhang
2015-07-07  8:41   ` Chunyan Zhang
2015-08-26 17:57   ` Christopher Covington
2015-08-26 17:57     ` Christopher Covington
2015-08-26 17:57     ` Christopher Covington
2015-08-27 15:12     ` Mathieu Poirier
2015-08-27 15:12       ` Mathieu Poirier
2015-08-27 15:12       ` Mathieu Poirier
2015-08-27 15:33       ` Christopher Covington
2015-08-27 15:33         ` Christopher Covington
2015-08-27 15:33         ` Christopher Covington
2015-08-27 15:54         ` Mathieu Poirier
2015-08-27 15:54           ` Mathieu Poirier
2015-08-27 15:54           ` Mathieu Poirier
2015-07-07  8:41 ` Chunyan Zhang [this message]
2015-07-07  8:41   ` [PATCH 3/5] Coresight: Add an interface for supporting ETM3/4 Context ID tracing Chunyan Zhang
2015-07-07  8:41   ` Chunyan Zhang
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   ` Chunyan Zhang
2015-07-07  8:41   ` Chunyan Zhang
2015-07-07  8:41 ` [PATCH 5/5] coresight-etm4x: " Chunyan Zhang
2015-07-07  8:41   ` Chunyan Zhang
2015-07-07  8:41   ` Chunyan Zhang
2015-07-13 17:26 ` [PATCH 0/5] coresight: " Mathieu Poirier
2015-07-13 17:26   ` Mathieu Poirier
2015-07-13 17:26   ` 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=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=serge.broslavsky@linaro.org \
    --cc=zhang.lyra@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.