From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C20CE606A68E for ; Fri, 4 Dec 2026 23:07:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=ZPL8qLCO; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=A9/bLC0S DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version: Content-Transfer-Encoding:Content-Type:In-Reply-To:From:References:Cc:To: Subject:Date:Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=raJQtSQVhZvBu866Mxl2S1zUCY54jGi7j1pl52wsiP0=; b=ZPL8qLCOvlHtvA/Jeea/9TKiee A5avKWS05Ff7bpQQ/IQvk4O/4+KX7gtUUSNigiTL+qEWVlFS8TKlzCFNlFVyfZv9Ybkv2AXaI/yFN prIxP0YSCAQA9xlseJ5GMLyu+GULZHG1ODWJM+6KKuvT9Z2ma+kKQeuKy7W+HLcNpWnDt0ke8IRmR KSuChcneB/bJ1NHI48P4chm2OYU3kKlNKaDwnqh+qs/Ty6spW2hdMqBfkpgUfixqMjayyw3zh7Zhb fyOxDIowKhwR1i53ojkN6p8OL1QfrPtsqlJQQi8+fiuhk4xevH9FzZZlFJpg6U1ZGbHvhKeJAY6Zy 2ca5IhGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZcN9-00000001jSb-1TVm; Fri, 04 Dec 2026 23:07:28 +0000 Received: from mail-southcentralusazlp170130001.outbound.protection.outlook.com ([2a01:111:f403:c10c::1] helo=SA9PR02CU001.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZcN6-00000001jS7-0WqJ for linux-arm-kernel@lists.infradead.org; Fri, 04 Dec 2026 23:07:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FLl9pFUxFl6BOYCLqYHC7l8c21xZvuOmbZwm5H4xNOW/NnymVoe9enIuG6xV4xsTnAI4Ksmw3HeKBT08Ic1A6ua0FxuuuAJoUaVQ2mV5O7ZQAMNkf7ghJ2eK9/KOXT6YfisPhL3HRWjHvqivmvWNICbOnlY8xom5p9LeHctdF13D2tSZFNySY8RppP72BF5zOsa6wjgplUyDlizdShHlvERfl1kTYtgCcW6ku7Q51jPkrhTWJzonc6r7zCac5Cs4xKDp1kAx1HY+4g56GMuXWhbIDZjIx6DMzlgx9LNsO/9njwypOXBHEO+djyDVPYqdo5TADg5rj1JSQvFyBSf0HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=raJQtSQVhZvBu866Mxl2S1zUCY54jGi7j1pl52wsiP0=; b=JVs6HWWL2ZVU5/LOqTI6dDExZTYavF0LA2pt//aFbR91ws7XKF+0sls8hAEvjczpnb+/T3LrK2TqD5YmIps0gHxwpjNygC8UUVcwGQMeIare2PgtduMwunqOmvEOMlVYzAA3gYxPJW8OMUYfon0XXLl9fpbp2oz1JRdfUw0mvkJXZ43ZFmTw/qklZDeNMTI5cVFjeqDx7mPWAxL2GbimQ/mbQfoifQpe8jbJl4YyHin8Lt38z2WSanvG7CAhTbEftwSUSEFCnV5HEy60KQPZlsdPXDblzwK8cfEyEFxyELalNJd41gnL95r7m160GvFyB6APvmA0gjXnZblsB5OllA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; 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=raJQtSQVhZvBu866Mxl2S1zUCY54jGi7j1pl52wsiP0=; b=A9/bLC0S3T/D/PuxWUGcCupi/SJyD+hzszhrEhFuAZC3hfbXzi8rtTIuVp0aEYFyqiH95vIvsaYvxkDPQaehTfEE8JJr5Y0FkujgBU9fpz2gGfhRtjwGvzMukpth21rTbALwecGVlTT7luAvfb7bJIe/Ln2n2mjhQVwjdPnICWI= Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from BL1PR12MB5320.namprd12.prod.outlook.com (2603:10b6:208:314::17) by PH8PR12MB6963.namprd12.prod.outlook.com (2603:10b6:510:1be::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.13; Fri, 4 Dec 2026 23:07:11 +0000 Received: from BL1PR12MB5320.namprd12.prod.outlook.com ([fe80::1876:4a6d:2cf5:b8d1]) by BL1PR12MB5320.namprd12.prod.outlook.com ([fe80::1876:4a6d:2cf5:b8d1%5]) with mapi id 15.21.0688.011; Fri, 4 Dec 2026 23:07:11 +0000 Message-ID: Date: Fri, 4 Dec 2026 17:07:08 -0600 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v7 10/19] fs/resctrl: Add interface to display kernel mode status To: Reinette Chatre , Babu Moger , tony.luck@intel.com, ben.horgan@arm.com, Dave.Martin@arm.com, james.morse@arm.com, bp@alien8.de Cc: corbet@lwn.net, skhan@linuxfoundation.org, rdunlap@infradead.org, x86@kernel.org, fustini@kernel.org, tglx@kernel.org, mingo@redhat.com, dave.hansen@linux.intel.com, hpa@zytor.com, fenghuay@nvidia.com, rppt@kernel.org, arnd@arndb.de, kmehltretter@gmail.com, dapeng1.mi@linux.intel.com, elver@google.com, enelsonmoore@gmail.com, jlayton@kernel.org, seanjc@google.com, ewanhai-oc@zhaoxin.com, binbin.wu@linux.intel.com, nikunj@amd.com, ashish.kalra@amd.com, peterz@infradead.org, superm1@kernel.org, thomas.lendacky@amd.com, prathyushi.nangia@amd.com, kim.phillips@amd.com, ricardo.neri-calderon@linux.intel.com, darwi@linutronix.de, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <24e59242-0646-4092-8db6-11844a122c48@intel.com> Content-Language: en-US From: "Moger, Babu" In-Reply-To: <24e59242-0646-4092-8db6-11844a122c48@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SA9PR13CA0074.namprd13.prod.outlook.com (2603:10b6:806:23::19) To BL1PR12MB5320.namprd12.prod.outlook.com (2603:10b6:208:314::17) X-Archived-By: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL1PR12MB5320:EE_|PH8PR12MB6963:EE_ X-MS-Office365-Filtering-Correlation-Id: c10e4fc3-f79d-4dd6-2694-08df525b53c2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|23010399003|376014|7416014|8126099003|6133799003|18002099003|22082099003|56012099006|4143699003|11063799006|5023799004|3023799007|261009223027099003|261021121427099003|261026121527099003|261026140227099003|261022105027099003|261022075727099003|261102123227099003|261028144727099003|10067099003; X-Microsoft-Antispam-Message-Info: pYVjeQG+wje8mGX9EvnTIldUR1iW8H8ezjI2nRAsXgS2TL5hcvpivKFnomd6nRTZLzk1xRHdqkmv77tuW6xg8ZXQY28FGvf+u/OZLukrvaH6Okmj2ty+IVX/47O4PTfzeCesvjEp+8X9hUWwwOL3jRuoHeg3ZdkC3I59WmrR5N7M2JnOWXOpZeKfyIYMC3z3z5114U11jHetCwyYSAoDsG1SNcG7NADrpYnoCrRxAk+LRBVzb16kQMaYniK88MIl5dLEfLdyuOc6PT+gqWGMDiMKkACJbJa44jxcVGcCpreTRz1OMxN27ae9yUSkveiWtFu76knieZsCtdbEpOmpOBO71sLl+HOX8h/NwFwNIiCjOqrF/u2RAsEacHawHC5LB5RyGU9TmWWIyjQEaziubiH6gjDN+QWNV4z6feVViw/DiJ8EJ0XFjVP4r326MwCFJvS1e+6RnZyWfNoQyOPcgv442m384mjzDQOoWs7Rh5vagogmI946ztkdsMBv+ETq84CWdbI7w4KBgjMIVo/SP74qcFhio+w1QKSym4mOxWk6dyr0nG6xUqw8r7iIUVQApOSVC1IoFyt9Xq1drwqvRag5Pbd69PAOI7wqkSKgt0C46nPb8+ggu0A9JV2M9uberrGGhXP8Cn5WZNz0YtvVmQii2HyHcsxCC1He7ckWcRw= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL1PR12MB5320.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(23010399003)(376014)(7416014)(8126099003)(6133799003)(18002099003)(22082099003)(56012099006)(4143699003)(11063799006)(5023799004)(3023799007)(261009223027099003)(261021121427099003)(261026121527099003)(261026140227099003)(261022105027099003)(261022075727099003)(261102123227099003)(261028144727099003)(10067099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?R2VMUnpMZkZHUzNjM2N1cGRCazVKQ0JUcWJta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W5NV2s0WVQzWDlmcE1yRTg3ZWFHSEpBZ1FwNG9HTG5YSkVGMFdx?= =?utf-8?B?WE1EZW94MHlINXdGZGVBQlVmWUVYSHl0NlpUQUZOTDBUdjcwTVdRQUFTWGxl?= =?utf-8?B?SWU2bHRIM0xIM1FsN0hrVmtzQ0VyMlpwL2xuTGhRUS90M2E5NHJOZnVoSS8y?= =?utf-8?B?NXZ6aWt4TC9ZSk1Fc0oxZ09ZUlZNZlJWbzdtWFArVDhBc1F3WHVkMTdyMitu?= =?utf-8?B?NDB1VVRvOFFCSFp1OFBnTkJ5QmxKRUxwb0RYYWlpQk5OSGM1ODFqVmFMZ0cw?= =?utf-8?B?N0MvTDJYZ2J0QnlickxNRTdnSTZSaGZlMThmaFAzUEJzSkpubi9nM2NDeTlS?= =?utf-8?B?RXVDcHZoSXM4N21oN3pOYmNrUlZvbHl2dVpma2RBYjhOVzdjRTk2QldZOXkr?= =?utf-8?B?dGE1NFFMTEI1dHVSQUVSTXlyWDl4NTF4OWJnWGU3emRoMHYrdTdwalpNMncr?= =?utf-8?Q?/jZx98fF4+V80p9KSY?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: c10e4fc3-f79d-4dd6-2694-08df525b53c2 X-MS-Exchange-CrossTenant-AuthSource: BL1PR12MB5320.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2026 23:07:11.2276 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: cFzFVUqdfniFLyaO9AzL/s/QZB9LoykQD8FxbwHele31iBv3d+aHLNswDruDy4sW X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6963 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261204_150720_364940_BB867154 X-CRM114-Status: GOOD ( 33.74 ) X-Spam-Score: -2.2 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-17.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Hi Reinette, On 12/1/2026 10:56 PM, Reinette Chatre wrote: > Hi Babu, > > On 11/11/26 2:44 PM, Babu Moger wrote: >> Kernel mode support allows the CPU's CLOSID and/or RMID association to >> change when transitioning from user mode to kernel mode. > > This sentence appears here and is then copy&pasted into many commits that > follow. First, please drop "association", I've noted it a few times so far > and will stop doing so, please just be specific about referring to CLOSID > and RMID. Second, please drop the "transitioning" term that uses some PLZA > implementation language. > This sentence can be something like: > The RESCTRL_GLOBAL_ENABLE_PER_CPU kernel mode runs all kernel work on > the CPUs where it is enabled with the CLOSID and/or RMID of a single > resource group. Sure. > > In commits that follow the specific property the commit depends on can > be highlighted instead of whole sentence repeatedly copy&pasted. For example, > "x86,fs/resctrl: Add CPU hotplug support for kernel mode" can then start > with: > The RESCTRL_GLOBAL_ENABLE_PER_CPU kernel mode is enabled per CPU. CPUs > that come online ... Yes. Sure. > >> >> Add info/kernel_mode to expose the supported and active kernel modes >> through the resctrl filesystem. Supported modes are listed one per line, > > needs imperative Sure. > >> with the active mode enclosed in square brackets. >> >> Signed-off-by: Babu Moger >> --- > > ... > >> --- >> Documentation/filesystems/resctrl.rst | 56 ++++++++++++++ >> fs/resctrl/rdtgroup.c | 105 ++++++++++++++++++++++++++ >> 2 files changed, 161 insertions(+) >> >> diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesystems/resctrl.rst >> index 2d672bbb69be..033d405338c0 100644 >> --- a/Documentation/filesystems/resctrl.rst >> +++ b/Documentation/filesystems/resctrl.rst >> @@ -549,6 +549,62 @@ The top level of the "info" directory contains the following file(s): >> # cat info/last_cmd_status >> mask f7 has non-consecutive 1-bits >> >> +"kernel_mode": >> + Lists the kernel modes supported by the system, one per line, with >> + the active mode enclosed in square brackets. >> + >> + A task running on a CPU is associated with an allocation and >> + monitoring ID pair (ctrl_hw_id, mon_hw_id), which determines the >> + resource allocation and monitoring applied to that task. Kernel > > Should this not rather be "A task is associated with a resource group, which > determines ..."? Sure. > >> + modes allow the CPU's allocation and/or monitoring association to >> + change during the transition from user mode to kernel mode. >> + >> + Possible kernel modes are: >> + >> + "inherit_user": >> + Default mode at boot. Kernel work uses the allocation >> + and monitoring of the user task on whose behalf it runs. >> + >> + "global_enable_per_cpu": >> + Kernel work uses the allocation and/or monitoring of a backing >> + CTRL_MON or MON group. The mode can be enabled or disabled >> + per-CPU. The line contains group= and whichever of ctrl= and >> + mon= the platform supports:: > > Final sentence above does not add more than example below. How about > > The mode and its parameters are shown as:: > Sure. >> + >> + global_enable_per_cpu:ctrl=;mon=;group=// >> + >> + "ctrl": >> + "assign" if kernel work uses the resource group's >> + allocation, or "inherit" if it uses the user task's > > allocation -> allocations > (a resource group contains multiple allocations across several resources) > >> + allocation. Present only on systems that support allocation. > > allocation -> allocations (just for the first instance, the "support allocation" remains singular.) Ack. > >> + >> + "mon": >> + "assign" if kernel work uses the resource group's monitoring, >> + or "inherit" if it uses the user task's monitoring. Present >> + only on systems that support monitoring. >> + >> + "group": >> + Path of the backing resource group, relative to the resctrl >> + mount point. >> + >> + A MON group is shown as "//". >> + >> + A CTRL_MON group is shown as "//" when "mon=assign". >> + >> + When "mon=inherit", or monitoring is unsupported, a CTRL_MON group >> + is shown as "/". >> + >> + When the mode is not active, the output lists the supported parameters >> + and their default values, which are used if the mode is activated >> + without new values. >> + >> + Example of a system that supports allocation and monitoring, with default mode > > drop default? Or perhaps better to match terminology with "with inherit_user mode active"? Sure. > >> + set to inherit_user:: >> + >> + # cat info/kernel_mode >> + [inherit_user] >> + global_enable_per_cpu:ctrl=assign;mon=assign;group=// >> + >> Resource alloc and monitor groups >> ================================= >> >> diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c >> index 28bd4c4d98f2..afbe0f94940a 100644 >> --- a/fs/resctrl/rdtgroup.c >> +++ b/fs/resctrl/rdtgroup.c >> @@ -998,6 +998,104 @@ static int rdt_last_cmd_status_show(struct kernfs_open_file *of, >> return 0; >> } >> >> +/* Names used in info/kernel_mode; indexed by enum resctrl_kernel_mode */ >> +static const char * const resctrl_kmode_str[] = { >> + [RESCTRL_INHERIT_USER] = "inherit_user", >> + [RESCTRL_GLOBAL_ENABLE_PER_CPU] = "global_enable_per_cpu" >> +}; >> + >> +static_assert(ARRAY_SIZE(resctrl_kmode_str) == RESCTRL_NUM_KERNEL_MODES); >> + >> +static const char *resctrl_kmode_state_str(enum kmode_state state) >> +{ >> + return state == KMODE_ASSIGN ? "assign" : "inherit"; >> +} >> + >> +static void resctrl_kmode_group_path(struct rdtgroup *rdtgrp, >> + const char **ctrl, const char **mon) >> +{ >> + *ctrl = ""; > > Above looks unnecessary. Sure. > >> + *mon = ""; > > Above can just move to the RDTCTRL_GROUP branch? Sure. > >> + >> + if (rdtgrp->type == RDTMON_GROUP) { >> + *ctrl = rdt_kn_name(rdtgrp->mon.parent->kn); >> + *mon = rdt_kn_name(rdtgrp->kn); >> + } else { >> + *ctrl = rdt_kn_name(rdtgrp->kn); >> + } >> +} >> + >> +/** >> + * resctrl_kernel_mode_show() - Display supported and active kernel modes >> + * @of: kernfs open file >> + * @seq: output seq_file >> + * @v: unused >> + * >> + * Lists one line per mode and brackets the active mode. inherit_user >> + * has no parameters. global_enable_per_cpu prints ctrl= only when >> + * allocation is supported and mon= only when monitoring is supported, >> + * then group=. The MON group is included in group= only when monitoring >> + * is supported and mon is assign. >> + * >> + * Return: 0 on success, or -ENOENT on error. >> + */ >> +static int resctrl_kernel_mode_show(struct kernfs_open_file *of, >> + struct seq_file *seq, void *v) >> +{ >> + const char *ctrl_grp, *mon_grp; >> + enum resctrl_kernel_mode mode; >> + bool active; >> + char sep; >> + >> + if (!info_kn_lock(of->kn)) >> + return -ENOENT; >> + >> + for (mode = 0; mode < RESCTRL_NUM_KERNEL_MODES; mode++) { >> + if (!test_bit(mode, resctrl_kmode.supported)) >> + continue; >> + >> + active = resctrl_kmode.active == mode; >> + >> + seq_printf(seq, active ? "[%s" : "%s", resctrl_kmode_str[mode]); >> + >> + if (mode == RESCTRL_GLOBAL_ENABLE_PER_CPU) { >> + ctrl_grp = ""; >> + mon_grp = ""; >> + if (active) { >> + if (resctrl_kmode.rdtgrp) >> + resctrl_kmode_group_path(resctrl_kmode.rdtgrp, >> + &ctrl_grp, &mon_grp); >> + else >> + pr_warn("%s active without a resource group\n", >> + resctrl_kmode_str[mode]); >> + } > > Above should be simplified if resctrl_kmode_cfg::rdtgrp is initialized to the > default resource group. Ack. > >> + >> + sep = ':'; >> + if (resctrl_arch_alloc_capable()) { >> + seq_printf(seq, "%cctrl=%s", sep, >> + resctrl_kmode_state_str(resctrl_kmode.ctrl)); >> + sep = ';'; >> + } >> + if (resctrl_arch_mon_capable()) { >> + seq_printf(seq, "%cmon=%s", sep, >> + resctrl_kmode_state_str(resctrl_kmode.mon)); >> + sep = ';'; >> + } >> + if (resctrl_arch_mon_capable() && >> + resctrl_kmode.mon != KMODE_INHERIT) >> + seq_printf(seq, "%cgroup=%s/%s/", sep, ctrl_grp, mon_grp); >> + else >> + seq_printf(seq, "%cgroup=%s/", sep, ctrl_grp); > > Above looks unnecessarily complicated. Why is the "sep" needed? Could this not be > simplified to: Ack. > seq_putc(seq, ':'); > if (resctrl_arch_alloc_capable()) > seq_printf(seq, "ctrl=%s;", > resctrl_kmode_state_str(resctrl_kmode.ctrl)); > if (resctrl_arch_mon_capable()) > seq_printf(seq, "mon=%s;", > resctrl_kmode_state_str(resctrl_kmode.mon)); > seq_printf(seq, "group=%s/", ctrl_grp); > if (resctrl_arch_mon_capable() && > resctrl_kmode.mon == KMODE_ASSIGN) > seq_printf(seq, "%s/", mon_grp); > Sure. Will do. Thanks Babu