From patchwork Wed Oct 25 20:16:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liang, Kan" X-Patchwork-Id: 158263 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp213638vqb; Wed, 25 Oct 2023 13:16:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFO0SN58WOxgMUgkg22iqzpJ55PH/kpDPUltBMRSQBHmG62AgRBljS2FUTTNUBkyl+kRJAk X-Received: by 2002:a25:6802:0:b0:d9c:e3ed:2559 with SMTP id d2-20020a256802000000b00d9ce3ed2559mr17005026ybc.65.1698265015130; Wed, 25 Oct 2023 13:16:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698265015; cv=none; d=google.com; s=arc-20160816; b=cOQfRV31hR9oV8nzYWUWnyrqiTDIyNzalc/6SVFkv0Yot+3wriUcjpeId/MxD29l3X bKeiMg22QL2UBrEe7H3DplcsPGLjtbvGRiw/RKivVhWtpB2EElTgITIwkb/bsHa2EKBn A2/NLwF/liy6QhSH1DZNHlx1Bjxl0N/v2DWXdCGvBgv8069tbAmlYWgS0I13b7M8d0Wj ANE1w+8j6YVHWMecqjBR3c/rx+G5lm5Oy0ZsCl7l0h+eAVVH9SEQ6oIEXs2OO5y42kl9 WNgWkgtxydh32zLyr/HUvUPQc52ZcZ7ufYAf9iSTS+768q2DPvnh+FnAG9/9KoIn/O5s C/sw== 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:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id u26-20020a25f81a000000b00d9a4691cf30si11980243ybd.82.2023.10.25.13.16.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 13:16:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; 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:4 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 howler.vger.email (Postfix) with ESMTP id D2F4D8022AB1; Wed, 25 Oct 2023 13:16:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234735AbjJYUQ3 (ORCPT + 25 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 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 howler.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 (howler.vger.email [0.0.0.0]); Wed, 25 Oct 2023 13:16:46 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780759936330402229 X-GMAIL-MSGID: 1780759936330402229 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,