Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp1151580rdh; Fri, 27 Oct 2023 06:17:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGx1KYRcPlkwJmTtZUOiMnKLdIQ5/bcd2jaSTtrayRDjQhxZDXsTa00fG3i+p+W7/KS3A4z X-Received: by 2002:a81:e70b:0:b0:5a1:db6a:6459 with SMTP id x11-20020a81e70b000000b005a1db6a6459mr2529399ywl.40.1698412656412; Fri, 27 Oct 2023 06:17:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698412656; cv=none; d=google.com; s=arc-20160816; b=iL5gK5dASIiQj+oGuNpAMvoi637CcxbeW8oyrOBNajEoP0a5x6VfHJ1GMavL1LIBfB ZF0ap6Stlcogq7Ss52nNxx0B86ZN8Z/LUoS/YGvcH8sjnlroLIfEtVTiNz2DG78Ge6+m k2AKuNxQafDomeRdSKcTCrIoasMlywBF7RtH/ZmiyEVHF1INCwl3kgIRfcMHDWIlkhyS YWC7A2RAxVcxfG0dUDvbK3HTcBpAiR4/rZnYDGBO6Rwem0gHQmSWWdgSDVMcPJ5+sTOP Z3qEg6BTTdcGZli2ccqaXvca/yi0/UsZc3uS3TV9/CgYEz+UWVExsxVCuZZMEnd1tf7w 19YQ== 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=uiSF5Np9mn/DveiCzhPpHBBhGb0WLRkwZ5XaYOgjchA=; fh=Cih3WYU0pVN5iGsyJchKC+BZ4wYcQPU4mMfbyT21iUg=; b=BYCBiG4MtyVH1wrBNQ7i7V1L7JzyDMh17uCM8le3qGumVKta+9CNGMe0Cie3/4lVSG HVu4JznFqRv+yb3pRgE7KXNGo9DMqKXa/YNk2+lHLVr6B8tpLrf62D4anVuyXOyPXp7g 9wWL9q1s7ClEoN8W+KGW8jTlseAK+9fv04LrPrRTB3dl5DD8kKHJES+SwrolvlBRwxFD 8/F2HiIpEEdUQ8LnnJCcOz6LF+eLUMGxJf/DAyKAiYp6Iwi9u9eLbCLdcuLRL8qn7/OT k1tzzJ6jcVzyL9ac4hfhIL4Ddj0S8w68wzyWLKGECG492R1AHbXhL/2m+BFZsiDDNq5r reIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=A4eoc4on; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id t11-20020a815f0b000000b00589fccf48c1si2356880ywb.363.2023.10.27.06.17.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 06:17:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=A4eoc4on; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id EDFAC8165382; Fri, 27 Oct 2023 06:17:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345833AbjJ0NQ5 (ORCPT + 99 others); Fri, 27 Oct 2023 09:16:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231555AbjJ0NQz (ORCPT ); Fri, 27 Oct 2023 09:16:55 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17C0C10E; Fri, 27 Oct 2023 06:16:53 -0700 (PDT) Date: Fri, 27 Oct 2023 13:16:50 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1698412611; 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=uiSF5Np9mn/DveiCzhPpHBBhGb0WLRkwZ5XaYOgjchA=; b=A4eoc4onAy40tgJ2cKS+jI1RaXWjB6oUg6Ou+g4nxl0vBDlm+e8qPougXx4nypgQ/hlEfN sAel4Y/j9MqtMJyNhgg2JZo3jnWR6U9ibLJhVAlSBLUt24qMetBByxqdTacWytq68+zgsf n3SNh1QhvZp2LvHDEE2QcFPKiGNzr1wdGr5Rm5zov8dJfjKth6J6WwANfuNlMX6m410knQ VNoJayvRNFQDw87eQYSiyMs3llB+pEqSLr9fQobINE/uzTQAX0/XFew2MhA+hphMcD3qX8 sR/cm96hw3Y6yPwry81ivlZ9HPk3/VVST+W0bUO17A3U3nGxr2LbJbXedn1ZBQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1698412611; 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=uiSF5Np9mn/DveiCzhPpHBBhGb0WLRkwZ5XaYOgjchA=; b=FMc4H138dBNhfcz6nzDSRGkim+wi3Qr3nLR0V2u4w8RyKP88/vuB1aIuHxXNOgNdbBS6vp nYiaUgOJMXE+BeCg== 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: Reorganize attrs and is_visible Cc: "Peter Zijlstra (Intel)" , Kan Liang , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231025201626.3000228-4-kan.liang@linux.intel.com> References: <20231025201626.3000228-4-kan.liang@linux.intel.com> MIME-Version: 1.0 Message-ID: <169841261028.3135.13368844314175705110.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email 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 (pete.vger.email [0.0.0.0]); Fri, 27 Oct 2023 06:17:26 -0700 (PDT) The following commit has been merged into the perf/core branch of tip: Commit-ID: 318c4985911245508f7e0bab5265e208a38b5f18 Gitweb: https://git.kernel.org/tip/318c4985911245508f7e0bab5265e208a38b5f18 Author: Kan Liang AuthorDate: Wed, 25 Oct 2023 13:16:22 -07:00 Committer: Peter Zijlstra CommitterDate: Fri, 27 Oct 2023 15:05:10 +02:00 perf/x86/intel: Reorganize attrs and is_visible Some attrs and is_visible implementations are rather far away from one another which makes the whole thing hard to interpret. There are only two attribute groups which have both .attrs and .is_visible, group_default and group_caps_lbr. Move them together. No functional changes. Suggested-by: Peter Zijlstra (Intel) Signed-off-by: Kan Liang Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20231025201626.3000228-4-kan.liang@linux.intel.com --- arch/x86/events/intel/core.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index a99449c..584b58d 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -5540,6 +5540,12 @@ static struct attribute *lbr_attrs[] = { NULL }; +static umode_t +lbr_is_visible(struct kobject *kobj, struct attribute *attr, int i) +{ + return x86_pmu.lbr_nr ? attr->mode : 0; +} + static char pmu_name_str[30]; static ssize_t pmu_name_show(struct device *cdev, @@ -5567,6 +5573,15 @@ static struct attribute *intel_pmu_attrs[] = { }; static umode_t +default_is_visible(struct kobject *kobj, struct attribute *attr, int i) +{ + if (attr == &dev_attr_allow_tsx_force_abort.attr) + return x86_pmu.flags & PMU_FL_TFA ? attr->mode : 0; + + return attr->mode; +} + +static umode_t tsx_is_visible(struct kobject *kobj, struct attribute *attr, int i) { return boot_cpu_has(X86_FEATURE_RTM) ? attr->mode : 0; @@ -5588,26 +5603,11 @@ mem_is_visible(struct kobject *kobj, struct attribute *attr, int i) } static umode_t -lbr_is_visible(struct kobject *kobj, struct attribute *attr, int i) -{ - return x86_pmu.lbr_nr ? attr->mode : 0; -} - -static umode_t exra_is_visible(struct kobject *kobj, struct attribute *attr, int i) { return x86_pmu.version >= 2 ? attr->mode : 0; } -static umode_t -default_is_visible(struct kobject *kobj, struct attribute *attr, int i) -{ - if (attr == &dev_attr_allow_tsx_force_abort.attr) - return x86_pmu.flags & PMU_FL_TFA ? attr->mode : 0; - - return attr->mode; -} - static struct attribute_group group_events_td = { .name = "events", };