Page MenuHomeFreeBSD

attempt to load vmm.ko if it's not already loaded (bhyveload)
ClosedPublic

Authored by rew on Feb 28 2019, 12:58 AM.
Tags
None
Referenced Files
F80127792: D19400.diff
Thu, Mar 28, 7:19 AM
Unknown Object (File)
Fri, Mar 22, 3:22 PM
Unknown Object (File)
Sat, Mar 9, 3:48 PM
Unknown Object (File)
Jan 27 2024, 5:48 PM
Unknown Object (File)
Dec 22 2023, 10:12 PM
Unknown Object (File)
Dec 14 2023, 11:33 PM
Unknown Object (File)
Dec 13 2023, 2:39 PM
Unknown Object (File)
Dec 11 2023, 11:41 PM
Subscribers

Details

Summary

This proposed patch attempts to load vmm.ko if it's not already present in the kernel. If vmm.ko fails to load, an error message is produced and bhyveload exits.

Test Plan
  1. ensure vmm.ko is not loaded
  2. invoke bhyveload
  3. ensure vmm.ko is loaded

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 28173
Build 26304: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.Apr 8 2019, 9:55 PM

@jhb Any objection if I proceed to commit this patch? I just hit the same situation "forgot to load vmm" and this patch does fix it.

@jhb Perhaps do the same with bhyverun.c?

I wonder if it makes more sense to do this in vmrun.sh? OTOH, it's probably fine to do this. We should also probably do it in bhyverun.c since bhyveload isn't used in the UEFI case. Another option would be to do this in the vm_create() wrapper in libvmmapi in which case that would fix bhyveload, grub2-bhyve, and bhyve all in one place.

In D19400#458949, @jhb wrote:

I wonder if it makes more sense to do this in vmrun.sh? OTOH, it's probably fine to do this. We should also probably do it in bhyverun.c since bhyveload isn't used in the UEFI case. Another option would be to do this in the vm_create() wrapper in libvmmapi in which case that would fix bhyveload, grub2-bhyve, and bhyve all in one place.

Yes, I agree to do that on libvmmapi!!! I was actually think about that, because at the end I would repeat code on bhyveload and bhyverun.c
Ok, let me update this patch with the libvmmapi approach.

Thank you.

@araujo, sounds like you are taking over this review?

In D19400#458961, @rob.fx907_gmail.com wrote:

@araujo, sounds like you are taking over this review?

Oops, sorry not really!!! If you can go forward and do the implementation, I will be happy too. It was not my intention to taking over the review.

You’re welcome to finish it up..

I just wanted to make sure that you weren’t waiting for me to update this review.

Thanks in advance for getting these changes in.

  • move the implementation to libvmmapi.
This revision now requires review to proceed.Dec 16 2019, 5:47 AM
jhb added inline comments.
lib/libvmmapi/vmmapi.c
108

Tiny nit:

/* Try to load the vmm(4) module before creating a guest. */

You could perhaps simplify this slightly by not worrying about errors from kldload() and letting it fall through to CREATE still in that case to report the error:

if (modfind("vmm") < 0)
    kldload("vmm");
This revision is now accepted and ready to land.Dec 16 2019, 6:42 PM