KVM CPU hotplug notifier triggers BUG_ON on arm64

Oliver Upton oliver.upton at linux.dev
Sat Jul 1 10:42:28 PDT 2023


Hi Kristina,

Thanks for the bug report.

On Sat, Jul 01, 2023 at 01:50:52PM +0100, Kristina Martsenko wrote:
> Hi,
> 
> When I try to online a CPU on arm64 while a KVM guest is running, I hit a
> BUG_ON(preemptible()) (as well as a WARN_ON). See below for the full log.
> 
> This is on kvmarm/next, but seems to have been broken since 6.3. Bisecting it
> points at commit:
> 
>   0bf50497f03b ("KVM: Drop kvm_count_lock and instead protect kvm_usage_count with kvm_lock")

Makes sense. We were using a spinlock before, which implictly disables
preemption.

Well, one way to hack around the problem would be to just cram
preempt_{disable,enable}() into kvm_arch_hardware_disable(), but that's
kinda gross in the context of cpuhp which isn't migratable in the first
place. Let me have a look...

--
Thanks,
Oliver



More information about the linux-arm-kernel mailing list