Received: by 2002:ab2:7041:0:b0:1f4:bcc8:f211 with SMTP id x1csp44893lql; Fri, 12 Apr 2024 03:16:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV0oIRpQwBLTay4IKBdnMTf4bXoJnKZlEO6Wth6ZkmiHcIjrxjpzYzrp6iSBdGOh+VpI8MykfE1KZe10SMIiLT9Nt7nKXpSLeZHRHDrYA== X-Google-Smtp-Source: AGHT+IH0YOjVaKEQNbtdOCf3qv31U9HHbSsOUBZxsYfEWry65xwHNar06/luSdtKXomgJ0sHt3qo X-Received: by 2002:a17:902:d2cf:b0:1e4:2b70:2f17 with SMTP id n15-20020a170902d2cf00b001e42b702f17mr2277162plc.52.1712916968227; Fri, 12 Apr 2024 03:16:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712916968; cv=pass; d=google.com; s=arc-20160816; b=RDln1/5izhgAzUwtfGl/kOioC2j4Xg6wVZ32f7Khp/mVGwf8/EPKCe0sPE2Fd+0lPx 1i0/Asmn5/UKW2es/Yf7ZJP+1Kakp105ECKjdY3j5OQLMfkHsDD8sVn7mKwqXqlpiJV8 fAGNAvwfTlULYnQbzH7RUKxe+KoHgSSkrvXISEktD45Uy0P98l89P/3JjBtq1ipLR0ud SN40Rg+ViSWRuyIQ+oBYu7zpKjxyrveBO7HQo6WFVwoaeDEAqCmZuEhn+kex1eDBDv3l JEI0c3sRQjW1omFN62CNBfACAXhxFxfw5Rszz3tjubz4unGcPEl2jNYhXfNkyryhwkr5 xjfQ== 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=eSJ6PCd5VkQ7nahH5WRJCH3XFdhG1eWcn/lOpn9ozUU=; fh=Hv+ZKh0o9cfbAMIcYR5R8hCbDBNF1A+3dVi1JHM9jXY=; b=gxur3ueajex1c09Ij7DaF9iN9KrghyrxIvQ/xh8GVYns0WkZloUfDRyRiucH0o+QoN y+KoEozkOAMWd9bLu5ANW9jp7oojbmBkrXoL7S+qjHcdJPHoSU+fG7GhV9Z9ur++O4wE UtQW5P2eqNmOSDItWGlQQMGHrSiCQHTzjunXUs+wh+4wo8W/zPjmtqaOYxMylfJcbYxl TDcWMpZDlhtBHh0I5Y+sWC7EYKhOtGesGyxJDZ86SzwF5Wh6hE3HufeYffiLr1EK2X22 EnHk8LMbWwI20aJ5581szp4E0LtqJwxJ+SwdE+Xy2w2jV7WBlPa3qAlzG5VeBAtpkvFY LqAw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="mG/TtnUT"; 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-142457-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142457-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id b3-20020a170902650300b001e54fde0130si2805460plk.405.2024.04.12.03.16.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 03:16:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142457-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="mG/TtnUT"; 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-142457-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142457-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 39B70B25D8C for ; Fri, 12 Apr 2024 10:03:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 47A4153E1A; 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="mG/TtnUT"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="NOr7y53a" 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 D2345524DC; Fri, 12 Apr 2024 10:03:25 +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=1712916208; cv=none; b=iKHSyXQH+hZM9imqb+u9/OT4zReNjS4YX7mpEtSGH7g2ozBtel7rfMFm4pySZfg/et5K2b+HIttB0sPt1QvjkTyQ2bwaoh9+n/UO+5s+lvALZKSYQMDjn0co+gK/oiSNPSlZFHVL4UtNpA/oa/PFEbSL5mj2lg8NKDje9su2qiQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712916208; c=relaxed/simple; bh=bEl3kUTpvDa4VaEDle7B8um9qQie+8Rg3DQQlt/FmUo=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=jxoQGx7zO5ku2A81if30ulVfWX9U/U4848RBcRPiV+/5hoMdoGJQxyXGTI7ing5s7nPyL4+zwhgTPhXJoH2TszOkJjr+G6bMAjLnRMfZ4Efdm/opE5sLRvLlpObmnFRDk2CwZL/r/450sV8uAH2ZfZPYaO9blBocBe6w2pCMgPE= 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=mG/TtnUT; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=NOr7y53a; 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:23 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1712916204; 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=eSJ6PCd5VkQ7nahH5WRJCH3XFdhG1eWcn/lOpn9ozUU=; b=mG/TtnUTRfJybUn2YJemYZVP/a5w5GR3VhvZPwbLVvrw6VS0Yb+BV+kuxavO+a8qBhWq2s UQWQ9vicw5GED8jketOiVDBgYmrNlqSw1iW2Zy91K3jzBbKRXb1Jzb/CSvZNsMBPyyJwFs hzB3I4GYcfBJG3N4j479Zq9daq9R41tZPb3OMkjW1xbZ0in85tRrB0auWpa7EAmrwv/J3Y Jg3FXCBJBHvLxhYeh2SiyQCBU+jYVRSNFshgvEeZLMFDbovG35Gg0MVYkVhfHd6qwx3t12 NtaPmgxZQbBhtq7U/VEetQ7+kMvSrnI6nsJPM6IPaOe+ySZFw4xSSdxcAywUEQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1712916204; 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=eSJ6PCd5VkQ7nahH5WRJCH3XFdhG1eWcn/lOpn9ozUU=; b=NOr7y53atvqb6HGacNnpJxa4q7DMaORNh22mhuDJ5pmp2NswBaOpyBe0JBXxSU+zLyaETm A1CsSCjOzqai1jAg== 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: Allow a BPF program to suppress all sample side effects Cc: Kyle Huey , Ingo Molnar , Song Liu , Jiri Olsa , Namhyung Kim , Andrii Nakryiko , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240412015019.7060-7-khuey@kylehuey.com> References: <20240412015019.7060-7-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: <171291620346.10875.14979532789812701380.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: c4fcc7d1f41532e878087c7c43f4cf247604d68b Gitweb: https://git.kernel.org/tip/c4fcc7d1f41532e878087c7c43f4cf247604d68b Author: Kyle Huey AuthorDate: Thu, 11 Apr 2024 18:50:18 -07:00 Committer: Ingo Molnar CommitterDate: Fri, 12 Apr 2024 11:49:50 +02:00 perf/bpf: Allow a BPF program to suppress all sample side effects Returning zero from a BPF program attached to a perf event already suppresses any data output. Return early from __perf_event_overflow() in this case so it will also suppress event_limit accounting, SIGTRAP generation, and F_ASYNC signalling. Signed-off-by: Kyle Huey Signed-off-by: Ingo Molnar Acked-by: Song Liu Acked-by: Jiri Olsa Acked-by: Namhyung Kim Acked-by: Andrii Nakryiko Link: https://lore.kernel.org/r/20240412015019.7060-7-khuey@kylehuey.com --- kernel/events/core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index c6a6936..2212670 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -9677,6 +9677,9 @@ static int __perf_event_overflow(struct perf_event *event, ret = __perf_event_account_interrupt(event, throttle); + if (event->prog && !bpf_overflow_handler(event, data, regs)) + return ret; + /* * XXX event_limit might not quite work as expected on inherited * events @@ -9726,8 +9729,7 @@ static int __perf_event_overflow(struct perf_event *event, irq_work_queue(&event->pending_irq); } - if (!(event->prog && !bpf_overflow_handler(event, data, regs))) - READ_ONCE(event->overflow_handler)(event, data, regs); + READ_ONCE(event->overflow_handler)(event, data, regs); if (*perf_event_fasync(event) && event->pending_kill) { event->pending_wakeup = 1;