From patchwork Mon Dec 5 06:44:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 29554 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2097684wrr; Sun, 4 Dec 2022 22:45:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf7Z3qA/Gs9bKiaZ0d+SrIMv4xYlwl1j5ok7D60b40lp70299pfY4w9cMWaQmxTa1g35TAOW X-Received: by 2002:a17:906:65c4:b0:7ad:d250:b907 with SMTP id z4-20020a17090665c400b007add250b907mr67732141ejn.737.1670222746143; Sun, 04 Dec 2022 22:45:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670222746; cv=none; d=google.com; s=arc-20160816; b=B+dCly/2qJ2dxE90kE7Qq8rXSfmaonCHvw5xaS7sMYWvT3HaCpjw8A9MIHSR4CKsLE wPW9s7OoNyd6wjDBrbrGrnbuRFltjOCr2iS3OR786aOXgNqjrTWVcQ7VAiJQNXmn8nhU YP/JANbtAQi3eGx/SWIWxZmA3h6lluCrONlfQ4DXhXP+A+RkyHJLfxgQoeTIEv8h0m15 zn5GC/NXoId7cRZZ5NT5QukAldGZeoezewmrN97/JoV8DXwXquAxgcJ1CiAACkQNlrkb n34U2V1zZSAdWuvlS4yhRepQGTLOE7MvPyO2H2q4YL+sxIBBgls7hK8GgPXsibuGbw0o Jggw== 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 :message-id:date:subject:cc:to:from; bh=2fxjJdK0NLi5yu9yULhge/xQeSAprv7khve3NAHE+6w=; b=VbnQ8TGG618SaCBaxP0MXGZHGPgkha+fpSESJvP+pZ1fW30p19cgkKFiR0b3NFNKuj /9JXJSQTCcpiDjpqF5hW3+BrQlEV8GWXF0JfmekWYL+G0AVh1z4vxLTrxirTaa9b0QCN HIMH61fKJBK7qJ2hS5uGnDGMlm2L+bZq/hLvDxmaLK/bazhgaPLzlIwarYJY5N2a+tqt H1aDaO+iLyJ1tUMLw8uve6Sm/BIfie6+2UGJHawUIOa7QgDzT/ezICRukbpc5NbJBFUo 8zGvanSsJOJDacHJl6VdiVfdAYQTyI7d4CEU05b8PMT49207S4yHvq4bdE/JtHh05Dla 4EQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg12-20020a170907970c00b007413b206b16si11168107ejc.843.2022.12.04.22.45.22; Sun, 04 Dec 2022 22:45:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231292AbiLEGo6 (ORCPT + 99 others); Mon, 5 Dec 2022 01:44:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230037AbiLEGo5 (ORCPT ); Mon, 5 Dec 2022 01:44:57 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4904C12095; Sun, 4 Dec 2022 22:44:56 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5BF8A23A; Sun, 4 Dec 2022 22:45:02 -0800 (PST) Received: from a077893.arm.com (unknown [10.163.44.51]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DA92F3F73D; Sun, 4 Dec 2022 22:44:52 -0800 (PST) From: Anshuman Khandual To: linux-kernel@vger.kernel.org Cc: james.clark@arm.com, Anshuman Khandual , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , linux-perf-users@vger.kernel.org Subject: [PATCH] perf/tool: Add remaining branch filters to perf record Date: Mon, 5 Dec 2022 12:14:43 +0530 Message-Id: <20221205064443.533587-1-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751355486710466464?= X-GMAIL-MSGID: =?utf-8?q?1751355486710466464?= This adds all remaining branch filters i.e no_cycles, no_flags and hw_index to perf record tool. While here, also updates the documentation. Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Arnaldo Carvalho de Melo Cc: linux-perf-users@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- tools/perf/Documentation/perf-record.txt | 5 +++++ tools/perf/util/parse-branch-options.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt index e41ae950fdc3..7803c0c4c8f9 100644 --- a/tools/perf/Documentation/perf-record.txt +++ b/tools/perf/Documentation/perf-record.txt @@ -388,6 +388,7 @@ following filters are defined: - any_call: any function call or system call - any_ret: any function return or system call return - ind_call: any indirect branch + - ind_jmp: any indirect jump - call: direct calls, including far (to/from kernel) calls - u: only when the branch target is at the user level - k: only when the branch target is in the kernel @@ -396,6 +397,10 @@ following filters are defined: - no_tx: only when the target is not in a hardware transaction - abort_tx: only when the target is a hardware transaction abort - cond: conditional branches + - call_stack: save call stack + - no_flags: don't save branch flags e.g prediction, misprediction etc + - no_cycles: don't save branch cycles + - hw_index: save branch hardware index - save_type: save branch type during sampling in case binary is not available later For the platforms with Intel Arch LBR support (12th-Gen+ client or 4th-Gen Xeon+ server), the save branch type is unconditionally enabled diff --git a/tools/perf/util/parse-branch-options.c b/tools/perf/util/parse-branch-options.c index 31faf2bb49ff..fd67d204d720 100644 --- a/tools/perf/util/parse-branch-options.c +++ b/tools/perf/util/parse-branch-options.c @@ -30,8 +30,11 @@ static const struct branch_mode branch_modes[] = { BRANCH_OPT("cond", PERF_SAMPLE_BRANCH_COND), BRANCH_OPT("ind_jmp", PERF_SAMPLE_BRANCH_IND_JUMP), BRANCH_OPT("call", PERF_SAMPLE_BRANCH_CALL), + BRANCH_OPT("no_flags", PERF_SAMPLE_BRANCH_NO_FLAGS), + BRANCH_OPT("no_cycles", PERF_SAMPLE_BRANCH_NO_CYCLES), BRANCH_OPT("save_type", PERF_SAMPLE_BRANCH_TYPE_SAVE), BRANCH_OPT("stack", PERF_SAMPLE_BRANCH_CALL_STACK), + BRANCH_OPT("hw_index", PERF_SAMPLE_BRANCH_HW_INDEX), BRANCH_OPT("priv", PERF_SAMPLE_BRANCH_PRIV_SAVE), BRANCH_END };