Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp428570rwe; Thu, 1 Sep 2022 01:45:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR7EPm+kNHnOJ4sHmtctjb9EtbT/kEyvmmpKepsXMS5TU1DymTslofzHRXvp9bsSwi1lh2Oi X-Received: by 2002:a63:88c3:0:b0:42b:33f8:6bc2 with SMTP id l186-20020a6388c3000000b0042b33f86bc2mr24956647pgd.495.1662021942052; Thu, 01 Sep 2022 01:45:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662021942; cv=none; d=google.com; s=arc-20160816; b=Uimgst5b+vWp0na2NmUv8wHFxKx0XhKFzCrGM6pBndEgWgTeYBYXgzm2fNU2btHKHb ztmgrzpOui/ip3k3zM11COLDnhTQneLpSJrzEb3eZETm+43LcCK64S1H7/dDZke/sAut D7DGd6T+R5UAQZX8BdtLsyIDIsU0XczWjJkEZGwsVjS6VWPnRfeXxsYR5X6Bai8kcmKb vjMtXwJ9gDE3jF29qag3Hyag1y+tLPIFXWLBGcOye2/gjD14YCg714sbUsixIM/PyVAR xbOoNuUWGDweckFFTA1USRwBwf9bTVFfuHdZJQKRreqSsQOw3od+Ccr5jyo7NOAlDK2F brLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=2BVVJWB+FdqmDQoz/2lQCiYMksJ7j4lLlKdXX3EHfCo=; b=DN5WuOfqArbqMsMqqZM0iGMrdlVKj5o1sOG1M88me9DKNn9z1o3G9hxhnrbss5v7eX rOtgIgB85v2gUGQEkrY+t3wONh4ysVEACpcAST8JIalrznTyZGK3CvMCG3aBwVhlALMY spV7kyRsf8IOogJMppBFIyDp/gDDyFWeUrEIc0MQUvhAa+yJOyc+XXBH9W6Wpra5gFIg FmbTHP4tf4IX4NMgHw/wzpBcHlOYNHyBz3EtY/BRi8SjOJSdaz7vVsgJb+YgUx8DBG4u XOMFK9AfMO886sfmwUkbLxrjAL9XZwvEGev3c4VvSR6cC2PhxT7QFwxCKadRebIHj6G5 ekRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=lfg1gfks; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bu4-20020a17090aee4400b001f74f8ee43asi3789759pjb.25.2022.09.01.01.45.30; Thu, 01 Sep 2022 01:45:42 -0700 (PDT) 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=@linutronix.de header.s=2020 header.b=lfg1gfks; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234127AbiIAIN2 (ORCPT + 99 others); Thu, 1 Sep 2022 04:13:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233893AbiIAIMw (ORCPT ); Thu, 1 Sep 2022 04:12:52 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E9D812BF68; Thu, 1 Sep 2022 01:12:50 -0700 (PDT) Date: Thu, 01 Sep 2022 08:12:46 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1662019968; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2BVVJWB+FdqmDQoz/2lQCiYMksJ7j4lLlKdXX3EHfCo=; b=lfg1gfkssnPaAi9G9e1uNdGgGU0d0795MNqKqOPT2ziVW/VYLR/oBVGag/PKVn2IYZaru7 5ihxLxS1Kt1VbGY06kMb3ohnAiWdb1A/wIvZbh6VIyL2Xq1YYakroy6grH89rs2JMhY8iJ iBJGoyCP+kv9xjch1ZLW7GGCZ56LugU6w9hww5q8v6bam2Tf/PLkTub1okJrZ6IDrdRQiR ejbOfNxNyWmWYMArp0xiP3lVzvC+R2IbwSmScRXiR9nInWBhEXFQaU29AZLRCBBbpo4WO2 +s74Z0NxJOwYzTyUBwnk69JMX9PbK+lTQWcYQI/P1xw6KRbSfwkTlnPepBh2xQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1662019968; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2BVVJWB+FdqmDQoz/2lQCiYMksJ7j4lLlKdXX3EHfCo=; b=haRTJ1tVQPCiPfFTdtUZM1p9rWBDSvV/OaRxHraHQFllKNTeD/bcLVFHYjN6q3AFGMnEzC 29qdt6z3NEc9LvAQ== From: "tip-bot2 for Marco Elver" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf/hw_breakpoint: Make hw_breakpoint_weight() inlinable Cc: Marco Elver , "Peter Zijlstra (Intel)" , Dmitry Vyukov , Ian Rogers , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220829124719.675715-8-elver@google.com> References: <20220829124719.675715-8-elver@google.com> MIME-Version: 1.0 Message-ID: <166201996690.401.10832809672722007197.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 The following commit has been merged into the perf/core branch of tip: Commit-ID: 9caf87be118f4639537404eeb67dd444a3716e9a Gitweb: https://git.kernel.org/tip/9caf87be118f4639537404eeb67dd444a3716e9a Author: Marco Elver AuthorDate: Mon, 29 Aug 2022 14:47:12 +02:00 Committer: Peter Zijlstra CommitterDate: Tue, 30 Aug 2022 10:56:22 +02:00 perf/hw_breakpoint: Make hw_breakpoint_weight() inlinable Due to being a __weak function, hw_breakpoint_weight() will cause the compiler to always emit a call to it. This generates unnecessarily bad code (register spills etc.) for no good reason; in fact it appears in profiles of `perf bench -r 100 breakpoint thread -b 4 -p 128 -t 512`: ... 0.70% [kernel] [k] hw_breakpoint_weight ... While a small percentage, no architecture defines its own hw_breakpoint_weight() nor are there users outside hw_breakpoint.c, which makes the fact it is currently __weak a poor choice. Change hw_breakpoint_weight()'s definition to follow a similar protocol to hw_breakpoint_slots(), such that if defines hw_breakpoint_weight(), we'll use it instead. The result is that it is inlined and no longer shows up in profiles. Signed-off-by: Marco Elver Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Dmitry Vyukov Acked-by: Ian Rogers Link: https://lore.kernel.org/r/20220829124719.675715-8-elver@google.com --- include/linux/hw_breakpoint.h | 1 - kernel/events/hw_breakpoint.c | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/linux/hw_breakpoint.h b/include/linux/hw_breakpoint.h index a3fb846..f319bd2 100644 --- a/include/linux/hw_breakpoint.h +++ b/include/linux/hw_breakpoint.h @@ -80,7 +80,6 @@ extern int dbg_reserve_bp_slot(struct perf_event *bp); extern int dbg_release_bp_slot(struct perf_event *bp); extern int reserve_bp_slot(struct perf_event *bp); extern void release_bp_slot(struct perf_event *bp); -int hw_breakpoint_weight(struct perf_event *bp); int arch_reserve_bp_slot(struct perf_event *bp); void arch_release_bp_slot(struct perf_event *bp); void arch_unregister_hw_breakpoint(struct perf_event *bp); diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c index 9fb66d3..9c9bf17 100644 --- a/kernel/events/hw_breakpoint.c +++ b/kernel/events/hw_breakpoint.c @@ -124,10 +124,12 @@ err: } #endif -__weak int hw_breakpoint_weight(struct perf_event *bp) +#ifndef hw_breakpoint_weight +static inline int hw_breakpoint_weight(struct perf_event *bp) { return 1; } +#endif static inline enum bp_type_idx find_slot_idx(u64 bp_type) {