[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <37db00d7-6839-447c-914f-31d2f4d8737d@arm.com>
Date: Wed, 7 May 2025 17:48:02 +0100
From: James Morse <james.morse@....com>
To: Reinette Chatre <reinette.chatre@...el.com>, x86@...nel.org,
linux-kernel@...r.kernel.org
Cc: 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,
baolin.wang@...ux.alibaba.com, Jamie Iles <quic_jiles@...cinc.com>,
Xin Hao <xhao@...ux.alibaba.com>, peternewman@...gle.com,
dfustini@...libre.com, amitsinght@...vell.com,
David Hildenbrand <david@...hat.com>, Rex Nie <rex.nie@...uarmicro.com>,
Dave Martin <dave.martin@....com>, Koba Ko <kobak@...dia.com>,
Shanker Donthineni <sdonthineni@...dia.com>, fenghuay@...dia.com,
Shaopeng Tan <tan.shaopeng@...fujitsu.com>, Tony Luck <tony.luck@...el.com>
Subject: Re: [PATCH v9 04/27] x86/resctrl: resctrl_exit() teardown resctrl but
leave the mount point
Hi Reinette,
On 01/05/2025 18:03, Reinette Chatre wrote:
> On 4/25/25 10:37 AM, James Morse wrote:
>> @@ -4432,23 +4445,42 @@ static bool __exit resctrl_online_domains_exist(void)
>> return false;
>> }
>>
>> -/*
>> +/**
> Why make the switch to kernel-doc now? The benefit is not clear considering
> resctrl_init() is not using kernel-doc.
Just the ratcheting of 'add a comment' eventually leading to 'put it in kernel-doc'
once the comment becomes sufficiently long.
>> * resctrl_exit() - Remove the resctrl filesystem and free resources.
>> *
>> + * Called by the architecture code in response to a fatal error.
>> + * Removes resctrl files and structures from kernfs to prevent further
>> + * configuration.
>> + *
>> * When called by the architecture code, all CPUs and resctrl domains must be
>> * offline. This ensures the limbo and overflow handlers are not scheduled to
>> * run, meaning the data structures they access can be freed by
>> * resctrl_mon_resource_exit().
>> + *
>> + * After this function has returned, the architecture code should return an
> nit: "After this function has returned," -> "After resctrl_exit() returns, "
Sure,
> "should return an" -> "should return an error"?
Fixed, thanks!
>> + * from all resctrl_arch_ functions that can do this.
>> + * resctrl_arch_get_resource() must continue to return struct rdt_resources
>> + * with the correct rid field to ensure the filesystem can be unmounted.
> Is this to get through set_mba_sc() and the for_each_alloc_capable_rdt_resource(r)
> loop in rdt_kill_sb() or is there something more subtle?
The for_each walkers, which may also get used by the arch code. I don't have an example of
where this would go wrong, but felt it was worth noting that resctrl_arch_get_resource()
should not return NULL for all possible resources in this case - resctrl doesn't expect
that for any entry in the enum. Adding that error handling was too noisy, given that today
x86 has all the resources.
Tony suggested that get changed to searching a list if the list of possible resources
starts to grow.
>> */
>> void __exit resctrl_exit(void)
>> {
>> cpus_read_lock();
>> WARN_ON_ONCE(resctrl_online_domains_exist());
>> +
>> + mutex_lock(&rdtgroup_mutex);
>> + resctrl_fs_teardown();
>> + mutex_unlock(&rdtgroup_mutex);
>> +
>> cpus_read_unlock();
>>
>> debugfs_remove_recursive(debugfs_resctrl);
>> + debugfs_resctrl = NULL;
>> unregister_filesystem(&rdt_fs_type);
>> - sysfs_remove_mount_point(fs_kobj, "resctrl");
>> +
>> + /*
>> + * Do not remove the sysfs mount point added by resctrl_init() so that
>> + * it can be used to umount resctrl.
>> + */
>>
>> resctrl_mon_resource_exit();
>> }
>
> Looks good to me.
Thanks!
James
Powered by blists - more mailing lists