When the clocksource of the system is HPET,a CPU executing read_hpet might be interrupted by #GP/#PF to executing the panic,this may lead to read_hpet dead loops: CPU x CPU x ---- ---- read_hpet() arch_spin_trylock(&hpet.lock) [CPU x got the hpet.lock] #GP/#PF happened panic() kmsg_dump() pstore_dump() pstore_record_init() ktime_get_real_fast_ns() read_hpet() [dead loops] To avoid this dead loops, read HPET directly if panic in progress.
The PR Link: https://gitee.com/anolis/cloud-kernel/pulls/3449