Re: [RFC/PATCH 15/15] guest: virtio device support, and kvm hypercalls

Carsten Otte
2008-03-21T07:12:15Z

Rusty Russell wrote:
>> +static int __init kvm_devices_init(void)
>> +{
>> + if (!MACHINE_IS_KVM)
>> + return -ENODEV;
>> +
>> + if (device_register(&kvm_root) != 0)
>> + panic("Could not register kvm root");
>> +
>> + if (add_shared_memory((max_pfn) << PAGE_SHIFT, PAGE_SIZE)) {
>> + device_unregister(&kvm_root);
>> + return -ENOMEM;
>> + }
>
> Hmm, panic on device_register fail, but -ENOMEM on add_shared_memory fail?
> My theory was that since this is boot time, panic() is the right thing.
We can't tell whether or not this is an important device or not. Maybe
the guest is running with ramdisk as rootfs and can have a happy life
if we don't kill it here. Return the rc from device register seems to
be the right thing to me, if it was an important device we'll see
"panic: cannot mount rootfs" or something later.