Re: [PATCH v4 11/16] selftests/resctrl: Simplify bandwidth report type handling

From: Reinette Chatre
Date: Wed May 29 2024 - 13:47:10 EST


Hi Ilpo,

On 5/20/24 5:30 AM, Ilpo Järvinen wrote:
bw_report is only needed for selecting the correct value from the
values IMC measured. It is a member in the resctrl_val_param struct and
is always set to "reads". The value is then checked in resctrl_val()
using validate_bw_report_request() that besides validating the input,
assumes it can mutate the string which is questionable programming
practice.

Simplify handling bw_report:

- Convert validate_bw_report_request() into get_bw_report_type() that
inputs and returns const char *. Use NULL to indicate error.

- Validate the report types inside measure_mem_bw(), not in
resctrl_val().

- As resctrl_val() no longer needs bw_report for anything, it can just
be passed to measure_mem_bw() by the ->measure() hooks.

Needs imperative tone


Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>
---

Reviewed-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>

Reinette