[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f18fc728-de30-8d2a-3ecc-6896f6559ab1@arm.com>
Date: Thu, 24 Nov 2022 14:21:40 +0000
From: James Morse <james.morse@....com>
To: "Shaopeng Tan (Fujitsu)" <tan.shaopeng@...itsu.com>,
"x86@...nel.org" <x86@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Cc: Fenghua Yu <fenghua.yu@...el.com>,
Reinette Chatre <reinette.chatre@...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"
<shameerali.kolothum.thodi@...wei.com>,
D Scott Phillips OS <scott@...amperecomputing.com>,
"carl@...amperecomputing.com" <carl@...amperecomputing.com>,
"lcherian@...vell.com" <lcherian@...vell.com>,
"bobo.shaobowang@...wei.com" <bobo.shaobowang@...wei.com>,
Jamie Iles <quic_jiles@...cinc.com>,
Xin Hao <xhao@...ux.alibaba.com>,
"xingxin.hx@...nanolis.org" <xingxin.hx@...nanolis.org>,
"baolin.wang@...ux.alibaba.com" <baolin.wang@...ux.alibaba.com>,
"peternewman@...gle.com" <peternewman@...gle.com>
Subject: Re: [PATCH 04/18] x86/resctrl: Move rmid allocation out of
mkdir_rdt_prepare()
Hello!
On 10/11/2022 10:50, Shaopeng Tan (Fujitsu) wrote:
>> RMID are allocated for each monitor or control group directory, because each of
>> these needs its own RMID. For control groups,
>> rdtgroup_mkdir_ctrl_mon() later goes on to allocate the CLOSID.
>>
>> MPAM's equivalent of RMID are not an independent number, so can't be
>> allocated until the closid is known. An RMID allocation for one CLOSID may fail,
>> whereas another may succeed depending on how many monitor groups a
>> control group has.
>>
>> The RMID allocation needs to move to be after the CLOSID has been allocated.
>>
>> Move the RMID allocation out of mkdir_rdt_prepare() to occur in its caller, after
>> the mkdir_rdt_prepare() call. This allows the RMID allocator to know the
>> CLOSID.
>> diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>> b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>> index 841294ad6263..c67083a8a5f5 100644
>> --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>> @@ -3003,12 +3004,19 @@ static int rdtgroup_mkdir_mon(struct kernfs_node
>> *parent_kn,
>> prgrp = rdtgrp->mon.parent;
>> rdtgrp->closid = prgrp->closid;
>>
>> + ret = mkdir_rdt_prepare_rmid_alloc(rdtgrp);
>> + if (ret) {
>> + mkdir_rdt_prepare_clean(rdtgrp);
>> + goto out_unlock;
>> + }
>> +
>> /*
>> * Add the rdtgrp to the list of rdtgrps the parent
>> * ctrl_mon group has to track.
>> */
>> list_add_tail(&rdtgrp->mon.crdtgrp_list, &prgrp->mon.crdtgrp_list);
>>
>> +out_unlock:
>> rdtgroup_kn_unlock(parent_kn);
> Is there any case that a lock is not unlocked here?
If you've found an example - please share!
The unlock is necessary because mkdir_rdt_prepare() calls rdtgroup_kn_lock_live(),
but expects its caller to do the unlock.
This patch allows the rmid allocation to fail separately to mkdir_rdt_prepare(), so
rdtgroup_mkdir_mon() needs to ensure the unlock() happens when it returns an error, this
work was previously done by 'out_unlock' in mkdir_rdt_prepare().
I hope this helps,
Thanks,
James
Powered by blists - more mailing lists