Live data from Hacker News

Apple Virtualization Framework

developer.apple.com

101–110 of 127 posts

Re: Apple Virtualization Framework

#101
post #100
post #98

Earlier quoted context omitted.

I can't upvote this enough: just take the sample code and build on it. I tired of evaluating and learning various wrappers and helpful virtualization applications. Being able to configure directly in a normal language is great, and it eliminates software supply chain concerns. Plus, I'm finding programs are running faster in my virtualized ubuntu than on macOS "bare metal" (still on Intel, where big memory is cheap)

> Plus, I'm finding programs are running faster in my virtualized ubuntu than on macOS "bare metal" (still on Intel, where big memory is cheap) Can you explain more? Sounds like you are saying your Ubuntu (guest) VM reacts faster to your actions than the underlying (host) macOS?

It's possible because of differences in performance/efficiency core scheduling and QoS: https://eclecticlight.co/2022/07/18/virtualisation-on-apple-...

Re: Apple Virtualization Framework

#102

Shameless plug for a couple blog posts I have written as explorations of the Virtualization Framework: - Introduction when Monterey was released: https://macops.ca/macos-monterey-apple-silicon-vms/ - New features added in Ventura: https://macops.ca/virtualization-updates-2022-06/

Cool! What’s the difference between Virtualisation.framework and Hypervisor.framework?

Re: Apple Virtualization Framework

#103
post #6

Has there been a significant development? Been using it with https://mac.getutm.app/ for a while

I've also been using the Apple Virtualization option with Linux VMs in UTM and have had zero issues whatsoever. The biggest benefit to doing so in my opinion isn't necessarily the noticeably better performance, but the RAM usage. I've noticed that Linux VMs in UTM that run using the Apple Virtualization Framework use significantly less RAM compared to otherwise because the framework provides dynamic memory allocation…

Isn’t it really hard to use though? Like you need decomposed Linux bits.

Re: Apple Virtualization Framework

#104
post #99

I use Virtualization.framework for OrbStack ( https://orbstack.dev ), which is a Docker Desktop and WSL alternative. It's great overall, and fairly convenient, but it has a fair share of bugs and limitations. The Virtualization service crashes with various combinations of Linux kernel version, macOS version, and architecture (ARM/Intel), so making it stable in each setup takes quite a bit of work. Device support is l…

> Apple doesn't allow third-party VMMs to set the necessary CPU flags for Rosetta.

Would that change with Asahi Linux host OS and macOS guest?

Re: Apple Virtualization Framework

#105
post #97
post #6

Has there been a significant development? Been using it with https://mac.getutm.app/ for a while

How does one actually enable AVF on UTM? I've got some Ubuntu VMs set up already, and as per [0] I cannot find an option called "Use Apple Virtualization" neither in UTM, nor in the VM settings. I am on Intel Mac. [0] https://www.jamesarmes.com/2022/12/linux-mac-utm.html#once-m...

I think it's only available when creating a VM, you cannot change after the VM has been created.

Re: Apple Virtualization Framework

#106

Shameless plug for a couple blog posts I have written as explorations of the Virtualization Framework: - Introduction when Monterey was released: https://macops.ca/macos-monterey-apple-silicon-vms/ - New features added in Ventura: https://macops.ca/virtualization-updates-2022-06/

Cool! What’s the difference between Virtualisation.framework and Hypervisor.framework?

Hypervisor.framework provides only the bare necessities: the ability to manage vCPUs, stage 2 page tables, and handle hypervisor exits. It does not do any sort of virtualization except for the CPU itself (which, on ARMv8, is very little due to hardware providing good primitives already). Virtualization.framework is full operating system virtualization suitable for running modern Linux and macOS guests.

Re: Apple Virtualization Framework

#107
Virtualization Framework is awesome and I'm slowly building my own VirtualBox-like app, learning Cocoa programming. Hopefully will release it some day.

One big thing that's missing is better storage support. Right now it's just disk image and that's about it. No way to implement something like qcow2 with snapshots and whatnot. It's missing a lot of opportunity for VMs.

Another big thing that's missing is USB pass-through.

Other than that: it does absolutely everything I need. It even provides some kind of hook for network which should allow to build userspace router with any network architecture (didn't try it myself, though, but I think it should work).

I was able to implement thing that I missed for years on M1 mac. Basically I run Fedora VM, I installed Rosetta helper inside, and docker. And then automagically my x86 images started to work with reasonable speed. I don't know if Docker Desktop supports it already, I don't want to touch it with a longest stick in the world. But for myself I solved this issue.

It was rock stable in my experience and just worked. qemu on the other hand managed to crash my entire macOS (hopefully that bug was fixed).

Another thing that I liked about it: protocols are "modern" and open-source. Almost every driver is virtio. No ancient cruft. No proprietary things. Eventually other operating systems could be run on this solution.

Re: Apple Virtualization Framework

#108
post #2

I'm posting this because I've just found it. I'm trying to boot a custom toy kernel that I'm developing (with virtio support). Wish me good luck! OSDEV rocks!

Fair warning, you might be better suited by QEMU since debug support in Virtualization.framework is not great. QEMU has support for debug stubs out of the box. QEMU does support Hypervisor.framework so your performance should still be good through it, assuming you're using a matching architecture as your host (i.e. don't build an x64 kernel for your ARM Mac)

Re: Apple Virtualization Framework

#109
post #99

I use Virtualization.framework for OrbStack ( https://orbstack.dev ), which is a Docker Desktop and WSL alternative. It's great overall, and fairly convenient, but it has a fair share of bugs and limitations. The Virtualization service crashes with various combinations of Linux kernel version, macOS version, and architecture (ARM/Intel), so making it stable in each setup takes quite a bit of work. Device support is l…

> Apple doesn't allow third-party VMMs to set the necessary CPU flags for Rosetta. Would that change with Asahi Linux host OS and macOS guest?

I can't speak for the feasibility of running a macOS guest on Asahi, but yes, Linux could be in control of the guest's CPU flags. Same goes for the m1n1 hypervisor.

I can't find the exact post but I remember marcan saying that he doesn't want to poke the bear of using Apple's custom ISA extensions on Linux. So even though it's possible, I'm not sure whether it'll actually be done.

Re: Apple Virtualization Framework

#110

Shameless plug for a couple blog posts I have written as explorations of the Virtualization Framework: - Introduction when Monterey was released: https://macops.ca/macos-monterey-apple-silicon-vms/ - New features added in Ventura: https://macops.ca/virtualization-updates-2022-06/

Cool! What’s the difference between Virtualisation.framework and Hypervisor.framework?

AFAIK Virtualization.framework is built on top of Hypervisor.framework. Former is high-level one allowing you to create Linux VM with few hundreds lines of code. Latter allows you to run your whatever you want with few tens of thousands lines of code, but absolute freedom when it comes to drivers and every low level detail.
Post reply on HN