Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4951366rdb; Fri, 15 Sep 2023 18:52:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGmQBM2TcyUDR9BJwL41vEt20GWA9ufdIwebMawo/G9vKbNy7p9HTDBI8e0KhRJ6JHW5Tjp X-Received: by 2002:aa7:88d6:0:b0:68e:4653:2a2b with SMTP id k22-20020aa788d6000000b0068e46532a2bmr3932440pff.24.1694829145364; Fri, 15 Sep 2023 18:52:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1694829145; cv=pass; d=google.com; s=arc-20160816; b=N6ojRbZeKDV7pAKnhK/pT+lnr+fEIok77v2/0TtyR9os13ycoS/N6hf1Tlb+0vxgWw ycppv2Qq3iFo4kfIqdKPgkkdZ1fdKk8ftSLjbZqTjcNlejNkEGtwmIgMwprjs+1w7fZ3 eskKQLTILtdRZbFvmQoarP+UWR2w+i4lIw9a57xDCCNGxxMNNua1FOHCXLKvGxgm81PN x3TN8GPPAG9SecMXWONJx9isOeG4rLXYUGrwo/u9fiE2g2053UN5o144v7ZNenJUS1KL E9wgtfUow6/3JDRXzmZEmVpvrP+F8Fz1hUgNW1yluDeVoY/vnof2xTM1r45J79gq49B5 pR/Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HvaKj6jCDUqPY4p5TSEJOa6+/CN/X84gmnBh324gLsk=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=IdLT9g9f9tHF/kpjPndyJfgP/Z8HHMbamHiawR1MAmge5kkp02hQovPW4fii62df/H qYXOF5lqmyIPTm2eN8a+3v/IvdlO/3nIoCB8+t8QWingCqKKvdbCX5sN8ynbbQ2caq2u 4hNKpJ4EwhkrDmLrzYmGJqa/zU1pzrcKQMb0pcylsaPvkWMFv7zc6YkM/2EJHcoHJv78 yL3ESig6rAugBVRH9TkgsvveQnGXXkAPees3miKsS3FimiWeLVzHz6+o6CRYWjku3DaV nJztFQorVxrhapIojCZKOdJMJfAVlMQgcRR/jE2ilPjvrRUqLmKEif/he9I+OuzV5FKd obkw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=t4YBQnc7; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id ct8-20020a056a000f8800b0068a54522bb0si4122593pfb.144.2023.09.15.18.52.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 18:52:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=t4YBQnc7; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id B348D82CFF2E; Fri, 15 Sep 2023 15:45:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238004AbjIOWnR (ORCPT + 99 others); Fri, 15 Sep 2023 18:43:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237945AbjIOWmz (ORCPT ); Fri, 15 Sep 2023 18:42:55 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2088.outbound.protection.outlook.com [40.107.223.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0655C115; Fri, 15 Sep 2023 15:42:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ie0j3RaN92UO+w09K92j1RtEbMUDLqMgFN67qW1lLFbM3lPXmZKwuap5pNnyxJxVbb8RVFYrwbqNJKYxQOfawTn0vgHmYn0Ymq3kx2l7yU+Kfsq12qHuG1az1v2s7ch1RjMT7M3M5d5qJWG1AOjHPL5SkEpZ2MZP6Vrk/EjO0LaGqJezV2eZzfFk06WEHYtPdBKKRia/z4k7S8XDgdsnQlad7nsNAq1oooVPYRFlImXA+wZ8TQzDp4oND0XvciJgOPHhRdCSLS8TVtnrlYrIRKMfP3zMU4T+b7opdMA575HfCUjewLRiLgEI6kdwYlCF0K9idcv3J6/weyC6pC1iCQ== 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=HvaKj6jCDUqPY4p5TSEJOa6+/CN/X84gmnBh324gLsk=; b=mvEhqVceVHWciRIkFQOzCtM39aw0SNE4nzIHwxXG95nt7eer6so8+l4eMxmtjrAI6g32VtYy7lcYzjlP/hNGXAfYSMzf6kD4+wsMiIQpnzueB3dlH+wgPjBIQXZ6zxWFaAtV+JcdOSCN3p2GiQcFEgXpIX7QiE8oeiJlE8+XQLCAMbKgtoA25cKT8/3SPM/A2TwE+2Fo8JOba6xhBxNInjrE6XhqvPk9+CKt30Ok/Ka8xA4BCFSL4HF36Y3Y6GH37MqteFfeFHWp6nYV+QLJw6zqgy0DSk5EK/CFcf3lsi2bWTiWmFGhYw3qrWkzFPFrN+6rn/x6966MkiztbDosVQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=HvaKj6jCDUqPY4p5TSEJOa6+/CN/X84gmnBh324gLsk=; b=t4YBQnc7ZVpnHRk2utbfpKlNyVmV7AEX9S5tm4A6NCxIJKbkpB0OGhbQHknu5MWfpFbgqZA4eqfpa9WLtI0WUUIseZC/WRBZFBnr+FPlMFg/y24NPXYhORj0+EvypbfI/M5A7NeSdjdLqGb88mJ0cK7nvm+fBPxthauhDD7XIBo= Received: from CY8PR12CA0030.namprd12.prod.outlook.com (2603:10b6:930:49::8) by MW6PR12MB8998.namprd12.prod.outlook.com (2603:10b6:303:249::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21; Fri, 15 Sep 2023 22:42:47 +0000 Received: from CY4PEPF0000E9D3.namprd03.prod.outlook.com (2603:10b6:930:49:cafe::3) by CY8PR12CA0030.outlook.office365.com (2603:10b6:930:49::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21 via Frontend Transport; Fri, 15 Sep 2023 22:42: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 CY4PEPF0000E9D3.mail.protection.outlook.com (10.167.241.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.20 via Frontend Transport; Fri, 15 Sep 2023 22:42:47 +0000 Received: from bmoger-ubuntu.amd.com (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.2507.27; Fri, 15 Sep 2023 17:42:44 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v10 07/10] x86/resctrl: Introduce "-o debug" mount option Date: Fri, 15 Sep 2023 17:42:24 -0500 Message-ID: <20230915224227.1336967-8-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230915224227.1336967-1-babu.moger@amd.com> References: <20230915224227.1336967-1-babu.moger@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D3:EE_|MW6PR12MB8998:EE_ X-MS-Office365-Filtering-Correlation-Id: 381d759c-3f2e-4a05-d6f4-08dbb63d1563 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: f15aanQmQKrphSPGL5T4VQ+5AYG6QgU3zKi/rnNVAmoBA2QIeFM1b3np14J91APk/K2IGUffJInMIYPOjn1sitkWnZMD+qqN1ei2PbP0qmMri5x7EY7ez0lawDuvEw3RsTfqNmkmekSVcWuF1yjyY+Vlc58rYEBTbgvUuTNUBBvWbtNwZ1LXeKeycZ6xY2HFuIQjqMvPZRi5v+2VeM8P4opOMyY2CO/kg5s6AU6Vn8ZGXeDr097ciT6NspIPgo3xwmsbvfJWDVF4u03FeWKov7lYW1HloeHjLsvhHUuLBE8f+HqeKBVNHeegRgNbm4Yh0KImiERSdVD6NcEWqp/rV3R3Uxm0V68I1i3S+1k2L+cgqVrAl2cpn2awRqIYPq8UQC8M2/A1PszJlqZci3giqovc0bSQYIe/U4iZEa2verg8wy5TDsJg+X8reyS/itwSRx8dezKCagSisp7EdpzGPY2F0wYu/AWpA58V0sKZrr8twl33qa63G1t/ctg8jsdN1tEnms9dfeUFqAFIVcUG11bKQiY54Tuz77gm5buQ9H3QcBis7XHSkELIAerhuD2vaZ2TXnRzZbtvKXUTm/Qn1yIt24nLYlo0RFbXCE2yDIznIwJY+XHjfBZzwsGwkgL2k+DOnq8a9Bgf9xZSuG35jUgdXEBuA+9A0iE58CMt5zKtwlglCuPgTkY8jkVE3rO96pnGv8x156T9IqXaGDGwEEpW83xK7ZZGqb+JNEULHdkIbtwbwGWswiXtNz0TRz0OXYQEUPdGZx+XLIznAIMMgA== 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:(13230031)(4636009)(39860400002)(396003)(376002)(346002)(136003)(82310400011)(451199024)(186009)(1800799009)(40470700004)(46966006)(36840700001)(7696005)(6666004)(478600001)(83380400001)(5660300002)(4326008)(1076003)(26005)(2616005)(336012)(426003)(2906002)(316002)(70586007)(7406005)(70206006)(7416002)(44832011)(16526019)(54906003)(41300700001)(110136005)(8676002)(8936002)(47076005)(40460700003)(356005)(82740400003)(36860700001)(36756003)(40480700001)(86362001)(81166007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 22:42:47.0088 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 381d759c-3f2e-4a05-d6f4-08dbb63d1563 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: CY4PEPF0000E9D3.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8998 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 15 Sep 2023 15:45:58 -0700 (PDT) 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. Reviewed-by: Reinette Chatre Reviewed-by: Fenghua Yu Signed-off-by: Babu Moger --- 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 8154e9975d1e..28d35aaa74b4 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 14988c9f402c..68d1b7147291 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) @@ -306,6 +307,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 a34657f0bd0c..150105c21fee 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); @@ -1874,6 +1876,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); @@ -2377,6 +2382,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) @@ -2401,6 +2408,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: @@ -2605,6 +2615,7 @@ enum rdt_param { Opt_cdp, Opt_cdpl2, Opt_mba_mbps, + Opt_debug, nr__rdt_params }; @@ -2612,6 +2623,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), {} }; @@ -2637,6 +2649,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; @@ -3705,6 +3720,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; } -- 2.34.1