Hi Jan, > -----Original Message----- > From: Jan Beulich <jbeul...@suse.com> > Subject: Re: [PATCH v4 03/17] xen/arm: implement node distance helpers for > Arm > > On 25.04.2023 11:31, Henry Wang wrote: > >> -----Original Message----- > >> From: Jan Beulich <jbeul...@suse.com> > >> > >> On 25.04.2023 09:56, Henry Wang wrote: > >>> + /* NUMA defines NUMA_NO_DISTANCE as unreachable and 0-9 are > >> undefined */ > >>> + if ( distance >= NUMA_NO_DISTANCE || distance <= > >> NUMA_DISTANCE_UDF_MAX || > >>> + (from == to && distance != NUMA_LOCAL_DISTANCE) ) > >>> + { > >>> + printk(KERN_WARNING > >>> + "NUMA: invalid distance: from=%"PRIu8" to=%"PRIu8" > >> distance=%"PRIu32"\n", > >>> + from, to, distance); > >>> + return; > >>> + } > >> > >> I appreciate the checking that node-local references are > >> NUMA_LOCAL_DISTANCE, > >> but if they're wrongly passed into here, shouldn't the resulting array > >> still > >> have NUMA_LOCAL_DISTANCE on its diagonal, at least as far as present > nodes > >> go? > > > > Apologies in advance to ask more specific details from you as I am not sure > > if I can correctly understand the "if they're wrongly passed into here" > > case. > Do you > > mean we are always guaranteed that if from == to, the distance will always > be > > NUMA_LOCAL_DISTANCE so the (from == to && distance != > NUMA_LOCAL_DISTANCE) > > check is redundant and can be removed? Thanks. > > It's a little odd that you ask me: It is your code which insists on > NUMA_LOCAL_DISTANCE when from == to. If you insist on your caller to pass > only this one value, then I think it is only logical to also set the > respective table entries to that value (rather than leaving them at > NUMA_NO_DISTANCE).
I think I understand what do you mean now. I was only checking this specific patch so didn't make the connection with the latter patches. Kind regards, Henry > > Jan