Re: Kernel crashes in VirtualBox module after commit 2ecd9d29abb1

From: Peter Zijlstra
Date: Tue Aug 11 2015 - 03:45:04 EST

On Mon, Aug 10, 2015 at 04:49:49PM -0500, Larry Finger wrote:
> A problem with the VirtualBox kernel module vboxdrv.ko has been bisected to
> commit 2ecd9d29abb1 "sched, preempt_notifier: separate notifier registration
> from static_key inc/dec". The affected kernels crash is various ways. The
> most instructive includes a warning issued at kernel/sched/core.c:2342 in
> prempt_notifier_register() for "registering prempt_notifier while notifiers
> disabled" The call from vboxdrv is as follows:
> /*
> * Register the callback.
> */
> preempt_disable();
> pThis->fEnabled = true;
> preempt_notifier_register(&pThis->LnxPreemptNotifier);
> preempt_enable();
> As I have no reason to suspect the kernel after this patch, I would like
> some suggestions regarding the best method to patch/fix the VirtualBox code.

You have to call preempt_notifier_inc() when creating your virtual box
instance _before_ creating your vCPU threads which will register the

You also have to call a matching preempt_notifier_dec() when destroying
your virtual box instance.

The patch you refer adds these calls in
kvm_create_vm()/kvm_destroy_vm(). Mirror that and things should work
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at