From patchwork Wed Oct 4 18:40:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liang, Kan" X-Patchwork-Id: 148460 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:254a:b0:403:3b70:6f57 with SMTP id hf10csp333453vqb; Wed, 4 Oct 2023 11:42:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IERrUw28ZUiRPT/yviy6LoHbuJ0DkTjwlcpFbC2ZeK9xzroUD0KcEQXk60xRuByBXTI5fuz X-Received: by 2002:a05:6808:159c:b0:3a8:512a:41b8 with SMTP id t28-20020a056808159c00b003a8512a41b8mr4028322oiw.21.1696444929371; Wed, 04 Oct 2023 11:42:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696444929; cv=none; d=google.com; s=arc-20160816; b=NL3f/nAJIWKv4tmDmU+WzXXjrFZVvHE4j2JAispG45eaac6zJd37KViB7X162Uo4hc 0t+IkDKzQIjphqFcm1ACmEYlHTI52X3o6j4gLGfAvUET/ZYx/REpsh8g88wfuI5MZxk5 bB3JCgvQdKB6l8Xm9FT7cFjGmU9z0AFhAQrKRIFFiguXQCu5oEfxUjFT1UQ5vTWUCmli 4d3+hXeQ1M9aH42OzOWWxBNqoZNJQLIXz39iPiVenBinOSRvPkTc7XWPOaRibIwR7Var v5koLmXyhxh5nX+xOaWs17jb76FIOdoU122HkVBfJWJatGdOmBI5y2+bixs1E833yGxw r6GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eupAEjouBZFxJSyzCxrk/2JGtgQfWlao0fa+WaRSzN0=; fh=PWMgxgslqMjOtye8I2qVy8I5pPekyJtpFTusQltnkEg=; b=MAA0kXp0Ly0IJtqRAzuemISB55dSPUl3B423tkck9aDo7qFfhgn4caJj1T7BHzb6v0 VuJjJpQA1YwrZWgRmySP3sPwIlntWqrtjjDMby+/SuxGMJxZlds4ISP1aZCgzoSBOI+a HDgWGxr30hOnrRAEymNgMQzQyIcGnRxLv34e+2A27t9ib4Ne+eIcFiOgiTm0JqkiHXZE qyVyNqtAgprOB6AViL5zrRCziDGFoV8gbk5emLctSBw5aeKqxho6wqcPKPFXDcXB6sIn pTL6+hWupk2JPFdwP2mW61w3OOp/JqwRgO67YjLXvFtM3Q4Sc96FR7m9k7Rq4djdLE9I gkgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Ril4Qlp3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id o15-20020a656a4f000000b005778df5647dsi4826186pgu.401.2023.10.04.11.42.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 11:42:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Ril4Qlp3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 9788881BAA60; Wed, 4 Oct 2023 11:42:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244534AbjJDSk7 (ORCPT + 19 others); Wed, 4 Oct 2023 14:40:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243780AbjJDSku (ORCPT ); Wed, 4 Oct 2023 14:40:50 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B6B9C6 for ; Wed, 4 Oct 2023 11:40:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696444846; x=1727980846; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dXb7QKe6eBS32qydfKpLV9J0fiI9elfImuMMvPKmnxA=; b=Ril4Qlp3b4awbnLOPv3BrZQbzv/K/Up53x3S8/MtOhMRq8ZV7IvCZ7GV lg48U9gBsqaRB/7XYl+SjMq1I/cjmNehzJ/g3EV2uupgdjJDbUXo6VwEq 597aYitdH6m1jDL/e2Bu+LpC13Bnw1YNA+gxwvR3/Ddee+7W3uK9YZsaM PgDYj/3s0rLVKTYmC608Sogs0mMMcvlZ1vwkQeLhJDWZXKNd7wWIGUUGI evOo0SHNsr+9BkP93oasdQ1Yb+D7B4xsIXDZno0hC3ZloTzlDb18AcU46 jCM/e2qkx5V/X8fl6oqI/I8dsOT7x8pg0o3Niqh6Kz2F7tQbg0VMu346q g==; X-IronPort-AV: E=McAfee;i="6600,9927,10853"; a="469537687" X-IronPort-AV: E=Sophos;i="6.03,201,1694761200"; d="scan'208";a="469537687" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Oct 2023 11:40:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10853"; a="786625996" X-IronPort-AV: E=Sophos;i="6.03,201,1694761200"; d="scan'208";a="786625996" Received: from kanliang-dev.jf.intel.com ([10.165.154.102]) by orsmga001.jf.intel.com with ESMTP; 04 Oct 2023 11:40:42 -0700 From: kan.liang@linux.intel.com To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org, linux-kernel@vger.kernel.org Cc: mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, namhyung@kernel.org, irogers@google.com, adrian.hunter@intel.com, ak@linux.intel.com, eranian@google.com, alexey.v.bayduraev@linux.intel.com, tinghao.zhang@intel.com, Kan Liang Subject: [PATCH V4 3/7] perf: Add branch_sample_call_stack Date: Wed, 4 Oct 2023 11:40:40 -0700 Message-Id: <20231004184044.3062788-3-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20231004184044.3062788-1-kan.liang@linux.intel.com> References: <20231004184044.3062788-1-kan.liang@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=2.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Wed, 04 Oct 2023 11:42:06 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778851438315215508 X-GMAIL-MSGID: 1778851438315215508 From: Kan Liang 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 --- No changes since V3 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 40c9af124128..09050641ce5d 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 9ad79f8107cb..826d2d632184 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -1143,6 +1143,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,