From nobody Tue Feb 10 07:39:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 719DCC7EE2D for ; Thu, 1 Jun 2023 19:02:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232166AbjFATCL (ORCPT ); Thu, 1 Jun 2023 15:02:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232663AbjFATCF (ORCPT ); Thu, 1 Jun 2023 15:02:05 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2075.outbound.protection.outlook.com [40.107.243.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB7CE13E; Thu, 1 Jun 2023 12:01:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HB0kH+/h5zfhsRMnWFNZCfpVpdpe3WN9igjZ8+EWjD6haeamK96kdxu6yqbzea+MoUQD2xE2FOeXgZRyR4DxSBL9v7r/OvJDCr5thXYCkx5WZVBxrT3kDFTU9J1HHdbENPaeoiGeuUKkdO9VOMkjpOLaR12spVM8bCNRl5PxePuLZ5tIos/xFK3SnLCStT/idq74nMxmCdMlBzQNhdYIl4vDbbz3YVoGDCk5ggad6I5TCAJlAWOFn9T6hCtI9cEueVPrf52zISVMFStTuBeYtmHM1XieyNN9yikfCe7ouKkf9BIfh3C7LvIPW/iOqt+6bi2HQsIRCBTqMO+dggnS6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=sM+u9qPh9p1d/oY1rC3cLQAN+jtCywVZGoNJo2u42+Q=; b=NyCNfYYhpoS2It8t66+VohiUgUdL6YFH2ytdzoYw8LEn8I4x5TeR5uTpfNlPjA1B+wuIJMPFWCCvylkZtz+3201gXxmk4pgWl9KaDkFTyLAIiQUtXjrf6HLO1cA6XyUK9WYc/2MFMRafcVllbEfw/GixN/LEUSN01THlihSDP4xUlm3/EIOnn2O24e2tPCuquuMN4YaoYfvvePyfpNCPzFY6aAsR7N7G2XIJBbwXIM9P1La5LCD44kZRnS6NtNf9N0xGaCRLrKK2Le5B82GXK6u2u6Rl5UT+l4zWritrIgFIhyUh1xUPYmduwUo15R2gpgevmH6VodERrkd7f1Jmqg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sM+u9qPh9p1d/oY1rC3cLQAN+jtCywVZGoNJo2u42+Q=; b=DZFBtwZwfAF7wkimePycfQwPhy76tZQPOP5kjhJqFiy0v05pM/TjWXhSAQ9ryumEiNb0LPrdEiSxXEnEZUb2bEAWe4Of6BbPYu1WQG61+XoZVwGHlyRCgudtc2kl/D9+McUr3B8fD4KVXtQv0MIIwSC3k0HWGKJnfTFNrGsep2k= Received: from BN9PR03CA0543.namprd03.prod.outlook.com (2603:10b6:408:138::8) by SA1PR12MB8723.namprd12.prod.outlook.com (2603:10b6:806:385::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.23; Thu, 1 Jun 2023 19:01:48 +0000 Received: from BN8NAM11FT010.eop-nam11.prod.protection.outlook.com (2603:10b6:408:138:cafe::c2) by BN9PR03CA0543.outlook.office365.com (2603:10b6:408:138::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23 via Frontend Transport; Thu, 1 Jun 2023 19:01:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT010.mail.protection.outlook.com (10.13.177.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.24 via Frontend Transport; Thu, 1 Jun 2023 19:01:47 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 1 Jun 2023 14:01:42 -0500 Subject: [PATCH v5 5/8] x86/resctrl: Introduce "-o debug" mount option From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 1 Jun 2023 14:01:40 -0500 Message-ID: <168564610093.527584.3413729327027786408.stgit@bmoger-ubuntu> In-Reply-To: <168564586603.527584.10518315376465080920.stgit@bmoger-ubuntu> References: <168564586603.527584.10518315376465080920.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT010:EE_|SA1PR12MB8723:EE_ X-MS-Office365-Filtering-Correlation-Id: 8c52d751-95b0-4b64-2aee-08db62d2a621 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kvNK7/yy2hIB8Iob0KMsqRvfxhuIYdnQ9JmcJtLpDoHl+zGq8N8YldUbTmq/CW2xrNkQ2oEy8rAgc1Zx/bD7d46G2ofdxom1we38T9n6F2WM/x/lEB69HWWGkSo8bRa3sFjD2v50qux2F6TmSIJk88/2emYpQ9oihIPe6xYDn6dNIikb2M2GbPhXUrstK39LnkxZ4z+UdgzjQsSVGb1RSnVXjcIkyAVuXiNI9TSl6Zenu/45o9eiO2tBDFD2aLJ3Mr/AYL25ygQ2QA8HsVFFidv4o7ZWsPSPPq6b+5Lf4HjWdwvcfaJHA5Swo+uUbHL6qZ1uXEYloN7i6OFYL+ez6I3wI4itjNwni9xSnuYG7SyTNmvohsZKHkxjnm5kSR/l5H33Iu/EkUyVRrv5mOkUTUFxvWCnW4s/pqoWSYasQdy9wNlvRdjFoxYi74FXhElfjXYgqlfEaIeQSYPPReMF96azneSq/Xf9+f2DM9BtX6zYCfeaei12MYssScxNQGWmmUlcHZKQV+77PldZuaFt2JSBlguPt134SllimYYJRjusx11mo4LFvhezCC6UPFtJbt/QayINRbi5eltk4l7UBkXG2xGllah1g0oIxbJGy6fKXc/8w29vBLMV593HTTFmnam5nNWsHPvxS/pnIxUJp/cvBVkTGxBrLZDIp6HBzGfLbyQlNswYgo6YfCBxDJHNhudeF9PdPquBt9j8PcAoxPb+1pcIybgZ9pGyFFDwq2o1ewIs5+AN1MXqSgvPXSDAjMt5BlLf9l7SqVxrYUp3aWj78a/xB5KCTl/6CPilBEk= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(7916004)(346002)(376002)(396003)(136003)(39860400002)(451199021)(40470700004)(46966006)(36840700001)(81166007)(82740400003)(36860700001)(356005)(47076005)(83380400001)(33716001)(70206006)(426003)(86362001)(4326008)(70586007)(54906003)(336012)(110136005)(16576012)(82310400005)(103116003)(2906002)(186003)(16526019)(316002)(26005)(9686003)(44832011)(5660300002)(41300700001)(8936002)(7416002)(7406005)(478600001)(8676002)(40480700001)(40460700003)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 19:01:47.2277 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8c52d751-95b0-4b64-2aee-08db62d2a621 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT010.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8723 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add "-o debug" option to mount resctrl filesystem in debug mode. This option can be used for adding extra files to help debug resctrl issues. For example, hardware uses CLOSID and RMIDs to control and monitor resctrl resources. These numbers are not visible to the user. These details can help to debug issues. Debug option provides a method to add these files to resctrl. Signed-off-by: Babu Moger --- Documentation/arch/x86/resctrl.rst | 3 +++ arch/x86/kernel/cpu/resctrl/internal.h | 1 + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 15 +++++++++++++++ 3 files changed, 19 insertions(+) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/re= sctrl.rst index 290f01aa3002..afdee4d1f691 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -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/r= esctrl/internal.h index c20cd6acb7a3..c07c6517d856 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) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/r= esctrl/rdtgroup.c index baed20b2d788..be91dea5f927 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -56,6 +56,8 @@ static char last_cmd_status_buf[512]; =20 struct dentry *debugfs_resctrl; =20 +static bool resctrl_debug; + void rdt_last_cmd_clear(void) { lockdep_assert_held(&rdtgroup_mutex); @@ -2368,6 +2370,9 @@ static int rdt_enable_ctx(struct rdt_fs_context *ctx) if (!ret && ctx->enable_mba_mbps) ret =3D set_mba_sc(true); =20 + if (!ret && ctx->enable_debug) + resctrl_debug =3D true; + return ret; } =20 @@ -2556,6 +2561,7 @@ enum rdt_param { Opt_cdp, Opt_cdpl2, Opt_mba_mbps, + Opt_debug, nr__rdt_params }; =20 @@ -2563,6 +2569,7 @@ static const struct fs_parameter_spec rdt_fs_paramete= rs[] =3D { fsparam_flag("cdp", Opt_cdp), fsparam_flag("cdpl2", Opt_cdpl2), fsparam_flag("mba_MBps", Opt_mba_mbps), + fsparam_flag("debug", Opt_debug), {} }; =20 @@ -2588,6 +2595,9 @@ static int rdt_parse_param(struct fs_context *fc, str= uct 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; @@ -2778,6 +2788,8 @@ static void rdt_kill_sb(struct super_block *sb) =20 set_mba_sc(false); =20 + resctrl_debug =3D false; + /*Put everything back to default values. */ for_each_alloc_capable_rdt_resource(r) reset_all_ctrls(r); @@ -3530,6 +3542,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