From patchwork Tue Jul 7 08:41:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 50810 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 27B9D22A03 for ; Tue, 7 Jul 2015 08:44:30 +0000 (UTC) Received: by wipp2 with SMTP id p2sf39906826wip.2 for ; Tue, 07 Jul 2015 01:44:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=jBikr1EsbErBPpwY3wBs16IXAhvSvMLmmgXq6irw8wQ=; b=DrWfQwRKEZT4VmXIlr49Jji+n0/DSExdsOiHmgTFqOjGVDrVpQD6ixX7x6jeqUgnlB qWv/5YkBeJ5DQRnFJ3KhyWzLVKxdpDlX8Rp/MaqljUW/m2NH3rgap7Twy66zDjgeEqV9 uAKU+SFf703U/RdPw4YEq9eEpqL9JUCtn2X2q+o7uVz9uVNLz1xjh3ZZEc0astHtTY0K 19deXrw3aVe9/XDO5t8RNU4AM6njI4Do/pO97lOih9wKbkzJ1zs41pOHfUjbylpr/3aU LQM8Fs9TEknBlCUzTMVgUCYYHEJ6/1X1h4gJs3iL8/zZlMEhj0iqHbu51dKPfMgyStmK rMVA== X-Gm-Message-State: ALoCoQlh38x3zW/e3pKR6mFvI9zL/yJupSPC9k0M3fP5KLnhP9x6l706/VEXKmtD7TmgxZ1q+HAm X-Received: by 10.112.181.37 with SMTP id dt5mr1573150lbc.10.1436258669462; Tue, 07 Jul 2015 01:44:29 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.206 with SMTP id q14ls661975lal.58.gmail; Tue, 07 Jul 2015 01:44:29 -0700 (PDT) X-Received: by 10.112.47.73 with SMTP id b9mr2971449lbn.46.1436258669142; Tue, 07 Jul 2015 01:44:29 -0700 (PDT) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id as10si11855163lbc.69.2015.07.07.01.44.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Jul 2015 01:44:28 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by lagc2 with SMTP id c2so184867796lag.3 for ; Tue, 07 Jul 2015 01:44:28 -0700 (PDT) X-Received: by 10.153.5.38 with SMTP id cj6mr2972819lad.36.1436258668821; Tue, 07 Jul 2015 01:44:28 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp2235116lbb; Tue, 7 Jul 2015 01:44:27 -0700 (PDT) X-Received: by 10.70.20.196 with SMTP id p4mr6729272pde.58.1436258666777; Tue, 07 Jul 2015 01:44:26 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id by2si33417604pbb.217.2015.07.07.01.44.25; Tue, 07 Jul 2015 01:44:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756727AbbGGIoW (ORCPT + 29 others); 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 Received: by pacgz10 with SMTP id gz10so36149834pac.3 for ; Tue, 07 Jul 2015 01:43:28 -0700 (PDT) X-Received: by 10.68.252.106 with SMTP id zr10mr6632035pbc.79.1436258608772; Tue, 07 Jul 2015 01:43:28 -0700 (PDT) Received: from zcy-ubuntu.spreadtrum.com ([175.111.195.49]) by mx.google.com with ESMTPSA id k3sm21037825pde.18.2015.07.07.01.43.23 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 07 Jul 2015 01:43:27 -0700 (PDT) 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 Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: zhang.chunyan@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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