Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2295478rwl; Thu, 6 Apr 2023 08:18:58 -0700 (PDT) X-Google-Smtp-Source: AKy350Z7fFZkjeFZv7zQ/qozwM8TN1v48RUcuYfQzO7uZUM5d8sANc3aoPhcfjGDyla7swqTFB6N X-Received: by 2002:a17:907:8b89:b0:920:254c:1e2d with SMTP id tb9-20020a1709078b8900b00920254c1e2dmr7808638ejc.39.1680794338079; Thu, 06 Apr 2023 08:18:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680794338; cv=none; d=google.com; s=arc-20160816; b=Mn4KVzh+alaleitpRrEUIfQm9cq5NIdipaByHw2BCO4mJqAZNbPQFQcgMH8DNmD92A uy8NOrRnnp7es7cNUrnX2RMaOkN2XG60NZbhcFa2LG9ie7uXM0gMDXslOqXtHHQEahfb DhdQel4Wx9pCPN8vesoKNvL9TyIW+qgrjJJVcW0zgLvcrwvgVKIJ9lL+/YXmiEyH7PgW VBGJOJmz4HNSokm9TJW+G26Ln+5eLNpSXs71NCd7XzJyHHRH8kcHAsdgjYfRY8Ud/2f+ 1mnSEoDNWijQz8GPJJ0dbebocP5n9GCRi+fezVDx8nwhtVY1q6YSIu20YBUP1PjveVOc DhZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=FcE1krgWqooRAVxYPnUNB6m8my9YUqR7UT2CN42CIJM=; b=Tf3hnF6FnrWBQcLOLYaA28HuoGSaM5KdTnxpY7J4S9OvBeBoxitJeIVZa58WENTPqq QquCMDFXCpyCx3LL9TxcxCLOxqWx71hnk4fpBHRu1aSgxyE23EaPJeafEhSYfX6zb+X4 YAw+PkjUm3IJj0zmGhmqq2U7ejJGALav6hwwyFPfBcj7iTMoDik6egB56c1rZbGiAi3U +/tkWAwwnkYdAipnAJLik4Z7bm4twcEEsiCS3BiGiG/E6zxmxYhLrVEgbosKsMQ8WMGp crq9tI+TicCtRx+cHenUauXJPB3PApwe8mAehrXN1edVM6zjo4RtGSRpjcsCqxzwjiev 0++Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rU3B19bL; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd24-20020a170906ce3800b0094554e23d87si1419758ejb.194.2023.04.06.08.18.32; Thu, 06 Apr 2023 08:18:58 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rU3B19bL; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239246AbjDFPLI (ORCPT + 99 others); Thu, 6 Apr 2023 11:11:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230049AbjDFPLG (ORCPT ); Thu, 6 Apr 2023 11:11:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDCE84C20; Thu, 6 Apr 2023 08:11:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 48D7C62965; Thu, 6 Apr 2023 15:10:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1761CC433EF; Thu, 6 Apr 2023 15:10:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680793829; bh=0UD7lBi4KhWPJ7V/3+hujN1yIN9Kh2kmwkcgc5o2o2g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rU3B19bLjMSfWSQKyVVBLd+GFum7QNWMNPJ+WV9uSc2cGuKr8vtOGRqp9WWRBSU/m Cm0Kkt0IJNae7kKhDULiEk3qKePAN60hPzRG3DmMywm4q+5i/4Wak2haSeJby/+G4B fQkj+uN1jddMGrmbMSeCRJSnFjjFWIhH4nTs58G6lk0mNnrAcJUqULhSa4kncIlWar PkUMwlnTdbkLcBsORvzKfi00k7MKQCVkaPhkDjnkyxDkudMV0ANVYDZ2g19OH878r0 WJkwPR/9ZMv3oY2KpwKMk7gAS10M2V8EGLHVq3hU3Dnx/aY7o8VySRs6LCOSL6Jjrv uTqXx58lk8Qsg== Date: Thu, 6 Apr 2023 16:10:23 +0100 From: Will Deacon To: Peter Newman Cc: mark.rutland@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, acme@kernel.org, adrian.hunter@intel.com, alexander.shishkin@linux.intel.com, catalin.marinas@arm.com, eranian@google.com, irogers@google.com, jolsa@kernel.org, mingo@redhat.com, namhyung@kernel.org, peterz@infradead.org Subject: Re: [PATCH v5] arm64: pmuv3: dynamically map PERF_COUNT_HW_BRANCH_INSTRUCTIONS Message-ID: <20230406151022.GB11802@willie-the-truck> References: <20230403091547.441550-1-peternewman@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230403091547.441550-1-peternewman@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Peter, On Mon, Apr 03, 2023 at 11:15:47AM +0200, Peter Newman wrote: > From: Stephane Eranian > > The mapping of perf_events generic hardware events to actual PMU events on > ARM PMUv3 may not always be correct. This is in particular true for the > PERF_COUNT_HW_BRANCH_INSTRUCTIONS event. Although the mapping points to an > architected event, it may not always be available. This can be seen with a > simple: > > $ perf stat -e branches sleep 0 > Performance counter stats for 'sleep 0': > > branches > > 0.001401081 seconds time elapsed > > Yet the hardware does have an event that could be used for branches. > > Dynamically check for a supported hardware event which can be used for > PERF_COUNT_HW_BRANCH_INSTRUCTIONS at mapping time. > > And with that: > > $ perf stat -e branches sleep 0 > > Performance counter stats for 'sleep 0': > > 166,739 branches > > 0.000832163 seconds time elapsed > > Co-Developed-by: Stephane Eranian > Signed-off-by: Stephane Eranian > Co-Developed-by: Mark Rutland > Signed-off-by: Mark Rutland > Co-Developed-by: Peter Newman > Signed-off-by: Peter Newman > Link: https://lore.kernel.org/all/YvunKCJHSXKz%2FkZB@FVFF77S0Q05N > --- > v4->v5: > - update changelog tags Thanks, this looks good to me. Please can you rebase it on my for-next/perf branch so that I can queue it up? More of the PMU code has moved out into drivers/perf/. Cheers, Will [1] https://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git/log/?h=for-next/perf