Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2303752pxp; Mon, 21 Mar 2022 16:23:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxH+QKWLZFGiYE1XQjCv7ZIh2fSB+nTfQdf6pf86MdkcCxS18cbpeXbcUINxqSI7RCOzJRX X-Received: by 2002:a63:d14:0:b0:381:af18:8259 with SMTP id c20-20020a630d14000000b00381af188259mr19530980pgl.309.1647904986869; Mon, 21 Mar 2022 16:23:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647904986; cv=none; d=google.com; s=arc-20160816; b=ZxOvDzAS+NsQ4BCz7oPXgABE137QyYdtbFGIlrFZDX6waB91vlybC5uG3V4EW53dCu kcjI4LnRTk+XYwrI/+Id9BOSN1y2s+Ick4I2QwrghcG4pdZvkULUrUob6mxMf91tm7cw 0avcDDTIPXgREeyfNTjJUylcpOXuKj+6vsG6Bw6hl1Dc/A7XOrFFbf0+3xLcNgbQQm2J e0D5dH+nq0bB+PmVeFvB5ysppGaSSnMVZtAIMi0jP2mn3BX0vWm1vu+221G5hwgVgPpV jZBJtGJVjrUG5am5G0hOmlWrJCtMlg9ZsxzEFePj+cE8qQDJqA8sw628K11eBhQyX/iZ s8EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=vh2JDlPM/n0gyCgxWSAO7bt/dlxFqWGiNZmJRnTiPEE=; b=RSdJ+AeJt2ZeeATd9gtfkwuzSo40G4Ig9tgAt21fumWefJs7a9M/nCNY9fdkj8jVg9 ffjc3z/+P4DquPyIy4OlNiAvsjuN5TNWkwXF/YBYx9pGdK/Nd73wKxsjschrWLnaEqVM U+zALc3JJmTVFrA84dwbWofVby/DMzW5DX1x6T6rOcEqaC5Sx4R5tTh2GkDLhJAhIRTM 4lpKqZyg2hGrGTPKLmAGl8gjvoqcWU054BYOWVFFL8ikS4ttTf4LAXFTX59OXkbwjE8H Hg3OU7ePTW9ngAPeOgvQl95nvmmxE+aniR35MkX+CnXOX3ebW/0VEC1tjhey3A9AKP3l GNEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="s/GLssab"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id p15-20020a056a000b4f00b004fa3a8e0085si10287112pfo.316.2022.03.21.16.23.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 16:23:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="s/GLssab"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id ECED742B554; Mon, 21 Mar 2022 15:23:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235523AbiCUUyY (ORCPT + 99 others); Mon, 21 Mar 2022 16:54:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229475AbiCUUyW (ORCPT ); Mon, 21 Mar 2022 16:54:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36608D63; Mon, 21 Mar 2022 13:52:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ABD32B819E1; Mon, 21 Mar 2022 20:52:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30816C340E8; Mon, 21 Mar 2022 20:52:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647895973; bh=RMHwF+upYOMgTMbO+pQMLcTl41MLqg+oxmrwPn97eaM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=s/GLssabZsc03oSZsONB+Xl4TIThhWoSwwpkIiw8nUfZFIBSF86YKRBhZTYQxBVD8 0e7WtnD/IX6C2sNWSRPGGkBbEVT8AGxzR7W1Y420eLf4id1DgKv9+O2ppwEBtADXja fYc9zJZGRcSyNhvgWMkWf6TtfQDx9EdbqUg7kjuX3rzG9hA7WV3jQxewla6cMEqBx2 mULb1ET3Z4c2PrwAQkiFblv3hhwwxYaTyU5QooW+GzyaAZvYKMH4gtTlD5HGP5nqW2 oUl2fjzQwC8YVwbcd0+cUi6GQLqZBy0WdnejhzDTEEYcI5lLyPpsr0MSxkLeZcKF47 m3VVCa94IjeIw== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 9DDAD40407; Mon, 21 Mar 2022 17:52:50 -0300 (-03) Date: Mon, 21 Mar 2022 17:52:50 -0300 From: Arnaldo Carvalho de Melo To: German Gomez Cc: James Clark , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, mark.rutland@arm.com, namhyung@kernel.org, leo.yan@linaro.org, Alexandre.Truong@arm.com, Jiri Olsa Subject: Re: [PATCH v2 1/1] perf test arm64: Test unwinding using fame-pointer (fp) mode Message-ID: References: <20220316172015.98000-1-german.gomez@arm.com> <592a32d6-b618-951c-9db9-711d022ff85e@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Em Wed, Mar 16, 2022 at 05:48:50PM +0000, German Gomez escreveu: > > On 16/03/2022 17:30, James Clark wrote: > > > > On 16/03/2022 17:20, German Gomez wrote: > >> Add a shell script to check that the call-graphs generated using frame > >> pointers (--call-graph fp) are complete and not missing leaf functions: > >> > >> | $ perf test 88 -v > >> | 88: Check Arm64 callgraphs are complete in fp mode : > >> | --- start --- > >> | test child forked, pid 8734 > >> | + Compiling test program (/tmp/test_program.Cz3yL)... > >> | + Recording (PID=8749)... > >> | + Stopping perf-record... > >> | test_program.Cz > >> | 728 leaf > >> | 753 parent > >> | 76c main > >> | test child finished with 0 > >> | ---- end ---- > >> | Check Arm SPE callgraphs are complete in fp mode: Ok > >> > > Ran it on N1SDP and it passes, and it fails if b9f6fbb3b2c2 isn't applied. > > I forgot to mention in the notes that it's supposed to work with both unwinders: > > $ make                # for libunwind (default) > $ make NO_LIBUNWIND=1 # for libdw I'll add it to the cset commit log, and also will fix this: ⬢[acme@toolbox perf]$ git am ./v2_20220316_german_gomez_perf_test_arm64_test_unwinding_using_fame_pointer_fp_mode.mbx Applying: perf test arm64: Test unwinding using fame-pointer (fp) mode .git/rebase-apply/patch:72: trailing whitespace. # program warning: 1 line adds whitespace errors. tools/perf/tests/shell/test_arm_callgraph_fp.sh:58: trailing whitespace. +# program ⬢[acme@toolbox perf]$ > > > > Reviewed-by: James Clark > > > >> Fixes: b9f6fbb3b2c2 ("perf arm64: Inject missing frames when using 'perf record --call-graph=fp'") > >> Suggested-by: Jiri Olsa > >> Signed-off-by: German Gomez > >> --- > >> Changes since v1: https://lore.kernel.org/all/a6ba0ea8-f070-9f79-f018-f638ff677c7c@arm.com/ > >> - Add explicit '-g' flag to GCC command > >> --- > >> .../perf/tests/shell/test_arm_callgraph_fp.sh | 68 +++++++++++++++++++ > >> 1 file changed, 68 insertions(+) > >> create mode 100755 tools/perf/tests/shell/test_arm_callgraph_fp.sh > >> > >> diff --git a/tools/perf/tests/shell/test_arm_callgraph_fp.sh b/tools/perf/tests/shell/test_arm_callgraph_fp.sh > >> new file mode 100755 > >> index 000000000..ea1b4e6bb > >> --- /dev/null > >> +++ b/tools/perf/tests/shell/test_arm_callgraph_fp.sh > >> @@ -0,0 +1,68 @@ > >> +#!/bin/sh > >> +# Check Arm64 callgraphs are complete in fp mode > >> +# SPDX-License-Identifier: GPL-2.0 > >> + > >> +lscpu | grep -q "aarch64" || exit 2 > >> + > >> +if ! [ -x "$(command -v cc)" ]; then > >> + echo "failed: no compiler, install gcc" > >> + exit 2 > >> +fi > >> + > >> +PERF_DATA=$(mktemp /tmp/__perf_test.perf.data.XXXXX) > >> +TEST_PROGRAM_SOURCE=$(mktemp /tmp/test_program.XXXXX.c) > >> +TEST_PROGRAM=$(mktemp /tmp/test_program.XXXXX) > >> + > >> +cleanup_files() > >> +{ > >> + rm -f $PERF_DATA > >> + rm -f $TEST_PROGRAM_SOURCE > >> + rm -f $TEST_PROGRAM > >> +} > >> + > >> +trap cleanup_files exit term int > >> + > >> +cat << EOF > $TEST_PROGRAM_SOURCE > >> +int a = 0; > >> +void leaf(void) { > >> + for (;;) > >> + a += a; > >> +} > >> +void parent(void) { > >> + leaf(); > >> +} > >> +int main(void) { > >> + parent(); > >> + return 0; > >> +} > >> +EOF > >> + > >> +echo " + Compiling test program ($TEST_PROGRAM)..." > >> + > >> +CFLAGS="-g -O0 -fno-inline -fno-omit-frame-pointer" > >> +cc $CFLAGS $TEST_PROGRAM_SOURCE -o $TEST_PROGRAM || exit 1 > >> + > >> +# Add a 1 second delay to skip samples that are not in the leaf() function > >> +perf record -o $PERF_DATA --call-graph fp -e cycles//u -D 1000 -- $TEST_PROGRAM 2> /dev/null & > >> +PID=$! > >> + > >> +echo " + Recording (PID=$PID)..." > >> +sleep 2 > >> +echo " + Stopping perf-record..." > >> + > >> +kill $PID > >> +wait $PID > >> + > >> +# expected perf-script output: > >> +# > >> +# program > >> +# 728 leaf > >> +# 753 parent > >> +# 76c main > >> +# ... > >> + > >> +perf script -i $PERF_DATA -F comm,ip,sym | head -n4 > >> +perf script -i $PERF_DATA -F comm,ip,sym | head -n4 | \ > >> + awk '{ if ($2 != "") sym[i++] = $2 } END { if (sym[0] != "leaf" || > >> + sym[1] != "parent" || > >> + sym[2] != "main") exit 1 }' -- - Arnaldo