From patchwork Thu Nov 24 12:02:59 2022 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: 25480 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3355574wrr; Thu, 24 Nov 2022 04:07:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf6vixsiJELYQ0WtlFxC5Xtko/LAnsw0Hxcl41sACpVJ9Ux34T/Y5ZsmStjqj7w3hfiFH3KA X-Received: by 2002:a17:906:ee2:b0:78d:3f96:b7aa with SMTP id x2-20020a1709060ee200b0078d3f96b7aamr13786543eji.74.1669291643286; Thu, 24 Nov 2022 04:07:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669291643; cv=none; d=google.com; s=arc-20160816; b=lkGXAT3vBQu9ZpiHQS36f6WeaKRf7ZJ4jcdP2IIdR7/10ai1EQIT68W5a94NSWeifD xcWkPRqJZPDwjxtAHV29G+74CMo3u3UeWRtyfHDw1BhlrguXuUxSEU+lSRpMMX6bZEDr Wbibcni+qR+pT6rirL3UFw2OjS7+rrRwuDbu8wAC4nWRKS4Ay6shvsUfbSU4haBFhZ5f yRbZJ42AsMmGY6fzuS8qVUl3+evmzD3poKAojZIiJ9ENOxUAL1NuVBErt8EifrrFd3yA Ig/oVBh6WLB+UylR04l9nYifv3s+C1b0eP69+WniG6CLAFAhonGToACXAsicMRbs40S4 Aosw== 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=kUHiE8a+1lv9ytkeBFtI2aUbZ3z2LKhBsO12Nwyan9Q=; b=G4TPPkNYuwuMxmBqk3Kaax8Zs7DLoa24QSBmq7dGT0RARBSjnBoiyTFgb5yIu9tRWR v5rjgz7jZVuhBHGN7UXG/O+khd70Ec32iiCA81DOJC5DUPh/tT4pnOEEwQmXIdpJV5pH trQrLbR1Njy4+NC4jAXyRtEqWn6YHiter6U2imLDKH15fuLB2a+EOq2SiiEUr3Rh2Jq0 aqqEgRhUMIKQmm64vCkq7VgouVmFsvodkTDJjEL9aC4ndyftGoSIH/9dHqiqutN1W6Mz Uw686aVbtLwOdvKFzrulBhBCf3v60NFmGIuiY22e01zmk5eAzBw6k1YCqELPRXs52ef+ 0k3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=r3NfTtOq; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="I5d7HIU/"; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hz6-20020a1709072ce600b007ae127c6c80si793141ejc.672.2022.11.24.04.06.59; Thu, 24 Nov 2022 04:07:23 -0800 (PST) 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=@linutronix.de header.s=2020 header.b=r3NfTtOq; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="I5d7HIU/"; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229953AbiKXMDf (ORCPT + 99 others); Thu, 24 Nov 2022 07:03:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229632AbiKXMDK (ORCPT ); Thu, 24 Nov 2022 07:03:10 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9F31391DB; Thu, 24 Nov 2022 04:03:01 -0800 (PST) Date: Thu, 24 Nov 2022 12:02:59 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669291380; 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=kUHiE8a+1lv9ytkeBFtI2aUbZ3z2LKhBsO12Nwyan9Q=; b=r3NfTtOqmCXc4Y7bkMQpx1kmVoPkrKkokfBjw3TlL3WuTrD3GsUC/jjHevU0Xyg92s9Bvz JAfQWHiZI10gAwN85rqJYxE4nMTiQJSgt7Q7EGhovHt7H1P2M3kH3TUJKiaFxtJii8U8fp CgHAxMocDTR9mShrN3VKAK55+Xtti3LQ64bIJwJLDwI6UXmgDtWy3mE5tG/hkd/HYS/vv2 yNWFMwc09tWFSTkK3MGMfvvTB2QeaSvA7CmCbMp+3tViAC771FiYeoAtIBkKZA6Cg5n4Bc 2UQ2Fpq4WeBq+cHwNFPfBgxhzyNmqLWl1yA7/YLzrDLV/c2HOSIIVVTu2l/q4Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669291380; 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=kUHiE8a+1lv9ytkeBFtI2aUbZ3z2LKhBsO12Nwyan9Q=; b=I5d7HIU/BshIv/S0ThgDs2ffH1DA83Plz2harpRmDTuIy6wGTO95dAI2moxj7QDsXhZlHi fGhS/lvaRAEOtNCg== From: "tip-bot2 for Alexander Antonov" 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/uncore: Clear attr_update properly Cc: Alexander Antonov , "Peter Zijlstra (Intel)" , Kan Liang , stable@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221117122833.3103580-4-alexander.antonov@linux.intel.com> References: <20221117122833.3103580-4-alexander.antonov@linux.intel.com> MIME-Version: 1.0 Message-ID: <166929137917.4906.3753361587804959232.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749746618918821013?= X-GMAIL-MSGID: =?utf-8?q?1750379154191506328?= The following commit has been merged into the perf/core branch of tip: Commit-ID: 6532783310e2b2f50dc13f46c49aa6546cb6e7a3 Gitweb: https://git.kernel.org/tip/6532783310e2b2f50dc13f46c49aa6546cb6e7a3 Author: Alexander Antonov AuthorDate: Thu, 17 Nov 2022 12:28:25 Committer: Peter Zijlstra CommitterDate: Thu, 24 Nov 2022 11:09:20 +01:00 perf/x86/intel/uncore: Clear attr_update properly Current clear_attr_update procedure in pmu_set_mapping() sets attr_update field in NULL that is not correct because intel_uncore_type pmu types can contain several groups in attr_update field. For example, SPR platform already has uncore_alias_group to update and then UPI topology group will be added in next patches. Fix current behavior and clear attr_update group related to mapping only. Fixes: bb42b3d39781 ("perf/x86/intel/uncore: Expose an Uncore unit to IIO PMON mapping") Signed-off-by: Alexander Antonov Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Kan Liang Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20221117122833.3103580-4-alexander.antonov@linux.intel.com --- arch/x86/events/intel/uncore_snbep.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c index d3323f1..0d06b56 100644 --- a/arch/x86/events/intel/uncore_snbep.c +++ b/arch/x86/events/intel/uncore_snbep.c @@ -3872,6 +3872,21 @@ static const struct attribute_group *skx_iio_attr_update[] = { NULL, }; +static void pmu_clear_mapping_attr(const struct attribute_group **groups, + struct attribute_group *ag) +{ + int i; + + for (i = 0; groups[i]; i++) { + if (groups[i] == ag) { + for (i++; groups[i]; i++) + groups[i - 1] = groups[i]; + groups[i - 1] = NULL; + break; + } + } +} + static int pmu_set_mapping(struct intel_uncore_type *type, struct attribute_group *ag, ssize_t (*show)(struct device*, struct device_attribute*, char*), @@ -3926,7 +3941,7 @@ clear_attrs: clear_topology: pmu_free_topology(type); clear_attr_update: - type->attr_update = NULL; + pmu_clear_mapping_attr(type->attr_update, ag); return ret; }