4 ms·
This is a great tutorial, thanks. Slight aside, with the incredible performance possible with Rosetta on Apple silicone, what are the chances of using it as pa
by samwillis 5y ago
This is a great tutorial, thanks.
Slight aside, with the incredible performance possible with Rosetta on Apple silicone, what are the chances of using it as part of a virtual machine emulating x86-64 with similar performance? I understand that Rosetta “recompiles” to ARM which would probably be harder with a VM but I think it also does real-time conversion to. I have no idea about he details but could QEMU use Rosetta under the hood for emulation?
- shoo_pl 5y agoLiterally second paragraph of the article mention QEMU-based app that allows you to virtualise x64 machines on M1 - UTM: https://mac.getutm.app/ https://mac.getutm.app/ The thing is, it only supports windows xp + windows 7, and not 8/10/11 (those are supported as arm64). Apparently the amount of work is massive (so are performance hits for the Windows XP/7 when you run it). It's one thing to emulate apps, another entirely to emulate whole advanced OS.
- samwillis 5y agoYes, I read the article and was in fact aware of UTM, also noted: > the performance penalty is significant I was asking the genuine question as to if it would be theoretically possible to use Rosetta as part of the emulation for a VM to potentially help it to perform better? For example could a tool be installed within a guest OS that effectively send binaries to Rosetta for translation before execution? It just seems to me that if Apple have done such an incredible job with Rosetta wouldn’t it be brilliant if it was possible to use that within an emulated VM on Apple silicone.
- olliej 5y agoNo rosetta doesn't do system level emulation. System vs app level are distinctly different problems. Att the app level rosetta can operate at link time (yes it does AoT, but that's essentially just caching), where it knows things like what things are text regions, what the entry points are, it can assume that the code is "correct" (if your code is buggy natively, then rosetta won't stop it going wrong), etc. System level emulation means rosetta (or whatever) loses that transparency, so can't precompile, and can't make any assumptions about code behaving properly. To get an idea of what the performance impact is you should check the performance of JIT compiled code under rosetta. Rosetta ensures that the JIT will work, but the perf hit is staggering. System level emulation basically means treating everything as being JIT code. I'm sure a system level emulator (Qemu?) could do better than for example just slapping a system emulator mode into rosetta, but that would be because rosetta is optimized for app level emulation.
- wmf 5y agoRosetta is deliberately just enough to run macOS/Intel apps on macOS/ARM. It's theoretically possible for Apple to enhance Rosetta to emulate a whole VM instead of a process but they don't feel they need that so they're not going to.
- ec109685 5y agoIf Apple can do it, will VMWare / Parallels eventually be able to achieve similar levels of performance or is there something physically stopping it from emulating a whole OS's required processor features?
- deleted 5y ago[deleted]
- saagarjha 5y agoNo, Rosetta is private and not exposed to third party applications, and not really appropriate for supporting a VM because it is designed for apps running in userspace.
- samwillis 5y agoAre there any architectural lessons that could be learnt from Rosetta and applied to QEMU? So for example the “precompiling” of a binary, would that be possible with a VM?
- saagarjha 5y agoIt’s not impossible, but it would be significantly more difficult and limited in scope.
- haberman 5y agoWhat about the hardware support for total store order that Rosetta uses to provide the x86 concurrency model? Is that something third-party implementations could conceivably use? As long as that is available, it seems like third-party virtualization software could get similar performance to Rosetta, and potentially experiment with attempting to support system-level CPU emulation.
- saagarjha 5y agoTSO is only enabled for processes using Rosetta, so if you want to use it you’ll either need to hijack an existing process or expose it via a kext that patches in the appropriate flags. TSO is also only one of the puzzle pieces for why Rosetta is fast: you’ll also have to figure out how to avoid a software MMU if you want similar performance. This is difficult for whole-system emulation.