Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2797524rdb; Wed, 4 Oct 2023 11:41:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH5gGini6n4mwBvTKeFbSAdaq06+ssCCTU4IkAnN6wZRsr1sm3hd36l2qigdUJWY6n+RFOc X-Received: by 2002:a17:90b:3e87:b0:274:755b:63b8 with SMTP id rj7-20020a17090b3e8700b00274755b63b8mr3126950pjb.43.1696444890777; Wed, 04 Oct 2023 11:41:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696444890; cv=none; d=google.com; s=arc-20160816; b=vz1//CAXM272A1FI5tvR1pskDBfdG7p0anzgXZ88yjVAaEmcpJx8ubS7rlqdQWPmVF +MIx5UdYl7Q2/bG4n1SeDdscMhxiSkgnKiQo62MHz6H28qjA7RdiJZ9Ha2xZYfHYWJDT sNL/PyaPvlTXo1EX1JrfLU/6curba5srs63Td+E1gLDzJD+MlrgiBo+USlCrIK3+b8yD GWpDBozPTTowrCH5qAqiN5r8Wxc/hK01AsCm1HqnpMKCNZZiA+v6xKmNUzKIKYR6ev1r siIakLTITJLlvfaj6dMaV9o/VqP/lhsiA2wCgxPat22vA98Vrg2YHGa2oKt8i8dSxsbB vHbQ== 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 Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id m1-20020a17090ade0100b0026b51ae4574si2008800pjv.36.2023.10.04.11.41.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 11:41:30 -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 9CAF981BC2F4; Wed, 4 Oct 2023 11:41:23 -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 S244533AbjJDSk6 (ORCPT + 99 others); Wed, 4 Oct 2023 14:40:58 -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 Content-Transfer-Encoding: 8bit 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:41:23 -0700 (PDT) X-Spam-Level: ** 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, -- 2.35.1