macOS 11 Virtualization Framework to Run Linux in a VM
developer.apple.com
developer.apple.com
Also I am yet to see any benefit with docker in Apple platforms ecosystem.
Particularly the main piece of virtualization is an added level of indirection to the page table walking hardware.
There's some IOMMU stuff that can be bought off the shelf (and ARM's SMMU for this is really good actually), but I imagine Apple would build their own (or acquire it) looking at the rest of their IP blocks.
Edit: Actually I'm not even sure if they could pull an SMMU in. Do we have confirmation that they're using AXI/CHI or do they have something else for their NoC protocol?
Is there a more ELI5'ish accessible walk through the context and why's behind this part of the discussion? It sounds really fascinating to me, but I'm not yet equipped to understand it well.
(Apple might be able to leverage off the shelf ARM technologies that might help with virtualization, but not the core feature of virtualization itself)
So are there any tells/indications that Apple's silicon took this into consideration from the beginning, or is virtualization something they had to retrofit into the core? It would be pretty amazing if say, way back in A1 days, we could point to something in the core that indicated they already started laying the groundwork to make virtualization feasible later.
Virtualization isn't terribly hard to add to a core, so they could've started thinking about it at any time. It's possible that some of their cores already support it and we just don't know; that would be a very Apple thing to do. The way virtualization on ARM works (at least the way ARM themselves implemented it; Apple could've done something differently) is that there are three execution levels: EL2 (VM), EL1 (guest kernel), and EL0 (guest userspace). So a device that supports EL2 but drops immediately to EL1 on boot to run a normal kernel (without virtualization active) would not necessarily have obvious "tells" that it supports virtualization, unless you broke into the boot process early enough to catch it in EL2.
It would be interesting to break into an A11 device using the checkm8 exploit and see if there is any evidence of EL2/virtualization support on that core.
Here's a fun one though: Apple CPUs did at least at one point support EL3 (that's one level higher, TrustZone), which they used for KPP:
https://xerub.github.io/ios/kpp/2017/04/13/tick-tock.html
Which suggests they might support EL2 and virtualization too. Honestly, I can't find any trustworthy reference claiming that existing Apple Silicon supports virtualization, nor that it doesn't. For all we know it does..
Apple isn’t really in the server business, and the kinds of high performance VMs that want direct hardware access seem unlikely to run on Apple silicon in the near future. It seems to me that virtualization could work just fine without an IOMMU in this scenario. (Certain GPU workloads would be an exception.)
That being said, I would expect Apple to have an IOMMU at launch for a different reason: Thunderbolt or any other external PCIe connection. Doing this without an IOMMU is a security catastrophe, in contrast to doing it with an IOMMU, which is merely an enormous attack surface that no one secured properly.
After they have a couple generations of laptop silicon under their belts, there's nothing stopping them from dogfooding a real server macOS for awhile and booting up an Apple Service Cloud.
No special insight into whether they actually will, but it's a natural play.
Yet Apple has quite the powerful chip family. If they were to spin off a subsidiary without the consumer-focused mission...well, that's what I would do!
Darwin, macOS Server. This sounds fun.
There’s also an issue of margins. Apple sells attractive hardware and provides a software ecosystem, and they charge high margins for it. Big server users use a large numbers of servers, and they want a lot of bang for their buck. This is not a game that Apple has historically played very well, nor do I see why they would want to.
Well, after Googling, I can’t find the exact quote that referenced new hardware in live blogs, but it’s telling that just before they did a demo of virtualization, Maya and so on, they said, “All of the Big Sur features demonstrated earlier were being run on the development platform” according to Anandtech — meaning the earlier Big Sur demo was on the A12Z but the next part would be possibly newer hardware.
My guess: Parallels on Apple Silicon will support virtualizing AArch64 VMs, and also x64 VMs through Rosetta 2. Support for AArch64 alone doesn't seem interesting enough to keep under wraps, and Apple did commit to supporting x64 JITs, so x64 VMs seems like a natural extension.
A user-level emulator is a completely different beast performance wise than a full system emulator. With a user-level emulator the kernel, and possibly even the shared libraries are native code, and the code that needs to be emulated is relatively easy to translate from one architecture to another.
For a full system emulator not only you need to emulate the kernel also, but all the system-levels instructions have to be emulated as well (unlike user space instruction that can be JITed).
Just compare the performance of qemu-system-aarch64 with qemu-aarch64 running on amd64, and you will see a MASSIVE difference in performance. It's very likely rosetta will be more optimised than qemu, but still there is a fundamental problem here.
I'm sure qemu-system-x86_64 will run on aarch64 macs, but I doubt Apple/Parallels/VMware will touch this space.
But Apple has a history of weird but successful systems that nobody else tried, like 64 bit user space with a 32 bit kernel, or mixed-endian processes sharing memory. And there's pointed coyness around "Apple Silicon" and Parallels keeping mum. So I want to believe.
There is a greater overhead and a limited scope when using paravirtualization. But that doesn't mean it is a relic, in fact you can try it right now in Virtualbox. I also believe that the Linux KVM has para-virtualization optimizations if the guest is Linux and the bare metal doesn't support hardware VT.
Paravirtualization is a general optimization technique for VMs that allows the guest OS to better communicate its intent to the hypervisor through the use of hypercall APIs, sparing the guest OS from having to issue many series of privileged CPU instructions that each have to be trapped and handled by the hypervisor. It saves time because going back and forth between the hypervisor and the guest OS is an expensive operation, and reducing the number of times it happens helps a lot. It's not a simple replacement for hardware assisted virtualization or the other way around.
> VMware [10] and Connectix [8] both virtualize commodity PC hardware, allowing multiple operating systems to run on a single host. All of these examples implement a full virtualization of (at least a subset of) the underlying hardware, rather than paravirtualizing and presenting a modified interface to the guest OS.
And no, I haven't forgotten about binary translation. As you mention, it was only used to replace privileged instructions and not a full-blown CPU emulator. VMware VMs still ran native CPU instructions, and the overhead incurred by translation is a whole different matter unrelated to my original point.
(1) Apple has a virtualization framework that can "...boot and run a Linux-based operating system on an Apple silicon or Intel-based Mac computer."
(2) The virtualization framework for arm-based Macs will virtualize arm-Linux and x86-based macs would virtualize x86-linux. There maybe a semantic issue here if you believe that this api would also allow the "virtualization" of x86-linux on arm. That would not be considered virtualization to my best understanding of the definition.
(3) Looking at Apple's VZVirtualMachineConfiguration, VZVirtualMachine and "Virtualization Constants" there is nothing apparently exposing the underlying virtualization mechanism. So we don't know if Apple uses hardware (ring -1 in x86 parlance) or software virtualization (almost always para-virtualization) under the hood. Likely it uses both depending on the context.
(4) We know that Apple's current dev kit hardware (A12z) doesn't support hardware virtualization. Hardware virtualization is commonly referred to as the "Virtualization Host Extension" in arm64 parlance.
(5) We know that Apple demoed virtualization on arm with what appeared to be a arm64 ubuntu guest.
(6) Your original message said that you believed they weren't using an a12z for the demo, likely because its aforementioned lack of hardware virtualization.
(7) The comment below yours suggest that "One can certainly write software that virtualizes another machine". They were more than likely referring to para-virtualzation in their comment. I don't know any other blanket type of software virtualization.
(8) You responded saying you didn't know what software virtualization was, it is almost always para-virtualization. Para-virtualziation does not require a hardware hypervisor and predates all hardware virtualization technologies.
While there is full-hardware virtualization, it basically never a thing that happens anymore because of the rather large overhead. I don't know of any modern virtualization software that offers full software virtualization. Especially if your guest is Linux.
I never claimed this
> (7) The comment below yours suggest that "One can certainly write software that virtualizes another machine". They were more than likely referring to para-virtualzation in their comment.
Well, yes and no. Virtualization (in the context of VMs) is about sharing the hardware between multiple OSes, so the statement about "virtualizing another machine" didn't even remotely make any sense. This led to my original comment, "emulation isn't virtualization."
And one small thing, it was the comment above mine, not below.
> (8) You responded saying you didn't know what software virtualization was, it is almost always para-virtualization.
Where can I find refereces to this term that supports this statement? I looked, and found the term "software virtualization" being used to refer to containerization and programming language runtimes, but not VMs.
> While there is full-hardware virtualization
I couldn't find anything about this either.
7/8 together. A Google scholar search of "software virtualization" or "software virtualization para virtualization" returned the following (plus many more) that refer to software virtualization in the same way I meant:
https://dl.acm.org/doi/abs/10.1145/1168918.1168860
https://ieeexplore.ieee.org/abstract/document/4709159/
https://ir.library.oregonstate.edu/dspace/handle/1957/9907
http://www.cs.toronto.edu/~demke/2227/S.14/Papers/p2-adams.p...
Finally I dopishly wrote "full hardware virtualization" when I meant "full virtualization", but for posterity here is VMware doc on it vs paravirtualzation vs hardware-assisted virtualzation: https://www.vmware.com/content/dam/digitalmarketing/vmware/e...
More importantly, I still haven't got the slightest idea what a "software VM" means, either. It's a term that I've never seen before. I even did an online search and found nothing.
A "software virtual machine" is a disambiguation that I chose indicating that the "machine" is implemented entirely in software with no help from special silicon (contrast with [2]). I can't fathom why that would be so controversial.
The entire thread comes down to this: the demo of x86 Linux running on Apple Silicon could very easily have been running in a virtual machine made entirely of software. No one claimed, as I recall, that Silicon implemented any hardware assistance for executing x86 code. There might even be IP issues doing that (IP - intellectual property, not "internet protocol".)
See also [3]
1 - https://en.wikipedia.org/wiki/Virtual_machine
2 - https://en.wikipedia.org/wiki/Hardware_virtualization
3 - https://en.wikipedia.org/wiki/Comparison_of_platform_virtual...
Wikipedia is useful tool, but it's wrong to rely on it for preciseness or the as absolute source of truth, especially on highly technical topics.
> This says nothing about whether the virtualization is entirely software, assisted by hardware, or entirely hardware.
Again, what does this even mean? What's your specific example for an "entirely software" virtualization or "entirely hardware" virtualization?
> A "software virtual machine" is a disambiguation that I chose indicating that the "machine" is implemented entirely in software with no help from special silicon (contrast with [2]). I can't fathom why that would be so controversial.
You can't just invent a new term without any explanation and wonder why people wouldn't just "get it."
> The entire thread comes down to this: the demo of x86 Linux running on Apple Silicon could very easily have been running in a virtual machine made entirely of software
Are you sure of this? I was assuming it was ARM Linux.
> No one claimed, as I recall, that Silicon implemented any hardware assistance for executing x86 code.
No one claimed that you claimed such a thing either.
https://profsandhu.com/cs6393_s14/popek-goldberg-1974.pdf
Though some details may arguably be outdated, the general concept applies.
Virtualization, by contrast, allows the user to run a guest OS designed for the same architecture as the physical hardware. i.e running x64 Linux guest on an X64 host that runs Windows as a host OS.
It shipped on a couple million iPads, we know a decent amount about it already.
Even if Apple's ARM chips are not classically virtualizable (and I don't know whether that is the case), that was indeed the case for the x86 (pre VT-x) when two fairly straightforward solutions were applied: binary translation of non-virtualizable instructions (VMware approach) and paravirtualization (Xen approach.) This sparked the x86 virtualization revolution even before hardware support was available from intel and AMD.
Other approaches that could potentially work on a "non-virtualizable" ARM CPU include user-mode Linux, emulation, microkernels (similar to paravirtualization - recall Xnu contains mach and presumably still has the ability to outsource system calls and paging) and containers.
Then virtualization will just occur in the touchbar using emojis as feedback. ;)
Is that correct?
No kernel extension required
This is something Apple and VMware are now obviously working on together for Big Sur.
In the non-MAS version there's a per-VM option to use either Parallels' or Apples' Hypervisor.
Otherwise they would be paying GNU/Linux OEMs.
We are still not sure about ASi’s memory map and if/how there are other limitations that might prevent it from booting anything other than macOS.
In the short term I expect that to be problematic. First party packages in the distro's package manager will be fine, but I expect it might be hard to find some third-party software compiled for ARM Linux. And any Docker containers in the Linux VM will need to use multi-arch or ARM Docker images.
Closed source, commercial software might be a bit more of a crapshoot, of course, but this should provide a fair bit of impetus.
So even though the rPi foundation may be slow (I don't know), the larger community has been working hard on making software build on AArch64.
I agree.
I liked that you could run docker on osx, but there was no support for something like FROM macosx:10.6
Maybe it will be possible? If apple put 1/1000th of the effort into virtualization/containers that they put into emojis...
I'd imagine the most common scenario for that would be macOS guests running on ESXi on Mac hardware, but my understanding is that e.g. a macOS guest under say Vbox or KVM with a linux host OS should also be "ok" in terms of the EULA.
Extremely limiting, and a real bummer.
Here in 2020, Apple invests a lot of resources to allow other OS's to be virtualized on macOS, but you still can't virtualize macOS on other OS's
The EULA does not say "you must virtualise macOS as a guest VM on a macOS host". It says you must do it on Mac hardware.
As I said above - ESXi on Mac with macOS guests is very much a thing that happens, at reasonable scale.
And the EULA clearly states it only allows up to 2 instances of macOS to be virtualized on a Mac computer already running Apple software, ie macOS.[1]
Of course you can run ESXi on Mac _hardware_. You can run nearly any OS or software on the Mac _hardware_. It's, until recently, pretty standard Intel x86 hardware.
You cannot, however, run macOS on Dell hardware as an ESXi guest. It very clearly violates Apple's EULA for macOS, even if you could trick it into doing so.
You can look around the internet for how to install a macOS guest on non Apple hardware running ESXi. It's not easy, and requires patching ESXi, and more.
Plus, the hosting company you linked to is clearly running things on Mac hardware. They even say it.
Doing otherwise would clearly violate Apple's EULA, which is what all this was originally about.
Have you read what I wrote? Or even what you asked originally?
You asked if macOS can be virtualised. The answer is yes, it can, on Mac hardware.
If you want to know if it can be virtualised on non-mac hardware, perhaps that's what you should have asked.
I guess that's fair enough. It used to be you couldn't virtualize OSX/macOS on anything, period. So this is a step in the right direction.
I suppose the historical lack of virtualization provisions in the license agreement led to the rise of insane concoctions like Imgix[1] - literally custom fabricating racks to hold a bunch of Mac Pros in a data center - absolutely insane, but necessary if you wanted a macOS/OSX stack.
I guess it's implied that virtualization would be hardware agnostic... since that's a primary reason to virtualize an OS.
Artificial limitations of only two (2) instances on only Apple hardware is absurd, and barely useful at all.
From kbutler's post[1]:
> "(iii) to install, use and run up to two (2) additional copies or instances of the Apple Software within virtual operating system environments on each Mac Computer you own or control that is already running the Apple Software, for purposes of: (a) software development; (b) testing during software development; (c) using macOS Server; or (d) personal, non-commercial use."
This seems to imply you can only virtualize macOS on Apple hardware that is already running macOS. Since ESXi is a Type-1 Hypervisor and includes it's own kernel, etc, it seems dubious to wipe the OS, and install ESXi on Apple hardware. Perhaps you'll never be caught doing this... but it seems like it would still violate the EULA.
And yes, you can run macOS in ESXi, on mac hardware.
Has a single court of law yet made a ruling to set a precedent saying they are legally binding?
If no, I’ll just keep treating EULAs like what they are: a corporate wish list of unlawful restrictions they want to impose on their customers.
Why should anyone care about that?
Many of the use cases for virtualizing OSX are for business purposes. Not a great idea to build a business off pirated software and trampled software licenses.
By requesting and reading this reply you hereby grant me 50% of your future income the next 5 years.
By your logic, this statement should legally binding too, just because someone somewhere wrote it and put it on your screen.
Obviously it’s not though, so why should a EULA be different? It’s literally the same thing.
At the very least: ProCD, Inc. v. Zeidenberg, 86 F.3d 1447 (7th Cir. 1996).
Just wish it was debian based
In early 1977, Unix V6 was an app that run on Interdata OS/32 [1]. (Within a few months, it had gained the ability to run directly on the Interdata 7/32 hardware, without the need for the rather primitive OS/32 operating system to sit under it.)
AT&T's 1979-1980 port of Unix to IBM mainframes ran it on top of the TSS/370 operating system [2]. (TSS was IBM's original, and ultimately unsuccessful, attempt to deliver timesharing for S/360 mainframes – TSO under MVS, and VM/CMS, succeeded where TSS largely failed. But TSS hung on for a few more years, sustained by the handful of customers using it, and AT&T decided it was the best base for their mainframe Unix port, and IBM was wiling to support them in that.)
[1] http://bitsavers.informatik.uni-stuttgart.de/bits/Interdata/...
[2] https://www.bell-labs.com/usr/dmr/www/otherports/ibm.pdf
Cool, why is this even posted?
I'm spoiled, though. I used to have the full 6-volume set of Inside Macintosh[1].
They don't write 'em like they used to...
[0] https://apps.apple.com/us/app/a-companion-for-swiftui/id1485...
https://github.com/docker/for-mac/issues/4733#issuecomment-6...
$ cat /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/
System/Library/Frameworks/Virtualization.framework/Headers/VZBootLoader.h
//
// VZBootLoader.h
// Virtualization
//
// Copyright © 2019 Apple Inc. All rights reserved.
//
#import <Virtualization/VZDefines.h>
NS_ASSUME_NONNULL_BEGIN
/*!
@abstract Base class of boot loader configuration.
@discussion
VZVirtualMachineConfiguration requires a boot loader defining how to start the virtual machine.
VZBootLoader is the abstract base class of boot loader definitions.
Don't instantiate VZBootLoader directly, instead you should use one of its subclasses.
@see VZLinuxBootLoader.
*/
VZ_EXPORT API_AVAILABLE(macos(11.0))
@interface VZBootLoader : NSObject <NSCopying>
+ (instancetype)new NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;
@end
NS_ASSUME_NONNULL_ENDESR wrote the cathedral and the bazaar how many years ago?
There will be some inconveniences, but the reign of desktop x86 can't come to an end fast enough.
> The fact that it is very unlikely that you will be able to run linux
The jury is still out. There's some problem with booting other operating systems natively (BIOS support?). If people can get that to boot up, Linux on ARM runs fine.
Apple has never supported Linux on Macs, and yet people have run it successfully, myself included.
Also note that many (maybe most?) people get Apple computers in order to run OSX. Linux users are a tiny minority - even Windows users are quite niche.
This isn’t really accurate at all.
> We’re also introducing new virtualization technologies in macOS Big Sur. So for developers who want to run other environments like Linux or tools like Docker, we have you covered.
Mac on Apple CPUs is exciting, but Apple doesn't sell their CPU or designs to third parties. So, the impact is limited to Mac users.
Of course, it may have the side-effect of making AArch64 more popular on servers as well.
"Eschew flamebait. Don't introduce flamewar topics unless you have something genuinely new to say. Avoid unrelated controversies and generic tangents." - https://news.ycombinator.com/newsguidelines.html