Skip to content

Commit

Permalink
Coresight: Add an interface for supporting ETM3/4 Context ID tracing
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Chunyan Zhang authored and Greg Kroah-Hartman committed Aug 5, 2015
1 parent cd196ac commit 7221022
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions include/linux/coresight.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7221022

Please sign in to comment.