From patchwork Fri Oct 27 13:16: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: 158923 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp595879vqb; Fri, 27 Oct 2023 06:17:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGK4Sl8tMFBKfTw7hi0a3RtrDz3/sZ1Gd3VomErXklCMUQkzxxmc1CU3I1EU+lVHnQb7YZO X-Received: by 2002:a05:620a:4116:b0:775:9040:cc69 with SMTP id j22-20020a05620a411600b007759040cc69mr2469486qko.60.1698412626721; Fri, 27 Oct 2023 06:17:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698412626; cv=none; d=google.com; s=arc-20160816; b=HxnSnoBWVcQkv7zmURoVDm5tSvvV2yH+/d6Vtm9HQ8r9PvJnzR8F11x38zLAVupKTQ PJmkk8Ozb90jLV+Mmi4u6pnUuyFRDkYSO+0OTcvZ5MwWikBgQIaFFuiUwg4kR2p7v5Wx sYaRfuc3c/uH3Z/OKAPgByHDXU8sbJACJLll9OLvoZ/s84hiQNZ7gR8PrGIVMVV/g5BB qeIkJLcLvzaArQPBJRz0J+i35Z2JNOdz0U+pvEBttAAo9Mavpcu/VY0pvNl4cVm75qe9 B0u/4G8nJz1z20ZwXjyOxLNg94o0Z2o9W2RiquA+NWUBt8C8JetFucixsjbPuKOAXgSS WBpA== 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=jwt9hayn6vPrZcnYrZKtCafofLuWqxGIW6u1vLVnfqw=; fh=hNrfQAbYh3Z2DJEENGJHk2DI4zZ1Z/35CV7+DFUZfaE=; b=H6u3snstKBC4oKELWLoF7vsZhTu3+a6BDnczNs9xdt6V7F7e9TE+mJPzoqvw1JDEmt c+ZDDEoOslKmG0H1uZJXyAVzpV8NcvFyA1L3bGeOPklXZzxJPme4GOOA6hviB5gHsHAv CodxGRVzs3iAaoCHi76mg5b4Hu5qggj8PqKau9cZZuThMUUPbh7sfj0Ud0Yv7S7ktAvI 1qY/dVmDcgkzNyXDC3XbDIgTZ7qsdsY7jVrX39Ywic3Mt1JdrBTLhfx2EaEEtfk1VTeJ MXlGH0yUDYi4VD88hVvroGlbOnP8j4fLChZjGAIsYgNVA3gv+e0AV+Vcs/+CpaEd5Dto FsSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="Iwgz/+oK"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id j11-20020a05620a410b00b00778ed931086si652083qko.631.2023.10.27.06.17.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 06:17:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="Iwgz/+oK"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 65C38830C336; Fri, 27 Oct 2023 06:17:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345875AbjJ0NQ6 (ORCPT + 25 others); Fri, 27 Oct 2023 09:16:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231305AbjJ0NQz (ORCPT ); Fri, 27 Oct 2023 09:16:55 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17B25C2; Fri, 27 Oct 2023 06:16:52 -0700 (PDT) Date: Fri, 27 Oct 2023 13:16:50 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1698412611; 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=jwt9hayn6vPrZcnYrZKtCafofLuWqxGIW6u1vLVnfqw=; b=Iwgz/+oK17eCxS4aiBIBOsriJEXa5rwVGqszG7FwC2Mwz4BJSgJwMRjEEOzPcfjiVzaV0J hoUpqDhTEYtqIgn8l8EIx3JPmMOiF8wB5zLnEMFkxkH0nd1efvlRDy8kjKPvkfHlfrJSbO xU3KKhQC7445PmCZXXS+2k8ToM93S5FposJhKCflZZ/vmQjRH25/laXLKJnfRZLNbhy1MI uWhdW16zKxgfDijveNj6/e1qSI9fZqX3pwuGhAS7pzffktB0zwwgKGOATSNbZFoEe94F46 L+OVCwS+ArfQUH/uruo1PyL/5qNdZ+EFyTYUXjUR19Bq7jwshrzEBwsUX0he7A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1698412611; 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=jwt9hayn6vPrZcnYrZKtCafofLuWqxGIW6u1vLVnfqw=; b=s35mDTwvw0LlKVIdhgporScUKzdR1r+raO7yMW1v2UlZxqv+FbLgGQJd5SE95eSu5GBoeV v4cA8afz2anyfEAQ== From: "tip-bot2 for Kan Liang" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf: Add branch_sample_call_stack Cc: Kan Liang , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231025201626.3000228-3-kan.liang@linux.intel.com> References: <20231025201626.3000228-3-kan.liang@linux.intel.com> MIME-Version: 1.0 Message-ID: <169841261085.3135.9502675795859035116.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 27 Oct 2023 06:17:05 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780759936330402229 X-GMAIL-MSGID: 1780914718634126974 The following commit has been merged into the perf/core branch of tip: Commit-ID: 1f2376cd03dd3b965d130ed46a7c92769d614ba1 Gitweb: https://git.kernel.org/tip/1f2376cd03dd3b965d130ed46a7c92769d614ba1 Author: Kan Liang AuthorDate: Wed, 25 Oct 2023 13:16:21 -07:00 Committer: Peter Zijlstra CommitterDate: Fri, 27 Oct 2023 15:05:09 +02:00 perf: Add branch_sample_call_stack Add a helper function to check call stack sample type. The later patch will invoke the function in several places. Signed-off-by: Kan Liang Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20231025201626.3000228-3-kan.liang@linux.intel.com --- arch/x86/events/core.c | 2 +- include/linux/perf_event.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index 40c9af1..0905064 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -601,7 +601,7 @@ int x86_pmu_hw_config(struct perf_event *event) } } - if (event->attr.branch_sample_type & PERF_SAMPLE_BRANCH_CALL_STACK) + if (branch_sample_call_stack(event)) event->attach_state |= PERF_ATTACH_TASK_DATA; /* diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 7897ef0..ac1a59c 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -1144,6 +1144,11 @@ static inline bool branch_sample_counters(const struct perf_event *event) return event->attr.branch_sample_type & PERF_SAMPLE_BRANCH_COUNTERS; } +static inline bool branch_sample_call_stack(const struct perf_event *event) +{ + return event->attr.branch_sample_type & PERF_SAMPLE_BRANCH_CALL_STACK; +} + struct perf_sample_data { /* * Fields set by perf_sample_data_init() unconditionally,