Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp1035791iol; Thu, 9 Jun 2022 21:33:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYmRRM+b+X7WFUYFwbr/QXeQNCw/vJJ6BJjTZSvHIBhjqujBUBAKI9ZFFUESgUtJ8OQ3Y7 X-Received: by 2002:a05:6a00:10d0:b0:4f7:5af4:47b6 with SMTP id d16-20020a056a0010d000b004f75af447b6mr43537152pfu.6.1654835606661; Thu, 09 Jun 2022 21:33:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654835606; cv=none; d=google.com; s=arc-20160816; b=i6wV0aXVj4J8j5ISO/i7/mjtFSwihlNhRwDuqRCnqpLlc5UohKd/43VFe0kA0M1Btt XwnrsR9rGBxX+gPSnB/jMNrxbH8mF3Fm9iKE4CyIN9U/+NJda77MGsV5bHbIzRzLsXJd +sGR/SsTWQr9eh6knDi8femYjRukfk4fdP6mVwBfiz0bW1RzWsc5owxd8ySCAKa+xhfp HEHbpgXuctvvc68H9uBhOFPZ5lBHLHSxW0vSnQvYvmGBL8FF4B3PVHhS7l1hSzk3rMP2 eCm7kMFHmRG5QgkAiYUGvZ+V+KozK0NZjyV+B7RDNDzaluUdAhm547iNiFs461YbN6OO 0AeQ== 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; bh=mj/RooWSHtVbWyVGkwhyCY6W1VewS26WKptFr3/WqSo=; b=gvzj6DuEUxqP9NH5AJDsewUJPeEnEKct9ikYtEp2YQRjUldZbv5t/nUxGF/RZ7Hu97 V+I+ERqrN06rTQcXdYI9KPTCI0i8uRY2m/SAxxkECKIeoTfe6Mq/o1rpbkV4ERTtclwB eDZgjx2xBuFnM7J9763mALEwrkMIxAOlQjdrhkX3QkvRj5/2bHBDAO/l2kcvw7VPlP2H MGuGT+QUIT2bwXz6oatvp7g33zjLmHPP/CMxKxUgzEU4CcOFVuopOYZDpzp906e6dEIo K2D23q7QJfv3Fj5Fnpi4UPKGrjfefHNcmuaEiEZYbAUFCu7wxI8Kdi651vJn0xXq8oA+ JoBQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f4-20020a056a00238400b0050ad22888dasi25415499pfc.158.2022.06.09.21.33.00; Thu, 09 Jun 2022 21:33:26 -0700 (PDT) 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 S1346109AbiFJDv0 (ORCPT + 99 others); Thu, 9 Jun 2022 23:51:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234635AbiFJDvX (ORCPT ); Thu, 9 Jun 2022 23:51:23 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 01F0C38A280; Thu, 9 Jun 2022 20:51:21 -0700 (PDT) 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 CD83712FC; Thu, 9 Jun 2022 20:51:20 -0700 (PDT) Received: from a077893.blr.arm.com (unknown [10.162.42.8]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 94D903F766; Thu, 9 Jun 2022 20:51:15 -0700 (PDT) From: Anshuman Khandual To: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, peterz@infradead.org, alexander.shishkin@linux.intel.com, jolsa@redhat.com, acme@kernel.org Cc: Anshuman Khandual , Robin Murphy , Suzuki Poulose , James Clark , Ingo Molnar , Mark Rutland , Namhyung Kim , Thomas Gleixner , Will Deacon , linux-arm-kernel@lists.infradead.org Subject: [PATCH V6 1/8] perf: Add system error and not in transaction branch types Date: Fri, 10 Jun 2022 09:20:54 +0530 Message-Id: <20220610035101.424112-2-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220610035101.424112-1-anshuman.khandual@arm.com> References: <20220610035101.424112-1-anshuman.khandual@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 This expands generic branch type classification by adding two more entries there in i.e system error and not in transaction. This also updates the x86 implementation to process X86_BR_NO_TX records as appropriate. This changes branch types reported to user space on x86 platform but it should not be a problem. The possible scenarios and impacts are enumerated here. -------------------------------------------------------------------------- | kernel | perf tool | Impact | -------------------------------------------------------------------------- | old | old | Works as before | -------------------------------------------------------------------------- | old | new | PERF_BR_UNKNOWN is processed | -------------------------------------------------------------------------- | new | old | PERF_BR_NO_TX is blocked via old PERF_BR_MAX | -------------------------------------------------------------------------- | new | new | PERF_BR_NO_TX is recognized | -------------------------------------------------------------------------- When PERF_BR_NO_TX is blocked via old PERF_BR_MAX (new kernel with old perf tool) the user space might throw up an warning complaining about an unrecognized branch types being reported, but it's expected. PERF_BR_SERROR & PERF_BR_NO_TX branch types will be used for BRBE implementation on arm64 platform. PERF_BR_NO_TX complements 'abort' and 'in_tx' elements in perf_branch_entry which represent other transaction states for a given branch record. Because this completes the transaction state classification. Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Arnaldo Carvalho de Melo Cc: Mark Rutland Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Namhyung Kim Cc: Thomas Gleixner Cc: Will Deacon Cc: linux-arm-kernel@lists.infradead.org Cc: linux-perf-users@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- arch/x86/events/intel/lbr.c | 2 +- include/uapi/linux/perf_event.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/events/intel/lbr.c b/arch/x86/events/intel/lbr.c index 13179f31fe10..0a506c85b53e 100644 --- a/arch/x86/events/intel/lbr.c +++ b/arch/x86/events/intel/lbr.c @@ -1334,7 +1334,7 @@ static int branch_map[X86_BR_TYPE_MAP_MAX] = { PERF_BR_IND_CALL, /* X86_BR_IND_CALL */ PERF_BR_UNKNOWN, /* X86_BR_ABORT */ PERF_BR_UNKNOWN, /* X86_BR_IN_TX */ - PERF_BR_UNKNOWN, /* X86_BR_NO_TX */ + PERF_BR_NO_TX, /* X86_BR_NO_TX */ PERF_BR_CALL, /* X86_BR_ZERO_CALL */ PERF_BR_UNKNOWN, /* X86_BR_CALL_STACK */ PERF_BR_IND, /* X86_BR_IND_JMP */ diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h index d37629dbad72..26d8f0b5ac0d 100644 --- a/include/uapi/linux/perf_event.h +++ b/include/uapi/linux/perf_event.h @@ -253,6 +253,8 @@ enum { PERF_BR_COND_RET = 10, /* conditional function return */ PERF_BR_ERET = 11, /* exception return */ PERF_BR_IRQ = 12, /* irq */ + PERF_BR_SERROR = 13, /* system error */ + PERF_BR_NO_TX = 14, /* not in transaction */ PERF_BR_MAX, }; -- 2.25.1