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