Re: [PATCH 1/5] selftests/resctrl: Clear unused initalization code in MBM tests

From: Reinette Chatre
Date: Thu Sep 29 2022 - 11:27:50 EST


Hi Shaopeng,

On 9/28/2022 10:28 PM, tan.shaopeng@xxxxxxxxxxx wrote:
>> On 9/27/2022 2:01 AM, tan.shaopeng@xxxxxxxxxxx wrote:
>>>> On 9/13/2022 6:51 PM, Shaopeng Tan wrote:
>>>>> There is a comment "Set up shemata with 100% allocation on the first run"
>>>>> in function mbm_setup(), but the condition "num_of_runs == 0" will
>>>>> never be met and write_schemata() will never be called to set
>>>>> schemata to 100%.
>>>>
>>>> Thanks for catching this.
>>>>
>>>>>
>>>>> Since umount/mount resctrl file system is run on each resctrl test,
>>>>> at the same time the default schemata will also be set to 100%.
>>>>
>>>> This is the case when a test is run with struct
>>>> resctrl_val_param->mum_resctrlfs == 1, but if the test is run with
>>>> struct resctrl_val_param->mum_resctrlfs == 0 then resctrl filesystem
>>>> will not be remounted.
>>>>
>>>> I do think that this setup function should support both cases.
>>>
>>> In mbm test(mbm_test.c), resctrl_val_param.mum_resctrlfs is set to 1
>>> and never be changed, and umount/mount resctrl file system is always
>> executed.
>>> So it is not necessary to run "if (num_of_runs == 0)".
>>
>> This is true for the current usage. You could also add a warning here ("running
>> test with stale config") if a future test sets mum_resctrlfs - but with all the
>> current output of the selftests a warning may be lost in the noise.
>>
>> I think it would just be simpler to support both cases. Having the tests be more
>> robust is good.
>
> I understand that mum_resctrlfs should support both cases(0&1).
>
> However, "num_of_runs++" is executed before "if (num_of_runs == 0)",
> So write_schemata() is never executed regardless of mum_rectrlfs is 0 or 1.
>
> 97 if (num_of_runs++ >= NUM_OF_RUNS)
> 105 if (num_of_runs == 0)
> 106 ret = write_schemata(p->ctrlgrp, "100", p->cpu_no,
>
> I will fix this in the next version
>

Thank you very much.

Reinette