Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3115460rdg; Tue, 17 Oct 2023 05:18:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFCUHf0du0ejDIxY7AE0/FisUBR8YuU12jN9MfNywqsatv+x6mQkB1cus7GmHn0iIk7ohkc X-Received: by 2002:a17:90b:2d81:b0:26c:f9a5:4493 with SMTP id sj1-20020a17090b2d8100b0026cf9a54493mr1892940pjb.5.1697545107875; Tue, 17 Oct 2023 05:18:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697545107; cv=none; d=google.com; s=arc-20160816; b=ppQ+/nNyCaTXnqcBHfVwLMxQT4IxGAtxcElTcvPg3okORszMqa3Su73hUY4hhrXP2r QPNM9qb6Mq6P/5goCwvK5XdlQb7aCm2A8T2ZNNSXVAVOupLCfBHPlVRf8zDG2cSX6WgX ODMt9QPhtGHL64qWE9yDiecv9uZw1Q3coPpMOA6dAInIp64tMQkrHFzSU60FeTpm+qhY pkTduMQg0bNaxJPkqGCelvkSdX+mHcXL5JsDlG3hUaAYBj50KPHUCFqrk9svAAzhXRT6 0inISyAYkRjIIYmGuLTEa8jtZFYNShXY1WWo69I90lSUiIswapFd75DkjautBxsbKfuo ENRQ== 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 header.b=tD5TP2Bg; 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 Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id a23-20020a17090acb9700b0027921228848si8353982pju.133.2023.10.17.05.18.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 05:18:27 -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=urnxCNel; dkim=neutral (no key) header.i=@linutronix.de header.b=tD5TP2Bg; 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 990B6801CBED; Tue, 17 Oct 2023 05:18:26 -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 S235113AbjJQMSR (ORCPT + 99 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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:26 -0700 (PDT) The following commit has been merged into the x86/cache branch of tip: Commit-ID: cb07d71f01017b7c2885ed629da9b973cb56b1d2 Gitweb: https://git.kernel.org/tip/cb07d71f01017b7c2885ed629da9b973cb5= 6b1d2 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=C3=A4rvinen 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/resc= trl.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. =20 To use the feature mount the file system:: =20 - # mount -t resctrl resctrl [-o cdp[,cdpl2][,mba_MBps]] /sys/fs/resctrl + # mount -t resctrl resctrl [-o cdp[,cdpl2][,mba_MBps][,debug]] /sys/fs/resc= trl =20 mount options are: =20 @@ -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". =20 L2 and L3 CDP are controlled separately. =20 diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/res= ctrl/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; }; =20 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/res= ctrl/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); =20 struct dentry *debugfs_resctrl; =20 +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, u= nsigned long fflags) =20 lockdep_assert_held(&rdtgroup_mutex); =20 + if (resctrl_debug) + fflags |=3D RFTYPE_DEBUG; + for (rft =3D rfts; rft < rfts + len; rft++) { if (rft->fflags && ((fflags & rft->fflags) =3D=3D rft->fflags)) { ret =3D 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 =3D false; } =20 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; } =20 + if (ctx->enable_debug) + resctrl_debug =3D true; + return 0; =20 out_cdpl3: @@ -2623,6 +2633,7 @@ enum rdt_param { Opt_cdp, Opt_cdpl2, Opt_mba_mbps, + Opt_debug, nr__rdt_params }; =20 @@ -2630,6 +2641,7 @@ static const struct fs_parameter_spec rdt_fs_parameters= [] =3D { fsparam_flag("cdp", Opt_cdp), fsparam_flag("cdpl2", Opt_cdpl2), fsparam_flag("mba_MBps", Opt_mba_mbps), + fsparam_flag("debug", Opt_debug), {} }; =20 @@ -2655,6 +2667,9 @@ static int rdt_parse_param(struct fs_context *fc, struc= t fs_parameter *param) return -EINVAL; ctx->enable_mba_mbps =3D true; return 0; + case Opt_debug: + ctx->enable_debug =3D true; + return 0; } =20 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"); =20 + if (resctrl_debug) + seq_puts(seq, ",debug"); + return 0; } =20