]> www.infradead.org Git - users/jedix/linux-maple.git/commit
LoongArch: Add cpuhotplug hooks to fix high cpu usage of vCPU threads
authorXianglai Li <lixianglai@loongson.cn>
Wed, 20 Aug 2025 14:23:44 +0000 (22:23 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Wed, 20 Aug 2025 14:23:44 +0000 (22:23 +0800)
commit8ef7f3132e4005a103b382e71abea7ad01fbeb86
tree6bc475705da46995329eeddcd3694e1128adda83
parentf7794a4d92ade518c813de69a01b27ca6d8d86f3
LoongArch: Add cpuhotplug hooks to fix high cpu usage of vCPU threads

When the CPU is offline, the timer of LoongArch is not correctly closed.
This is harmless for real machines, but resulting in an excessively high
cpu usage rate of the offline vCPU thread in the virtual machines.

To correctly close the timer, we have made the following modifications:

Register the cpu hotplug event (CPUHP_AP_LOONGARCH_ARCH_TIMER_STARTING)
for LoongArch. This event's hooks will be called to close the timer when
the CPU is offline.

Clear the timer interrupt when the timer is turned off. Since before the
timer is turned off, there may be a timer interrupt that has already been
in the pending state due to the interruption of the disabled, which also
affects the halt state of the offline vCPU.

Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/kernel/time.c
include/linux/cpuhotplug.h