(→Scope) |
(adding tracker bug) |
||
(24 intermediate revisions by 3 users not shown) | |||
Line 3: | Line 3: | ||
= Integrate FEX in Fedora Linux = | = Integrate FEX in Fedora Linux = | ||
== Summary == | == Summary == | ||
<!-- A sentence or two summarizing what this change is and what it will do. This information is used for the overall changeset summary page for each release. Note that motivation for the change should be in the Benefit to Fedora section below, and this part should answer the question "What?" rather than "Why?". --> | <!-- A sentence or two summarizing what this change is and what it will do. This information is used for the overall changeset summary page for each release. Note that motivation for the change should be in the Benefit to Fedora section below, and this part should answer the question "What?" rather than "Why?". --> | ||
[https://fex-emu.com/ FEX] is a fast emulator that allows one to run x86 and x86-64 binaries on an AArch64 Linux host. FEX requires a number of supporting components, including a RootFS image, and integration with | [https://fex-emu.com/ FEX] is a fast emulator that allows one to run x86 and x86-64 binaries on an AArch64 Linux host. FEX requires a number of supporting components, including a RootFS image, and integration with muvm to support 16k page-size hosts. The purpose of this Change is to integrate FEX itself and its supporting components into Fedora Linux, to provide a delightful out-of-box experience for users that want to run x86 and x86-64 binaries on their aarch64 systems. This also includes integration into the AArch64 Fedora KDE spin as a non-blocking component of the spin. | ||
== Owner == | == Owner == | ||
Line 16: | Line 15: | ||
--> | --> | ||
* Name: [[User:dcavalca|Davide Cavalca]], [[User:ngompa|Neal Gompa]], [[User:alyssa|Alyssa Rosenzweig]] | * Name: [[User:dcavalca|Davide Cavalca]], [[User:ngompa|Neal Gompa]], [[User:alyssa|Alyssa Rosenzweig]] | ||
* | * Responsible Teams: [[SIGs/Asahi|Asahi SIG]], [[SIGs/KDE|KDE SIG]] | ||
<!-- Include you email address that you can be reached should people want to contact you about helping with your change, status is requested, or technical issues need to be resolved. If the change proposal is owned by a SIG, please also add a primary contact person. --> | <!-- Include you email address that you can be reached should people want to contact you about helping with your change, status is requested, or technical issues need to be resolved. If the change proposal is owned by a SIG, please also add a primary contact person. --> | ||
* Email: | * Email: davide(at)cavalca.name, ngompa13(at)gmail.com, alyssa(at)rosenzweig.io | ||
<!--- UNCOMMENT only for Changes with assigned Shepherd (by FESCo) | <!--- UNCOMMENT only for Changes with assigned Shepherd (by FESCo) | ||
* FESCo shepherd: [[User:FASAccountName| Shehperd name]] <email address> | * FESCo shepherd: [[User:FASAccountName| Shehperd name]] <email address> | ||
--> | --> | ||
== Current status == | == Current status == | ||
[[Category: | [[Category:ChangeAcceptedF42]] | ||
<!-- When your change proposal page is completed and ready for review and announcement --> | <!-- When your change proposal page is completed and ready for review and announcement --> | ||
<!-- remove Category:ChangePageIncomplete and change it to Category:ChangeReadyForWrangler --> | <!-- remove Category:ChangePageIncomplete and change it to Category:ChangeReadyForWrangler --> | ||
Line 43: | Line 41: | ||
ON_QA -> change is fully code complete | ON_QA -> change is fully code complete | ||
--> | --> | ||
* [ | * [https://lists.fedoraproject.org/archives/list/devel-announce@lists.fedoraproject.org/thread/ZW6K7WKFNPZ4KY4RIAZKGKZOOYOUMHOQ/ Announced] | ||
* FESCo issue: | * [https://discussion.fedoraproject.org/t/f42-change-proposal-integrate-fex-in-fedora-linux-self-contained/131147 Discussion thread] | ||
* Tracker bug: | * FESCo issue: [https://pagure.io/fesco/issue/3273 #3273] | ||
* Tracker bug: [https://bugzilla.redhat.com/show_bug.cgi?id=2318566 #2318566] | |||
* Release notes tracker: <will be assigned by the Wrangler> | * Release notes tracker: <will be assigned by the Wrangler> | ||
Line 51: | Line 50: | ||
<!-- Expand on the summary, if appropriate. A couple sentences suffices to explain the goal, but the more details you can provide the better. --> | <!-- Expand on the summary, if appropriate. A couple sentences suffices to explain the goal, but the more details you can provide the better. --> | ||
When running Fedora Linux on an AArch64 host, one can normally only run AArch64 binaries. This can be a problem if the user needs to run preexisting software that was built for x86 or x86-64, which is still the predominant architecture. If the software is opensource it can sometimes be recompiled (or, even better, packaged in Fedora), but this isn't always an option and could require significant work on the user's part. For proprietary software, there is no viable option short of persuading the author to release a native AArch64 build. | |||
FEX allows the user to sidestep this issue entirely by making it possible to run x86 and x86-64 binares on AArch64 Linux hosts, as if they were native. FEX achieves this via emulation, and it integrates with the binfmts infrastructure to provide a seamless experience. To ensure wide compatibility, FEX is also able to leverage a distribution-shipped root filesystem tree (RootFS) to provide core system libraries that the emulated binaries might need. | |||
FEX only supports AArch64 host systems running a 4k page-size kernel. This is the default in Fedora Linux, but it presents a problem for [https://fedora-asahi-remix.org/ Fedora Asahi Remix], as Apple Silicon Macs use a 16k page-size. To address this, we will leverage [https://github.com/AsahiLinux/muvm muvm] (formerly krun) to run FEX inside a microVM with a 4k page-size kernel, thus providing a compatible environment with minimal overhead. | |||
== Feedback == | == Feedback == | ||
<!-- Summarize the feedback from the community and address why you chose not to accept proposed alternatives. This section is optional for all change proposals but is strongly suggested. Incorporating feedback here as it is raised gives FESCo a clearer view of your proposal and leaves a good record for the future. If you get no feedback, that is useful to note in this section as well. For innovative or possibly controversial ideas, consider collecting feedback before you file the change proposal. --> | <!-- Summarize the feedback from the community and address why you chose not to accept proposed alternatives. This section is optional for all change proposals but is strongly suggested. Incorporating feedback here as it is raised gives FESCo a clearer view of your proposal and leaves a good record for the future. If you get no feedback, that is useful to note in this section as well. For innovative or possibly controversial ideas, consider collecting feedback before you file the change proposal. --> | ||
( | === What's the difference between FEX, QEMU and box64 ? Why should a user prefer one vs the other? === | ||
QEMU, FEX and box64 are all user-mode emulators that allow one to run foreign arch binaries. Additionally, QEMU also provides a system emulator, that allows one to run a whole OS in a virtual machine -- that's out of scope for the context of this Change, which is only concerned with user-mode emulation of binaries. | |||
The main difference mostly boils down to architecture support and accuracy vs performance tradeoffs. | |||
QEMU, box64 and FEX all support x86_64 on aarch64; FEX and QEMU also support x86 on aarch64, box64 does not (this matters because, for example, Steam requires both x86 and x86_64). QEMU and box64 also support additional architectures that are out of scope for this Change. | |||
FEX only supports systems running 4k page-size kernels, and this is why we plan to leverage muvm to support FEX on other page-size kernels. box64 implements hacks to support a limited subset of x86_64 apps on a 16k page-size kernel; this is not a general solution, and is specifically broken with e.g. wine. QEMU does not care about the page-size and works the same regardless. | |||
Performance is similar between box64 and FEX, and both are steadily improving. QEMU is the best implementation for correctness, but it's extremely slow in comparison, making it unsuitable for a lot of practical usecases (such as gaming). | |||
The Change owners are actively involved with FEX development upstream and are focusing on making it faster. Given this, we believe that FEX will provide the best out-of-the-box experience for most users. | |||
=== How does FEX interact with binfmts when there's other things also setting up binfmts for the same stuff (say, QEMU); also how will this work with muvm? === | |||
The implementation details are still being defined here, but in general we expect that we'll want muvm to take precedence over bare FEX on non-4k page-size systems, and FEX to take precedence over QEMU. We are considering deploying a shim for the binfmt handler to allow for smarter handling of this (e.g. to dynamically choose whether to use muvm). | |||
=== Should we have a virtual Provides: binfmt($target) to make it easier to depend on an emulator instead of a specific implementation? === | |||
We believe this is out of scope for this Change. | |||
=== Will this work with x86 and x86_64 flatpak too? === | |||
Not yet. This planned, but it requires non-trivial technical work. In the interest of keeping things focused, we're going to consider it out of scope for the initial implementation, and might revisit it down the road depending within the timeframe of this Change. | |||
=== Will this work with just x86_64 or x86 as well? === | |||
Yes, as mentioned above we want to support both x86_64 (i.e. 64-bit) and x86 (i.e. 32-bit) binaries. This is one of the reasons why we're targeting FEX instead of box64. | |||
=== Which platforms are we targeting for muvm? === | |||
muvm is primarily meant for Fedora Asahi Remix, which runs on Apple Silicon Macs using a 16k page-size kernel, and that's the target we're going to develop and test against. That said, it should work for other any non-4k page-size systems (say, aarch64 boxes running a 64k page-size kernel) as well. | |||
== Benefit to Fedora == | == Benefit to Fedora == | ||
Line 99: | Line 124: | ||
== Scope == | == Scope == | ||
* Proposal owners: | * Proposal owners: | ||
** DONE: | ** DONE: Package [https://github.com/FEX-Emu/FEX FEX] in Fedora Linux - https://src.fedoraproject.org/rpms/fex-emu | ||
** | ** DONE: Create a [https://pagure.io/fedora-kiwi-descriptions/ Kiwi definition] to produce a FEX root filesystem - https://pagure.io/fedora-kiwi-descriptions/pull-request/83 | ||
** DONE: Add the FEX root filesystem to the compose - https://pagure.io/pungi-fedora/pull-request/1381 | |||
** DONE: Package the root filesystem in Fedora Linux as an RPM - https://src.fedoraproject.org/rpms/fex-emu-rootfs-fedora | |||
** DONE: Package [https://chromium.googlesource.com/chromiumos/platform2/+/HEAD/vm_tools/sommelier/ sommelier] -- https://src.fedoraproject.org/rpms/chromiumos-platform | |||
** DONE: Package [https://github.com/AsahiLinux/muvm muvm] - https://src.fedoraproject.org/rpms/rust-muvm | |||
** DONE: Package [https://github.com/AsahiLinux/hidpipe hidpipe] - https://src.fedoraproject.org/rpms/rust-hidpipe | |||
** DONE: Enable hidpipe socket by default: https://bugzilla.redhat.com/show_bug.cgi?id=2317288 https://src.fedoraproject.org/rpms/fedora-release/pull-request/345 | |||
** TODO: Integrate FEX with muvm to support 16k page-size systems | |||
** TODO: Create a comps group for FEX and supporting components | |||
** TODO: Attach the comps group to the kde-desktop-environment group | |||
** TODO: Create a [https://pagure.io/fedora-kiwi-descriptions/ Kiwi definition] to produce a sysroot image to be used by FEX at build time to enable thunks | |||
** TODO: Write documentation | |||
<!-- What work do the feature owners have to accomplish to complete the feature in time for release? Is it a large change affecting many parts of the distribution or is it a very isolated change? What are those changes?--> | <!-- What work do the feature owners have to accomplish to complete the feature in time for release? Is it a large change affecting many parts of the distribution or is it a very isolated change? What are those changes?--> | ||
* Other developers: | * Other developers: assist with package reviews and provide feedback <!-- REQUIRED FOR SYSTEM WIDE CHANGES --> | ||
<!-- What work do other developers have to accomplish to complete the feature in time for release? Is it a large change affecting many parts of the distribution or is it a very isolated change? What are those changes?--> | <!-- What work do other developers have to accomplish to complete the feature in time for release? Is it a large change affecting many parts of the distribution or is it a very isolated change? What are those changes?--> | ||
* Release engineering: [https://pagure.io/releng/ | * Release engineering: [https://pagure.io/releng/issue/12299 #12299] <!-- REQUIRED FOR SYSTEM WIDE CHANGES --> | ||
<!-- Does this feature require coordination with release engineering (e.g. changes to installer image generation or update package delivery)? Is a mass rebuild required? include a link to the releng issue. | <!-- Does this feature require coordination with release engineering (e.g. changes to installer image generation or update package delivery)? Is a mass rebuild required? include a link to the releng issue. | ||
The issue is required to be filed prior to feature submission, to ensure that someone is on board to do any process development work and testing and that all changes make it into the pipeline; a bullet point in a change is not sufficient communication --> | The issue is required to be filed prior to feature submission, to ensure that someone is on board to do any process development work and testing and that all changes make it into the pipeline; a bullet point in a change is not sufficient communication --> | ||
Line 143: | Line 179: | ||
<!-- REQUIRED FOR SYSTEM WIDE CHANGES --> | <!-- REQUIRED FOR SYSTEM WIDE CHANGES --> | ||
Once the relevant components have been packaged and the comps group has been created, this Change will be testable with: | |||
# dnf install @fex-x86-emulation | # dnf install @fex-x86-emulation | ||
Line 159: | Line 197: | ||
- Green has been scientifically proven to be the most relaxing color. The move to a default background color of green with green text will result in Fedora users being the most relaxed users of any operating system. | - Green has been scientifically proven to be the most relaxing color. The move to a default background color of green with green text will result in Fedora users being the most relaxed users of any operating system. | ||
--> | --> | ||
Users will be able to run x86 and x86-64 binaries out of the box when running Fedora Linux on their Aarch64 systems. | |||
== Dependencies == | == Dependencies == | ||
Line 165: | Line 205: | ||
<!-- REQUIRED FOR SYSTEM WIDE CHANGES --> | <!-- REQUIRED FOR SYSTEM WIDE CHANGES --> | ||
This is pretty much self contained. | |||
== Contingency Plan == | == Contingency Plan == |
Latest revision as of 16:39, 14 October 2024
Integrate FEX in Fedora Linux
Summary
FEX is a fast emulator that allows one to run x86 and x86-64 binaries on an AArch64 Linux host. FEX requires a number of supporting components, including a RootFS image, and integration with muvm to support 16k page-size hosts. The purpose of this Change is to integrate FEX itself and its supporting components into Fedora Linux, to provide a delightful out-of-box experience for users that want to run x86 and x86-64 binaries on their aarch64 systems. This also includes integration into the AArch64 Fedora KDE spin as a non-blocking component of the spin.
Owner
- Name: Davide Cavalca, Neal Gompa, Alyssa Rosenzweig
- Responsible Teams: Asahi SIG, KDE SIG
- Email: davide(at)cavalca.name, ngompa13(at)gmail.com, alyssa(at)rosenzweig.io
Current status
- Targeted release: Fedora Linux 42
- Last updated: 2024-10-14
- Announced
- Discussion thread
- FESCo issue: #3273
- Tracker bug: #2318566
- Release notes tracker: <will be assigned by the Wrangler>
Detailed Description
When running Fedora Linux on an AArch64 host, one can normally only run AArch64 binaries. This can be a problem if the user needs to run preexisting software that was built for x86 or x86-64, which is still the predominant architecture. If the software is opensource it can sometimes be recompiled (or, even better, packaged in Fedora), but this isn't always an option and could require significant work on the user's part. For proprietary software, there is no viable option short of persuading the author to release a native AArch64 build.
FEX allows the user to sidestep this issue entirely by making it possible to run x86 and x86-64 binares on AArch64 Linux hosts, as if they were native. FEX achieves this via emulation, and it integrates with the binfmts infrastructure to provide a seamless experience. To ensure wide compatibility, FEX is also able to leverage a distribution-shipped root filesystem tree (RootFS) to provide core system libraries that the emulated binaries might need.
FEX only supports AArch64 host systems running a 4k page-size kernel. This is the default in Fedora Linux, but it presents a problem for Fedora Asahi Remix, as Apple Silicon Macs use a 16k page-size. To address this, we will leverage muvm (formerly krun) to run FEX inside a microVM with a 4k page-size kernel, thus providing a compatible environment with minimal overhead.
Feedback
What's the difference between FEX, QEMU and box64 ? Why should a user prefer one vs the other?
QEMU, FEX and box64 are all user-mode emulators that allow one to run foreign arch binaries. Additionally, QEMU also provides a system emulator, that allows one to run a whole OS in a virtual machine -- that's out of scope for the context of this Change, which is only concerned with user-mode emulation of binaries.
The main difference mostly boils down to architecture support and accuracy vs performance tradeoffs.
QEMU, box64 and FEX all support x86_64 on aarch64; FEX and QEMU also support x86 on aarch64, box64 does not (this matters because, for example, Steam requires both x86 and x86_64). QEMU and box64 also support additional architectures that are out of scope for this Change.
FEX only supports systems running 4k page-size kernels, and this is why we plan to leverage muvm to support FEX on other page-size kernels. box64 implements hacks to support a limited subset of x86_64 apps on a 16k page-size kernel; this is not a general solution, and is specifically broken with e.g. wine. QEMU does not care about the page-size and works the same regardless.
Performance is similar between box64 and FEX, and both are steadily improving. QEMU is the best implementation for correctness, but it's extremely slow in comparison, making it unsuitable for a lot of practical usecases (such as gaming).
The Change owners are actively involved with FEX development upstream and are focusing on making it faster. Given this, we believe that FEX will provide the best out-of-the-box experience for most users.
How does FEX interact with binfmts when there's other things also setting up binfmts for the same stuff (say, QEMU); also how will this work with muvm?
The implementation details are still being defined here, but in general we expect that we'll want muvm to take precedence over bare FEX on non-4k page-size systems, and FEX to take precedence over QEMU. We are considering deploying a shim for the binfmt handler to allow for smarter handling of this (e.g. to dynamically choose whether to use muvm).
Should we have a virtual Provides: binfmt($target) to make it easier to depend on an emulator instead of a specific implementation?
We believe this is out of scope for this Change.
Will this work with x86 and x86_64 flatpak too?
Not yet. This planned, but it requires non-trivial technical work. In the interest of keeping things focused, we're going to consider it out of scope for the initial implementation, and might revisit it down the road depending within the timeframe of this Change.
Will this work with just x86_64 or x86 as well?
Yes, as mentioned above we want to support both x86_64 (i.e. 64-bit) and x86 (i.e. 32-bit) binaries. This is one of the reasons why we're targeting FEX instead of box64.
Which platforms are we targeting for muvm?
muvm is primarily meant for Fedora Asahi Remix, which runs on Apple Silicon Macs using a 16k page-size kernel, and that's the target we're going to develop and test against. That said, it should work for other any non-4k page-size systems (say, aarch64 boxes running a 64k page-size kernel) as well.
Benefit to Fedora
Users will be able to run x86 and x86-64 binaries out of the box when running Fedora Linux on their Aarch64 systems. This particularly improves the usability of Fedora KDE for day-to-day usage on AArch64 systems.
Scope
- Proposal owners:
- DONE: Package FEX in Fedora Linux - https://src.fedoraproject.org/rpms/fex-emu
- DONE: Create a Kiwi definition to produce a FEX root filesystem - https://pagure.io/fedora-kiwi-descriptions/pull-request/83
- DONE: Add the FEX root filesystem to the compose - https://pagure.io/pungi-fedora/pull-request/1381
- DONE: Package the root filesystem in Fedora Linux as an RPM - https://src.fedoraproject.org/rpms/fex-emu-rootfs-fedora
- DONE: Package sommelier -- https://src.fedoraproject.org/rpms/chromiumos-platform
- DONE: Package muvm - https://src.fedoraproject.org/rpms/rust-muvm
- DONE: Package hidpipe - https://src.fedoraproject.org/rpms/rust-hidpipe
- DONE: Enable hidpipe socket by default: https://bugzilla.redhat.com/show_bug.cgi?id=2317288 https://src.fedoraproject.org/rpms/fedora-release/pull-request/345
- TODO: Integrate FEX with muvm to support 16k page-size systems
- TODO: Create a comps group for FEX and supporting components
- TODO: Attach the comps group to the kde-desktop-environment group
- TODO: Create a Kiwi definition to produce a sysroot image to be used by FEX at build time to enable thunks
- TODO: Write documentation
- Other developers: assist with package reviews and provide feedback
- Release engineering: #12299
- Policies and guidelines: N/A (not needed for this Change)
- Trademark approval: N/A (not needed for this Change)
- Alignment with Community Initiatives:
Upgrade/compatibility impact
No expected upgrade or compatibility impact, this is a purely additive Change.
How To Test
Once the relevant components have been packaged and the comps group has been created, this Change will be testable with:
- dnf install @fex-x86-emulation
- ...
- profit!
User Experience
Users will be able to run x86 and x86-64 binaries out of the box when running Fedora Linux on their Aarch64 systems.
Dependencies
This is pretty much self contained.
Contingency Plan
- Contingency mechanism: (What to do? Who will do it?) Don't ship this
- Contingency deadline: N/A (not a System Wide Change)
- Blocks release? No
Documentation
The Change owners will write documentation on how to use FEX, both for general Fedora systems and in the context of Fedora Asahi Remix.