Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756726AbbGGIoW (ORCPT ); Tue, 7 Jul 2015 04:44:22 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:36622 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753796AbbGGIn3 (ORCPT ); Tue, 7 Jul 2015 04:43:29 -0400 From: Chunyan Zhang 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 Message-Id: <1436258518-9339-4-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1436258518-9339-1-git-send-email-zhang.chunyan@linaro.org> References: <1436258518-9339-1-git-send-email-zhang.chunyan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1459 Lines: 49 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 --- 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 -- 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/