Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2100455rwl; Thu, 30 Mar 2023 06:08:23 -0700 (PDT) X-Google-Smtp-Source: AKy350b1qT5U+V6W46yHqAVZUr2KnxdsO+HtLiJJmCBI3fbA+KmaA+Kme4ou+ITHgQ2XZwBx9NrL X-Received: by 2002:a17:90b:1253:b0:236:1ec1:6d30 with SMTP id gx19-20020a17090b125300b002361ec16d30mr2307999pjb.3.1680181702740; Thu, 30 Mar 2023 06:08:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680181702; cv=none; d=google.com; s=arc-20160816; b=TrLgitEawh1CwnjX2g6hYR+Ufy+0R4/b9K8rFXPPnklKGcFqmbGQbsdAQ9p91vAXao lVrZTsvhFF08WHzhXzmpC9jy6tM5yTzcan3InqgHUBc7oe4xRnCliPDCiBdXc1bhWhTy IS4pGCn1/7aDDY07MhsLVT1YeQAQmkvZPVzKz1z85md6wekNg4xguOMuWZuiunm5o+Ay 3Uyb6Y+tn3DX5tPlZpwfz0A/EQ61ruRPqRRbmmUygGxxjON+AvFiMZzO9+DtC/cwF4k0 NAXZXwFoTXOAH0JtWDwN7qgCWJXL/KCWFpJaISR9H59pBGCbIvBt0WN8wf3Ly3yisNPj RRhA== 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=msbl6O2CGPkUkUvjCW+nOGY6ckr9evNZQggsspXa+z8=; b=p0lKQgoZ77DfQXzReXE1mcVw5llRxTMH1rNKKwAcSHX5Dqqs+V5iOkjb0Ny+QIV0Oe c6IbgyG8/18aiCLjJzbfFuEtpRMJ9/CC3pYK83aoy/xW9HFsP7c1gAHQDTOLrsctfrnA MQEqYcfRihPpk0hWwwhXuaP+aZP4OiITKr1YRgY+gvZObKJTtBnIEdyI+YYZbfNqX1VM eNCDXbns559Edg9WBN2EJ4ygAcTw1NqV6SKi5wAL30fPcOkXiDrpC4v8UaApqHRmPed6 7Ne57jIkhFxSaIR9KW/zh0l1NnYRkYGCuuPVtDvLI1T3StXapLLzjMKUnHvGEdJDC6L5 ibvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=PQVyAxFY; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id me14-20020a17090b17ce00b002340b11f1e8si4268597pjb.44.2023.03.30.06.08.08; Thu, 30 Mar 2023 06:08:22 -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=@infradead.org header.s=casper.20170209 header.b=PQVyAxFY; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231645AbjC3NHW (ORCPT + 99 others); Thu, 30 Mar 2023 09:07:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231474AbjC3NHV (ORCPT ); Thu, 30 Mar 2023 09:07:21 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CB9DB8; Thu, 30 Mar 2023 06:07:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=msbl6O2CGPkUkUvjCW+nOGY6ckr9evNZQggsspXa+z8=; b=PQVyAxFY2wxeQDB6gMz26HUZML uwaGBn5Hm6KT8k53QozhTJxJbrK+0Wqu/CgzV6iojDrt1kJ8iSi8SKxa7YSUpbpyjQG7oOWSr3rbn phjKltE3xQmunowptbzUtymHd+92aKKUteqpXtZnKuzykc4cNcpAtZm3kl5nwcRD1XpsbCzRwLMe/ gYi6VAnrq+/yVKs0+57kzARfQtyglhUN1KcPISot+pKTisRjmqAFRoORSa8aAj928KKhvAlg8Qy/F rLY5bDnYJTkdF881SWv6nCQvlodChMKrBITrjY/mtn3DLbZkzzlgCslvGPkwTrAPrh+FECYEjaCLt OOlOuQEA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1phrzb-00AQbG-Bo; Thu, 30 Mar 2023 13:07:03 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 6622A300230; Thu, 30 Mar 2023 15:07:02 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 1EA692065CD4A; Thu, 30 Mar 2023 15:07:02 +0200 (CEST) Date: Thu, 30 Mar 2023 15:07:02 +0200 From: Peter Zijlstra To: Dapeng Mi Cc: Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Jiri Olsa , Ian Rogers , Adrian Hunter , Thomas Gleixner , Dave Hansen , x86@kernel.org, Kan Liang , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Zhenyu Wang , Zhang Tinghao , Zhuocheng Ding Subject: Re: [PATCH] perf/x86/intel: Define bit macros for FixCntrCtl MSR Message-ID: <20230330130702.GF124812@hirez.programming.kicks-ass.net> References: <20230330012846.2927220-1-dapeng1.mi@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230330012846.2927220-1-dapeng1.mi@linux.intel.com> 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_NONE 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 On Thu, Mar 30, 2023 at 09:28:46AM +0800, Dapeng Mi wrote: > Define bit macros for FixCntrCtl MSR and replace the bit hardcoding > with these bit macros. This would make code be more human-readable. > > Perf commands 'perf stat -e "instructions,cycles,ref-cycles"' and > 'perf record -e "instructions,cycles,ref-cycles"' pass. > > Signed-off-by: Dapeng Mi > --- > arch/x86/events/intel/core.c | 18 +++++++++--------- > arch/x86/include/asm/perf_event.h | 10 ++++++++++ > 2 files changed, 19 insertions(+), 9 deletions(-) > > diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c > index 070cc4ef2672..b7c0bb78ed59 100644 > --- a/arch/x86/events/intel/core.c > +++ b/arch/x86/events/intel/core.c > @@ -2451,7 +2451,7 @@ static void intel_pmu_disable_fixed(struct perf_event *event) > > intel_clear_masks(event, idx); > > - mask = 0xfULL << ((idx - INTEL_PMC_IDX_FIXED) * 4); > + mask = intel_fixed_bits(idx - INTEL_PMC_IDX_FIXED, INTEL_FIXED_BITS_MASK); > cpuc->fixed_ctrl_val &= ~mask; So maybe it's me, but I find the original far easier to read :/ That new things I need to look up every single identifier before I can tell wth it does.