From: Zeng Heng <zengheng4@huawei.com>
To: Dave Martin <Dave.Martin@arm.com>
Cc: <james.morse@arm.com>, <bobo.shaobowang@huawei.com>,
<jonathan.cameron@huawei.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH mpam mpam/snapshot/v6.14-rc1 3/5] arm_mpam: Provide conversion method for new closid/rmid pairs
Date: Tue, 18 Feb 2025 14:32:11 +0800 [thread overview]
Message-ID: <f1be34f0-fed8-0256-fbb3-a1cce42d786b@huawei.com> (raw)
In-Reply-To: <Z7M7R8uf4g2C68cO@e133380.arm.com>
Hi,
On 2025/2/17 21:36, Dave Martin wrote:
> Hi,
>
> On Mon, Feb 17, 2025 at 02:18:44PM +0800, Zeng Heng wrote:
>> Hi Martin,
>>
>> On 2025/2/17 11:18, Zeng Heng wrote:
>>> The MPAM driver statically assigns all reqPARTIDs to respective intPARTIDs.
>>> For the new rmid allocation strategy, it will check if there is an
>>> available rmid of any reqPARTID which belongs to the input closid, not just
>>> the rmids belonging to the closid.
>>>
>>> For a mixture of MSCs system, for MSCs that do not support narrow-partid,
>>> we use the PARTIDs exceeding the number of closids as reqPARTIDs for
>>> expanding the monitoring groups.
>>>
>>> In order to keep the existing resctrl API interface, the rmid contains both
>>> req_idx and PMG information instead of PMG only under the MPAM driver. The
>>> req_idx represents the req_idx-th sub-monitoring group under the control
>>> group. The new rmid would be like:
>>>
>>> rmid = (req_idx << shift | pmg).
>>>
>>
>> To consider future compatibility with dynamically allocated reqpartid,
>> should I refactor the rmid?
>>
>> Instead of defining rmid.req_idx, we could place the entire reqpartid
>> directly within rmid. In This way, the allocation of reqpartid will no
>> longer be constrained by the static allocation of closid, facilitating
>> future compatibility with dynamic allocation mechanisms.
>>
>> In this case, it needs to refactor the resctrl_arch_rmid_idx_encode()
>> and resctrl_arch_rmid_idx_decode(), and we can simplify
>> closid_rmid2reqpartid() to rmid2reqpartid().
>>
>> What are your thoughts on this idea? Thank you in advance for your
>> reply.
>>
>> Best regards,
>> Zeng Heng
>
> Does this mean that the RMID must be expanded to cover all possible
> (reqPARTID, PMG) combinations?
>
> A single reqPARTID cannot be allocated to two different resctrl control
> groups at the same time, even though a PMG value can be reused across
> multiple control groups -- so it sounds like your proposal would
> require changes in the resctrl core code as well as possibly requiring
> a larger rmid_ptrs table.
>
> But I might have misunderstood what you are proposing here...
>
> Can you illustrate with one or two examples?
>
Yes, as you have written. It might be worth trying this approach:
rmid = (reqpartid, pmg).
But to avoid the reuse of rmid across multiple control groups, we will
check the incoming closid in resctrl_arch_rmid_idx_encode() to prevent
rmid from being reallocated by resctrl_find_free_rmid().
We don't need a larger rmid_ptrs table, nor do we need to modify the
existing resctrl common code by continuing with the current static
allocation method.
Below are the implementations of several key functions for reference:
~~~
u32 rmid2reqpartid(u32 rmid)
{
u8 pmg_shift = fls(mpam_pmg_max);
WARN_ON_ONCE(pmg_shift > 8);
return rmid >> pmg_shift;
}
/*
* If the closid and rmid do not match upon inspection,
* immediately return an invalid idx value.
*/
u32 resctrl_arch_rmid_idx_encode(u32 closid, u32 rmid)
{
u32 reqpartid = rmid2reqpartid(rmid);
u32 intpartid = req2intpartid(reqpartid);
if (cdp_enabled)
intpartid >>= 1;
if (closid != intpartid)
return U32_MAX;
return rmid;
}
void resctrl_arch_rmid_idx_decode(u32 idx, u32 *closid, u32 *rmid)
{
u32 reqpartid = rmid2reqpartid(idx);
u32 intpartid = req2intpartid(reqpartid);
if (rmid)
*rmid = idx;
if (closid) {
if (cdp_enabled)
intpartid >>= 1;
*closid = intpartid;
}
}
~~~
Best regards,
Zeng Heng
next prev parent reply other threads:[~2025-02-18 6:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-17 3:18 [PATCH mpam mpam/snapshot/v6.14-rc1 0/5] arm_mpam: Introduce the Narrow-PARTID feature for MPAM driver Zeng Heng
2025-02-17 3:18 ` [PATCH mpam mpam/snapshot/v6.14-rc1 1/5] arm_mpam: Introduce the definitions of intPARTID and reqPARTID Zeng Heng
2025-02-17 3:18 ` [PATCH mpam mpam/snapshot/v6.14-rc1 2/5] arm_mpam: Add limitation for the Narrow-PARTID feature Zeng Heng
2025-02-17 3:18 ` [PATCH mpam mpam/snapshot/v6.14-rc1 3/5] arm_mpam: Provide conversion method for new closid/rmid pairs Zeng Heng
2025-02-17 6:18 ` Zeng Heng
2025-02-17 13:36 ` Dave Martin
2025-02-18 6:32 ` Zeng Heng [this message]
2025-02-17 3:18 ` [PATCH mpam mpam/snapshot/v6.14-rc1 4/5] arm_mpam: Set INTERNAL as needed when setting MSC controls Zeng Heng
2025-02-17 3:18 ` [PATCH mpam mpam/snapshot/v6.14-rc1 5/5] arm_mpam: Automatically synchronize the configuration of all sub-monitoring groups Zeng Heng
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=f1be34f0-fed8-0256-fbb3-a1cce42d786b@huawei.com \
--to=zengheng4@huawei.com \
--cc=Dave.Martin@arm.com \
--cc=bobo.shaobowang@huawei.com \
--cc=james.morse@arm.com \
--cc=jonathan.cameron@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
/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®