From patchwork Fri Oct 27 13:16:50 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: 158922 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp595815vqb; Fri, 27 Oct 2023 06:17:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE2DRwhGU3zDuE3p9ZdSHXSJNkGoZJAy95u7nQ7KQ/HnoPhvCLF9kBlfeHnA4eLz9WcgTWc X-Received: by 2002:a05:622a:11d3:b0:41b:773c:184f with SMTP id n19-20020a05622a11d300b0041b773c184fmr3116186qtk.10.1698412621902; Fri, 27 Oct 2023 06:17:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698412621; cv=none; d=google.com; s=arc-20160816; b=X4xmAKYBvwKBPJlCj9dNgx3ZZ8WB0QCVu2FEPFu8rUrdkUR5LlzSycpfNdzKG7SyBw crH5x8csFaxDb4uL5dbkrHgIntfm8jRXhUSva+eGcLACEnDsd2nHVm8+ok4iju21ExKx 6rghz9AjsDmUUR0w3ziIjI8yOsRTUDeg4DSAv63IjGyyevBaliCS8DJqXY5Cli2YRY+f CmUr0z80EIoTz7ZGQ8xYHyBd/YL1gFZ8hFbhWmL5+PJMKvH8FZTwQZHJ5N9m4AYZI9XB 0Bcfx9t+dPw4HIToiTpjrUAidUIys+EkCPuToOjQL5w2y0qsNwIf/gVh1r443KkQB1HV sdoA== 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; 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 o10-20020a05622a138a00b004108a7e5ef6si764045qtk.126.2023.10.27.06.17.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 06:17:01 -0700 (PDT) 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=A4eoc4on; dkim=neutral (no key) header.i=@linutronix.de; 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 0801982C92EE; Fri, 27 Oct 2023 06:17:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345855AbjJ0NQ5 (ORCPT + 25 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 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,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]); Fri, 27 Oct 2023 06:17:00 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780759951974928016 X-GMAIL-MSGID: 1780914713826626414 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", };