Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2819628rda; Wed, 25 Oct 2023 13:17:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGUCD9HKR63TASzwaUozt7cm9iGMn+SviAe+DYGxd416SHWKShsIVNyHM00VsvM3Nxur6MN X-Received: by 2002:a25:4e86:0:b0:d86:2cd4:c443 with SMTP id c128-20020a254e86000000b00d862cd4c443mr15531894ybb.21.1698265020923; Wed, 25 Oct 2023 13:17:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698265020; cv=none; d=google.com; s=arc-20160816; b=Jr5OUkDU2BcLrna1x/ScDQTvjQK8+uj2MSk/PLIPQJqsyBk1R9izhU8+fYSWE9kFHk ghuSpeYj35BEO/hAZlfu6Sh2nZufxS7oiksnczUxNcb8/VOprtSzxiWyhE7qO5JCbM7L aDYm1uE8cQaEVsL+f6dXADT7tVw5MKqtV9/PV/lb3rzzyL+cEUnKZBNQba1nvkKTJoBx vjvWDeOVH3kftVfOJKZwZWtOAEqSY2RpISIYm0X1/3dLGORJ5kqcX4dS4K2MA4htaLe7 gJx22wlWy/fFwcMKbYJ6R8sZE9JdrRA7LCMhhxasmBGnl1bGPvZikNXE/CN/wC2F2BGD GOpA== 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=IRZhNumo4lzN/HaoA8nuitzhwa3NRlwQewDoOwEZs6Q=; fh=PWMgxgslqMjOtye8I2qVy8I5pPekyJtpFTusQltnkEg=; b=ifx5JQAXtfAh3Vn1s1oOJE7D411Ml2pBgkMLuWRkzQFjKAW1ty9VzEIan5mDIA+JAP dLsPbi0oJsfgLaZ6gS2/5cCC3xDVo+zxL6FdvH7oQqIRm95phmpgMoHFFM03XTBqDBX7 UWbXVM7K9Laja+gxd+CMgtMGlRucJJ/U1Ero0XPV99ZjpQRjmLXDFoxfVtzawdmkiEUi y47JFAItEti0hF03VZ4ji0kX8kxMyjBUBnzn4KF2PSlKXD0IL2nuQk3n6yv/nL1jB8Uh vDDT9M36bSxKT8f6T4209orOIgYIpm3eXH8x70ZVt3QTQtmIa+co6SFdUsibRdJnvtO5 eJdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KQNd9ANj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id h9-20020a25d009000000b00d9a5aedd594si11683276ybg.234.2023.10.25.13.16.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 13:17:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KQNd9ANj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id E6BDE81D316D; Wed, 25 Oct 2023 13:16:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234673AbjJYUQ3 (ORCPT + 99 others); Wed, 25 Oct 2023 16:16:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230010AbjJYUQ0 (ORCPT ); Wed, 25 Oct 2023 16:16:26 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A694C12A for ; Wed, 25 Oct 2023 13:16:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698264984; x=1729800984; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9gZSBMskh2hZ8fcjIkrsOhLkgVvk84ph0SNH00MJChU=; b=KQNd9ANjtgEbPd+T3BhF6MIcJC17ThUxxp4ixMTNqE38w+LYtrsuDUdv Vu9kYPR94samjN4R1yh8aO0xZZ5bcMfxPFs74/2p7xaOblhIav1pVsYxl fE+9HDqIZ7taO7+HipHraiWehZGq+oTmNY4sBkDamTpk2GuRt/SzL3QMv 07bpmSYMcUtFNj8lWhGXz6xu6FRhjyuVvkMRUfcvCQcXXZhFOLg/6AQ7+ sKXqT8wq2v8OYQt5JgG4uqP9udm9YBoVwNZO5Y9OGQ7mcvny2/VMSKEb3 LLyqohm/j7VeeEnG1kRbqiGi6CCks+abiCmpJw4NuICWrbH/PPAvAbbMH g==; X-IronPort-AV: E=McAfee;i="6600,9927,10874"; a="377758207" X-IronPort-AV: E=Sophos;i="6.03,250,1694761200"; d="scan'208";a="377758207" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Oct 2023 13:16:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10874"; a="752459068" X-IronPort-AV: E=Sophos;i="6.03,250,1694761200"; d="scan'208";a="752459068" Received: from kanliang-dev.jf.intel.com ([10.165.154.102]) by orsmga007.jf.intel.com with ESMTP; 25 Oct 2023 13:16:22 -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 V5 3/8] perf: Add branch_sample_call_stack Date: Wed, 25 Oct 2023 13:16:21 -0700 Message-Id: <20231025201626.3000228-3-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20231025201626.3000228-1-kan.liang@linux.intel.com> References: <20231025201626.3000228-1-kan.liang@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Wed, 25 Oct 2023 13:16:52 -0700 (PDT) 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 V4 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 7897ef066027..ac1a59c1f252 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, -- 2.35.1