Unverified Commit d497590c authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!9223 [OLK-6.6] x86/hpet: Read HPET directly if panic in progress

Merge Pull Request from: @leoliu-oc 
 
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:

![输入图片说明](https://foruda.gitee.com/images/1718074657676425361/81c9bc12_8868386.png "屏幕截图")

To avoid this dead loops, read HPET directly if panic in progress.

### Issue
https://gitee.com/openeuler/kernel/issues/IA6NHA

### Default config Change
N/A

### Test
Pass. 
 
Link:https://gitee.com/openeuler/kernel/pulls/9223

 

Reviewed-by: default avatarJason Zeng <jason.zeng@intel.com>
Signed-off-by: default avatarZhang Peng <zhangpeng362@huawei.com>
parents fe72cb5a c7cb7548
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -804,6 +804,12 @@ static u64 read_hpet(struct clocksource *cs)
	if (in_nmi())
		return (u64)hpet_readl(HPET_COUNTER);

	/*
	 * Read HPET directly if panic in progress.
	 */
	if (unlikely(atomic_read(&panic_cpu) != PANIC_CPU_INVALID))
		return (u64)hpet_readl(HPET_COUNTER);

	/*
	 * Read the current state of the lock and HPET value atomically.
	 */