Received: by 2002:ab2:7041:0:b0:1f4:bcc8:f211 with SMTP id x1csp38919lql; Fri, 12 Apr 2024 03:04:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU9Ft2Cm+ElLpVTqh3NsDxRRZWuBLHy1zUthgEWHzTc9vSBMeT/9w6/jQlHtkow3Ls0V3w6MH6dgtTZh1e5YnnHWRQX9rH3Oi/Ll3wy/w== X-Google-Smtp-Source: AGHT+IGuBT/Q3yFcwaR7JUCgHdee2qRLqcO/v5MlZqkyqq/OSfG5GYuyPcqbfT+eerpvRkcOSVjW X-Received: by 2002:ac2:5963:0:b0:516:ce00:d05a with SMTP id h3-20020ac25963000000b00516ce00d05amr1273505lfp.25.1712916244375; Fri, 12 Apr 2024 03:04:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712916244; cv=pass; d=google.com; s=arc-20160816; b=HG47ZCjfj1YRf31raqDbXoqioDV7YjkGRD88aErDiRZWcRleaSGrAfWZ5DtaPjbEa8 7b5YPr7IOzp8Nrc2FbjwpFjTzV6STtQ9L7J0p4l3za6XXdD7/SGqdUFoJXwfzgyFp4If pcotBsG4ejv40Z2jo/Sox0uTC5xVtj5hPYXLJefehx7umS2DX6uKxxnZQ7T5mwtf+QKm 3QPRSGLUTOLBpjZryFw1Srz7eagOuQExKllA88MBG4lsWr7Vjs2h5Ug9MCE0nyq93iXQ nlUxtcVEWJpx51UR02tpw85rXZia6EzWEqWLuS/g8syqHiH96wZWgmqJw50/MrVRBcuw UUzw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=UAWn/cFjvTk+aXbcVOZIgrYlc5atTEL1VmaicMWN/Gc=; fh=6pSHQG7MVsi5SCYIPDTACQf9WmjUIyl3nHk9XaFMYwE=; b=JDX1zyxy+RgO50F82HnxgNfAIxeZ+j6SjBOxtMZ5bqMtpzJyJ5HHleUWs1oduktCRK MiWiq4S7uzJlhxv8eJEA5tQolj4ZDO4Fer+H76zJLrPtOcE1s1zELaKOCHa+N+GSsaFA cbw+/TWNcHSeFmFAh1rHOca8LK+hYqzaFLB9uH+LJhBJZZQi0/GLfwSmuA2yE2ejW1f1 VdRMVYmZxeQV30ARy7VGNiXi9/jpOdFAGEvQIqL0B+r0XwQDSXOkMzbLeLc34ePBHQrF Y8M227XxJMFNLvROjgbRjyFTiS72/KXyL2bZIngn2+G6A69YLiZ4ZO0ww7DBKXkcTliV 8ofw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="AEEEPuU/"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-142458-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142458-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id lx16-20020a170906af1000b00a51c9692fc1si1630288ejb.474.2024.04.12.03.04.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 03:04:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142458-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="AEEEPuU/"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-142458-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142458-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E5BCE1F21D26 for ; Fri, 12 Apr 2024 10:04:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EC2DE5467B; Fri, 12 Apr 2024 10:03:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="AEEEPuU/"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="1QNn9r1g" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 65C0652F9C; Fri, 12 Apr 2024 10:03:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712916209; cv=none; b=uW/8Nn/9jOgTNepziTprbPYDAq67pivz514YXt2KIuKj/l96VqyXcd/4I8lzjBFeS9UD9VvEcsBnr096WUK4lCpPROPuCCmlgRWr1i1I4FPKdjNE00ZNbqcQ+jZqruBEGcrleVdgVDgr3BNVAA+R7HrgWPSHKXuT2QYgVcGbg3Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712916209; c=relaxed/simple; bh=HMlfKgG+IBRbY2u0j889PwOzLC/AtJbwbVg1f7xSiVI=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=RzEzos2wIEYMYHZ1ryaw49vU6sInlu5uKptNsBgOOzwVKilC9LmOtyuVFxGc1nvzy7s+LhnrYZ7XO8pIbfWq4RuYaC2MXxCz3k2rImECtGiowSc/bieVwfV+BYrZ5J4JX+s5GVk2Q8VL1h1xamFHJDyBYBHhF5Mt/RnrEN4PPts= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=AEEEPuU/; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=1QNn9r1g; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Fri, 12 Apr 2024 10:03:24 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1712916205; 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=UAWn/cFjvTk+aXbcVOZIgrYlc5atTEL1VmaicMWN/Gc=; b=AEEEPuU/evWhP3l3dk7fX9fveomKuDwqCrBb2q1E/EmNzKVBxRDYYU4AVfX5PdnP8kWXNe kmS9WWB7eUqtTQTIl3NVAEfN13QIOaWzWop3PiYANFOoVv9vOno/MgVeU8aDGa/ZzYLqHh 1gB4zTBBSj+vdpDsjTXDVGkQLJt1rDvNWQb2J4KbxQZ19KCpQyX5b4STubfKr/aruExYEI VOot+4a8eEp6FYsL15VFiMnui/9foVvGQRVfb6M8fTZgj5YPDKyLpmU3/AT1fp5AxOt1Oj x4PBy3NUKmviz9MM9jYcZ4jhvc/vRrqAhwiqxaS3MgwFqSch53gSfMMYumHCWg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1712916205; 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=UAWn/cFjvTk+aXbcVOZIgrYlc5atTEL1VmaicMWN/Gc=; b=1QNn9r1gAtgR0z93SMoSDYWGvJmwl0EDm1QJ4g45IcW9TwOO+ckjI2urnCZaKFhtJ/WtlA EMySMYDbz3CfSmBQ== From: "tip-bot2 for Kyle Huey" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf/bpf: Remove unneeded uses_default_overflow_handler() Cc: Kyle Huey , Ingo Molnar , Will Deacon , Song Liu , Jiri Olsa , Andrii Nakryiko , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240412015019.7060-6-khuey@kylehuey.com> References: <20240412015019.7060-6-khuey@kylehuey.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <171291620418.10875.14587542569279269259.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the perf/core branch of tip: Commit-ID: 76f6d58845829e5d6ef55532e67a323e7d30c26e Gitweb: https://git.kernel.org/tip/76f6d58845829e5d6ef55532e67a323e7d30c26e Author: Kyle Huey AuthorDate: Thu, 11 Apr 2024 18:50:17 -07:00 Committer: Ingo Molnar CommitterDate: Fri, 12 Apr 2024 11:49:50 +02:00 perf/bpf: Remove unneeded uses_default_overflow_handler() Now that struct perf_event's orig_overflow_handler is gone, there's no need for the functions and macros to support looking past overflow_handler to orig_overflow_handler. This patch is solely a refactoring and results in no behavior change. Signed-off-by: Kyle Huey Signed-off-by: Ingo Molnar Acked-by: Will Deacon Acked-by: Song Liu Acked-by: Jiri Olsa Acked-by: Andrii Nakryiko Link: https://lore.kernel.org/r/20240412015019.7060-6-khuey@kylehuey.com --- arch/arm/kernel/hw_breakpoint.c | 8 ++++---- arch/arm64/kernel/hw_breakpoint.c | 4 ++-- include/linux/perf_event.h | 17 +++-------------- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c index dc0fb7a..054e919 100644 --- a/arch/arm/kernel/hw_breakpoint.c +++ b/arch/arm/kernel/hw_breakpoint.c @@ -626,7 +626,7 @@ int hw_breakpoint_arch_parse(struct perf_event *bp, hw->address &= ~alignment_mask; hw->ctrl.len <<= offset; - if (uses_default_overflow_handler(bp)) { + if (is_default_overflow_handler(bp)) { /* * Mismatch breakpoints are required for single-stepping * breakpoints. @@ -798,7 +798,7 @@ static void watchpoint_handler(unsigned long addr, unsigned int fsr, * Otherwise, insert a temporary mismatch breakpoint so that * we can single-step over the watchpoint trigger. */ - if (!uses_default_overflow_handler(wp)) + if (!is_default_overflow_handler(wp)) continue; step: enable_single_step(wp, instruction_pointer(regs)); @@ -811,7 +811,7 @@ step: info->trigger = addr; pr_debug("watchpoint fired: address = 0x%x\n", info->trigger); perf_bp_event(wp, regs); - if (uses_default_overflow_handler(wp)) + if (is_default_overflow_handler(wp)) enable_single_step(wp, instruction_pointer(regs)); } @@ -886,7 +886,7 @@ static void breakpoint_handler(unsigned long unknown, struct pt_regs *regs) info->trigger = addr; pr_debug("breakpoint fired: address = 0x%x\n", addr); perf_bp_event(bp, regs); - if (uses_default_overflow_handler(bp)) + if (is_default_overflow_handler(bp)) enable_single_step(bp, addr); goto unlock; } diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c index 2f57551..722ac45 100644 --- a/arch/arm64/kernel/hw_breakpoint.c +++ b/arch/arm64/kernel/hw_breakpoint.c @@ -655,7 +655,7 @@ static int breakpoint_handler(unsigned long unused, unsigned long esr, perf_bp_event(bp, regs); /* Do we need to handle the stepping? */ - if (uses_default_overflow_handler(bp)) + if (is_default_overflow_handler(bp)) step = 1; unlock: rcu_read_unlock(); @@ -734,7 +734,7 @@ static u64 get_distance_from_watchpoint(unsigned long addr, u64 val, static int watchpoint_report(struct perf_event *wp, unsigned long addr, struct pt_regs *regs) { - int step = uses_default_overflow_handler(wp); + int step = is_default_overflow_handler(wp); struct arch_hw_breakpoint *info = counter_arch_bp(wp); info->trigger = addr; diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 2ce2fbc..d5ff0c1 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -1345,8 +1345,10 @@ extern int perf_event_output(struct perf_event *event, struct pt_regs *regs); static inline bool -__is_default_overflow_handler(perf_overflow_handler_t overflow_handler) +is_default_overflow_handler(struct perf_event *event) { + perf_overflow_handler_t overflow_handler = event->overflow_handler; + if (likely(overflow_handler == perf_event_output_forward)) return true; if (unlikely(overflow_handler == perf_event_output_backward)) @@ -1354,19 +1356,6 @@ __is_default_overflow_handler(perf_overflow_handler_t overflow_handler) return false; } -#define is_default_overflow_handler(event) \ - __is_default_overflow_handler((event)->overflow_handler) - -#ifdef CONFIG_BPF_SYSCALL -static inline bool uses_default_overflow_handler(struct perf_event *event) -{ - return is_default_overflow_handler(event); -} -#else -#define uses_default_overflow_handler(event) \ - is_default_overflow_handler(event) -#endif - extern void perf_event_header__init_id(struct perf_event_header *header, struct perf_sample_data *data,