From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="IBWh+Ga2" Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8093A1A1 for ; Mon, 4 Dec 2023 01:40:11 -0800 (PST) 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 3B49MaBn025648; Mon, 4 Dec 2023 09:40:09 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=agzCCl5B1arkwdoCgtJLCiFTJNEGyadtNBtY70FaHjk=; b=IBWh+Ga2/eGE6urfuUTcA5J1YCmWeVwWaIMSTz6FJegAeQI/KBSBEyxYaaEejFq9fd6O P0QyteC2UKT8HPcsF9BgdgscKj9alU7jtyY/EIkFthTN4R3Kg1ixnHfxkvIABLKU7fM+ KiJu7nOIUPOFS+Hja5zlrhHq/i4dsd6xyEw+r4JrTwyA+sGuzSFFm/cZhOu65LzpNNAl XQHx+k5eCblpiZNFbZaQmumQA5eDJKmNRqvdW4FMn+BEBzdkH3/eEp/s7d63ZgbN2iyQ ShyPTVFs68SG0q1XUXgmmE6PlGR5jnOu/reCBkYnYNUc5sb65aYZASPa05qvOnRX1QSy oA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3usc2urkgn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 04 Dec 2023 09:40:08 +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 3B49OKU6030096; Mon, 4 Dec 2023 09:40:08 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3usc2urkfy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 04 Dec 2023 09:40:08 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3B474W6K030402; Mon, 4 Dec 2023 09:40:07 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3urv8dm3me-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 04 Dec 2023 09:40:06 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3B49e36q18809102 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 4 Dec 2023 09:40:03 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 30F402004D; Mon, 4 Dec 2023 09:40:03 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 199D720040; Mon, 4 Dec 2023 09:40:01 +0000 (GMT) Received: from li-3c92a0cc-27cf-11b2-a85c-b804d9ca68fa.ibm.com.com (unknown [9.171.12.32]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 4 Dec 2023 09:40:00 +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 v8 0/4] Introduce perf check subcommand Date: Mon, 4 Dec 2023 15:09:50 +0530 Message-ID: <20231204093954.304030-1-adityag@linux.ibm.com> X-Mailer: git-send-email 2.42.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 9ZeBdRvQ2X89TAJQYHYr_scPr33ie2bj X-Proofpoint-GUID: vQ3CjlF8eAWNp0nZVaT-QBlhkzshrq-B 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.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-04_06,2023-11-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 mlxscore=0 adultscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 spamscore=0 phishscore=0 clxscore=1015 suspectscore=0 impostorscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2312040072 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 or multiple features, such as: perf check --feature HAVE_LIBTRACEEVENT or perf check --feature libtraceevent or perf check --feature libtraceevent,bpf 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-v8 Changelog ========= V8 + handle return value of 'malloc' in patch #1 + fix error due to strncpy depending on source string's length V7 + modified patch #1 to fix compile issue, and add feature to allow multiple comma-separated features V6 + rebased to perf-tools-next/perf-tools-next + modified patch #1 to include FEATURE_SUPPORT("bpf_skeletons", HAVE_BPF_SKEL) 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