RustInQemu/2022: Difference between revisions

From QEMU
(Created page with "Notes about possibilities for including Rust code in the Qemu project. Started after discussion at the [https://etherpad.opendev.org/p/KVMForum2021-QEMU+Rust-BoF Rust in Qemu...")
 
m (Add Category)
 
(25 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Notes about possibilities for including Rust code in the Qemu project.  Started after discussion at the [https://etherpad.opendev.org/p/KVMForum2021-QEMU+Rust-BoF Rust in Qemu BoF] at KVM Forum 2021.
Notes about possibilities for including Rust code in the Qemu project.  Started after discussion at the [https://etherpad.opendev.org/p/KVMForum2021-QEMU+Rust-BoF Rust in Qemu BoF] at KVM Forum 2021.


== Rust vs. Qemu platform support ==
== Rust target support for Qemu host platforms ==


Information sources:
Information sources:
* Information on support qemu host platforms comes from [https://qemu-project.gitlab.io/qemu/about/build-platforms.html here]
* [https://qemu-project.gitlab.io/qemu/about/build-platforms.html Qemu supported platforms matrix]
* Information on supported Rust targets comes from [https://doc.rust-lang.org/nightly/rustc/platform-support.html here]
* [https://doc.rust-lang.org/nightly/rustc/platform-support.html Rust target support tiers]
* Supported architectures for:
** [https://www.freebsd.org/platforms/ FreeBSD]
** [https://www.netbsd.org/ports/ NetBSD]
** [https://www.openbsd.org/plat.html OpenBSD]
* ([https://github.com/Rust-for-Linux/linux/blob/rust/Documentation/rust/arch-support.rst Rust-for-Linux support], which gathers similar informations for Linux)


=== Rust target support for Qemu host platforms ===
[https://lists.gnu.org/archive/html/qemu-devel/2021-09/msg04589.html QEMU discussion thread]


Analysis of whether Rust can generate code for the various host platforms which Qemu supports.
[https://www.reddit.com/r/rust/comments/ppya5y/rust_in_qemu_host_support_matrix/ Reddit post]
 
'''Notes:'''
* Some of the N/A entries I'm uncertain about
** I think NetBSD lacks mips64 support, but I don't entirely know how to interpret the way they describe CPU architecture support, so again, I'm uncertain.
** I don't believe macOS or Windows have ARM32 support, but I'm not sure where to confirm that
** It's not clear to me if qemu supports 32-bit RISC-V as a built platform
* In the colouring, I've considered Tier3* as "better than" Tier2.  This is debatable, but the rationale is that if we don't have host tools, that's not really sufficient for a supported qemu build platform.
* I've not investigated support on Solaris or other Unix variants.  Those aren't mentioned [https://qemu-project.gitlab.io/qemu/about/build-platforms.html here], but I'm not really sure if there are some users of qemu on those platforms.
* Rust doesn't support 32-bit x86 on macOS, but macOS itself dropped 32-bit starting with Catalina, and QEMU doesn't support any older macOS versions than that. So it's N/A for us.
 
{| class="wikitable"
|+ Legend
|-
! style="color:white;background-color:green" | Tier1*
| Rust [https://doc.rust-lang.org/nightly/rustc/platform-support.html#tier-1-with-host-tools Tier 1 with Host Tools] supported target.
|-
! style="background-color:lightgreen" | Tier2*
| Rust [https://doc.rust-lang.org/nightly/rustc/platform-support.html#tier-2-with-host-tools Tier 2 with Host Tools] supported target
|-
! style="background-color:yellow" | Tier3*
| Rust [https://doc.rust-lang.org/nightly/rustc/platform-support.html#tier-3 Tier 3] target, ''with full standard library, and host tool build support''
|-
! style="background-color:orange" | Tier2
| Rust [https://doc.rust-lang.org/nightly/rustc/platform-support.html#tier-2 Tier 2] target ''without'' host tools, but with full standard library.
|-
! style="background-color:red" | Tier3
| Rust [https://doc.rust-lang.org/nightly/rustc/platform-support.html#tier-3 Tier 3] target, but lacks either full standard library or host tool build support.
|-
! style="background-color:red" | -
| Rust does not have support for this target
|-
! style="background-color:grey" | N/A
| OS doesn't support this architecture
|}
 
 
{| class="wikitable" style="text-align:center"
|-
|
! Linux
! macOS
! Windows
! FreeBSD
! NetBSD
! OpenBSD
|-
! armv6
| style="background-color:lightgreen" | Tier2*
| style="background-color:grey" | N/A?
| style="background-color:grey" | N/A?
| style="background-color:yellow" | Tier3*
| style="background-color:yellow" | Tier3*
| style="background-color:grey" | N/A
|-
! armv7
| style="background-color:lightgreen" | Tier2*
| style="background-color:grey" | N/A?
| style="background-color:grey" | N/A?
| style="background-color:yellow" | Tier3*
| style="background-color:yellow" | Tier3*
| style="background-color:red" | -
|-
! aarch64
| style="color:white;background-color:green" | Tier1*
| style="background-color:lightgreen" | Tier2*
| style="background-color:lightgreen" | Tier2*
| style="background-color:yellow" | Tier3*
| style="background-color:yellow" | Tier3*
| style="background-color:yellow" | Tier3*
|-
! MIPS (32-bit)
| style="background-color:lightgreen" | Tier2*
| style="background-color:grey" | N/A
| style="background-color:grey" | N/A
| style="background-color:red" | -
| style="background-color:red" | -
| style="background-color:grey" | N/A
|-
! MIPS (64-bit)
| style="background-color:lightgreen" | Tier2*
| style="background-color:grey" | N/A
| style="background-color:grey" | N/A
| style="background-color:red" | -
| style="background-color:grey" | N/A?
| style="background-color:red" | -
|-
! PPC (32-bit)
| style="background-color:lightgreen" | Tier2*
| style="background-color:grey" | N/A
| style="background-color:grey" | N/A
| style="background-color:red" | -
| style="background-color:lightgreen" | Tier2*
| style="background-color:red" | Tier3
|-
! PPC (64-bit)
| style="background-color:lightgreen" | Tier2*
| style="background-color:grey" | N/A
| style="background-color:grey" | N/A
| style="background-color:yellow" | Tier3*
| style="background-color:grey" | N/A?
| style="background-color:grey" | N/A
|-
! RISC-V (64-bit)
| style="background-color:lightgreen" | Tier2*
| style="background-color:grey" | N/A
| style="background-color:grey" | N/A
| style="background-color:red" | -
| style="background-color:grey" | N/A
| style="background-color:grey" | N/A
|-
! s390x
| style="background-color:lightgreen" | Tier2*
| style="background-color:grey" | N/A
| style="background-color:grey" | N/A
| style="background-color:grey" | N/A
| style="background-color:grey" | N/A
| style="background-color:grey" | N/A
|-
! SPARC (32-bit)
| style="background-color:red" | Tier3
| style="background-color:grey" | N/A
| style="background-color:grey" | N/A
| style="background-color:grey" | N/A
| style="background-color:red" | -
| style="background-color:grey" | N/A
|-
! SPARC (64-bit)
| style="background-color:orange" | Tier2
| style="background-color:grey" | N/A
| style="background-color:grey" | N/A
| style="background-color:grey" | N/A
| style="background-color:yellow" | Tier3*
| style="background-color:red" | Tier3
|-
! x86 (32-bit)
| style="color:white;background-color:green" | Tier1*
| style="background-color:grey" | N/A
| style="color:white;background-color:green" | Tier1*
| style="background-color:orange" | Tier2
| style="background-color:yellow" | Tier3*
| style="background-color:yellow" | Tier3*
|-
! x86 (64-bit)
| style="color:white;background-color:green" | Tier1*
| style="color:white;background-color:green" | Tier1*
| style="color:white;background-color:green" | Tier1*
| style="background-color:lightgreen" | Tier2*
| style="background-color:lightgreen" | Tier2*
| style="background-color:yellow" | Tier3*
|}
 
== Rust toolchain availability for Qemu host platforms ==
 
Notes:
* [https://qemu-project.gitlab.io/qemu/about/build-platforms.html Qemu build platforms / distros]
* Package availability information from [https://repology.org/ Repology]
** When relevant updates are included, not just the distro as released
* Not sure what, if anything, should count as "packaged" for Windows
* Not sure how to test how easy/effective it is to use Rustup to get a toolchain on various platforms
* Suitable version is currently considered Rust 1.31.0 or later
** This version is chosen since it's the first with Rust 2018 edition support, which we almost certainly want
** There may well be important features since then that we want, but I don't yet know what they are
 
{| class="wikitable"
|+ Legend (Packaged column)
|-
! style="color:white;background-color:green" | <version>
| OS/distro has a prebuilt packages including rustc and cargo, version 1.31.0 or later
|-
! style="background-color:yellow" | <version>
| OS/distro has a prebuilt package, earlier than version 1.31.0
|-
! style="background-color:gray" | N/A
| No standard packaging for this OS
|}
 
{| class="wikitable"
|+ Legend (Rustup column)
|-
! style="background-color:green" | Tier1
| Rustup is expected to work on this platform.  This means that the platform is in Rust's Tier1 with host tools list for at least one architecture, and has sufficiently recent kernel and libc versions to support it. (These criteria suggested by Peter Maydell)
|-
! style="background-color:lightgreen" | Tier2
| Rustup is expected to work on this platform.  This means that the platform is in Rust's Tier2 with host tools list for at least one architecture, and the distro has sufficiently recent kernel and libc versions packaged. (These criteria suggested by Peter Maydell)
|-
! style="background-color:yellow" | Tier3
| Rustup might on this platform.  This means that the platform is in Rust's Tier3 list with host tools list for at least one architecture, and the distro has sufficiently recent kernel and libc versions packaged.
|-
! style="background-color:orange" | Tier1-
| Rustup might work on this platform with some work.  It's on the tier 1, 2 or 3 list with host tools support, but the distro does not have the necessary kernel and/or libc packaged.
|-
! Unknown
| Rust toolchain availability unknown
|}
 
 
{| class="wikitable" style="text-align:center"
|-
! OS/distro
! Packaged
! Rustup
|-
! Linux, CentOS 8 & RHEL 8
| style="color:white;background-color:green" | 1.52.1
| style="background-color:green" | Tier1
|-
! Linux, Debian 9
| style="color:white;background-color:green" | 1.34.2
| style="background-color:green" | Tier1
|-
! Linux, Debian 10
| style="color:white;background-color:green" | 1.41.1
| style="background-color:green" | Tier1
|-
! Linux, Debian 11
| style="color:white;background-color:green" | 1.48.0
| style="background-color:green" | Tier1
|-
! Linux, Debian 12
| style="color:white;background-color:green" | 1.50.0
| style="background-color:green" | Tier1
|-
! Linux, Fedora 33
| style="color:white;background-color:green" | 1.55.0
| style="background-color:green" | Tier1
|-
! Linux, Fedora 34
| style="color:white;background-color:green" | 1.55.0
| style="background-color:green" | Tier1
|-
! Linux, openSUSE Leap 42.3
| style="background-color:yellow" | 1.24.0
| style="background-color:green" | Tier1
|-
! Linux, openSUSE Leap 15.3 & SLES 15.3
| style="color:white;background-color:green" | 1.43.1
| style="background-color:green" | Tier1
|-
! Linux, openSUSE Tumbleweed
| style="color:white;background-color:green" | 1.54.0
| style="background-color:green" | Tier1
|-
! Linux, Ubuntu LTS 14.04
| style="color:white;background-color:green" | 1.31.0
| style="background-color:orange" | Tier1-
|-
! Linux, Ubuntu LTS 16.04
| style="color:white;background-color:green" | 1.47.0
| style="background-color:green" | Tier1
|-
! Linux, Ubuntu LTS 18.04
| style="color:white;background-color:green" | 1.51.0
| style="background-color:green" | Tier1
|-
! Linux, Ubuntu LTS 20.04
| style="color:white;background-color:green" | 1.51.0
| style="background-color:green" | Tier1
|-
! FreeBSD, ports
| style="color:white;background-color:green" | 1.55.0
| style="background-color:lightgreen" | Tier2
|-
! NetBSD, pkgsrc
| style="color:white;background-color:green" | 1.54.0
| style="background-color:lightgreen" | Tier2
|-
! OpenBSD, ports
| style="color:white;background-color:green" | 1.55.0
| style="background-color:yellow" | Tier3
|-
! MacOS, HomeBrew
| style="color:white;background-color:green" | 1.55.0
| style="background-color:green" | Tier1
|-
! Windows, ???
| style="background-color:gray" | N/A
| style="background-color:green" | Tier1
|}
 
[[Category:RustInQemu]]

Latest revision as of 10:04, 10 June 2024

Notes about possibilities for including Rust code in the Qemu project. Started after discussion at the Rust in Qemu BoF at KVM Forum 2021.

Rust target support for Qemu host platforms

Information sources:

QEMU discussion thread

Reddit post

Notes:

  • Some of the N/A entries I'm uncertain about
    • I think NetBSD lacks mips64 support, but I don't entirely know how to interpret the way they describe CPU architecture support, so again, I'm uncertain.
    • I don't believe macOS or Windows have ARM32 support, but I'm not sure where to confirm that
    • It's not clear to me if qemu supports 32-bit RISC-V as a built platform
  • In the colouring, I've considered Tier3* as "better than" Tier2. This is debatable, but the rationale is that if we don't have host tools, that's not really sufficient for a supported qemu build platform.
  • I've not investigated support on Solaris or other Unix variants. Those aren't mentioned here, but I'm not really sure if there are some users of qemu on those platforms.
  • Rust doesn't support 32-bit x86 on macOS, but macOS itself dropped 32-bit starting with Catalina, and QEMU doesn't support any older macOS versions than that. So it's N/A for us.
Legend
Tier1* Rust Tier 1 with Host Tools supported target.
Tier2* Rust Tier 2 with Host Tools supported target
Tier3* Rust Tier 3 target, with full standard library, and host tool build support
Tier2 Rust Tier 2 target without host tools, but with full standard library.
Tier3 Rust Tier 3 target, but lacks either full standard library or host tool build support.
- Rust does not have support for this target
N/A OS doesn't support this architecture


Linux macOS Windows FreeBSD NetBSD OpenBSD
armv6 Tier2* N/A? N/A? Tier3* Tier3* N/A
armv7 Tier2* N/A? N/A? Tier3* Tier3* -
aarch64 Tier1* Tier2* Tier2* Tier3* Tier3* Tier3*
MIPS (32-bit) Tier2* N/A N/A - - N/A
MIPS (64-bit) Tier2* N/A N/A - N/A? -
PPC (32-bit) Tier2* N/A N/A - Tier2* Tier3
PPC (64-bit) Tier2* N/A N/A Tier3* N/A? N/A
RISC-V (64-bit) Tier2* N/A N/A - N/A N/A
s390x Tier2* N/A N/A N/A N/A N/A
SPARC (32-bit) Tier3 N/A N/A N/A - N/A
SPARC (64-bit) Tier2 N/A N/A N/A Tier3* Tier3
x86 (32-bit) Tier1* N/A Tier1* Tier2 Tier3* Tier3*
x86 (64-bit) Tier1* Tier1* Tier1* Tier2* Tier2* Tier3*

Rust toolchain availability for Qemu host platforms

Notes:

  • Qemu build platforms / distros
  • Package availability information from Repology
    • When relevant updates are included, not just the distro as released
  • Not sure what, if anything, should count as "packaged" for Windows
  • Not sure how to test how easy/effective it is to use Rustup to get a toolchain on various platforms
  • Suitable version is currently considered Rust 1.31.0 or later
    • This version is chosen since it's the first with Rust 2018 edition support, which we almost certainly want
    • There may well be important features since then that we want, but I don't yet know what they are
Legend (Packaged column)
<version> OS/distro has a prebuilt packages including rustc and cargo, version 1.31.0 or later
<version> OS/distro has a prebuilt package, earlier than version 1.31.0
N/A No standard packaging for this OS
Legend (Rustup column)
Tier1 Rustup is expected to work on this platform. This means that the platform is in Rust's Tier1 with host tools list for at least one architecture, and has sufficiently recent kernel and libc versions to support it. (These criteria suggested by Peter Maydell)
Tier2 Rustup is expected to work on this platform. This means that the platform is in Rust's Tier2 with host tools list for at least one architecture, and the distro has sufficiently recent kernel and libc versions packaged. (These criteria suggested by Peter Maydell)
Tier3 Rustup might on this platform. This means that the platform is in Rust's Tier3 list with host tools list for at least one architecture, and the distro has sufficiently recent kernel and libc versions packaged.
Tier1- Rustup might work on this platform with some work. It's on the tier 1, 2 or 3 list with host tools support, but the distro does not have the necessary kernel and/or libc packaged.
Unknown Rust toolchain availability unknown


OS/distro Packaged Rustup
Linux, CentOS 8 & RHEL 8 1.52.1 Tier1
Linux, Debian 9 1.34.2 Tier1
Linux, Debian 10 1.41.1 Tier1
Linux, Debian 11 1.48.0 Tier1
Linux, Debian 12 1.50.0 Tier1
Linux, Fedora 33 1.55.0 Tier1
Linux, Fedora 34 1.55.0 Tier1
Linux, openSUSE Leap 42.3 1.24.0 Tier1
Linux, openSUSE Leap 15.3 & SLES 15.3 1.43.1 Tier1
Linux, openSUSE Tumbleweed 1.54.0 Tier1
Linux, Ubuntu LTS 14.04 1.31.0 Tier1-
Linux, Ubuntu LTS 16.04 1.47.0 Tier1
Linux, Ubuntu LTS 18.04 1.51.0 Tier1
Linux, Ubuntu LTS 20.04 1.51.0 Tier1
FreeBSD, ports 1.55.0 Tier2
NetBSD, pkgsrc 1.54.0 Tier2
OpenBSD, ports 1.55.0 Tier3
MacOS, HomeBrew 1.55.0 Tier1
Windows, ??? N/A Tier1