From patchwork Mon Dec 11 04:55:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyle Huey X-Patchwork-Id: 13486659 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 82536C4167B for ; Mon, 11 Dec 2023 04:56:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UzNCt8wbvye9EZn3RS45hxM7XxetY4/GrEcAdM9RBFw=; b=Tu2DkorGmAYfx9 fotAnFfkVVyQgvhvmssnwK0jruG9qiZGDdd40qtVBnMr2z7UtJZlI3P0xZhSpgRGn3PDBI4bjSxud DpSz2nMceuJE9ror6jVUnvFBHvP3OsuNoMz7bWIlSQyygOX9DUlSgfiiIUISo9Ma6NXLZnoUsS4+g cGJ2f/H7HHoGiXNRGsyeF156CUglrM1a3dPMws92G0yokXg693MAb2av25oYohP2qJANCnvqbs8x9 sogkqmX5fpJlxw0dS97bsFSJzh2Wf0WY1oSxtEL/hENSmrn7TAZ+I1GtB2OjNQFl0K6PKaVavy057 2yp8Zb44DZP8edeYyqoQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rCYKo-00406A-0I; Mon, 11 Dec 2023 04:56:02 +0000 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rCYKk-004052-0w for linux-arm-kernel@lists.infradead.org; Mon, 11 Dec 2023 04:56:00 +0000 Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-28865456abbso2802519a91.1 for ; Sun, 10 Dec 2023 20:55:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kylehuey.com; s=google; t=1702270556; x=1702875356; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MD1CGVptJqB75nV04X/vQRYGuHl6l1SpLkm2NuE80OA=; b=JIYu/hxmcobnDCWONFfy1ivSxyKpytjAJZaPyc+XfKsJgYRCZdyKiewfPOCLXrqGKm 7jZl0PtsTTNTr+WQc3Kt02rXzzfzIzjJlh+OL5EhM/ypByIQEZUEHwTqnjsmtRQ3q2ze anOmmNUbvZfV0nbI/rQssbXWCMghVeNN9jgbXCN1doz7Yb7j/7CX5Z9EqmvyDYikQxVi taE4Wh38MRU0BkXhLPhX8QtkqjgfH1Wvfk6PS5qBAB5ndXxfQaBZxIrTxGXePe0CfSOO rehn4Dpe87FUYgkYZ3R5QSXGaDbIOnLMPWF9BgtWL08gpWlOlKBwUWhn1/DExMY3isPi FYyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702270556; x=1702875356; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MD1CGVptJqB75nV04X/vQRYGuHl6l1SpLkm2NuE80OA=; b=pVjYglnF46Ehdafu7wKHs9tFc0Nsc5j6Sm2493ORHU0i2ymS7s85oPBNWRmIb9PWaH TzdVHufvQQYXdV3OjBvhPMCdAq7U58xmsml/LGwvpnCu34Gxda490sz0O0xb7T2zB4e7 IM97oQmd2knU+dghrbe278RwsXF6ukR3KTeSIyR8iZ8f09NI8mvMsMVrCplSD0EWjKFD a83DJ+Kmhx91pys2OKMayucYH+0pGbcs9oC8MkvB/iVUYiIfCoOOzmosv+rfQ3SvQpF6 w5nriCvnpoyibVTrHKLHZ1ARfcGuVywCI93RmkBRZikPq5twCjPFiQotlokgY+P4gurV a3lw== X-Gm-Message-State: AOJu0Yx41YHEAPxd50U6evNgmlro9Gyc1iuXCblyV8Ltgnx1+BAJ2N6f IWMdPMCnM6c9fPMdLSCWQEF1mQ== X-Google-Smtp-Source: AGHT+IFk4Rw49zHj089ze8JCHt9tGAvA1DX6jp40Y61tz9veBn8RRGtYiMdt7+m5TnCHgq0Zz4xZqQ== X-Received: by 2002:a17:902:da89:b0:1d0:6ffe:1e63 with SMTP id j9-20020a170902da8900b001d06ffe1e63mr2161568plx.70.1702270556361; Sun, 10 Dec 2023 20:55:56 -0800 (PST) Received: from zhadum.home.kylehuey.com (c-76-126-33-191.hsd1.ca.comcast.net. [76.126.33.191]) by smtp.gmail.com with ESMTPSA id e11-20020a170902b78b00b001d2ffeac9d3sm3300623pls.186.2023.12.10.20.55.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 20:55:55 -0800 (PST) From: Kyle Huey X-Google-Original-From: Kyle Huey To: Kyle Huey , linux-kernel@vger.kernel.org, Andrii Nakryiko , Jiri Olsa , Namhyung Kim , Marco Elver , Yonghong Song Cc: Robert O'Callahan , Will Deacon , Mark Rutland , Russell King , Catalin Marinas , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Ian Rogers , Adrian Hunter , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH v3 2/4] perf/bpf: Remove unneeded uses_default_overflow_handler. Date: Sun, 10 Dec 2023 20:55:41 -0800 Message-Id: <20231211045543.31741-3-khuey@kylehuey.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231211045543.31741-1-khuey@kylehuey.com> References: <20231211045543.31741-1-khuey@kylehuey.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231210_205558_333343_8F6AE419 X-CRM114-Status: GOOD ( 17.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Acked-by: Will Deacon Acked-by: Song Liu --- arch/arm/kernel/hw_breakpoint.c | 8 ++++---- arch/arm64/kernel/hw_breakpoint.c | 4 ++-- include/linux/perf_event.h | 16 ++-------------- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c index dc0fb7a81371..054e9199f30d 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 @@ static void watchpoint_handler(unsigned long addr, unsigned int fsr, 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 35225632d70a..db2a1861bb97 100644 --- a/arch/arm64/kernel/hw_breakpoint.c +++ b/arch/arm64/kernel/hw_breakpoint.c @@ -654,7 +654,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(); @@ -733,7 +733,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 312b9f31442c..7fef6299151b 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -1321,8 +1321,9 @@ 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)) @@ -1330,19 +1331,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,