Skip to contentSkip to conversation

Kernel crashes in VirtualBox module after commit 2ecd9d29abb1

DISCUSSION Larry Finger 2 participants 2 messages Aug 10, 2015 – Aug 11, 2015

lore
Share & tools
lore
#0 lore raw

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.

Thanks,

Larry

#1 lore raw
Quoted 15 lines · Larry Finger

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();
Quoted 2 lines

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 preempt_notifiers.

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 again.