util cpu detection breaks on 128-core AMD machines
I recently got a crash report from X.org starting on a 128 core AMD EPYC machine
asan tracked it down to a memory write into
util_cpu_caps.L3_affinity_mask = calloc(sizeof(util_affinity_mask),
util_cpu_caps.num_L3_caches);
unsigned L3_index = apic_id[i] /
util_next_power_of_two(cores_per_L3);
util_cpu_caps.L3_affinity_mask[L3_index][i / 32] |= cpu_bit;
In the broken case apic_id is 192, num_L3_caches is 16, 128 cpus and cores_per_L3 is 8
The calc ends up setting L3_index to 23 and things explode.
I'm not sure why we have to have code like this in mesa, but this type of bug shows it's fragile to have GPU developers working on CPU affinity code.