Re: [PATCH 03/24] selftests/resctrl: Refactor get_cbm_mask()

From: Maciej Wieczór-Retman
Date: Fri Oct 27 2023 - 07:39:45 EST


On 2023-10-24 at 12:26:13 +0300, Ilpo Järvinen wrote:
>Callers of get_cbm_mask() are required to pass a string into which the
>CBM bit mask is read. Neither CAT nor CMT tests need the mask as string

"CBM bit mask" -> "CBM" / "capacity bitmask (CBM)"?

Generally isn't cbm_mask an odd name because of the repetition (capacity bitmask
mask)? After looking at x86/resctrl files putting "mask" after "cbm" only
happens there. Maybe a better naming scheme here would be get_cbm_bits()?

>but just convert it into an unsigned long value.
>
>The bit mask reader can only read .../cbm_mask files.
>
>Generalize the bit mask reading function into get_bit_mask() such that
>it can be used to handle other files besides the .../cbm_mask and
>handle the unsigned long conversion within get_bit_mask() using
>fscanf(). Alter get_cbm_mask() to construct the filename for
>get_bit_mask().
>
>Also mark cache_type const while at it.
>
>Co-developed-by: Fenghua Yu <fenghua.yu@xxxxxxxxx>
>Signed-off-by: Fenghua Yu <fenghua.yu@xxxxxxxxx>
>Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>
>---

--
Kind regards
Maciej Wieczór-Retman