Re: [PATCH v4 15/39] x86/resctrl: Move monitor exit work to a resctrl exit call

From: James Morse
Date: Mon Sep 30 2024 - 12:42:59 EST


Hi Reinette,

On 14/08/2024 05:01, Reinette Chatre wrote:
> On 8/2/24 10:28 AM, James Morse wrote:
>> rdt_put_mon_l3_config() is called via the architecture's
>> resctrl_arch_exit() call, and appears to free the rmid_ptrs[]
>> and closid_num_dirty_rmid[] arrays. In reality this code is marked
>> __exit, and is removed by the linker as resctrl can't be built
>> as a module.
>>
>> To separate the filesystem and architecture parts of resctrl,
>> this free()ing work needs to be triggered by the filesystem,
>> as these structures belong to the filesystem code.
>>
>> Rename rdt_put_mon_l3_config() resctrl_mon_resource_exit()
>> and call it from resctrl_exit(). The kfree() is currently
>> dependent on r->mon_capable.
>>
>> Signed-off-by: James Morse <james.morse@xxxxxxx>
>> Tested-by: Carl Worth <carl@xxxxxxxxxxxxxxxxxxxxxx> # arm64
>> ---
>> Changes since v3:
>>   * Moved r->mon_capable check under the lock.
>>   * Dropped references to resctrl_mon_resource_init() from the commit message.
>>   * Fixed more resctrl typos,
>>
>> Changes since v2:
>>   * Dropped __exit as needed in the next patch.
>
> Is this still relevant? It is unclear to me why __exit is dropped here.

resctrl_init() in the next patch wants to call resctrl_mon_resource_exit() as part of its
cleanup. This trips the mismatched section checks as the __exit code is discarded at link
time because you can't build resctrl as a module.

I'll opt for the churnier version that removes the exit markers in the next patch.


Thanks,

James