From patchwork Tue Oct 17 12:17:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 154226 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4091356vqb; Tue, 17 Oct 2023 05:18:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF0RHo6s4p5BsTExydZeCntMoVk8cBq4G4YjvVtI8GjXkV0dx37QzPQoly6QcSlZ9GvZcd5 X-Received: by 2002:a92:cd4d:0:b0:350:f353:4017 with SMTP id v13-20020a92cd4d000000b00350f3534017mr2302366ilq.0.1697545110479; Tue, 17 Oct 2023 05:18:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697545110; cv=none; d=google.com; s=arc-20160816; b=vFGsHi+dF3Zu9f5QSld/BOc7psxS+UiKd3A5lJlYnmbrtjn0YUnlO3j16tdqV5i1MR yfsVttIwXrohxCY5hYzbwouw7aSKbrok5nHwmEdQR4seFwkgCwr9ORbBsI0XS51/G4BR Vnbr0O83rW+m4l1sqFJWMShLhX3Oxa5NiTjc4o4eaGH19E5DBBF1dk4+HccSUVlXRgju ircby+71Uz6uSIqztpXjDvCp6DYvNO9l03+4zZUtFG23frARGEg7S8spRVby9VfHG4en LcR5c5bZEzoEO/fa3575pyqJZK1UQkd4c92paNGLdwzp3j67IcwHg7zD31c3ukxDtHOI vlZA== 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=0JU3NqWjgwykZxeiRbyFGvYyb+ANvfSQfxPKkBi3l0w=; fh=xlieDj8o+jXNpmF12Ogr15ctNOIP4IDTbgVIdoNwRD8=; b=nF7R+D8fidhUUSDBwBPF6nvr3ATWTfcrLfVbutMAm6/bTlIWpKxCkBmwGVfRIbWqC1 PBtXTj/uUocTotlmBTjKR/dMHR0/5XkO+VJ8oYI9CjbxKn2TmkMN9N6ivY/0FtHUKzxY sPBTiBgovykvflJwv3B7yz6dj2gRVyYMjpVWRMQEnKL5CJZb4rW5S/KJZaqNyT32ntZD gBFtewxaC+z080xSilRzAJYNe3gVnlHtQT0yu23F0z9tZLwXitdZiwegLEWKx59Y12G3 hwiRmuVXCvQbKFA6p/TvtsDt+lklf9S79+aE/JtWFi3YyeImcbHj7MczqDUTq0qfABCq A5OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=urnxCNel; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id y191-20020a638ac8000000b0056c0e3c77f7si1635085pgd.805.2023.10.17.05.18.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 05:18:30 -0700 (PDT) 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=@linutronix.de header.s=2020 header.b=urnxCNel; dkim=neutral (no key) header.i=@linutronix.de; 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=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 7EA37801C181; Tue, 17 Oct 2023 05:18:29 -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 S1343550AbjJQMSR (ORCPT + 19 others); Tue, 17 Oct 2023 08:18:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233549AbjJQMSF (ORCPT ); Tue, 17 Oct 2023 08:18:05 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 801BC12F; Tue, 17 Oct 2023 05:18:02 -0700 (PDT) Date: Tue, 17 Oct 2023 12:17:59 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1697545080; 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=0JU3NqWjgwykZxeiRbyFGvYyb+ANvfSQfxPKkBi3l0w=; b=urnxCNelCbDcmdmG5882YuploNlv1LOaVbKOsTkHcvSbN3ylO7lQuCQeKk6+8C5XaqnuJA I1BIKuhR89JBVXN7XtqYf8+1NC8rpmtPdprzTyxzYEXWcLVHK/P2NJikGC25f6cYhpRAVr gEIarPHiSfOiUidI8F0vuEn/8Oo0LyaDA4fo3r4YospRWn4Eld8YGVRAjQ5SJJVt3q/HIj MVk5zUBVzzU2Ji+4T4lmJQx8ym8pkWV/LqY3MYojtWRyaVfQ5RErglYCPHRnomdO7oVa1C a0rSPUtHL4kwTuIfrn2CUFHMMM7U+AnTmQmSd9BjHwmL6tRPIZGVll5U7wwxIg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1697545080; 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=0JU3NqWjgwykZxeiRbyFGvYyb+ANvfSQfxPKkBi3l0w=; b=tD5TP2Bgkn7yNWhHOeVZVscjKmJslmwdAWjx7FN1hcy9bFwGHOiIvYUcWZvop7BGVTlWsq +gAvSu6NjOJS+XCA== From: "tip-bot2 for Babu Moger" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/cache] x86/resctrl: Introduce "-o debug" mount option Cc: Babu Moger , "Borislav Petkov (AMD)" , Peter Newman , Tan Shaopeng , Fenghua Yu , Reinette Chatre , ilpo.jarvinen@linux.intel.com, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231017002308.134480-7-babu.moger@amd.com> References: <20231017002308.134480-7-babu.moger@amd.com> MIME-Version: 1.0 Message-ID: <169754507967.3135.11415385807971392786.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 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]); Tue, 17 Oct 2023 05:18:29 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779960119938532158 X-GMAIL-MSGID: 1780005061288020160 The following commit has been merged into the x86/cache branch of tip: Commit-ID: cb07d71f01017b7c2885ed629da9b973cb56b1d2 Gitweb: https://git.kernel.org/tip/cb07d71f01017b7c2885ed629da9b973cb56b1d2 Author: Babu Moger AuthorDate: Mon, 16 Oct 2023 19:23:05 -05:00 Committer: Borislav Petkov (AMD) CommitterDate: Tue, 17 Oct 2023 13:07:17 +02:00 x86/resctrl: Introduce "-o debug" mount option Add "-o debug" option to mount resctrl filesystem in debug mode. When in debug mode resctrl displays files that have the new RFTYPE_DEBUG flag to help resctrl debugging. Signed-off-by: Babu Moger Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Peter Newman Reviewed-by: Tan Shaopeng Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Reviewed-by: Ilpo Järvinen Tested-by: Peter Newman Tested-by: Tan Shaopeng Link: https://lore.kernel.org/r/20231017002308.134480-7-babu.moger@amd.com --- Documentation/arch/x86/resctrl.rst | 5 ++++- arch/x86/kernel/cpu/resctrl/internal.h | 2 ++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 178ab1d..68f1161 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -35,7 +35,7 @@ about the feature from resctrl's info directory. To use the feature mount the file system:: - # mount -t resctrl resctrl [-o cdp[,cdpl2][,mba_MBps]] /sys/fs/resctrl + # mount -t resctrl resctrl [-o cdp[,cdpl2][,mba_MBps][,debug]] /sys/fs/resctrl mount options are: @@ -46,6 +46,9 @@ mount options are: "mba_MBps": Enable the MBA Software Controller(mba_sc) to specify MBA bandwidth in MBps +"debug": + Make debug files accessible. Available debug files are annotated with + "Available only with debug option". L2 and L3 CDP are controlled separately. diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index ba46111..b816b90 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -59,6 +59,7 @@ struct rdt_fs_context { bool enable_cdpl2; bool enable_cdpl3; bool enable_mba_mbps; + bool enable_debug; }; static inline struct rdt_fs_context *rdt_fc2context(struct fs_context *fc) @@ -248,6 +249,7 @@ struct rdtgroup { #define RFTYPE_TOP BIT(6) #define RFTYPE_RES_CACHE BIT(8) #define RFTYPE_RES_MB BIT(9) +#define RFTYPE_DEBUG BIT(10) #define RFTYPE_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) #define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON) #define RFTYPE_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 55da93b..84e0f45 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -59,6 +59,8 @@ static void rdtgroup_destroy_root(void); struct dentry *debugfs_resctrl; +static bool resctrl_debug; + void rdt_last_cmd_clear(void) { lockdep_assert_held(&rdtgroup_mutex); @@ -1892,6 +1894,9 @@ static int rdtgroup_add_files(struct kernfs_node *kn, unsigned long fflags) lockdep_assert_held(&rdtgroup_mutex); + if (resctrl_debug) + fflags |= RFTYPE_DEBUG; + for (rft = rfts; rft < rfts + len; rft++) { if (rft->fflags && ((fflags & rft->fflags) == rft->fflags)) { ret = rdtgroup_add_file(kn, rft); @@ -2395,6 +2400,8 @@ static void rdt_disable_ctx(void) resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, false); resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, false); set_mba_sc(false); + + resctrl_debug = false; } static int rdt_enable_ctx(struct rdt_fs_context *ctx) @@ -2419,6 +2426,9 @@ static int rdt_enable_ctx(struct rdt_fs_context *ctx) goto out_cdpl3; } + if (ctx->enable_debug) + resctrl_debug = true; + return 0; out_cdpl3: @@ -2623,6 +2633,7 @@ enum rdt_param { Opt_cdp, Opt_cdpl2, Opt_mba_mbps, + Opt_debug, nr__rdt_params }; @@ -2630,6 +2641,7 @@ static const struct fs_parameter_spec rdt_fs_parameters[] = { fsparam_flag("cdp", Opt_cdp), fsparam_flag("cdpl2", Opt_cdpl2), fsparam_flag("mba_MBps", Opt_mba_mbps), + fsparam_flag("debug", Opt_debug), {} }; @@ -2655,6 +2667,9 @@ static int rdt_parse_param(struct fs_context *fc, struct fs_parameter *param) return -EINVAL; ctx->enable_mba_mbps = true; return 0; + case Opt_debug: + ctx->enable_debug = true; + return 0; } return -EINVAL; @@ -3723,6 +3738,9 @@ static int rdtgroup_show_options(struct seq_file *seq, struct kernfs_root *kf) if (is_mba_sc(&rdt_resources_all[RDT_RESOURCE_MBA].r_resctrl)) seq_puts(seq, ",mba_MBps"); + if (resctrl_debug) + seq_puts(seq, ",debug"); + return 0; }