Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3311753rdb; Thu, 16 Nov 2023 06:22:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IE9TVOpUNmgvgufn8Khm/YBvFuxg+3V3pEEbDZenBZ/HmEldIHwefpKOatEgAZtWazEuWxP X-Received: by 2002:a05:6a20:12d1:b0:185:a90d:3628 with SMTP id v17-20020a056a2012d100b00185a90d3628mr15411035pzg.38.1700144579171; Thu, 16 Nov 2023 06:22:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700144579; cv=none; d=google.com; s=arc-20160816; b=e5SjMZCh8vSXvFDO57atPgCprNew7t4psG65vCkbZFRBKhPccuAxMrhqyhqzlkzhUE Jo4EGZre7ci9BTtmY+pJVunvBksUx55C1uju9yzHw4iOg5zTyvjIAcX87NZgsCKEQd0m VKfU4PAwDr+OQ43cSGnINQT9HrSJgnHiqUPJyJwSfurOY1ur3G31RS2lqo79HY7q24Ok Y2aqfSD0CiCkXTi4q5JFgoy7jtDFupWO2dBDiv3YGWcs5oanBFGaoB4XFwsZgZqqQxF+ VLQz9CkQD1pam8tKFPZ1MD2bTFNX04i8Ec6V69iiSdhAxGz40WNo5yLrBEhDzW55vfmv uDVg== 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:dkim-signature; bh=EM2uyD0ALKDajQamVcskfWytEzuAZ9KvnS9fF7OO3Y8=; fh=xH4moCvQzsN+9ugM7JX/UQN3H6rCLhcemTuT12mMY/c=; b=CL2p5uSo5DSzgfY1AadNLlrpyUw/kjgg+xHxFrGc9jtVxAq2xNZk3YsnKJR/m40U+K MmbmNe6sSPnniunO9IfsFG/nb3Qpd6uPJvBNNO4yehRdEInKUDTWCHKyjtl1pa2I1L3M tgh36P6UuxUB5YxdJwS2wn1n09KwDWmH2MhuZ7bROb1eKMXn5h62rZSp3WcWRDXJGLAH jgUVttfqLemSPqqzoFyVuDiZ08lswNSfth4yfZc790jOh9jw4M/HC8A3T3xJyi4xIRew Nq0qquEv/xJeq8gsSQ9MFzewqOG+WXg1iNQT8Stg2tRq8TCA7/KYvxg4VoAdvgKnT2SP XupA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SXiSDKuQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id bd33-20020a056a0027a100b006a77343b0d1si12307672pfb.272.2023.11.16.06.22.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 06:22:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SXiSDKuQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 8FC68821704A; Thu, 16 Nov 2023 06:22:57 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345282AbjKPOW4 (ORCPT + 99 others); Thu, 16 Nov 2023 09:22:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345303AbjKPOWz (ORCPT ); Thu, 16 Nov 2023 09:22:55 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0358719D for ; Thu, 16 Nov 2023 06:22:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700144572; x=1731680572; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=twF0yMuknuHU1zfCoxs5nE6Pr/iTI67oOU0Ux/+a/uk=; b=SXiSDKuQvEe2Il3Zi84tpSM8l6PwlBHF7yALcOb0IID7hJ5YUkILhLf5 EO53zHh8ClTfsudLh1hDyDK5tzsyScJZrHE0vZTta6awgnEv8MEoKCCMz +JqesnTA9W+A1cc36Bu8KKT5eZunSRzqVU6DYmKRpjBZISv0V7keeahLN cLHW56yxnoUXyzi0fPjun62hFpqVtXMUDhlSNpOkzLU3mKHmx+w9T/7B8 pQuhdcmdYBn31YVyPZ/KbAHyoWwV5YNc3fY0m4ggJnnRH7xT49j1f5aB5 G9AtrGCMqfm0HmQtgudMlUXHyq24a5MP4xyzkVXUkJt79CmGhow12C5t/ g==; X-IronPort-AV: E=McAfee;i="6600,9927,10896"; a="12644424" X-IronPort-AV: E=Sophos;i="6.04,308,1695711600"; d="scan'208";a="12644424" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Nov 2023 06:22:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10896"; a="800173365" X-IronPort-AV: E=Sophos;i="6.04,308,1695711600"; d="scan'208";a="800173365" Received: from kanliang-dev.jf.intel.com ([10.165.154.102]) by orsmga001.jf.intel.com with ESMTP; 16 Nov 2023 06:22:49 -0800 From: kan.liang@linux.intel.com To: peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org Cc: artem.bityutskiy@linux.intel.com, rui.zhang@intel.com, Kan Liang Subject: [RESEND PATCH 1/4] perf/x86/intel/cstate: Cleanup duplicate attr_groups Date: Thu, 16 Nov 2023 06:22:42 -0800 Message-Id: <20231116142245.1233485-1-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 16 Nov 2023 06:22:57 -0800 (PST) From: Kan Liang The events of the cstate_core and cstate_pkg PMU have the same format. They both need to create a "events" group (with empty attrs). The attr_groups can be shared. Remove the dedicated attr_groups for each cstate PMU. Use the shared cstate_attr_groups to replace. Signed-off-by: Kan Liang --- arch/x86/events/intel/cstate.c | 44 +++++++++------------------------- 1 file changed, 11 insertions(+), 33 deletions(-) diff --git a/arch/x86/events/intel/cstate.c b/arch/x86/events/intel/cstate.c index cbeb6d2bf5b4..693bdcd92e8c 100644 --- a/arch/x86/events/intel/cstate.c +++ b/arch/x86/events/intel/cstate.c @@ -189,20 +189,20 @@ static struct attribute *attrs_empty[] = { * "events" group (with empty attrs) before updating * it with detected events. */ -static struct attribute_group core_events_attr_group = { +static struct attribute_group cstate_events_attr_group = { .name = "events", .attrs = attrs_empty, }; -DEFINE_CSTATE_FORMAT_ATTR(core_event, event, "config:0-63"); -static struct attribute *core_format_attrs[] = { - &format_attr_core_event.attr, +DEFINE_CSTATE_FORMAT_ATTR(cstate_event, event, "config:0-63"); +static struct attribute *cstate_format_attrs[] = { + &format_attr_cstate_event.attr, NULL, }; -static struct attribute_group core_format_attr_group = { +static struct attribute_group cstate_format_attr_group = { .name = "format", - .attrs = core_format_attrs, + .attrs = cstate_format_attrs, }; static cpumask_t cstate_core_cpu_mask; @@ -217,9 +217,9 @@ static struct attribute_group cpumask_attr_group = { .attrs = cstate_cpumask_attrs, }; -static const struct attribute_group *core_attr_groups[] = { - &core_events_attr_group, - &core_format_attr_group, +static const struct attribute_group *cstate_attr_groups[] = { + &cstate_events_attr_group, + &cstate_format_attr_group, &cpumask_attr_group, NULL, }; @@ -268,30 +268,8 @@ static struct perf_msr pkg_msr[] = { [PERF_CSTATE_PKG_C10_RES] = { MSR_PKG_C10_RESIDENCY, &group_cstate_pkg_c10, test_msr }, }; -static struct attribute_group pkg_events_attr_group = { - .name = "events", - .attrs = attrs_empty, -}; - -DEFINE_CSTATE_FORMAT_ATTR(pkg_event, event, "config:0-63"); -static struct attribute *pkg_format_attrs[] = { - &format_attr_pkg_event.attr, - NULL, -}; -static struct attribute_group pkg_format_attr_group = { - .name = "format", - .attrs = pkg_format_attrs, -}; - static cpumask_t cstate_pkg_cpu_mask; -static const struct attribute_group *pkg_attr_groups[] = { - &pkg_events_attr_group, - &pkg_format_attr_group, - &cpumask_attr_group, - NULL, -}; - static ssize_t cstate_get_attr_cpumask(struct device *dev, struct device_attribute *attr, char *buf) @@ -478,7 +456,7 @@ static const struct attribute_group *pkg_attr_update[] = { }; static struct pmu cstate_core_pmu = { - .attr_groups = core_attr_groups, + .attr_groups = cstate_attr_groups, .attr_update = core_attr_update, .name = "cstate_core", .task_ctx_nr = perf_invalid_context, @@ -493,7 +471,7 @@ static struct pmu cstate_core_pmu = { }; static struct pmu cstate_pkg_pmu = { - .attr_groups = pkg_attr_groups, + .attr_groups = cstate_attr_groups, .attr_update = pkg_attr_update, .name = "cstate_pkg", .task_ctx_nr = perf_invalid_context, -- 2.35.1