From: "Moger, Babu" <bmoger@amd.com>
To: Reinette Chatre <reinette.chatre@intel.com>,
babu.moger@amd.com, corbet@lwn.net, tony.luck@intel.com,
Dave.Martin@arm.com, james.morse@arm.com, tglx@linutronix.de,
mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com
Cc: x86@kernel.org, hpa@zytor.com, akpm@linux-foundation.org,
paulmck@kernel.org, rostedt@goodmis.org, thuth@redhat.com,
ardb@kernel.org, gregkh@linuxfoundation.org, seanjc@google.com,
thomas.lendacky@amd.com, pawan.kumar.gupta@linux.intel.com,
perry.yuan@amd.com, yosry.ahmed@linux.dev, kai.huang@intel.com,
xiaoyao.li@intel.com, peterz@infradead.org,
kan.liang@linux.intel.com, mario.limonciello@amd.com,
xin3.li@intel.com, sohil.mehta@intel.com,
chang.seok.bae@intel.com, andrew.cooper3@citrix.com,
ebiggers@google.com, ak@linux.intel.com, xin@zytor.com,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 5/8] fs/resctrl: Add user interface to enable/disable io_alloc feature
Date: Fri, 20 Jun 2025 16:57:16 -0500 [thread overview]
Message-ID: <69950bd1-d0f8-42f1-9aeb-07afa2cfb155@amd.com> (raw)
In-Reply-To: <93df95f2-b37d-436e-9872-b64f14256914@intel.com>
Hi Reinette,
On 6/20/2025 10:53 AM, Reinette Chatre wrote:
> Hi Babu,
>
> On 6/19/25 11:41 AM, Moger, Babu wrote:
>> On 6/17/25 22:59, Reinette Chatre wrote:
>>> On 6/11/25 2:23 PM, Babu Moger wrote:
>
> ...
>
>>>> + */
>>>> +static int resctrl_io_alloc_closid_get(struct rdt_resource *r)
>>>> +{
>>>> + int num_closids = closids_supported();
>>>> +
>>>> + if (resctrl_arch_get_cdp_enabled(r->rid))
>>>> + num_closids *= 2;
>>>> +
>>>> + if (num_closids != resctrl_arch_get_num_closid(r))
>>>> + return -ENOSPC;
>>>> +
>>>> + return closids_supported() - 1;
>>>> +}
>>>
>>> resctrl_io_alloc_closid_get() seems to be trying to do two things:
>>> - determine what the io_alloc_closid is
>>> - make sure the io_alloc_closid is supported
>>>
>>> I think this should be split into two functions. Once the
>>> io_alloc_closid is determined to be supported and io_alloc
>>> enabled then there is no reason to keep checking if it is
>>> supported whenever the io_alloc_closid is queried.
>>>
>>> How about simplifying this to:
>>>
>>> /*
>>> * note how this returns u32 that will eliminate
>>> * unnecessary error checking in usages where io_alloc_closid
>>> * needs to be determined after an resctrl_arch_get_io_alloc_enabled(r)
>>> * already confirmed io_alloc is enabled
>>> * function comment could note that this returns the CLOSID
>>> * required by io_alloc but not whether the CLOSID can
>>> * be supported, for this resctrl_io_alloc_closid_supported() should
>>> * be used.
>>> * Can also note that returned value will always be valid if
>>> * resctrl_arch_get_io_alloc_enabled(r) is true.
>>> */
>>> u32 resctrl_io_alloc_closid(struct rdt_resource *r) {
>>> if (resctrl_arch_get_cdp_enabled(r->rid))
>>> return resctrl_arch_get_num_closid(r)/2 - 1
>>> else
>>> return resctrl_arch_get_num_closid(r) -1
>>> }
>>>
>>> /*
>>> * note how below already makes resctrl's io_alloc implementation
>>> * more generic
>>> */
>>> resctrl_io_alloc_closid_supported(u32 io_alloc_closid) {
>>> return io_alloc_closid < closids_supported()
>>> }
>>>
>>
>> Sure.
>> Changed the check to
>>
>> return io_alloc_closid == (closids_supported() -1)
>>
>
> resctrl_io_alloc_closid_supported() is not intended to reflect what the
> value is but just check if provided value is supported. By changing the
> check to above resctrl_io_alloc_closid_supported() does two things again
> (what the move to new functions aimed to avoid): checking that the CLOSID
> is supported while requiring that it is the highest supported CLOSID.
> What issue(s) do you see with using "io_alloc_closid < closids_supported()"
> as the check?
I don't see any issue. It should be fine. Will test and verify it.
thanks
Babu
next prev parent reply other threads:[~2025-06-20 21:57 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-11 21:23 [PATCH v6 0/8] x86/resctrl: Support L3 Smart Data Cache Injection Allocation Enforcement (SDCIAE) Babu Moger
2025-06-11 21:23 ` [PATCH v6 1/8] x86/cpufeatures: Add support for L3 Smart Data Cache Injection Allocation Enforcement Babu Moger
2025-06-11 21:23 ` [PATCH v6 2/8] x86/resctrl: Add SDCIAE feature in the command line options Babu Moger
2025-06-11 21:23 ` [PATCH v6 3/8] x86/resctrl: Detect io_alloc feature Babu Moger
2025-06-18 3:45 ` Reinette Chatre
2025-06-18 19:27 ` Moger, Babu
2025-06-11 21:23 ` [PATCH v6 4/8] x86/resctrl: Implement "io_alloc" enable/disable handlers Babu Moger
2025-06-18 3:51 ` Reinette Chatre
2025-06-18 19:27 ` Moger, Babu
2025-06-18 20:32 ` Reinette Chatre
2025-06-18 21:57 ` Moger, Babu
2025-06-11 21:23 ` [PATCH v6 5/8] fs/resctrl: Add user interface to enable/disable io_alloc feature Babu Moger
2025-06-18 3:59 ` Reinette Chatre
2025-06-19 18:41 ` Moger, Babu
2025-06-20 15:53 ` Reinette Chatre
2025-06-20 21:57 ` Moger, Babu [this message]
2025-06-11 21:23 ` [PATCH v6 6/8] fs/resctrl: Introduce interface to display io_alloc CBMs Babu Moger
2025-06-18 4:01 ` Reinette Chatre
2025-06-20 21:57 ` Moger, Babu
2025-06-11 21:23 ` [PATCH v6 7/8] fs/resctrl: Modify rdt_parse_data to pass mode and CLOSID Babu Moger
2025-06-18 4:03 ` Reinette Chatre
2025-06-20 21:58 ` Moger, Babu
2025-06-11 21:23 ` [PATCH v6 8/8] fs/resctrl: Introduce interface to modify io_alloc Capacity Bit Masks Babu Moger
[not found] ` <202506131403.MWHHLsxB-lkp@intel.com>
2025-06-16 14:51 ` Moger, Babu
2025-06-18 4:03 ` Reinette Chatre
2025-06-20 21:58 ` Moger, Babu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=69950bd1-d0f8-42f1-9aeb-07afa2cfb155@amd.com \
--to=bmoger@amd.com \
--cc=Dave.Martin@arm.com \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=andrew.cooper3@citrix.com \
--cc=ardb@kernel.org \
--cc=babu.moger@amd.com \
--cc=bp@alien8.de \
--cc=chang.seok.bae@intel.com \
--cc=corbet@lwn.net \
--cc=dave.hansen@linux.intel.com \
--cc=ebiggers@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=hpa@zytor.com \
--cc=james.morse@arm.com \
--cc=kai.huang@intel.com \
--cc=kan.liang@linux.intel.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=mingo@redhat.com \
--cc=paulmck@kernel.org \
--cc=pawan.kumar.gupta@linux.intel.com \
--cc=perry.yuan@amd.com \
--cc=peterz@infradead.org \
--cc=reinette.chatre@intel.com \
--cc=rostedt@goodmis.org \
--cc=seanjc@google.com \
--cc=sohil.mehta@intel.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=thuth@redhat.com \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
--cc=xiaoyao.li@intel.com \
--cc=xin3.li@intel.com \
--cc=xin@zytor.com \
--cc=yosry.ahmed@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®