If we are in the middle of hotplugging a cpu at the same time we try to enter kgdb then things won't be so happy.
In <https://lkml.kernel.org/r/20181114220744.GB4044@brain-police> Will pointed out that kgdb_roundup_cpus() might not be so happy since it iterates over all online CPUs.
Presumably this bit of code will also be problematic:
while (kgdb_do_roundup && --time_left &&
(atomic_read(&masters_in_kgdb) + atomic_read(&slaves_in_kgdb)) !=
online_cpus)
udelay(1000);
It might be a bit hard to totally inhibit things because I think we'd have to interact with the mutex "cpu_add_remove_lock", but when we enter kgdb we might be at interrupt time and so interacting with mutexes isn't totally trivial.
We should try to figure something out here. Maybe we can have some sort of delay waiting for someone else to release the mutex? Something with mutex_trylock()?