Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp686633imw; Fri, 8 Jul 2022 09:52:36 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u9Es/vQeIHvcyy5QLkNsKV1D1kD0/UtTRdYyF6x0T14uAuhUGfpUaL7mJRqkhRY2oXDKuJ X-Received: by 2002:a05:6402:43c4:b0:43a:6309:6c9b with SMTP id p4-20020a05640243c400b0043a63096c9bmr5986655edc.91.1657299156811; Fri, 08 Jul 2022 09:52:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657299156; cv=none; d=google.com; s=arc-20160816; b=SB7Fa05HV+EzZ0l0XfmpVJIZNQUEhNLdXRMMhC7gJ2VHGwU3WolOx7xURdMd+vCLVe Hp5WMFFfdQ4wVxMRpxYEQEmxgM14EHW7vrS2fz11QD7D5j5kYiCbMuSGwRp7Ir07X8+O L4LRF3ynxp1wwhPB5gfalM1A15cCGnLnwJqdN0dj0xyje5cimuJom0FD0X4Y3DWXZLJI iGA/NY5f3uD3ucfQVIIshkqDTtog3nB33cZ9ua58EUnvmPqvyjXUUoP5zyBCAceI5Lb9 NJQDwZWC/eMhZKuxLzzc76aVV5zeLK0cw3zowGZV7qG2CKAmcIsY/NpmvMZ/By+ss3IS FjUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id; bh=J/SD4pLZPqXyK7Vlao+WSMiCWYSgcEp7SCYkA/Xm+ZA=; b=VHUtivGGtIYcPu3HTkRiz7/5wO6VDAn5MWa2q05ldLzn6G3ECstXKe84XRSKbwRw1Y 2Us4coM0vc+IgNXApKnw0Ij64MTf8v08jVUxfpnuvQSkJF4Es9sk2DkggL/4OPEocXbC UgYw2puDAt0OxcK970eJ99k6fPcMtvS80pubO2p1h7fnNXXgRJ9VaULoQJ7IvcIGMavi /b7A6veuvq2jc58cDESDknoz67MWVEBVo7Y+Sw+TwB5QBb52/k6nLeJzeI/+vXcaXYbT SthgB+uxyn6h/S4eeHr5/dERlvdimUnYGL5Jf+duN4rr6PnjGdXvnaJM9FJWCynOjLfi nVmw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb15-20020a1709071c8f00b0072651e16626si27000592ejc.225.2022.07.08.09.52.06; Fri, 08 Jul 2022 09:52:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S238049AbiGHQp0 (ORCPT + 99 others); Fri, 8 Jul 2022 12:45:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237590AbiGHQpY (ORCPT ); Fri, 8 Jul 2022 12:45:24 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B2B88E005; Fri, 8 Jul 2022 09:45:23 -0700 (PDT) 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 D78831063; Fri, 8 Jul 2022 09:45:23 -0700 (PDT) Received: from [192.168.99.12] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7632B3F66F; Fri, 8 Jul 2022 09:45:22 -0700 (PDT) Message-ID: <34db7cf2-32cc-5d9b-d98d-a29928ea898b@foss.arm.com> Date: Fri, 8 Jul 2022 17:45:07 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH 10/14] perf test: Add thread loop test shell scripts Content-Language: en-US To: Mike Leach Cc: James Clark , linux-kernel@vger.kernel.org, coresight@lists.linaro.org, mathieu.poirier@linaro.org, linux-perf-users@vger.kernel.org, acme@kernel.org, Suzuki K Poulose References: <20220701120804.3226396-1-carsten.haitzler@foss.arm.com> <20220701120804.3226396-11-carsten.haitzler@foss.arm.com> From: Carsten Haitzler Organization: Arm Ltd. In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/8/22 11:27, Mike Leach wrote: > Hi, > > On Fri, 8 Jul 2022 at 10:22, Carsten Haitzler > wrote: >> >> >> >> On 7/5/22 14:53, James Clark wrote: >>> >>> >>> On 01/07/2022 13:07, carsten.haitzler@foss.arm.com wrote: >>>> From: "Carsten Haitzler (Rasterman)" >>>> >>>> Add a script to drive the thread loop test that gathers data so >>>> it passes a minimum bar (in this case do we get any perf context data >>>> for every thread). >>>> >>>> Signed-off-by: Carsten Haitzler >>> >>> Hi Carsten, >>> >>> I checked this on N1SDP and I get failures in both threads tests. This is >>> because it's looking for "CID=..." when in my output threads are shown as >>> "VMID=...": >>> >>> Idx:628048; ID:10; I_ADDR_CTXT_L_64IS0 : Address & Context, Long, 64 bit, IS0.; Addr=0x0000AAAAE3BF0B18; Ctxt: AArch64,EL0, NS; VMID=0xa588c; >>> >>> I think with a change to the grep it should work. >> >> Errrr... I get no VMID= ... it's all >> >> Idx:563008; ID:12; I_ADDR_CTXT_L_64IS0 : Address & Context, Long, 64 >> bit, IS0.; Addr=0x0000AAAAE4B00A60; Ctxt: AArch64,EL0, NS; CID=0x00004aff; >> >> are you using containers or something? because: >> >> if(context.updated_c) >> { >> oss << "CID=0x" << std::hex << std::setfill('0') << >> std::setw(8) << context.ctxtID << "; "; >> } >> if(context.updated_v) >> { >> oss << "VMID=0x" << std::hex << std::setfill('0') << >> std::setw(4) << context.VMID << "; "; >> } >> >> I'm running without any containers etc. - bare metal. Haven't bothered >> with any VM stuff. >> >> In OpenOCD the CID should be the the pid/thread id. It seems to not be >> the same thing as VMID. I haven't traced this beyond here as to exactly >> what this represents though my first reaction is "This is extra VM info >> and not the PID/TID being looked for". OpenOCD is full of tests with log >> dumps that produce CID and VMID: >> >> Idx:1676; ID:10; I_ADDR_CTXT_L_64IS0 : Address & Context, Long, >> 64 bit, IS0.; Addr=0xFFFFFFC000096A00; Ctxt: AArch64,EL1, NS; >> CID=0x00000000; VMID=0x0000; >> >> A quick git grep CID= in OpenCD will show them all. My understanding is >> CID is the thread/process ID and thus the test/check "Do we get reported >> data from all threads? - anything?". >> >> I don't think using VMID is right. The fact you are missing a CID is an >> issue though... >> > > The register used for linux TID trace is dependent on the EL of the kernel. > EL1 => CONTEXT_IDR_EL1 > EL2 => CONTEXT_IDR_EL2. > > By design, the trace hardware traces CONTEXT_IDR_EL2 as the VMID packet. > > So, depending on your kernel build, TID can validly be traced as CID or VMID Ahhh I haven't encountered that. So basically look for CID=xxx OR VMID=xxx if no CID=xxx is there. > Regards > > Mike > >>> Thanks >>> James >>> >>>> --- >>>> .../coresight/thread_loop_check_tid_10.sh | 19 +++++++++++++++++++ >>>> .../coresight/thread_loop_check_tid_2.sh | 19 +++++++++++++++++++ >>>> 2 files changed, 38 insertions(+) >>>> create mode 100755 tools/perf/tests/shell/coresight/thread_loop_check_tid_10.sh >>>> create mode 100755 tools/perf/tests/shell/coresight/thread_loop_check_tid_2.sh >>>> >>>> diff --git a/tools/perf/tests/shell/coresight/thread_loop_check_tid_10.sh b/tools/perf/tests/shell/coresight/thread_loop_check_tid_10.sh >>>> new file mode 100755 >>>> index 000000000000..7c13636fc778 >>>> --- /dev/null >>>> +++ b/tools/perf/tests/shell/coresight/thread_loop_check_tid_10.sh >>>> @@ -0,0 +1,19 @@ >>>> +#!/bin/sh -e >>>> +# CoreSight / Thread Loop 10 Threads - Check TID >>>> + >>>> +# SPDX-License-Identifier: GPL-2.0 >>>> +# Carsten Haitzler , 2021 >>>> + >>>> +TEST="thread_loop" >>>> +. $(dirname $0)/../lib/coresight.sh >>>> +ARGS="10 1" >>>> +DATV="check-tid-10th" >>>> +DATA="$DATD/perf-$TEST-$DATV.data" >>>> +STDO="$DATD/perf-$TEST-$DATV.stdout" >>>> + >>>> +SHOW_TID=1 perf record -s $PERFRECOPT -o "$DATA" "$BIN" $ARGS > $STDO >>>> + >>>> +perf_dump_aux_tid_verify "$DATA" "$STDO" >>>> + >>>> +err=$? >>>> +exit $err >>>> diff --git a/tools/perf/tests/shell/coresight/thread_loop_check_tid_2.sh b/tools/perf/tests/shell/coresight/thread_loop_check_tid_2.sh >>>> new file mode 100755 >>>> index 000000000000..a067145af43c >>>> --- /dev/null >>>> +++ b/tools/perf/tests/shell/coresight/thread_loop_check_tid_2.sh >>>> @@ -0,0 +1,19 @@ >>>> +#!/bin/sh -e >>>> +# CoreSight / Thread Loop 2 Threads - Check TID >>>> + >>>> +# SPDX-License-Identifier: GPL-2.0 >>>> +# Carsten Haitzler , 2021 >>>> + >>>> +TEST="thread_loop" >>>> +. $(dirname $0)/../lib/coresight.sh >>>> +ARGS="2 20" >>>> +DATV="check-tid-2th" >>>> +DATA="$DATD/perf-$TEST-$DATV.data" >>>> +STDO="$DATD/perf-$TEST-$DATV.stdout" >>>> + >>>> +SHOW_TID=1 perf record -s $PERFRECOPT -o "$DATA" "$BIN" $ARGS > $STDO >>>> + >>>> +perf_dump_aux_tid_verify "$DATA" "$STDO" >>>> + >>>> +err=$? >>>> +exit $err > > >