Re: [patch V6 11/19] x86/cpu: Use common topology code for AMD

From: Yuezhang.Mo@xxxxxxxx
Date: Thu Mar 14 2024 - 06:22:53 EST


I ran xfstests generic/650 and found that it failed.

The reason for the failure is that this appears in dmesg:

[ 649.590421] smpboot: CPU 2 is now offline
[ 650.132920] smpboot: Booting Node 0 Processor 3 APIC 0x13
[ 650.133432] LVT offset 0 assigned for vector 0x400
[ 650.148931] ACPI: \_PR_.P003: Found 2 idle states
[ 650.149478] BUG: arch topology borken
[ 650.149483] the CLS domain not a subset of the MC domain
[ 650.149486] BUG: arch topology borken
[ 650.149487] the CLS domain not a subset of the MC domain

I prepared the following script to reproduce this issue.

#! /bin/sh

sysfs_cpu_dir="/sys/devices/system/cpu"
nrcpus=$(getconf _NPROCESSORS_CONF)
hotplug_cpus=()
for ((i = 0; i < nrcpus; i++ )); do
test -e "$sysfs_cpu_dir/cpu$i/online" && hotplug_cpus+=("$i")
done

nr_hotplug_cpus="${#hotplug_cpus[@]}"

for ((i=0; i<20;i++)); do
idx=$(( RANDOM % nr_hotplug_cpus ))
cpu="${hotplug_cpus[$idx]}"
action=$(( RANDOM % 2 ))

echo "$action" > "$sysfs_cpu_dir/cpu$cpu/online" 2>/dev/null
sleep 0.5
done

If run the script without this commit, the issue cannot be reproduced.