[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4002faaa-d93a-0d9b-0234-05bfae3d7b93@arm.com>
Date: Mon, 6 Mar 2023 11:32:10 +0000
From: James Morse <james.morse@....com>
To: Reinette Chatre <reinette.chatre@...el.com>, x86@...nel.org,
linux-kernel@...r.kernel.org
Cc: Fenghua Yu <fenghua.yu@...el.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
H Peter Anvin <hpa@...or.com>,
Babu Moger <Babu.Moger@....com>,
shameerali.kolothum.thodi@...wei.com,
D Scott Phillips OS <scott@...amperecomputing.com>,
carl@...amperecomputing.com, lcherian@...vell.com,
bobo.shaobowang@...wei.com, tan.shaopeng@...itsu.com,
xingxin.hx@...nanolis.org, baolin.wang@...ux.alibaba.com,
Jamie Iles <quic_jiles@...cinc.com>,
Xin Hao <xhao@...ux.alibaba.com>, peternewman@...gle.com
Subject: Re: [PATCH v2 07/18] x86/resctrl: Move CLOSID/RMID matching and
setting to use helpers
Hi Reinette,
On 02/02/2023 23:47, Reinette Chatre wrote:
> On 1/13/2023 9:54 AM, James Morse wrote:
>
> ...
>
>> @@ -567,19 +579,14 @@ static int __rdtgroup_move_task(struct task_struct *tsk,
>> * For monitor groups, can move the tasks only from
>> * their parent CTRL group.
>> */
>> -
>> - if (rdtgrp->type == RDTCTRL_GROUP) {
>> - WRITE_ONCE(tsk->closid, rdtgrp->closid);
>> - WRITE_ONCE(tsk->rmid, rdtgrp->mon.rmid);
>> - } else if (rdtgrp->type == RDTMON_GROUP) {
>> - if (rdtgrp->mon.parent->closid == tsk->closid) {
>> - WRITE_ONCE(tsk->rmid, rdtgrp->mon.rmid);
>> - } else {
>> - rdt_last_cmd_puts("Can't move task to different control group\n");
>> - return -EINVAL;
>> - }
>> + if (rdtgrp->type == RDTMON_GROUP &&
>> + !resctrl_arch_match_closid(tsk, rdtgrp->mon.parent->closid)) {
>> + rdt_last_cmd_puts("Can't move task to different control group\n");
>> + return -EINVAL;
>> }
>>
>> + resctrl_arch_set_closid_rmid(tsk, rdtgrp->closid, rdtgrp->mon.rmid);
>
> This does not use the intended closid when rdtgrp->type == RDTMON_GROUP.
Yes, it should be rdtgrp->mon.parent->closid.
rdtgroup_mkdir_mon() initialises them to be the same, I guess its Peter's monitor-group
rename that means this could get the wrong value?
I've fixed it as:
---------%<---------
diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
index c7392d10dc5b..30d8961b833c 100644
--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
+++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
@@ -585,7 +585,12 @@ static int __rdtgroup_move_task(struct task_struct *tsk,
return -EINVAL;
}
- resctrl_arch_set_closid_rmid(tsk, rdtgrp->closid, rdtgrp->mon.rmid);
+ if (rdtgrp->type == RDTMON_GROUP)
+ resctrl_arch_set_closid_rmid(tsk, rdtgrp->mon.parent->closid,
+ rdtgrp->mon.rmid);
+ else
+ resctrl_arch_set_closid_rmid(tsk, rdtgrp->closid,
+ rdtgrp->mon.rmid);
/*
* Ensure the task's closid and rmid are written before determining if
---------%<---------
Thanks,
James
Powered by blists - more mailing lists