From patchwork Wed Dec 28 00:35:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ahelenia_Ziemia=C5=84ska?= X-Patchwork-Id: 37052 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1650543wrt; Tue, 27 Dec 2022 16:41:09 -0800 (PST) X-Google-Smtp-Source: AMrXdXty+Xqo5W87G/wgeO67cX5XShfDYV3+aYvcWPM4BMlR5RvFKa5Z6KBhMM4nJUfAhBhaFHbJ X-Received: by 2002:a05:6a21:596:b0:a3:9ca0:b982 with SMTP id lw22-20020a056a21059600b000a39ca0b982mr27556441pzb.26.1672188069333; Tue, 27 Dec 2022 16:41:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672188069; cv=none; d=google.com; s=arc-20160816; b=NjfIBkDljLppuUsDnR918vbDjNs3ZxnABm2kWLY7QN/kk+Lx4yaRkossZJgVwPhb6o lHKDi8JRbAW10UFxp3eHCtWC+qODLGPa8QsQBDmD8jmR2oUEyAlX380mQW7y5WlqiG48 lj9zLDH4WG+7jr60rffaeKXxOfF6579kH9UXoNaPiBJc4NJh2iy5c4eyopdSwoxcRDXC KxG3S7hmg5F9RdUnS1xk2Qx2qKEXdvk/9FmnF0plDrRzhJ7qxRaOcT8v74z0up8EPPGZ 2PSoYUsKPo3s+DKOz1c7XkVV5qpL14tGdPkzn4fWlsHMEyR1YSi18Jx7PP/XBUKw94nW xKMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:user-agent:content-disposition:mime-version :message-id:subject:cc:from:date:dkim-signature; bh=huc3jApK7cpas+mkALhKGHef4s6PYdSCXK1LdAYWHF0=; b=Dhz9sruiGt5dvN6BqFoL2PyXD9J07sAz5ucnh89QPv/IeHuLspMhjYfFc2vXa+4sDc lQMKZWLQtxx6GF1yMI9WLQepfrEWN/EEK3Jb/AaClPiMj+ofFVSbZRc7FUyCkPdcQODl Hb13H26zl6O8YvgrQBCt7N30kUpDv6iQ9WSvC01AUu/MOW5Z2rHaf4n2ExXMOwb1MN+O +Ajp4aVbktk/06PTQMZcWSi9dxo7BI+5Q/xMe5PyJARhtFa6TwTqwzhcB7v7ZmtunL96 k4YspaHTWHEQdw9uadJi+5ZhHDRSAUuLiBZwwFbHtQglMvncE4bZYJSiyKGFvCmMmq+v NrgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202211 header.b=hsmtYgBQ; 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=nabijaczleweli.xyz Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t203-20020a635fd4000000b0049ab7c8661bsi4739015pgb.112.2022.12.27.16.40.51; Tue, 27 Dec 2022 16:41:09 -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=@nabijaczleweli.xyz header.s=202211 header.b=hsmtYgBQ; 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=nabijaczleweli.xyz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229608AbiL1Af5 (ORCPT + 99 others); Tue, 27 Dec 2022 19:35:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229475AbiL1Af4 (ORCPT ); Tue, 27 Dec 2022 19:35:56 -0500 Received: from tarta.nabijaczleweli.xyz (unknown [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5AC8BC2A; Tue, 27 Dec 2022 16:35:53 -0800 (PST) Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id B34C6DB4; Wed, 28 Dec 2022 01:35:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202211; t=1672187750; bh=+yuFqRfY2HLZJC2FTM5sps1/rCx07mHiCqapWOI0R/c=; h=Date:From:Cc:Subject:From; b=hsmtYgBQLo1Z4Qzh85AN9gMUxXyHYaoD5iz+hIUBCovvxPn6km+W6Z1C6v1MscyZh Lha37KFpdbgElHnNfALmj/AhX2VXwFxgZ2vUGoLmBRzZJaEeVUVPe6tRrEgzcPEyW6 equ9UmhUp9IeYY8D0PfCeYpxvVomhg42/LJPGJ6PTDaMKuvjmB7KjTfzq6THmx9Itd B3e5634EoqAHoDAXNs9JLN9S8ZUPw4quAzlRqd+eYHvYAEs0jsOI15Sr1IjxZ2W1kp 7N+AZ6KCyos8845Hofx20UxisuGi+6QxUpes/opTdX+SEfHwcXarHyZCpdKoxjA/Fz NH0pbvjRY+mNQ== Date: Wed, 28 Dec 2022 01:35:49 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 1/2] perf python: fix clang feature detection littering Message-ID: <44bb9a29bd7a0385c25ebfd69abd0a41ac2d753b.1672187710.git.nabijaczleweli@nabijaczleweli.xyz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20220429 X-Spam-Status: No, score=2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FROM_SUSPICIOUS_NTLD, FROM_SUSPICIOUS_NTLD_FP,MISSING_HEADERS,PDS_RDNS_DYNAMIC_FP, RDNS_DYNAMIC,SPF_HELO_PASS,SPF_PASS,T_PDS_OTHER_BAD_TLD autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) 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?1753416276777707111?= X-GMAIL-MSGID: =?utf-8?q?1753416276777707111?= This left behind tools/perf/a.out, not .gitignored and not removed by make clean. Fixes: commit 5508672d7f4949f15c316ffd947228f130498534 ("perf python: Remove -mcet and -fcf-protection when building with clang") Signed-off-by: Ahelenia Ziemiańska --- tools/perf/util/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py index c294db713677..58239e1cdb2a 100644 --- a/tools/perf/util/setup.py +++ b/tools/perf/util/setup.py @@ -16,7 +16,7 @@ cc_is_clang = b"clang version" in Popen([cc, "-v"], stderr=PIPE).stderr.readline src_feature_tests = getenv('srctree') + '/tools/build/feature' def clang_has_option(option): - cc_output = Popen([cc, cc_options + option, path.join(src_feature_tests, "test-hello.c") ], stderr=PIPE).stderr.readlines() + cc_output = Popen([cc, cc_options + option + "-o /dev/null", path.join(src_feature_tests, "test-hello.c") ], stderr=PIPE).stderr.readlines() return [o for o in cc_output if ((b"unknown argument" in o) or (b"is not supported" in o))] == [ ] if cc_is_clang: From patchwork Wed Dec 28 00:36:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ahelenia_Ziemia=C5=84ska?= X-Patchwork-Id: 37053 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1651092wrt; Tue, 27 Dec 2022 16:42:39 -0800 (PST) X-Google-Smtp-Source: AMrXdXsh5GA9DvnIJxV8ZZDR0UeTXgDhypM9yqvfjO7/rtxhDaEmvwItU6HR7yBz7mAPXoOEG9Hp X-Received: by 2002:a62:198a:0:b0:577:d10d:6eab with SMTP id 132-20020a62198a000000b00577d10d6eabmr24448794pfz.21.1672188158982; Tue, 27 Dec 2022 16:42:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672188158; cv=none; d=google.com; s=arc-20160816; b=Be/p8kGzgH2uQzNLkNt7Yc1Ji0IrX/KHrtet1wR3PraeOFOAQMF5mhY+M0kYna+ul6 bnGQxDcceq8E5TfLtESGSuUUDnfd4eJqMHPualD1tre5WzptAHud8KjCSvNIRXPGqQWV 1pW96oYUANl52Av/apuKrtYhTL3Sfi2DCaafy+UO7VivRYQ1OqEcYr/qg3WAtF9l5Se1 j3+e+RIk8qpk5WnHNToGmb50mWXsJ20S5QHUbNNuzUozNlmIcJV8yxQgKKFwzEmy/N4y i7Y4V06kuY1yi1opNDahyMv4J8Ym9UzImEsLC1ObZtza9u4Izoc2jXMGCm+hdJpXfzPO TcbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:from:date :dkim-signature; bh=5Nyu5a8aD0exGXIEq9DfNxLT0kk4u4U0mdegstypVdM=; b=BrP1Qukb2eh+IwxChcKW83vZ6TVZ1IziSY6wCjoLxxSCD+x78H6/7RKtiLvzXrip1l FEdFGpXFAysJFo+9NdrbvuMnL1353VxR8fTyAel/YcPWp8EqInNXGH4ACMw6GOZcICs+ IoHcjxAxzVbw4nJdq+xXh9ooPI2Dgqhm0v16v+zExOHbQsrqeVA02DHzyp/UJNdg0vdm lmolSnIuFqmzHXlajCuCUqOYPF4yxubiIYtXNiWy96I+96QG0GEnOHxJXTne4HIH9nNf NJalyJs426qCaATI6gSPQSlQ27b9zwAnYo3KbO+CTMD6ZeeFlxXE5RCOBAVhUvcdGZax rsfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202211 header.b=fuPuYWcB; 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=nabijaczleweli.xyz Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c20-20020a624e14000000b005818164ef32si1590786pfb.291.2022.12.27.16.42.26; Tue, 27 Dec 2022 16:42:38 -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=@nabijaczleweli.xyz header.s=202211 header.b=fuPuYWcB; 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=nabijaczleweli.xyz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229939AbiL1AgR (ORCPT + 99 others); Tue, 27 Dec 2022 19:36:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229918AbiL1AgN (ORCPT ); Tue, 27 Dec 2022 19:36:13 -0500 Received: from tarta.nabijaczleweli.xyz (unknown [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D1170C2A; Tue, 27 Dec 2022 16:36:12 -0800 (PST) Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 04443DB8; Wed, 28 Dec 2022 01:36:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202211; t=1672187772; bh=/RGVuKr5/3fCEx87FQ8Nip6ERreIb5DBGC2EyffIs24=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=fuPuYWcBEuWZDrHK7r+tlFxnVEDjRSfUxg5F1XbZUdKjSLnkAUn2hZH2WRFYRtVr8 7wbGB7GKMQYpblP0yaD0DtfNvlvENzCWXcxQglQf288+wAbkC8nEH0BT4UmkQhCQnP vQ0spz/+EKLikRfa3lbF2LnzbCnoXuP+26d1jR4upnQOKZ/qSSyJpaZBkUyTlIw7As HhCx1oru5tKwvwf3knElh+jyjJH3ijWm8lONORICVA+3YDTNVUNYqM+8mMTZrueFEZ DZr/3V7lh66OSxXg0jtO1rBxeHh8ooZHLMAt8CWOKf+0eG73JtCyofQ4vMrHiF28GF jZSohr6L3xI+g== Date: Wed, 28 Dec 2022 01:36:10 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 2/2] perf python: don't run the linker for clang feature tests Message-ID: <7d943ff294fbc606880a824b9764704f803f8beb.1672187710.git.nabijaczleweli@nabijaczleweli.xyz> References: <44bb9a29bd7a0385c25ebfd69abd0a41ac2d753b.1672187710.git.nabijaczleweli@nabijaczleweli.xyz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <44bb9a29bd7a0385c25ebfd69abd0a41ac2d753b.1672187710.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20220429 X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FROM_SUSPICIOUS_NTLD, MISSING_HEADERS,PDS_RDNS_DYNAMIC_FP,RDNS_DYNAMIC,SPF_HELO_PASS, SPF_PASS,T_PDS_OTHER_BAD_TLD autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) 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?1753416370897010813?= X-GMAIL-MSGID: =?utf-8?q?1753416370897010813?= This, for me, slightly-more-than-halves the time it takes to run for a in "-mcet" "-fcf-protection" "-fstack-clash-protection" \ "-fstack-protector-strong" "-fno-semantic-interposition" \ "-ffat-lto-objects"; do cc "$a" ../build/feature/test-hello.c -o /dev/null; done from just over 600ms. Signed-off-by: Ahelenia Ziemiańska --- tools/perf/util/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py index 58239e1cdb2a..400c99cd7734 100644 --- a/tools/perf/util/setup.py +++ b/tools/perf/util/setup.py @@ -16,7 +16,7 @@ cc_is_clang = b"clang version" in Popen([cc, "-v"], stderr=PIPE).stderr.readline src_feature_tests = getenv('srctree') + '/tools/build/feature' def clang_has_option(option): - cc_output = Popen([cc, cc_options + option + "-o /dev/null", path.join(src_feature_tests, "test-hello.c") ], stderr=PIPE).stderr.readlines() + cc_output = Popen([cc, cc_options + option + "-c -o /dev/null", path.join(src_feature_tests, "test-hello.c") ], stderr=PIPE).stderr.readlines() return [o for o in cc_output if ((b"unknown argument" in o) or (b"is not supported" in o))] == [ ] if cc_is_clang: From patchwork Wed Dec 28 01:57:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ahelenia_Ziemia=C5=84ska?= X-Patchwork-Id: 37087 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1674650wrt; Tue, 27 Dec 2022 18:01:10 -0800 (PST) X-Google-Smtp-Source: AMrXdXswbeuPqeFApVkFIXP1hNV3GvXVQfJvW5v70bQcuBCWHmRDm+P2sS+ymQEmdqJH0giX0oBI X-Received: by 2002:a05:6a21:78a0:b0:a3:960e:7d0a with SMTP id bf32-20020a056a2178a000b000a3960e7d0amr37324675pzc.58.1672192869837; Tue, 27 Dec 2022 18:01:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672192869; cv=none; d=google.com; s=arc-20160816; b=bXcKZ/ZR7C9M4Z3Jv3jIE07wYlQiq8J7WXLgXycr2NmjkVYh1BDi8f1JtrAWU6kv7M E+wQLhlNUO8oTc3yTcF0gwOEyQ2b6sjopZ6xg/UJcL6FukNRHrRxmXFbIMd2qBLUVEqZ xzH18SEnvs76ZRdOyvqL2n8gchZuwXJCVxFtf0LrNfnISBGTri+kGqKEGt6DkSSrnb3z F55e3Gv0b1hiXtC7b9+Q9ig/xFaIWoP9css4H2SFbbFwgozwR0Ql7sVX3Thlr+VkwxzR KN4tUkxvcmfz9++49lUxpbe3Dplegl51NmQCiHmeVUMCggxNbVOKodGZYSZZKfio1Yih xMCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:from:date :dkim-signature; bh=o4jIGtLja4Hj5GRjeark9HSlYauGwO868x9Vz1r98v8=; b=G5tm8GYmmN4wy/J8QZxYvrqCZUcRIC2i0qa9Zz4GrQGl1ocGbjJHNocxUfV3tUeGnC cddFRKpRO04G1wC9ufFYlJBvLN7+1qek+IEVXn+0okMWBGzO0KHEI+VFTwwBFsKVnaxD nhpIC78DuLklbdv3cUcQkeCfHmytPEcMBXMCdp26/LPCHVl5/zeGQnSJpVVmK2HAfqSn fJUl7zpSv2RyX7NNXuAOW9zHl768ITKAed5kPF6giSCNj8ifc1cBu62ee/Rnos9nnCLW LV+u6EDFjy5o2510cxpC/u66kdE6i1X4UgR1ZY7Da3CAzGrec2nAVRCU0+yoTz3lgqZT Plag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202211 header.b=WJ8W7cOk; 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=nabijaczleweli.xyz Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j11-20020a63e74b000000b004774e9ef1casi14983916pgk.728.2022.12.27.18.00.57; Tue, 27 Dec 2022 18:01:09 -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=@nabijaczleweli.xyz header.s=202211 header.b=WJ8W7cOk; 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=nabijaczleweli.xyz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232560AbiL1B6Y (ORCPT + 99 others); Tue, 27 Dec 2022 20:58:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230141AbiL1B5t (ORCPT ); Tue, 27 Dec 2022 20:57:49 -0500 Received: from tarta.nabijaczleweli.xyz (unknown [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1C3F9292; Tue, 27 Dec 2022 17:57:49 -0800 (PST) Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 67C94120C; Wed, 28 Dec 2022 02:57:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202211; t=1672192668; bh=Xb7nUn6EDqGGST4kb/TTOlSVXa+n18Xx10sbI7pkaC4=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=WJ8W7cOkD3Lw2VBRVTJz9C7TXysy97mFkEQj8xQEkMWm/X/k6T2VOYZ+qILeedJT0 HoAnOmyrwPpQLRXtCkU9ZqfdDBokmuVUzyo4FEoi3Fj5zqoNBuBsMnQKnE8xxTXcLU tnmHCeC3VWhFPkfu/zA+0JBd8OU7lnjAwSoy9fnoDqmeWE3fTm9tcg9kzihmc2m+bp /E8yxp2+08AuudJc84X4xan5COazxmYRzRhyax6dQnu12gjOHRGR+EYL7eU7D03sje 3WtxhyNwnnvspISDmbEd/amakF6T5dG/wZblaaJYW+OdLWdqIydQwODUxS8zUtW9pa eE7aMnBJ8yFqQ== Date: Wed, 28 Dec 2022 02:57:47 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH v2 3/4] perf python: don't run the linker for clang feature tests Message-ID: <6dd7e9dd522c7c6014f8273affa7a558918b048b.1672192591.git.nabijaczleweli@nabijaczleweli.xyz> References: <44bb9a29bd7a0385c25ebfd69abd0a41ac2d753b.1672187710.git.nabijaczleweli@nabijaczleweli.xyz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <44bb9a29bd7a0385c25ebfd69abd0a41ac2d753b.1672187710.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20220429 X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FROM_SUSPICIOUS_NTLD, MISSING_HEADERS,PDS_RDNS_DYNAMIC_FP,RDNS_DYNAMIC,SPF_HELO_PASS, SPF_PASS,T_PDS_OTHER_BAD_TLD autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) 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?1753416370897010813?= X-GMAIL-MSGID: =?utf-8?q?1753421310654574995?= This, for me, slightly-more-than-halves the time it takes to run for a in "-mcet" "-fcf-protection" "-fstack-clash-protection" \ "-fstack-protector-strong" "-fno-semantic-interposition" \ "-ffat-lto-objects"; do sh -c '$CC "$@"' '' "$a" -o /dev/null ../build/feature/test-hello.c; done from just over 600ms. Signed-off-by: Ahelenia Ziemiańska --- tools/perf/util/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py index ba0b1e078855..0a557f2bf357 100644 --- a/tools/perf/util/setup.py +++ b/tools/perf/util/setup.py @@ -6,7 +6,7 @@ cc_is_clang = b"clang version" in Popen(["/bin/sh", "-c", "$CC -v"], stderr=PIPE src_feature_tests = getenv('srctree') + '/tools/build/feature' def clang_has_option(option): - cc_output = Popen(["/bin/sh", "-c", '$CC "$@"', "", option, "-o", "/dev/null", path.join(src_feature_tests, "test-hello.c")], stderr=PIPE).stderr.readlines() + cc_output = Popen(["/bin/sh", "-c", '$CC "$@"', "", option, "-c", "-o", "/dev/null", path.join(src_feature_tests, "test-hello.c")], stderr=PIPE).stderr.readlines() return [o for o in cc_output if ((b"unknown argument" in o) or (b"is not supported" in o))] == [ ] if cc_is_clang: From patchwork Wed Dec 28 01:58:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ahelenia_Ziemia=C5=84ska?= X-Patchwork-Id: 37092 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1686542wrt; Tue, 27 Dec 2022 18:42:24 -0800 (PST) X-Google-Smtp-Source: AMrXdXtJiIUeTvFOACUSKOBMHB+U/tuWaqekzu0M6eeFeXhs2aPki/iWEwuC0jIpHGcCqXRKh9VB X-Received: by 2002:a17:906:c24f:b0:7c0:efb9:bc0e with SMTP id bl15-20020a170906c24f00b007c0efb9bc0emr19005938ejb.62.1672195344465; Tue, 27 Dec 2022 18:42:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672195344; cv=none; d=google.com; s=arc-20160816; b=hAtOw+9zpXcSbXGWx9CE8GNB3wMvoNKvuf5/HBXpS7ZRglcCruHE3XcUSKefFyqz4F RgAYGBtPtpHMTsNpbAz+7cRcIjZ+XaizhXWob3FNyZ2/0tG9wRGGfYQOO5OWz1FwC9Mb ZVI4krb1sxHzraSe0jqIsLXqk6O5vOM8a/6esZGTFWV7wXMIeO9/bBRLapNvhGV+Td8f N4RX8jngqrJvmucfWwyk7XLLbm+GQbTGRH3KZIYJyyHoN3TeIpmRApNH2kkKoas0zikw 44sbLAO0J8N7qagwmZa1tFhy6WOJfPnq0k4CmBLrulkzhRM6CQsOKbtPlqLJZkNt34qP ME+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:from:date :dkim-signature; bh=c+emAzP2819+NwSWvo0hj9NxKeB8ohnCV+rjZM+j+kA=; b=f/QHjcwz2XwicmSstfUwGvxHJn/XqrhjA48DxaxwIFFWsRuDkUWzD1XYZn1Q7ZDyM+ ddq4aCBKtehMD7lvT/KijfkIi7fOX5jGpLCbJQlmBJFtE+OV1SKwEsz1z24Vc989kB+E Aoxb4ERE1FG6dA9tutp+brbKZP2HUNQ/8RAxoQQ0Y7FVV97A9rtto5oWAFnuQgoDl+X4 ymUvMOUlMCafnstPoBvpCCFJwDA1MW2wLiniGMhChKcRoiaghEPv0OTwkDiFKzwQWfPN kp51rVvWWguOpEL1yzyvUlvwbm+NZiwnEETQggytFYW2VmOJYQb10BjN88dsbMuoRe3w r/xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202211 header.b=ZTOnaPXu; 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=nabijaczleweli.xyz Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xh9-20020a170906da8900b0084c464789absi7397361ejb.781.2022.12.27.18.41.58; Tue, 27 Dec 2022 18:42:24 -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=@nabijaczleweli.xyz header.s=202211 header.b=ZTOnaPXu; 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=nabijaczleweli.xyz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232602AbiL1B65 (ORCPT + 99 others); Tue, 27 Dec 2022 20:58:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232744AbiL1B6m (ORCPT ); Tue, 27 Dec 2022 20:58:42 -0500 Received: from tarta.nabijaczleweli.xyz (unknown [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E23B7292; Tue, 27 Dec 2022 17:58:41 -0800 (PST) Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 401901106; Wed, 28 Dec 2022 02:58:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202211; t=1672192721; bh=T0xNNhCSq7eox6ZW7rwjelLQ+yuE6npQ6iDEXXXfl30=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=ZTOnaPXuT3XIbwLeV/42cgze1icACWTRw/6Do4cHQZC4rcrCOSV2oMLKDwCxsnnDi NBMFkQz8nQ59zuEpTcREVFSJfbUGOmgjfSJQbCJdCgxEQIGGMvUNeRR0fV7vIowW0F QL9aIXvtp6LeZF2ALe5CKE/+wdHg54VVOMKbHTHMaB6OJet1RX4imW18Bm0FHL+yYe i5sivRv4tNE8thKMZJiZAAp4gh31nT1CqwKeuvWgPzq/0oRxjHTlP89F3EcVOQgZWA yte3vIWy86KQbZuNYSnatvL3sKSYXxVQSjKPs6LC+K9NiluMWhiTlPIBVbeZIZoIGa U8ZGz7PGac86g== Date: Wed, 28 Dec 2022 02:58:40 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH v2 4/4] perf python: only check for the clang features we care about removing Message-ID: <9756370bbcf53781b073dfc7953b76db0b69a08b.1672192591.git.nabijaczleweli@nabijaczleweli.xyz> References: <44bb9a29bd7a0385c25ebfd69abd0a41ac2d753b.1672187710.git.nabijaczleweli@nabijaczleweli.xyz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <44bb9a29bd7a0385c25ebfd69abd0a41ac2d753b.1672187710.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20220429 X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FROM_SUSPICIOUS_NTLD, MISSING_HEADERS,PDS_RDNS_DYNAMIC_FP,RDNS_DYNAMIC,SPF_HELO_PASS, SPF_PASS,T_PDS_OTHER_BAD_TLD autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) 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?1753423905594126557?= X-GMAIL-MSGID: =?utf-8?q?1753423905594126557?= Instead of checking for all 6 flags every time for both fields, only check for the ones we already know are in there. This means instead of running 2*6 processes, we run, on my Bullseye system, just one (for -fstack-protector-strong)! This reduces the run-time by appx. (2*6-1)*.05=550ms (or, without the -c patch, 1.1s). Signed-off-by: Ahelenia Ziemiańska --- tools/perf/util/setup.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py index 0a557f2bf357..f4b94c0f9055 100644 --- a/tools/perf/util/setup.py +++ b/tools/perf/util/setup.py @@ -14,18 +14,9 @@ if cc_is_clang: vars = get_config_vars() for var in ('CFLAGS', 'OPT'): vars[var] = sub("-specs=[^ ]+", "", vars[var]) - if not clang_has_option("-mcet"): - vars[var] = sub("-mcet", "", vars[var]) - if not clang_has_option("-fcf-protection"): - vars[var] = sub("-fcf-protection", "", vars[var]) - if not clang_has_option("-fstack-clash-protection"): - vars[var] = sub("-fstack-clash-protection", "", vars[var]) - if not clang_has_option("-fstack-protector-strong"): - vars[var] = sub("-fstack-protector-strong", "", vars[var]) - if not clang_has_option("-fno-semantic-interposition"): - vars[var] = sub("-fno-semantic-interposition", "", vars[var]) - if not clang_has_option("-ffat-lto-objects"): - vars[var] = sub("-ffat-lto-objects", "", vars[var]) + for opt in ("-mcet", "-fcf-protection", "-fstack-clash-protection", "-fstack-protector-strong", "-fno-semantic-interposition", "-ffat-lto-objects"): + if vars[var].find(opt) != -1 and not clang_has_option(opt): + vars[var] = vars[var].replace(opt, "") from setuptools import setup, Extension