From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD8DB4429 for ; Tue, 3 Oct 2023 05:54:52 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23200B3 for ; Mon, 2 Oct 2023 22:54:51 -0700 (PDT) Received: from pps.filterd (m0353727.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3935HMmL002279; Tue, 3 Oct 2023 05:54:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : mime-version; s=pp1; bh=YQ2dCorvtE8OwNqM9YgvMQKX7g5+Cro4o1kBzezqzLA=; b=Eoh+HjoCGW6EJCkgV1Gb7yHCr2meFm0PsMDlV0qegeitXxYbpZADtjhhDJvcLZZ4urSv Ib4V9iAml1wqUWze+41httKHzMnZOqpJRVUgRGKHbVyAW5I9je3XCuVGWO2arE8JVxmD 7emUJ1zvroDezc3ZyikiDLIny+aQXfVvLOg039TeF9PYkeW+Z20MoXB4YQtW9YCoy5Ke wSi6r7BOHEuoxGves8ZNOJo/cY/sl2ljvwYB4AZrTgwCxB2lMxYl7FUTOfnbFKuUuMzf Yq8VIpZEwBDZUwx3RILLXEELhdpwMwB2ypG1HudVLTGMGTDjAvYyL29fYi7tN22WDKV0 yw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3tgcp0h3f9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 03 Oct 2023 05:54:48 +0000 Received: from m0353727.ppops.net (m0353727.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3935K346007120; Tue, 3 Oct 2023 05:54:48 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3tgcp0h3ex-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 03 Oct 2023 05:54:48 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3935NuhY007467; Tue, 3 Oct 2023 05:54:46 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3teygk726r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 03 Oct 2023 05:54:46 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3935shfg44433952 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 3 Oct 2023 05:54:43 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 955CF20040; Tue, 3 Oct 2023 05:54:43 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C4B4F2004B; Tue, 3 Oct 2023 05:54:41 +0000 (GMT) Received: from li-3c92a0cc-27cf-11b2-a85c-b804d9ca68fa.in.ibm.com (unknown [9.109.199.72]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 3 Oct 2023 05:54:41 +0000 (GMT) From: Aditya Gupta To: acme@kernel.org, jolsa@kernel.org, irogers@google.com, namhyung@kernel.org Cc: linux-perf-users@vger.kernel.org, maddy@linux.ibm.com, atrajeev@linux.vnet.ibm.com, kjain@linux.ibm.com, disgoel@linux.vnet.ibm.com Subject: [PATCH v5 0/4] Introduce perf check subcommand Date: Tue, 3 Oct 2023 11:24:36 +0530 Message-ID: <20231003055440.111907-1-adityag@linux.ibm.com> X-Mailer: git-send-email 2.41.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: _YJwE029Sn6Rfc1Z80wSssWebHkKtWhN X-Proofpoint-ORIG-GUID: dDoX3P-4QP1mabGcpiSWEX4WbvxLelGM Content-Transfer-Encoding: 8bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten Precedence: bulk X-Mailing-List: linux-perf-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-03_03,2023-10-02_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 malwarescore=0 priorityscore=1501 impostorscore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310030044 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net The Problem =========== Currently the presence of a feature is checked with a combination of perf version --build-options and greps, such as: perf version --build-options | grep " on .* HAVE_FEATURE" Proposed solution ================= As suggested by contributors in: https://lore.kernel.org/linux-perf-users/ZMPWk5K63tadmDlU@kernel.org/ Introduce a subcommand "perf check --feature", with which scripts can test for presence of a feature, such as: perf check --feature HAVE_LIBTRACEEVENT or perf check --feature libtraceevent The usage of "perf version --build-options | grep" has been replaced in two tests, with "perf check --feature" command Also, to not duplicate the same feature list at multiple places, a new global 'supported_features' array has been introduced in builtin.h, so both commands 'perf check --feature' and 'perf version --build-options' use the same array 'supported_features' feature is an array of 'struct feature_support', which also has the name of the feature, macro used to test it's presence, and a is_builtin member, which will be 0 if feature not built-in, and 1 if built-in Architectures Tested ==================== * x86_64 * ppc64le Git tree ======== Git tree with this patch series applied for testing: https://github.com/adi-g15-ibm/linux/tree/perf-check-feature-v5 Changelog ========= V5 + invert return value of 'has_support', but return value of perf check --feature according to shell convention V4 + invert return value of perf check --feature V3 + simplified has_support code in builtin-check.c (patch #1) + modified patch #3 and patch #4 according to change in return value in patch #1 V2 + improved the patch series with suggestions from Namhyung + fix incorrect return value, added -q option, and moved array definition to perf-check.c V1 + changed subcommand name to 'perf check --feature' + added documentation for perf check + support both macro (eg. HAVE_LIBTRACEEVENT), and name (eg. libtraceevent) as input to 'perf check --feature' + change subject and descriptions of all patch mentioning perf check instead of perf build V0: Previous patch series: https://lore.kernel.org/linux-perf-users/20230825061125.24312-1-adityag@linux.ibm.com/ Aditya Gupta (3): perf check: introduce check subcommand perf version: update --build-options to use 'supported_features' array perf tests task_analyzer: use perf check for libtraceevent support Athira Rajeev (1): tools/perf/tests: Update probe_vfs_getname.sh script to use perf check --feature tools/perf/Build | 1 + tools/perf/Documentation/perf-check.txt | 59 +++++++++ tools/perf/builtin-check.c | 122 ++++++++++++++++++ tools/perf/builtin-version.c | 39 ++---- tools/perf/builtin.h | 18 +++ tools/perf/perf.c | 1 + .../perf/tests/shell/lib/probe_vfs_getname.sh | 4 +- .../shell/record+probe_libc_inet_pton.sh | 5 +- .../shell/record+script_probe_vfs_getname.sh | 5 +- tools/perf/tests/shell/test_task_analyzer.sh | 4 +- 10 files changed, 221 insertions(+), 37 deletions(-) create mode 100644 tools/perf/Documentation/perf-check.txt create mode 100644 tools/perf/builtin-check.c -- 2.41.0