From patchwork Wed Jan 18 11:37:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 45203 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2304902wrn; Wed, 18 Jan 2023 04:20:38 -0800 (PST) X-Google-Smtp-Source: AMrXdXvWQT10nFqg3FbJAKYLsyy61/1POvGs5iccDXKsAjldY7tcBGhyENOldCJfLkGqKob5gifG X-Received: by 2002:a17:906:3a97:b0:86e:bbdf:95c5 with SMTP id y23-20020a1709063a9700b0086ebbdf95c5mr6770245ejd.26.1674044438337; Wed, 18 Jan 2023 04:20:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674044438; cv=none; d=google.com; s=arc-20160816; b=DoEu5h0oix2Prg+rw2ylJLcFKifbGKkeLcHV8OwU1P1ZVuk8UWEPP/EZHYYOSvp6Le faS4mMh6wr8HQRnN01Ax94OZWwgs//KvepgpboDmL6uH0n03kkvRcTbammODHlNL/uie BDRBw09AZP4NhQSjB8qX2vDY9qdc3ebracJkynWN+wIpnc4RiH4rL78ajozEcDZl6MSP eWTgutiAzsn5VFw85WQD6BENWFcigNIvfzoft4Fyj2Q75V+A1m/TP41RH/ezr8qp+mSx YvD0fJ/7vOKtdQW6SW2QEdaU4d+EVQRqKqtHbMplPkLKEINq5nQZMcqxT/kuRtqtSs6f NQ5A== 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=zVrowPVlkqAmIujgyVf+EEgLijVC+lYFOBUR5Zwa8wE=; b=mcmCcz6qRtjlT0yFNemwfv87PfKvBjAfgSfGgq7BgV/+D7QW9zXhD2VGj4Lk3+2tjz 5k5A0caNMlqcC4EMmT71z/6Q7kFAeN+hq08gwc0DbEMMrxFVPUgM8r3deky03y5FRvmN /wVw/fwAb6Rp6HQTJZ2dAo/SeGErde7DdiYpk8BSWH4kbYpsYWL+CT05BnaCYcPUye2z 0RvpTLlfmSLHa6NorsQ4m/P1jB46a8+0hysfsiwhy1kTbWcLzdMS2dkEehLksDfrS48g ntLW47C4Th/6M//q8BZDC0aQUVb3vSlnFLzQN+EZD1mchXMztBN1DSJYJ5IKWwDIv9di /tAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=LaAR433F; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=SaVgS1kw; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hr25-20020a1709073f9900b0087577d15839si3633936ejc.976.2023.01.18.04.20.14; Wed, 18 Jan 2023 04:20:38 -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=@linutronix.de header.s=2020 header.b=LaAR433F; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=SaVgS1kw; 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 S230215AbjARMQl (ORCPT + 99 others); Wed, 18 Jan 2023 07:16:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230222AbjARMQG (ORCPT ); Wed, 18 Jan 2023 07:16:06 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD69E875BB; Wed, 18 Jan 2023 03:37:53 -0800 (PST) Date: Wed, 18 Jan 2023 11:37:50 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1674041871; 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=zVrowPVlkqAmIujgyVf+EEgLijVC+lYFOBUR5Zwa8wE=; b=LaAR433FVGITqKJYmekkmjNcvfI1S71MLXcc0nSYe0NW8cqHld8YGIkiG607o00+p6eEL8 FbBFc3mUqwy98e5YmUZUbKzYh73QBLr+TpGlRd+8mfWYWUOtbobnvxcFfSKXiKiUtxMk9+ OZ0cGKIUp1KxZEZQmqnN/TaSAeVZo7VTUpNmO51eC998Pn9oLsiQfNs8QJUYXXpDjX5uAU CioCQZw4+cd7rBlmAK0CF+9qJSEK2m56UKmXzjs2prnqgrggqPRXROAO4LfjzJ1ZvtgS7+ bscJC5coz/JPO+lefgf3HPUH1UIjiE52/DTt0vGuHCChX2Z9ciqdQUJqeMVskw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1674041871; 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=zVrowPVlkqAmIujgyVf+EEgLijVC+lYFOBUR5Zwa8wE=; b=SaVgS1kwa/S5KKkZJ9k8sNxMjkq1dfcRrEV4CQ8I7l2B2pITrGVv1lmEzF25Es3BfIDe4/ zZZPwhKSh8XAbVCA== From: "tip-bot2 for Namhyung Kim" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf/core: Call perf_prepare_sample() before running BPF Cc: Namhyung Kim , Ingo Molnar , Jiri Olsa , Song Liu , Peter Zijlstra , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230118060559.615653-9-namhyung@kernel.org> References: <20230118060559.615653-9-namhyung@kernel.org> MIME-Version: 1.0 Message-ID: <167404187070.4906.11315546110666794035.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755340379408810842?= X-GMAIL-MSGID: =?utf-8?q?1755362820724697482?= The following commit has been merged into the perf/core branch of tip: Commit-ID: 0eed28220598cd990d094b7b9f8c832c425080c0 Gitweb: https://git.kernel.org/tip/0eed28220598cd990d094b7b9f8c832c425080c0 Author: Namhyung Kim AuthorDate: Tue, 17 Jan 2023 22:05:59 -08:00 Committer: Ingo Molnar CommitterDate: Wed, 18 Jan 2023 11:57:21 +01:00 perf/core: Call perf_prepare_sample() before running BPF As BPF can access sample data, it needs to populate the data. Also remove the logic to get the callchain specifically as it's covered by the perf_prepare_sample() now. Signed-off-by: Namhyung Kim Signed-off-by: Ingo Molnar Tested-by: Jiri Olsa Acked-by: Jiri Olsa Acked-by: Song Liu Acked-by: Peter Zijlstra Link: https://lore.kernel.org/r/20230118060559.615653-9-namhyung@kernel.org --- kernel/events/core.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index 4aa73ed..380476a 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -10356,13 +10356,7 @@ static void bpf_overflow_handler(struct perf_event *event, rcu_read_lock(); prog = READ_ONCE(event->prog); if (prog) { - if (prog->call_get_stack && - (event->attr.sample_type & PERF_SAMPLE_CALLCHAIN) && - !(data->sample_flags & PERF_SAMPLE_CALLCHAIN)) { - data->callchain = perf_callchain(event, regs); - data->sample_flags |= PERF_SAMPLE_CALLCHAIN; - } - + perf_prepare_sample(data, event, regs); ret = bpf_prog_run(prog, &ctx); } rcu_read_unlock();