Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2092762rdb; Tue, 3 Oct 2023 09:57:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEGoI/glaKmuog3OT1LbvUIeXSVROQBmYPku642lGE69HM309Rb5niWrfGOf7zQ41itJztb X-Received: by 2002:a05:6358:7f15:b0:143:786b:3de5 with SMTP id p21-20020a0563587f1500b00143786b3de5mr19825rwn.9.1696352279458; Tue, 03 Oct 2023 09:57:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696352279; cv=none; d=google.com; s=arc-20160816; b=Bx8Dz6ySFxLyTd0sK35DaqC9f3ThNjDilIa44wyJxqUJtw47rvOw7lnarX7cmyhMkf HlUHCljPbVnJRakEaYkl063bM9ZSROCJnsNO4x7XPI58rqB9Uz4VlgOgmtpJq2B9Wygr oC5qib5zcVS6Yg0VyUwIoo4i/ZdXCn1EOZCOChYmM/bsU0PMNDDYov2NTKWtaN1IYkWm /J6wSdQfz9YISsCM3dg9cZesWMmSydCzG1SSHo+lHU2qEyjkMXml6vQr4HzEKatipp8t oibYJ9fArzts3hdLoQVksEatxVQBXzVeKY/j9NQdVxACbnJgkDFKxrSrRoT/nbvrBQLV bnvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=k79MMAVxKS2reHPbOZhjcl8yome8sw6F0OeGkmGp6pI=; fh=WIH6z9/erDLXkiBE+WmJEE8nDM8d1663KKUSmeAL/q0=; b=G8ggtl9vok1dED5PfX8pckA5akiK+u3iecSxQtgGbQL6rffo8JcRMi3BR5eqTjhXuB v4Jf7RflkYb92cYhWxxEGK+jOeYu0PTfazrLvU/bEaHTdh3D2sX9d94v9nTxPM02PUpL HTMeE62VnOcMB/smDXY/9+6elT9kq4tVdux9PXdU3ahbftqG1qfxxSuDnrCRlxbpUzDO KRvQ2Dub8Ieleblyq/p2Cfji+uIzntxjpm4rimT8xc8WdVGiBVwdhZ7WFDVLy/OnnrG4 IoYAxe//cIWQETR5IJcpqltSB/cDFlNZEMBd3ON0o+eN7vNXHjU7Jgtamm7Fs+IBHngn R98g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hl+rTVuF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id s21-20020a63af55000000b00565f182839asi1758598pgo.28.2023.10.03.09.57.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 09:57:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hl+rTVuF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id A9230809B76E; Tue, 3 Oct 2023 09:57:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240543AbjJCQ4C (ORCPT + 99 others); Tue, 3 Oct 2023 12:56:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240561AbjJCQzk (ORCPT ); Tue, 3 Oct 2023 12:55:40 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34AB6136 for ; Tue, 3 Oct 2023 09:55:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696352133; x=1727888133; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=pOmDbgmKcuR1roL2tpS4qxKkRr99cuVsIxqAedHHY30=; b=hl+rTVuFffzSCFHmqCz9ICBuQmXM5kpRMV9GRrJWEOXkXrANyNSTdl/1 y69jERJ46mnkPO89xjVSSqgUmr35zNOjXEKPzqm83zBon0OYVUcbG9BLy IbGG0SHm/31E8phyhalO+6GqW/AplBWPsmrOuZy6iGfeTPa4gb/cJvzNa OS+3LZ1sOEJDgYTxW+M8l+85K0Brxsq6+Ehwlx1bsGsfbwd5h2TNOhucO 5Tp2v3bVpeFKjNQc8aDleMUgeJ1l/s+R0gVbnGPre2XKO1Cym6n7z5yhB 2znvCzYz6JJjU75vh4xdayzr/FZu7LkTAEiZRcrB/zDUro6Z+RsVdbCvi w==; X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="413836513" X-IronPort-AV: E=Sophos;i="6.03,197,1694761200"; d="scan'208";a="413836513" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2023 09:55:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="816755076" X-IronPort-AV: E=Sophos;i="6.03,197,1694761200"; d="scan'208";a="816755076" Received: from tassilo.jf.intel.com (HELO tassilo) ([10.54.38.190]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2023 09:55:26 -0700 Date: Tue, 3 Oct 2023 09:55:25 -0700 From: Andi Kleen To: Peter Zijlstra Cc: "Liang, Kan" , mingo@redhat.com, acme@kernel.org, linux-kernel@vger.kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, namhyung@kernel.org, irogers@google.com, adrian.hunter@intel.com, eranian@google.com, alexey.v.bayduraev@linux.intel.com, tinghao.zhang@intel.com, Sandipan Das , Ravi Bangoria , Athira Rajeev Subject: Re: [RESEND PATCH V3 1/6] perf: Add branch stack extra Message-ID: References: <20230911154822.2559213-1-kan.liang@linux.intel.com> <20231002154535.GB35785@noisy.programming.kicks-ass.net> <20231002213752.GB1539@noisy.programming.kicks-ass.net> <20231003102733.GC1539@noisy.programming.kicks-ass.net> <20231003163300.GF1539@noisy.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231003163300.GF1539@noisy.programming.kicks-ass.net> 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 groat.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 (groat.vger.email [0.0.0.0]); Tue, 03 Oct 2023 09:57:45 -0700 (PDT) On Tue, Oct 03, 2023 at 06:33:00PM +0200, Peter Zijlstra wrote: > On Tue, Oct 03, 2023 at 08:06:59AM -0700, Andi Kleen wrote: > > > I'm thinking we should do something like expose branch_counter_nr and > > > branch_counter_width in the sysfs node, and then rename this extra field > > > to counters. > > > > > > Then userspace can do something like: > > > > > > for (i = 0; i < branch_counter_nr; i++) { > > > counter[i] = counters & ((1 << branch_counter_width) - 1); > > > counters >>= branch_counter_width; > > > } > > > > > > to extract the actual counter values. > > > > perf script/report won't necessarily have access to the sysfs > > values if they run on a different system > > > > It would need extra PT style metadata written by perf record to > > perf.data and read by the user tools. > > > > Seems complicated. It would be better if it just parsed on its own. > > Well, you really don't want to repeat the 4,2 thing in every event, that > seems daft (and a waste of space, because how large do we want those > fields to be etc..). It's just a few bits? It could be an extra 16bit field or so per event. There are probably other self describing encodings for the numbers (e.g. some variant of LEB128 on a sub byte level), but that might be more expensive to store it. What would worry me is that various users would just hard code and then fail later. There are lots of non perf tools perf.data parsers around these days. -Andi