Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp6383472rwb; Wed, 18 Jan 2023 04:38:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXtLFDXAQBiYikK1Ty795caT0Cu/Qo9Qdk03XoRRNRML3pZ1to3N+ZSaTytOfU9+kZkVUOBK X-Received: by 2002:a17:90a:bb8f:b0:226:cdcf:da83 with SMTP id v15-20020a17090abb8f00b00226cdcfda83mr6852479pjr.46.1674045525676; Wed, 18 Jan 2023 04:38:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674045525; cv=none; d=google.com; s=arc-20160816; b=O+vabDpHZwnYlAlrN7Ayyx16IycO0mzUp81lNpqIKG/8xgaXWMeR7izthPbwFWVbgm wO+NkGWThveeRyNou1IV3YKfOpBGOqyMAq52tFU8Wyy/15aAJ1ycFuvz8fDjkbtg3SYG vjWZtXFcKXtcjGUxaJe0Z7wAKvZktvCt17ylgZ2ecC8+UqmiG9c78PpNpp8JrICK+69v tzOZYQSkLLuU7DkQO6ZTCBT0tTBAxesIiQ7UgyaEOzFGwBqYFmfSCkjMUd9mRLp1Dnyx SB6LozVMOrJ2GTnePUej0Jyqv5Zm59kKQ3kVJyGsBOUj/rtIiviOb+1/CveRs93c/HVd /RLQ== 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; 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 mw8-20020a17090b4d0800b0022960cd9da1si2203718pjb.63.2023.01.18.04.38.39; Wed, 18 Jan 2023 04:38:45 -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; 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 + 45 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 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 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: 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();