> > > > While here, fix a problem where of_node_put could be called even when > > of_get_cpu_node was not successful. > > of_node_put() handles NULL arguments, so this should not be necessary. >
Ok > > @@ -875,7 +908,7 @@ void __init mem_topology_setup(void) > > reset_numa_cpu_lookup_table(); > > > > for_each_present_cpu(cpu) > > - numa_setup_cpu(cpu); > > + numa_setup_cpu(cpu, false); > > } > > I'm open to other points of view here, but I would prefer two separate > functions, something like vphn_get_nid() for runtime and > vphn_get_nid_early() (which could be __init) for boot-time > initialization. Propagating a somewhat unexpressive boolean flag through > two levels of function calls in this code is unappealing... > Somehow not convinced that we need to duplicate function just to avoid passing a bool. If propagating a boolean flag in two levels of function calls is an issue, we could decipher the logic in numa_setup_cpu itself Something like this static int numa_setup_cpu(unsigned long lcpu, bool get_hwid) { .... if (firmware_has_feature(FW_FEATURE_VPHN)) { long hwid; if (get_hwid) hwid = get_hard_smp_processor_id(cpu); else hwid = cpu_to_phys_id[cpu]; nid = vphn_get_nid(lcpu, hwid); } .... Would this help? > Regardless, I have an annoying question :-) Isn't it possible that, > while Linux is calling vphn_get_nid() for each logical cpu in sequence, > the platform could change a virtual processor's node assignment, > potentially causing sibling threads to get different node assignments > and producing an incoherent topology (which then leads to sched domain > assertions etc)? > Right, its certainly possible for node assignment to change while we iterate through the siblings. Do you have an recommendations? > If so, I think more care is needed. The algorithm should make the vphn > call only once per cpu node, I think? I didn't get "once per cpu node", How do we know which all cpus are part of that cpu node? Or did you mean once per cpu core? -- Thanks and Regards Srikar Dronamraju