Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp730859pxb; Tue, 2 Feb 2021 16:59:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJz5iw+CRqZfu9B2g+nNEKC1oGyURe/xeGDloFDcV5/J4ymYEvXIIGdbioC9VcLuyDTj4CyW X-Received: by 2002:a17:906:52c1:: with SMTP id w1mr674931ejn.214.1612313970627; Tue, 02 Feb 2021 16:59:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612313970; cv=none; d=google.com; s=arc-20160816; b=XBEpz1g5VKVfv85eZd68iSDjsDoDdDgkBJWwTA+CFF+ZB/ruZnxnNcmi7df4XxYVqo bcfo1VBIkAP72E5+sN9Iz789FxKVVfzFqbYrU3vZaxU33g6Q3sDv4JuQc5qBjWxDhdYE YNx0w+KPIez4uxx5yZNC6Td95pLtyvBBQlFIRzRDAVu43BUB4pvXH19sZH+gchgcDbQ9 ninCwXjcolGVB2b8ThVGhQj3s2IZh1o3OA0jKWAfqJ5z0weN7zlEYNewB+W5WcSfwcuE ITsF0GHF5eZjJ6gM0oXe7VIutX/hwt/1iMBbJTWtnG4MbV1E2kvdJDDzdZD+EB/7BSiQ uJ5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=spWv1/nruAs6zaYz42K1YwE4K/Sc/T9l+oPzcAZRIqc=; b=gu39J5tg+8a6FbxxBL1/k6RMlCu8yd0MZKapwFQoHRBbrBKf13kUhAS4LUNx3dGayY dwOivchh1LuL+2k62nTuu+hTtwbXAy5iJMaR2i284/D7JRvYXm2xKTYZWskEZBGbXTM8 KoDX+p2kEjqsVXJumNv2P/UpLrodfbMUJPgl8FjWkBW8iI/SLLuzIr7YYetLeeOf8hDv b9eu2YOSrzf2RS5YudktO9eAIBV8r2F7zm7Yh3aIDU9Eo58vWPzOcqITNwSlpKKVlo19 lFeUpwxotIvFpbFUNVldmBqbvlfSbjdilnBvK7jgvN5eTEXI68d/vuA0naIhcxzPUBJx ye5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n5si281990eju.567.2021.02.02.16.59.07; Tue, 02 Feb 2021 16:59:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236224AbhBBXHY (ORCPT + 99 others); Tue, 2 Feb 2021 18:07:24 -0500 Received: from foss.arm.com ([217.140.110.172]:59676 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234260AbhBBXHT (ORCPT ); Tue, 2 Feb 2021 18:07:19 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 31DD231B; Tue, 2 Feb 2021 15:06:33 -0800 (PST) Received: from [10.57.35.108] (unknown [10.57.35.108]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 793E63F694; Tue, 2 Feb 2021 15:06:29 -0800 (PST) Subject: Re: [PATCH v2 2/7] coresight: etm-perf: Support PID tracing for kernel at EL2 To: Leo Yan , Arnaldo Carvalho de Melo , Mathieu Poirier , Mike Leach , Jonathan Corbet , Alexander Shishkin , John Garry , Will Deacon , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Daniel Kiss , Denis Nikitin , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Al Grant References: <20210202163842.134734-1-leo.yan@linaro.org> <20210202163842.134734-3-leo.yan@linaro.org> From: Suzuki K Poulose Message-ID: <3c0a0641-a375-c7c3-d72d-e1d626e60ad6@arm.com> Date: Tue, 2 Feb 2021 23:06:16 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <20210202163842.134734-3-leo.yan@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/2/21 4:38 PM, Leo Yan wrote: > From: Suzuki K Poulose > > When the kernel is running at EL2, the PID is stored in CONTEXTIDR_EL2. > So, tracing CONTEXTIDR_EL1 doesn't give us the pid of the process. > Thus we should trace the VMID with VMIDOPT set to trace CONTEXTIDR_EL2 > instead of CONTEXTIDR_EL1. Given that we have an existing config > option "contextid" and this will be useful for tracing virtual machines > (when we get to support virtualization). > > So instead, this patch extends option CTXTID with an extra bit > ETM_OPT_CTXTID2 (bit 15), thus on an EL2 kernel, we will have another > bit available for the perf tool: ETM_OPT_CTXTID is for kernel running in > EL1, ETM_OPT_CTXTID2 is used when kernel runs in EL2 with VHE enabled. > > The tool must be backward compatible for users, i.e, "contextid" today > traces PID and that should remain the same; for this purpose, the perf > tool is updated to automatically set corresponding bit for the > "contextid" config, therefore, the user doesn't have to bother which EL > the kernel is running. > > i.e, perf record -e cs_etm/contextid/u -- > > will always do the "pid" tracing, independent of the kernel EL. > > The driver parses the format "contextid", which traces CONTEXTIDR_EL1 > for ETM_OPT_CTXTID (on EL1 kernel) and traces CONTEXTIDR_EL2 for > ETM_OPT_CTXTID2 (on EL2 kernel). > > Besides the enhancement for format "contexid", extra two formats are > introduced: "contextid1" and "contextid2". This considers to support > tracing both CONTEXTIDR_EL1 and CONTEXTIDR_EL2 when the kernel is > running at EL2. Finally, the PMU formats are defined as follow: > > "contextid1": Available on both EL1 kernel and EL2 kernel. When the > kernel is running at EL1, "contextid1" enables the PID > tracing; when the kernel is running at EL2, this enables > tracing the PID of guest applications. > > "contextid2": Only usable when the kernel is running at EL2. When > selected, enables PID tracing on EL2 kernel. > > "contextid": Will be an alias for the option that enables PID > tracing. I.e, > contextid == contextid1, on EL1 kernel. > contextid == contextid2, on EL2 kernel. > > Cc: Mathieu Poirier > Cc: Al Grant > Cc: Mike Leach > Cc: Leo Yan > Signed-off-by: Suzuki K Poulose You may add the following line here : [ Added two config formats: contextid1, contextid2 ] > Signed-off-by: Leo Yan The patch as such looks good to me. Suzuki