Re: [PATCH v5 16/20] x86/resctrl: Report "Unassigned" for MBM events in ABMC mode

From: Markus Elfring
Date: Sat Jul 13 2024 - 16:28:12 EST



> +++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c

> @@ -609,12 +609,21 @@ int rdtgroup_mondata_show(struct seq_file *m, void *arg)

+ if (resctrl_arch_get_abmc_enabled()) {
+ index = mon_event_config_index_get(evtid);
+ if (rdtgrp->mon.cntr_id[index] == MON_CNTR_UNSET)
+ seq_puts(m, "Unassigned\n");
+ else
+ seq_puts(m, "Unavailable\n");
+ } else {


I suggest to restrict the scope for the shown local variable to this if branch.

How do you think about to apply a code variant like the following?

int index = mon_event_config_index_get(evtid);

seq_puts(m,
(rdtgrp->mon.cntr_id[index] == MON_CNTR_UNSET
? "Unassigned\n"
: "Unavailable\n") );


Regards,
Markus