Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp319917rdb; Sat, 19 Aug 2023 03:13:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEhHrmFO9hyRs1NyQKpUFuZTdIWq9opIejRpDV4WzuvXmLcwM/G8Q52fYmrQ9i3J4NfGWL4 X-Received: by 2002:a17:903:41cf:b0:1b8:1591:9f81 with SMTP id u15-20020a17090341cf00b001b815919f81mr1969090ple.4.1692439996660; Sat, 19 Aug 2023 03:13:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692439996; cv=none; d=google.com; s=arc-20160816; b=v75ie/sp5z5p0pZbCPGjQLHx095M7VbhWV2+fcw/jmoki7oiy1ctM2X+s5t3PI8Fp0 Gz0HghoLIYxBj9EzmTyrkN9QSwpay4ejlNymuaIaHk9eQkUIg6PROkcnnp2bBtq3fEAw /TW8pDF18SyqlCp0mqJGAUkPRxh8Dq2v3c/6jngh6pJ0iGlx/4Xwp4zfCQs0nH6LeD9N Czquv304pFFCW9KJuO0YQOcl43ctibRMR3mrnroAVzIkbiRSPjMBgTwStkytXPmCowEo /oQtSoeEHMNX1m6BialDbYcrUVK6Mf+wPBYO7I2tYZ+OuebQBasZkQe0aPgyIJiHQTQE 8sig== 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=D2L9CFDioIVlN2M0o0pDMzOXAl4kkGhslHoc0coMnxE=; fh=vRd55J7bea2EQf1p5gn/DX1RRTD2+8bc0GIYP08QV6A=; b=e5Plwx6DxCv7z4UZIA9ya/nNZ6XHDoSPRBlkRcKiETt7O4QRVbub3RDuBQZZHI2I97 epPv1xle7I4gkzto2wZL5+fx/aSfb6B+NTmf0E7pBGs0XTeAkb2VBQaonhXJZz3g6L7y cW/xODDPad6Uornb0dWztvjMHlTmTFelxVo+J2Kh46nHpvzcY2nlMllGxPQszwwb/Omr f0dvC4FkQLSf87z5get9WHhbscr92kXzAcfh9n7Yq8s/xeuD57Hi4BM7EUQQQdTM/NDn J/G46jGyR+5cXDYs/c0MlLQXqJ4McZczxiqsX1NoTRrz5ATOHg922ruVZxdWtL4Fya0c D0sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mzQzscVJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id n12-20020a170903110c00b001bb792749a2si3419587plh.146.2023.08.19.03.13.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Aug 2023 03:13:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mzQzscVJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 441823F570; Sat, 19 Aug 2023 01:30:19 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343691AbjHPOhK (ORCPT + 99 others); Wed, 16 Aug 2023 10:37:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343678AbjHPOgr (ORCPT ); Wed, 16 Aug 2023 10:36:47 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 585BB2717 for ; Wed, 16 Aug 2023 07:36: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=1692196606; x=1723732606; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OyKPNhRoXHCMy1Q27SfkblCl7ccMMEKKhLj4ca17UTo=; b=mzQzscVJQWucnsBTaCmZKPlsMwfZwUEF+cpp6Lmq3PLWjwcLi7l4g+AO oEIsuhJWGHqDr8/cKUHLlD1OqwAlbH424DmsocX/ZHfhQqXZrorG24tXS Db5ARBIBW6DfriN25/RHMOGTsbwod168H6vOgPKJ0MoD9KaSFHJ82wm7E gJeSI4+ytI1kh3lLb8GObh194tPgOvT4CmPuiZha6xgITku+sw9rxbqkF gwedDnZvCjiPOQ/DyUHxKoGG2Es3+6QiG8NS9fKNNdjBHP9agnKSz8HjI V6eH8sAY3vKZ7uFmFXWQMQvauMUYeCutKTHEtvGdD2rqoIla3GdOozdZD g==; X-IronPort-AV: E=McAfee;i="6600,9927,10803"; a="352138643" X-IronPort-AV: E=Sophos;i="6.01,177,1684825200"; d="scan'208";a="352138643" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Aug 2023 07:36:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10803"; a="980758848" X-IronPort-AV: E=Sophos;i="6.01,177,1684825200"; d="scan'208";a="980758848" Received: from kanliang-dev.jf.intel.com ([10.165.154.102]) by fmsmga006.fm.intel.com with ESMTP; 16 Aug 2023 07:36:43 -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 V3 3/6] perf: Add branch_sample_call_stack Date: Wed, 16 Aug 2023 07:36:25 -0700 Message-Id: <20230816143628.1885281-3-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230816143628.1885281-1-kan.liang@linux.intel.com> References: <20230816143628.1885281-1-kan.liang@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,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 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 --- New patch 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 2919bb5a53a0..b56e9c3a0cc8 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 c4877924d43c..58ad6745cdda 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -1147,6 +1147,11 @@ static inline bool branch_sample_evt_cntrs(const struct perf_event *event) return event->attr.branch_sample_type & PERF_SAMPLE_BRANCH_EVT_CNTRS; } +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