Re: [RESEND PATCH v4 08/15] fs/resctrl: Add interface to display supported and active kernel-mode policy

Babu Moger <[email protected]>
Newsgroups org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Hi Reinette,

On 8/12/26 18:38, Reinette Chatre wrote:
> Hi Babu,
> 
> On 8/12/26 3:57 PM, Moger, Babu wrote:
>> On 8/10/2026 10:18 PM, Reinette Chatre wrote:
>>> On 7/7/26 2:50 PM, Babu Moger wrote:
> 
> ...
> 
>>>> +         */
>>>> +        rdtgrp = resctrl_kcfg.k_rdtgrp;
>>>> +        if (!rdtgrp) {
>>>> +            ret = -ENOENT;
>>>> +            goto out_unlock;
>>>
>>> If this fails there needs to be content in last_cmd_status. Otherwise this
>>> fails and then last_cmd_status reads "ok" or worse .. an old failure message.
>>
>> if (WARN_ON(!rdtgrp)) {
>>      rdt_last_cmd_puts("Invalid kernel mode group\n");
>>      ret = -ENOENT;
>>      goto out_unlock;
>> }
> It is not clear to me why the WARN_ON() was added. Is the resource group not being
> associated with kernel mode not a legitimate scenario if the kernel mode group was
> re-assigned while the reader of this file was blocked on the mutex?
> 
A valid group is required whenever any global mode is enabled. Reaching 
this condition without one is unexpected and should be treated as a bug.

To help catch this, I added a WARN_ON() to log the issue. I think 
updating last_cmd_status is reasonable as well and should provide the 
necessary user-visible error indication.

thanks
Babu
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.