Re: [PATCH v22 09/18] x86/resctrl: Add a new field to struct rmid_read for summation of domains

From: Reinette Chatre
Date: Fri Jun 28 2024 - 16:54:27 EST


Hi Tony,

On 6/27/24 1:38 PM, Tony Luck wrote:
When a user reads a monitor file rdtgroup_mondata_show() calls
mon_event_read() to package up all the required details into an rmid_read
structure which is passed across the smp_call*() infrastructure to code
that will read data from hardware and return the value (or error status)
in the rmid_read structure.

Sub-NUMA Cluster (SNC) mode adds files with new semantics. These require
the smp_call-ed code to sum event data from all domains that share an
L3 cache.

Add a pointer to the L3 "cacheinfo" structure to struct rmid_read
for the data collection routines to use to pick the domains to be
summed.

This patch has evolved to a point asking for a split. Everything described below
would be a good fit for its own patch. I do not know if a single patch like this
one will be acceptable but at minimum I would propose that you motivate the
additional changes as a result of the semantic changes related to this struct.
For example, something like below inserted at this point in changelog:

The new semantics rely on some struct rmid_read members having
NULL values to distinguish between the SNC and non-SNC scenarios.
resctrl can thus no longer rely on this struct not being initialized
properly.


Initialize all on-stack declarations of struct rmid_read:
rdtgroup_mondata_show()
mbm_update()
mkdir_mondata_subdir()
to ensure that garbage values from the stack are not passed down
to other functions.

Remove redundant rr->val = 0; from mon_event_read() and rr.first = false;
from mbm_update() since the rmid_read structure is cleared by compiler.

Reinette suggested that the rmid_read structure has become complex enough
to warrant documentation of each of its fields and provided the kerneldoc
documentation for struct rmid_read.

Co-developed-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>
Signed-off-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>
Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>
---

With patch either split or its changes motivated to be logically connected:

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

Reinette