It may not be enough to just clear staged_config[] whenah - indeed. Thank you for catching that.
resctrl_arch_update_domains() exits. I think the fix needs to make
sure staged_config[] can be cleared where it is set.
The modification of staged_config[] comes from two paths:
Path 1:
rdtgroup_schemata_write() {
...
rdtgroup_parse_resource() // set staged_config[]
...
resctrl_arch_update_domains() // clear staged_config[]
...
}
Path 2:
rdtgroup_init_alloc() {
...
rdtgroup_init_mba()/rdtgroup_init_cat() // set staged_config[]
...
resctrl_arch_update_domains() // clear staged_config[]
...
}
If we clear staged_config[] in resctrl_arch_update_domains(), goto
statement for error handling between setting staged_config[] and
calling resctrl_arch_update_domains() will be ignored. This can still
remain the stale staged_config[].
I think maybe it is better to put the clearing work where
rdtgroup_schemata_write() and rdtgroup_init_alloc() exit.
It may be more robust to let rdtgroup_init_alloc() follow
how rdtgroup_schemata_write() already ensures that it is
working with a clean state by clearing staged_config[] before
placing its staged config within.