From patchwork Mon Nov 20 14:35:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 167184 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp2246799vqn; Mon, 20 Nov 2023 06:39:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IEWi9Wt+LlWaPkshJuiPF295wyXl0DLLNdlKaM4uTaBf7NkL+aaaI8i4A8Z4p5eSZr++0PL X-Received: by 2002:a05:6a20:4281:b0:187:4118:140 with SMTP id o1-20020a056a20428100b0018741180140mr19014140pzj.24.1700491195862; Mon, 20 Nov 2023 06:39:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700491195; cv=none; d=google.com; s=arc-20160816; b=mbOADODCJs1auMy8UbXk9BJQnSt8FBTdSYU88m5Joew3Y8wPM/von1Gf4nXcEZ9GEy syfbb5ZB3S1lCSWu1wSqiL5SPP2THUi6abNHsDjYKF0e+PC6/Z2EF69o3xKPqN4k1dA0 D6DAtcxBazfyF1uipvtLX992sN9++YcjwkndeEBlMXNIEqRn/SOtagcGEfkmDCmKowGx Sr4lhkvpfrgbKbNbo1T2omzsVDMndPi1Pafdj5pNnZW9mpdARpaME8NRcYT1l2KZ3kJF PDSA9/JrN/eptlNeX3boUIGFa2PcnjH6+fxhXr0L02rskYygCgC7qUZD3lL/ZdLpoks+ sXEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=9M6sdiqGCwinQGMULaQmGbucsy2SVfpdAMoCHNBDpF0=; fh=hNrfQAbYh3Z2DJEENGJHk2DI4zZ1Z/35CV7+DFUZfaE=; b=KpU/bErQxW783PDSwXr4c4Ux9aj7xxNtwEu+KZMJw2JJ3JdZ4cT2TtbcOCK+qJf2T4 PgKhqpJ9BVahkgLxhH/UXqV17waBlBfcQ+BQc7A44+B9nYtkmaeipZn+fgQ1gMJC/4eY 8vAImX+q8T2Q5IYiPS+A8zQKmuWN2KeIDl4nVhXE+xnjBXAlYaiyJPIPgeHckf0YLaOp HV7EeI4j1d2jtTn4Ee1r91/H4qQEaFtMNHpK1LrO2FzXL5b5reTeH95MZzqn5sQQdE2A DHQmoKaOam/gDyrN+WjDdtOpQgVKBETAFPHHBtJqARfEZtrjP3/0jFzjXaQH7V91qhJR fteg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=SbV8qGCS; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id bx11-20020a056a02050b00b005be0a705478si8947758pgb.89.2023.11.20.06.39.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 06:39:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=SbV8qGCS; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 78B998090047; Mon, 20 Nov 2023 06:36:09 -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 S233584AbjKTOfv (ORCPT + 27 others); Mon, 20 Nov 2023 09:35:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233483AbjKTOfp (ORCPT ); Mon, 20 Nov 2023 09:35:45 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D34B8131; Mon, 20 Nov 2023 06:35:41 -0800 (PST) Date: Mon, 20 Nov 2023 14:35:39 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1700490940; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9M6sdiqGCwinQGMULaQmGbucsy2SVfpdAMoCHNBDpF0=; b=SbV8qGCSJ60aoBfUWO8zvv/w1riknKDbj9z7udbfzyUOpcTGcnp9lYORiwmu8O9McbEuFa 00uMxrq9j8uyojzgAVZVYjUiI6L+JXET/SgulN2V5onjD551FmGdBp4hUOzIYNxQXUrr43 i1WpCeyE2k5P30zjJjetuEpjBkMT0EJVdB7XmGrbxzYwJqMFwg5uf3/aOvWWxvPx+h1YNw Nbblpbv8ZZ4VbTFakOZyt2bqxlPOo5l6Buu/SZodUgaSD2tkbb4Kq39uaJNavwbxtwJomG DdBrwBSsV/p8Ru/Beg3N8/aPaGimEI0BmqkupvXLGiHjk5Od3jyTGZfqCYCdEA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1700490940; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9M6sdiqGCwinQGMULaQmGbucsy2SVfpdAMoCHNBDpF0=; b=Q/zvfwnqv+DNYVXrNV9sr0nIJIvHWnUuwYHh2XYRnHmGFadX/CWeiin8w2Btiy1Ozl0fDO m/Rshz/7w7xyefAw== From: "tip-bot2 for Kan Liang" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf/x86/intel/cstate: Cleanup duplicate attr_groups Cc: Kan Liang , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231116142245.1233485-1-kan.liang@linux.intel.com> References: <20231116142245.1233485-1-kan.liang@linux.intel.com> MIME-Version: 1.0 Message-ID: <170049093988.398.3710895579013151635.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 20 Nov 2023 06:36:09 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782730838998732274 X-GMAIL-MSGID: 1783094255715917363 The following commit has been merged into the perf/core branch of tip: Commit-ID: 243218ca93037631f0224fdbefea045912cb761a Gitweb: https://git.kernel.org/tip/243218ca93037631f0224fdbefea045912cb761a Author: Kan Liang AuthorDate: Thu, 16 Nov 2023 06:22:42 -08:00 Committer: Peter Zijlstra CommitterDate: Fri, 17 Nov 2023 10:54:52 +01:00 perf/x86/intel/cstate: Cleanup duplicate attr_groups 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 Signed-off-by: Peter Zijlstra (Intel) Link: https://lore.kernel.org/r/20231116142245.1233485-1-kan.liang@linux.intel.com --- 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 cbeb6d2..693bdcd 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,