From patchwork Thu Nov 10 18:19:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 18275 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp302736wru; Thu, 10 Nov 2022 10:23:19 -0800 (PST) X-Google-Smtp-Source: AMsMyM6HlHMIOTjZHRBq+7imsvQXZxBVt/DElg82J3Et4MGCjsTRv5ixs+de6iy7oTdpohzYAzWN X-Received: by 2002:a17:90b:4c87:b0:213:5fe0:6700 with SMTP id my7-20020a17090b4c8700b002135fe06700mr81563654pjb.128.1668104599136; Thu, 10 Nov 2022 10:23:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668104599; cv=none; d=google.com; s=arc-20160816; b=Nk5wTw2nXdkox06yTA8YeSTn4psnI8zIVC4CdSudXuA41XIsUYovw66pXU/BERyg4U kdQFQPTiLLt77SlsQbFOR7QdT9M353siX5KPKDJtsYzY4FlVtdjr9WNCAj1c3tXcyWiq LbIFW6FI4dOSXFjAMiMC5zqxIL3L/fPe51vjeRrueJPw9MTlyg36TBDFeXg4T7H6JNNC M3SHlZvFJnUlRYUoeFU9wHY1poMS0cmDlAle1TcSBUTLLm5bVjf+CmlI+5LsiZPknYrv //Dt20X7mlQ1KUKCPCOA1dGsB5FOH0KAro3Cky843QUrO/bM/yeey2P4CWTp1dmSP7x8 GYFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=kHtWNAtYktOIgs6nS4lgKw2kHSGAY/bbpUgRU4xzJN4=; b=0P1VFRJBZqAg20gDWcqOrCBqvJGiGEO3WjlKY0zEKzhudGCYHjhKERu4V75kb1ANHX gAfRyvSS4HoY86dpkzt2UeADPfxXG+RaajNiD9uil7LuVEe0bpRnF67GUBPk+jat6oSV q7TeaCXyMTaJsfz/TeRn6MaZFRz2rlZcsTB/B9z0xnPYA8dBRNgijskrCG63vpvfoabm cn/8LaiVO4+PXytosWKyfkoNyB3stqRWu4bE+CzyrIRCl9iLuKq3MVAlB7Ks1E8nhvfB tYy9TNL2WacAxGtxSDOitNu3l1z0MnAS63qTFgPMx/2IiaoIBDx9Pvr99M0XH+TZEhOI QJmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Gevv+KwM; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q2-20020a170902dac200b0017145b821d2si23940434plx.477.2022.11.10.10.23.05; Thu, 10 Nov 2022 10:23:19 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Gevv+KwM; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230296AbiKJSTo (ORCPT + 99 others); Thu, 10 Nov 2022 13:19:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231586AbiKJSTa (ORCPT ); Thu, 10 Nov 2022 13:19:30 -0500 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DFD03FB9E; Thu, 10 Nov 2022 10:19:30 -0800 (PST) Received: by mail-pl1-x630.google.com with SMTP id k7so2134173pll.6; Thu, 10 Nov 2022 10:19:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=kHtWNAtYktOIgs6nS4lgKw2kHSGAY/bbpUgRU4xzJN4=; b=Gevv+KwMkjgHS2suEvRfwl6RP6NVEJKhevUXMwlZFMjF36LmwEb9/uz/XbrZgFTnEF Tz66g6Hk499lJj5AnGz7kf+ThUsM/vJuF8K6Vt7d5dWKlVb+dRs+dxlpgqyVciJFoEsY XHOonL/LjQOJDxQP4TikKootOuwsLnkWQUMvbfdnsUSCn+vuOdXt8P0He7QzqsMpWqAx UV8kpmMVgXtBe1VRjkuxW7CUDWk6BM+RhrOkOvVmKA6Kmz+04zZsPkePUr/xJqf/yRwO UEiVBp51lN+8BIHTknuiiB+rqfaO9UaF9qc8Ah7QMpf139uAKZ8fOL7OfPnZi0OJTIAZ +jXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=kHtWNAtYktOIgs6nS4lgKw2kHSGAY/bbpUgRU4xzJN4=; b=4iECDwwJjWXoDNudzRwjl6OMBkuNeww4TC9tofHmJDmvlvi7h6NVt2AJGFq8AmozHx /9sT48pnOkWwxUq9oQL4XomFlg56uYaB3vd2Arc8FO2aXrQvkUl/2MP3BDoagJoaZC4S uZIUJPKsBuZJzUODU7WRniHdcjgXjFH2/DHZEi8t0uNpdt0EqRlceUk6GlBDZJMQ61zs gDdTBr2uW8ihIpbXps4BWlU/3Rx/WYCegmZHFUmASCTjOF/CAQTjMkPkuSBxSDYDol8G cOrnw+3Rjs9azoHVX3RlJR8b8q+sBibZ4XxFYFAR5mEHbo/N015l3c9tuxDdohnaTLXX kcPw== X-Gm-Message-State: ACrzQf0TCZ1zWgTWXg7Biyk0gd88mG1+1wUrFRUisy1+VTAutFt48Z+5 GmlfRxhWw2Wyl9gxzQNlZvo= X-Received: by 2002:a17:90b:1095:b0:213:ee6a:f268 with SMTP id gj21-20020a17090b109500b00213ee6af268mr54565898pjb.213.1668104369654; Thu, 10 Nov 2022 10:19:29 -0800 (PST) Received: from youngsil.svl.corp.google.com ([2620:15c:2d4:203:12cb:b694:b3d8:467c]) by smtp.gmail.com with ESMTPSA id e9-20020a170902784900b00183e2a96414sm11518744pln.121.2022.11.10.10.19.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 10:19:29 -0800 (PST) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org, Leo Yan , German Gomez , Zhengjun Xing , James Clark , Athira Jajeev Subject: [PATCH 05/12] perf test: Add 'leafloop' test workload Date: Thu, 10 Nov 2022 10:19:13 -0800 Message-Id: <20221110181920.84900-6-namhyung@kernel.org> X-Mailer: git-send-email 2.38.1.493.g58b659f92b-goog In-Reply-To: <20221110181920.84900-1-namhyung@kernel.org> References: <20221110181920.84900-1-namhyung@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS autolearn=no 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749134448261666535?= X-GMAIL-MSGID: =?utf-8?q?1749134448261666535?= The leafloop workload is to run an infinite loop in the test_leaf function. This is needed for the ARM fp callgraph test to verify if it gets the correct callchains. $ perf test -w leafloop Signed-off-by: Namhyung Kim --- tools/perf/tests/builtin-test.c | 1 + tools/perf/tests/tests.h | 1 + tools/perf/tests/workloads/Build | 3 +++ tools/perf/tests/workloads/leafloop.c | 34 +++++++++++++++++++++++++++ 4 files changed, 39 insertions(+) create mode 100644 tools/perf/tests/workloads/leafloop.c diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c index 161f38476e77..0ed5ac452f6e 100644 --- a/tools/perf/tests/builtin-test.c +++ b/tools/perf/tests/builtin-test.c @@ -121,6 +121,7 @@ static struct test_suite **tests[] = { static struct test_workload *workloads[] = { &workload__noploop, &workload__thloop, + &workload__leafloop, }; static int num_subtests(const struct test_suite *t) diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h index e6edfeeadaeb..86804dd6452b 100644 --- a/tools/perf/tests/tests.h +++ b/tools/perf/tests/tests.h @@ -202,5 +202,6 @@ struct test_workload workload__##work = { \ /* The list of test workloads */ DECLARE_WORKLOAD(noploop); DECLARE_WORKLOAD(thloop); +DECLARE_WORKLOAD(leafloop); #endif /* TESTS_H */ diff --git a/tools/perf/tests/workloads/Build b/tools/perf/tests/workloads/Build index b8964b1099c0..631596bdb2b3 100644 --- a/tools/perf/tests/workloads/Build +++ b/tools/perf/tests/workloads/Build @@ -2,3 +2,6 @@ perf-y += noploop.o perf-y += thloop.o +perf-y += leafloop.o + +CFLAGS_leafloop.o = -g -O0 -fno-inline -fno-omit-frame-pointer diff --git a/tools/perf/tests/workloads/leafloop.c b/tools/perf/tests/workloads/leafloop.c new file mode 100644 index 000000000000..1bf5cc97649b --- /dev/null +++ b/tools/perf/tests/workloads/leafloop.c @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#include +#include +#include "../tests.h" + +/* We want to check these symbols in perf script */ +noinline void leaf(volatile int b); +noinline void parent(volatile int b); + +static volatile int a; + +noinline void leaf(volatile int b) +{ + for (;;) + a += b; +} + +noinline void parent(volatile int b) +{ + leaf(b); +} + +static int leafloop(int argc, const char **argv) +{ + int c = 1; + + if (argc > 0) + c = atoi(argv[0]); + + parent(c); + return 0; +} + +DEFINE_WORKLOAD(leafloop);