Skip to contentSkip to conversation

vhost-device: add recipes for vhost-device daemons

PATCH In review Erik Schilling 3 participants 8 messages Aug 14, 2023 – Aug 17, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 vhost-device: add recipes for vhost-device daemons

This adds recipes for the first tagged release of the vhost-device daemons of the rust-vmm project.

While the initial release was done for all daemons at the same time, the daemons all have indepentend version numbers and will be released on their own schedules in the future. Therefore, I splitted them into independent recipes.

---
These are a bunch of daemons that implement various vhost-user virtio devices. Currently, they are mostly tested with QEMU, but we are also working on Xen support (most bits are upstream already).
---
Changes in v2:
- Added README.md to explain generation of dependency .inc files
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 README.md                                          |  14 ++
 .../vhost-device/vhost-device-gpio-crates.inc      | 184 +++++++++++++++
 .../vhost-device/vhost-device-gpio_0.1.0.bb        |  20 ++
 .../vhost-device/vhost-device-i2c-crates.inc       | 126 ++++++++++
 .../vhost-device/vhost-device-i2c_0.1.0.bb         |  16 ++
 .../vhost-device/vhost-device-rng-crates.inc       | 158 +++++++++++++
 .../vhost-device/vhost-device-rng_0.1.0.bb         |  17 ++
 .../vhost-device/vhost-device-scsi-crates.inc      | 166 +++++++++++++
 .../vhost-device/vhost-device-scsi_0.1.0.bb        |  16 ++
 .../vhost-device/vhost-device-vsock-crates.inc     | 258 +++++++++++++++++++++
 .../vhost-device/vhost-device-vsock_0.1.0.bb       |  16 ++
 11 files changed, 991 insertions(+)
README.md new file +14 -0
new file mode 100644
index 0000000..dd79b48
@@ -0,0 +1,14 @@
+# vhost-device: A collection of vhost-user devices
+
+[vhost-device](https://github.com/rust-vmm/vhost-device) provides a series of
+daemons that implement the
+[vhost-user protocol](https://qemu-project.gitlab.io/qemu/interop/vhost-user.html)
+for various virtio device types.
+
+## Updating the recipes
+
+1. Bump the version number to the newly published version listed on crates.io
+2. Regenerate the .inc file that list the dependencies:
+   `bitbake -c update_crates vhost-device-<type>`
+3. Review, build and test the changes
+
recipes-extended/vhost-device/vhost-device-gpio-crates.inc new file +184 -0

184 lines not on this page · raw message

recipes-extended/vhost-device/vhost-device-gpio_0.1.0.bb new file +20 -0
new file mode 100644
index 0000000..4ef9de4
@@ -0,0 +1,20 @@
+SUMMARY = "vhost gpio backend device"
+DESCRIPTION = "A vhost-user backend that emulates a VirtIO GPIO device"
+HOMEPAGE = "https://github.com/rust-vmm/vhost-device"
+LICENSE = "Apache-2.0 | BSD-3-Clause"
+LIC_FILES_CHKSUM = "\
+    file://LICENSE-APACHE;md5=3b83ef96387f14655fc854ddc3c6bd57 \
+    file://LICENSE-BSD-3-Clause;md5=2489db1359f496fff34bd393df63947e \
+"
+DEPENDS += "libgpiod"
+# libgpiod-sys generates bindings using bindgen, which depends on clang
+DEPENDS += "clang-native"
+
+SRC_URI += "crate://crates.io/vhost-device-gpio/0.1.0"
+SRC_URI[vhost-device-gpio-0.1.0.sha256sum] = "f4789dd127ce746d4f702d50256ff09e47b19fdb2bfee88a254b7e48efbf1100"
+
+inherit cargo
+inherit cargo-update-recipe-crates
+inherit pkgconfig
+
+include vhost-device-gpio-crates.inc
recipes-extended/vhost-device/vhost-device-i2c-crates.inc new file +126 -0

126 lines not on this page · raw message

recipes-extended/vhost-device/vhost-device-i2c_0.1.0.bb new file +16 -0
new file mode 100644
index 0000000..c9179da
@@ -0,0 +1,16 @@
+SUMMARY = "vhost i2c backend device"
+DESCRIPTION = "A vhost-user backend that emulates a VirtIO I2C device"
+HOMEPAGE = "https://github.com/rust-vmm/vhost-device"
+LICENSE = "Apache-2.0 | BSD-3-Clause"
+LIC_FILES_CHKSUM = " \
+    file://LICENSE-APACHE;md5=3b83ef96387f14655fc854ddc3c6bd57 \
+    file://LICENSE-BSD-3-Clause;md5=2489db1359f496fff34bd393df63947e \
+"
+
+SRC_URI += "crate://crates.io/vhost-device-i2c/0.1.0"
+SRC_URI[vhost-device-i2c-0.1.0.sha256sum] = "a77923a4f161887ca2a19ead2d2f2271d62d1268e774265c42c277367f019a3f"
+
+inherit cargo
+inherit cargo-update-recipe-crates
+
+include vhost-device-i2c-crates.inc
recipes-extended/vhost-device/vhost-device-rng-crates.inc new file +158 -0

158 lines not on this page · raw message

recipes-extended/vhost-device/vhost-device-rng_0.1.0.bb new file +17 -0
new file mode 100644
index 0000000..6e4cf82
@@ -0,0 +1,17 @@
+SUMMARY = "vhost rng backend device"
+DESCRIPTION = "A vhost-user backend that emulates a VirtIO random number \
+    generator device"
+HOMEPAGE = "https://github.com/rust-vmm/vhost-device"
+LICENSE = "Apache-2.0 | BSD-3-Clause"
+LIC_FILES_CHKSUM = " \
+    file://LICENSE-APACHE;md5=3b83ef96387f14655fc854ddc3c6bd57 \
+    file://LICENSE-BSD-3-Clause;md5=2489db1359f496fff34bd393df63947e \
+"
+
+SRC_URI += "crate://crates.io/vhost-device-rng/0.1.0"
+SRC_URI[vhost-device-rng-0.1.0.sha256sum] = "51e0af4acaaefc19a3d6c2e2cb00caf2130d728d857494c857662781da9f1329"
+
+inherit cargo
+inherit cargo-update-recipe-crates
+
+include vhost-device-rng-crates.inc
recipes-extended/vhost-device/vhost-device-scsi-crates.inc new file +166 -0

166 lines not on this page · raw message

recipes-extended/vhost-device/vhost-device-scsi_0.1.0.bb new file +16 -0
new file mode 100644
index 0000000..6c9b49f
@@ -0,0 +1,16 @@
+SUMMARY = "vhost scsi backend device"
+DESCRIPTION = "A vhost-user backend that emulates a VirtIO SCSI block device"
+HOMEPAGE = "https://github.com/rust-vmm/vhost-device"
+LICENSE = "Apache-2.0 | BSD-3-Clause"
+LIC_FILES_CHKSUM = " \
+    file://LICENSE-APACHE;md5=3b83ef96387f14655fc854ddc3c6bd57 \
+    file://LICENSE-BSD-3-Clause;md5=2489db1359f496fff34bd393df63947e \
+"
+
+SRC_URI += "crate://crates.io/vhost-device-scsi/0.1.0"
+SRC_URI[vhost-device-scsi-0.1.0.sha256sum] = "85e4abd5a07cb6abfe07b92e49c5cc81437058d7ec7beea441039e829cf82c22"
+
+inherit cargo
+inherit cargo-update-recipe-crates
+
+include vhost-device-scsi-crates.inc
recipes-extended/vhost-device/vhost-device-vsock-crates.inc new file +258 -0

258 lines not on this page · raw message

recipes-extended/vhost-device/vhost-device-vsock_0.1.0.bb new file +16 -0
new file mode 100644
index 0000000..12ef88f
@@ -0,0 +1,16 @@
+SUMMARY = "vhost vsock backend device"
+DESCRIPTION = "A vhost-user backend that emulates a VirtIO socket device"
+HOMEPAGE = "https://github.com/rust-vmm/vhost-device"
+LICENSE = "Apache-2.0 | BSD-3-Clause"
+LIC_FILES_CHKSUM = " \
+    file://LICENSE-APACHE;md5=3b83ef96387f14655fc854ddc3c6bd57 \
+    file://LICENSE-BSD-3-Clause;md5=2489db1359f496fff34bd393df63947e \
+"
+
+SRC_URI += "crate://crates.io/vhost-device-vsock/0.1.0"
+SRC_URI[vhost-device-vsock-0.1.0.sha256sum] = "b1b22596359e46c3986574707a0f616c6e200a6751adeaa353db8cfdbc0472f6"
+
+inherit cargo
+inherit cargo-update-recipe-crates
+
+include vhost-device-vsock-crates.inc

---
base-commit: 5bb2ad0d25969f93964c7870ebafeab92271013f
change-id: 20230728-vhost-device-2dc9633034cb

Best regards,

Signature · 1 line
Erik Schilling <[email protected]>
#1 lore raw

Hi,

Quoted 30 lines · Erik Schilling

This adds recipes for the first tagged release of the vhost-device daemons of the rust-vmm project.

While the initial release was done for all daemons at the same time, the daemons all have indepentend version numbers and will be released on their own schedules in the future. Therefore, I splitted them into independent recipes.

---
These are a bunch of daemons that implement various vhost-user virtio devices. Currently, they are mostly tested with QEMU, but we are also working on Xen support (most bits are upstream already).
---
Changes in v2:
- Added README.md to explain generation of dependency .inc files
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 README.md                                          |  14 ++
 .../vhost-device/vhost-device-gpio-crates.inc      | 184 +++++++++++++++
 .../vhost-device/vhost-device-gpio_0.1.0.bb        |  20 ++
 .../vhost-device/vhost-device-i2c-crates.inc       | 126 ++++++++++
 .../vhost-device/vhost-device-i2c_0.1.0.bb         |  16 ++
 .../vhost-device/vhost-device-rng-crates.inc       | 158 +++++++++++++
 .../vhost-device/vhost-device-rng_0.1.0.bb         |  17 ++
 .../vhost-device/vhost-device-scsi-crates.inc      | 166 +++++++++++++
 .../vhost-device/vhost-device-scsi_0.1.0.bb        |  16 ++
 .../vhost-device/vhost-device-vsock-crates.inc     | 258 +++++++++++++++++++++
 .../vhost-device/vhost-device-vsock_0.1.0.bb       |  16 ++
 11 files changed, 991 insertions(+)

<snip>

recipes-extended/vhost-device/vhost-device-gpio_0.1.0.bb line 11

Quoted 13 lines

+++ b/recipes-extended/vhost-device/vhost-device-gpio_0.1.0.bb

recipes-extended/vhost-device/vhost-device-gpio_0.1.0.bb new file +11 -0
@@ -0,0 +1,20 @@
+SUMMARY = "vhost gpio backend device"
+DESCRIPTION = "A vhost-user backend that emulates a VirtIO GPIO device"
+HOMEPAGE = "https://github.com/rust-vmm/vhost-device"
+LICENSE = "Apache-2.0 | BSD-3-Clause"
+LIC_FILES_CHKSUM = "\
+    file://LICENSE-APACHE;md5=3b83ef96387f14655fc854ddc3c6bd57 \
+    file://LICENSE-BSD-3-Clause;md5=2489db1359f496fff34bd393df63947e \
+"
+DEPENDS += "libgpiod"
+# libgpiod-sys generates bindings using bindgen, which depends on clang
+DEPENDS += "clang-native"

As Richard mentioned on #yocto, this recipe adds a new layer dependency from meta-virtualization to meta-clang. This could be documented and test build jobs changed to include meta-clang, or these recipes could be moved to build conditionally only when meta-clang is available by moving the recipes to directory dynamic-layers/meta-clang/recipes-extended

https://autobuilder.yoctoproject.org/typhoon/#/builders/121/builds/1528/steps/23/logs/stdio

Or how hard is the dependency to clang-native?

Cheers,

-Mikko

#2 lore raw
Quoted 54 lines · Mikko Rapeli

Hi,

Quoted 30 lines · Erik Schilling

This adds recipes for the first tagged release of the vhost-device daemons of the rust-vmm project.

While the initial release was done for all daemons at the same time, the daemons all have indepentend version numbers and will be released on their own schedules in the future. Therefore, I splitted them into independent recipes.

---
These are a bunch of daemons that implement various vhost-user virtio devices. Currently, they are mostly tested with QEMU, but we are also working on Xen support (most bits are upstream already).
---
Changes in v2:
- Added README.md to explain generation of dependency .inc files
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 README.md                                          |  14 ++
 .../vhost-device/vhost-device-gpio-crates.inc      | 184 +++++++++++++++
 .../vhost-device/vhost-device-gpio_0.1.0.bb        |  20 ++
 .../vhost-device/vhost-device-i2c-crates.inc       | 126 ++++++++++
 .../vhost-device/vhost-device-i2c_0.1.0.bb         |  16 ++
 .../vhost-device/vhost-device-rng-crates.inc       | 158 +++++++++++++
 .../vhost-device/vhost-device-rng_0.1.0.bb         |  17 ++
 .../vhost-device/vhost-device-scsi-crates.inc      | 166 +++++++++++++
 .../vhost-device/vhost-device-scsi_0.1.0.bb        |  16 ++
 .../vhost-device/vhost-device-vsock-crates.inc     | 258 +++++++++++++++++++++
 .../vhost-device/vhost-device-vsock_0.1.0.bb       |  16 ++
 11 files changed, 991 insertions(+)

<snip>

recipes-extended/vhost-device/vhost-device-gpio_0.1.0.bb line 11

Quoted 13 lines

+++ b/recipes-extended/vhost-device/vhost-device-gpio_0.1.0.bb

recipes-extended/vhost-device/vhost-device-gpio_0.1.0.bb new file +11 -0
@@ -0,0 +1,20 @@
+SUMMARY = "vhost gpio backend device"
+DESCRIPTION = "A vhost-user backend that emulates a VirtIO GPIO device"
+HOMEPAGE = "https://github.com/rust-vmm/vhost-device"
+LICENSE = "Apache-2.0 | BSD-3-Clause"
+LIC_FILES_CHKSUM = "\
+    file://LICENSE-APACHE;md5=3b83ef96387f14655fc854ddc3c6bd57 \
+    file://LICENSE-BSD-3-Clause;md5=2489db1359f496fff34bd393df63947e \
+"
+DEPENDS += "libgpiod"
+# libgpiod-sys generates bindings using bindgen, which depends on clang
+DEPENDS += "clang-native"

As Richard mentioned on #yocto, this recipe adds a new layer dependency from meta-virtualization to meta-clang. This could be documented and test build jobs changed to include meta-clang, or these recipes could be moved to build conditionally only when meta-clang is available by moving the recipes to directory dynamic-layers/meta-clang/recipes-extended

Quoted 1 line

https://autobuilder.yoctoproject.org/typhoon/#/builders/121/builds/1528/steps/23/logs/stdio

Hm... I guess moving vhost-device-gpio to dynamic-layers/ is the least invasive option?

@Bruce: Which option do you prefer? I can draft a patch.

Quoted 1 line

Or how hard is the dependency to clang-native?

vhost-device-gpio depends on libgpiod which generates the bindings at build time with bindgen [1]. So it is a hard dependency for that daemon. The other daemons are fine without it.

[1] https://github.com/rust-lang/rust-bindgen

- Erik

#3 lore raw
Quoted 56 lines · Erik Schilling
Quoted 54 lines · Mikko Rapeli

Hi,

Quoted 30 lines · Erik Schilling

This adds recipes for the first tagged release of the vhost-device daemons of the rust-vmm project.

While the initial release was done for all daemons at the same time, the daemons all have indepentend version numbers and will be released on their own schedules in the future. Therefore, I splitted them into independent recipes.

---
These are a bunch of daemons that implement various vhost-user virtio devices. Currently, they are mostly tested with QEMU, but we are also working on Xen support (most bits are upstream already).
---
Changes in v2:
- Added README.md to explain generation of dependency .inc files
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 README.md                                          |  14 ++
 .../vhost-device/vhost-device-gpio-crates.inc      | 184 +++++++++++++++
 .../vhost-device/vhost-device-gpio_0.1.0.bb        |  20 ++
 .../vhost-device/vhost-device-i2c-crates.inc       | 126 ++++++++++
 .../vhost-device/vhost-device-i2c_0.1.0.bb         |  16 ++
 .../vhost-device/vhost-device-rng-crates.inc       | 158 +++++++++++++
 .../vhost-device/vhost-device-rng_0.1.0.bb         |  17 ++
 .../vhost-device/vhost-device-scsi-crates.inc      | 166 +++++++++++++
 .../vhost-device/vhost-device-scsi_0.1.0.bb        |  16 ++
 .../vhost-device/vhost-device-vsock-crates.inc     | 258 +++++++++++++++++++++
 .../vhost-device/vhost-device-vsock_0.1.0.bb       |  16 ++
 11 files changed, 991 insertions(+)

<snip>

recipes-extended/vhost-device/vhost-device-gpio_0.1.0.bb line 11

Quoted 13 lines

+++ b/recipes-extended/vhost-device/vhost-device-gpio_0.1.0.bb

recipes-extended/vhost-device/vhost-device-gpio_0.1.0.bb new file +11 -0
@@ -0,0 +1,20 @@
+SUMMARY = "vhost gpio backend device"
+DESCRIPTION = "A vhost-user backend that emulates a VirtIO GPIO device"
+HOMEPAGE = "https://github.com/rust-vmm/vhost-device"
+LICENSE = "Apache-2.0 | BSD-3-Clause"
+LIC_FILES_CHKSUM = "\
+    file://LICENSE-APACHE;md5=3b83ef96387f14655fc854ddc3c6bd57 \
+    file://LICENSE-BSD-3-Clause;md5=2489db1359f496fff34bd393df63947e \
+"
+DEPENDS += "libgpiod"
+# libgpiod-sys generates bindings using bindgen, which depends on clang
+DEPENDS += "clang-native"

As Richard mentioned on #yocto, this recipe adds a new layer dependency from meta-virtualization to meta-clang. This could be documented and test build jobs changed to include meta-clang, or these recipes could be moved to build conditionally only when meta-clang is available by moving the recipes to directory dynamic-layers/meta-clang/recipes-extended

Quoted 6 lines
Quoted 1 line

https://autobuilder.yoctoproject.org/typhoon/#/builders/121/builds/1528/steps/23/logs/stdio

Hm... I guess moving vhost-device-gpio to dynamic-layers/ is the least invasive option?

@Bruce: Which option do you prefer? I can draft a patch.

Definitely not a dynamic layer :)

Can you expand on the dependency a bit more for me ? I find it odd that libgpiod is in meta-oe, but there's no mention (that I can see) about any clang dependencies.

I know very little about the way rust is stitching the bits together.

Should libgpod really be in the DEPENDS ? Is libgpiod-sys a clang thing ? And libgpiod is somehow conditionally using it ?

Either way, we used to do this same dance with meta-security, and we did that via SKIP_RECIPE. So that's how I'd solve this. But obviously none of the core packagesgroups, etc, in meta-virt can have the vhost* packages if that is the case. Barring that, we add the dependency, if it becomes a widespread use case, it'll end up in core anyway.

But I still need to understand this a bit better before I will firmly land one way
or the other.

Bruce

Quoted 11 lines
Quoted 2 lines

Or how hard is the dependency to clang-native?

vhost-device-gpio depends on libgpiod which generates the bindings at build time with bindgen [1]. So it is a hard dependency for that daemon. The other daemons are fine without it.

[1] https://github.com/rust-lang/rust-bindgen

- Erik

--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

#4 lore raw
Quoted 67 lines · Bruce Ashfield
Quoted 56 lines · Erik Schilling
Quoted 54 lines · Mikko Rapeli

Hi,

Quoted 30 lines · Erik Schilling

This adds recipes for the first tagged release of the vhost-device daemons of the rust-vmm project.

While the initial release was done for all daemons at the same time, the daemons all have indepentend version numbers and will be released on their own schedules in the future. Therefore, I splitted them into independent recipes.

---
These are a bunch of daemons that implement various vhost-user virtio devices. Currently, they are mostly tested with QEMU, but we are also working on Xen support (most bits are upstream already).
---
Changes in v2:
- Added README.md to explain generation of dependency .inc files
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 README.md                                          |  14 ++
 .../vhost-device/vhost-device-gpio-crates.inc      | 184 +++++++++++++++
 .../vhost-device/vhost-device-gpio_0.1.0.bb        |  20 ++
 .../vhost-device/vhost-device-i2c-crates.inc       | 126 ++++++++++
 .../vhost-device/vhost-device-i2c_0.1.0.bb         |  16 ++
 .../vhost-device/vhost-device-rng-crates.inc       | 158 +++++++++++++
 .../vhost-device/vhost-device-rng_0.1.0.bb         |  17 ++
 .../vhost-device/vhost-device-scsi-crates.inc      | 166 +++++++++++++
 .../vhost-device/vhost-device-scsi_0.1.0.bb        |  16 ++
 .../vhost-device/vhost-device-vsock-crates.inc     | 258 +++++++++++++++++++++
 .../vhost-device/vhost-device-vsock_0.1.0.bb       |  16 ++
 11 files changed, 991 insertions(+)

<snip>

recipes-extended/vhost-device/vhost-device-gpio_0.1.0.bb line 11

Quoted 13 lines

+++ b/recipes-extended/vhost-device/vhost-device-gpio_0.1.0.bb

recipes-extended/vhost-device/vhost-device-gpio_0.1.0.bb new file +11 -0
@@ -0,0 +1,20 @@
+SUMMARY = "vhost gpio backend device"
+DESCRIPTION = "A vhost-user backend that emulates a VirtIO GPIO device"
+HOMEPAGE = "https://github.com/rust-vmm/vhost-device"
+LICENSE = "Apache-2.0 | BSD-3-Clause"
+LIC_FILES_CHKSUM = "\
+    file://LICENSE-APACHE;md5=3b83ef96387f14655fc854ddc3c6bd57 \
+    file://LICENSE-BSD-3-Clause;md5=2489db1359f496fff34bd393df63947e \
+"
+DEPENDS += "libgpiod"
+# libgpiod-sys generates bindings using bindgen, which depends on clang
+DEPENDS += "clang-native"

As Richard mentioned on #yocto, this recipe adds a new layer dependency from meta-virtualization to meta-clang. This could be documented and test build jobs changed to include meta-clang, or these recipes could be moved to build conditionally only when meta-clang is available by moving the recipes to directory dynamic-layers/meta-clang/recipes-extended

Quoted 6 lines
Quoted 1 line

https://autobuilder.yoctoproject.org/typhoon/#/builders/121/builds/1528/steps/23/logs/stdio

Hm... I guess moving vhost-device-gpio to dynamic-layers/ is the least invasive option?

@Bruce: Which option do you prefer? I can draft a patch.

Definitely not a dynamic layer :)

Quoted 8 lines

Can you expand on the dependency a bit more for me ? I find it odd that libgpiod is in meta-oe, but there's no mention (that I can see) about any clang dependencies.

I know very little about the way rust is stitching the bits together.

Should libgpod really be in the DEPENDS ? Is libgpiod-sys a clang thing ? And libgpiod is somehow conditionally using it ?

Yeah, this is a bit confusing...

Here is a (hopefully) better attempt at explaining what is going on:

vhost-device-gpio depends on libgpiod (the Rust crate, not the C lib). which in its turn depends on libgpiod-sys - a helper crate that provides binding to the libgpiod (C) lib.

Now, libgpiod-sys does not really consist of any _real_ code. Instead, it is a recipe to generate the bindings at build time. This happens by reading the pkg-config info from libgpiod (the C lib), parsing the headers and linking to it.

So: libgpiod (the C lib) - as it is in meta-oe - does not depend on clang-native, only libgpiod-sys (the Rust lib) does.

The final result is two dependencies being required for building
libgpiod-sys: libclang (for bindgen) and libgpiod (the C lib) (for pkg-config, the headers and linking).

In Rust - in contrast to how C libs are typically packaged - libgpiod (the Rust lib) and libgpiod-sys (Rust lib again) are built and linked into vhost-device-gpio all during the build of this recipe. So the dependencies are required here.

The final result is:

┌──────────────────────────────────────┐
│          vhost-device-gpio           │
│                                      │
│ libgpiod (Rust), libgpiod-sys (Rust) │ ─────────────►  libgpiod (C)
│           (static linking)           │ (dynamic link)      ▲
└──────────────────────────────────────┘                     │
                   ▲                           the usual libgpiod recipe
                   │

this is the build result of this recipe

Overall, the generation of bindings at build time is fairly common in the Rust ecosystem. parsec in meta-security, for example, also does the same thing. There the situation seems to be solved by putting parsec into it's own layer within the meta-security repo.

Quoted 5 lines

Either way, we used to do this same dance with meta-security, and we did that via SKIP_RECIPE. So that's how I'd solve this. But obviously none of the core packagesgroups, etc, in meta-virt can have the vhost* packages if that is the case. Barring that, we add the dependency, if it becomes a widespread use case, it'll end up in core anyway.

This would require users of the layer to undo the SKIP_RECIPE? Or am I misunderstanding what you mean? Just trying to understand the proposal, I got no opinions on the best solution to resolve this. I am happy with what seems best for the greater world.

Quoted 3 lines

But I still need to understand this a bit better before I will firmly land one way
or the other.

Let me know if you got further questions :)

- Erik

#5 lore raw
Quoted 113 lines · Erik Schilling
Quoted 67 lines · Bruce Ashfield
Quoted 56 lines · Erik Schilling
Quoted 54 lines · Mikko Rapeli

Hi,

Quoted 30 lines · Erik Schilling

This adds recipes for the first tagged release of the vhost-device daemons of the rust-vmm project.

While the initial release was done for all daemons at the same time, the daemons all have indepentend version numbers and will be released on their own schedules in the future. Therefore, I splitted them into independent recipes.

---
These are a bunch of daemons that implement various vhost-user virtio devices. Currently, they are mostly tested with QEMU, but we are also working on Xen support (most bits are upstream already).
---
Changes in v2:
- Added README.md to explain generation of dependency .inc files
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 README.md                                          |  14 ++
 .../vhost-device/vhost-device-gpio-crates.inc      | 184 +++++++++++++++
 .../vhost-device/vhost-device-gpio_0.1.0.bb        |  20 ++
 .../vhost-device/vhost-device-i2c-crates.inc       | 126 ++++++++++
 .../vhost-device/vhost-device-i2c_0.1.0.bb         |  16 ++
 .../vhost-device/vhost-device-rng-crates.inc       | 158 +++++++++++++
 .../vhost-device/vhost-device-rng_0.1.0.bb         |  17 ++
 .../vhost-device/vhost-device-scsi-crates.inc      | 166 +++++++++++++
 .../vhost-device/vhost-device-scsi_0.1.0.bb        |  16 ++
 .../vhost-device/vhost-device-vsock-crates.inc     | 258 +++++++++++++++++++++
 .../vhost-device/vhost-device-vsock_0.1.0.bb       |  16 ++
 11 files changed, 991 insertions(+)

<snip>

recipes-extended/vhost-device/vhost-device-gpio_0.1.0.bb line 11

Quoted 13 lines

+++ b/recipes-extended/vhost-device/vhost-device-gpio_0.1.0.bb

recipes-extended/vhost-device/vhost-device-gpio_0.1.0.bb new file +11 -0
@@ -0,0 +1,20 @@
+SUMMARY = "vhost gpio backend device"
+DESCRIPTION = "A vhost-user backend that emulates a VirtIO GPIO device"
+HOMEPAGE = "https://github.com/rust-vmm/vhost-device"
+LICENSE = "Apache-2.0 | BSD-3-Clause"
+LIC_FILES_CHKSUM = "\
+    file://LICENSE-APACHE;md5=3b83ef96387f14655fc854ddc3c6bd57 \
+    file://LICENSE-BSD-3-Clause;md5=2489db1359f496fff34bd393df63947e \
+"
+DEPENDS += "libgpiod"
+# libgpiod-sys generates bindings using bindgen, which depends on clang
+DEPENDS += "clang-native"

As Richard mentioned on #yocto, this recipe adds a new layer dependency from meta-virtualization to meta-clang. This could be documented and test build jobs changed to include meta-clang, or these recipes could be moved to build conditionally only when meta-clang is available by moving the recipes to directory dynamic-layers/meta-clang/recipes-extended

Quoted 6 lines
Quoted 1 line

https://autobuilder.yoctoproject.org/typhoon/#/builders/121/builds/1528/steps/23/logs/stdio

Hm... I guess moving vhost-device-gpio to dynamic-layers/ is the least invasive option?

@Bruce: Which option do you prefer? I can draft a patch.

Definitely not a dynamic layer :)

Quoted 8 lines

Can you expand on the dependency a bit more for me ? I find it odd that libgpiod is in meta-oe, but there's no mention (that I can see) about any clang dependencies.

I know very little about the way rust is stitching the bits together.

Should libgpod really be in the DEPENDS ? Is libgpiod-sys a clang thing ? And libgpiod is somehow conditionally using it ?

Yeah, this is a bit confusing...

Here is a (hopefully) better attempt at explaining what is going on:

vhost-device-gpio depends on libgpiod (the Rust crate, not the C lib). which in its turn depends on libgpiod-sys - a helper crate that provides binding to the libgpiod (C) lib.

Now, libgpiod-sys does not really consist of any _real_ code. Instead, it is a recipe to generate the bindings at build time. This happens by reading the pkg-config info from libgpiod (the C lib), parsing the headers and linking to it.

So: libgpiod (the C lib) - as it is in meta-oe - does not depend on clang-native, only libgpiod-sys (the Rust lib) does.

The final result is two dependencies being required for building
libgpiod-sys: libclang (for bindgen) and libgpiod (the C lib) (for pkg-config, the headers and linking).

In Rust - in contrast to how C libs are typically packaged - libgpiod (the Rust lib) and libgpiod-sys (Rust lib again) are built and linked into vhost-device-gpio all during the build of this recipe. So the dependencies are required here.

The final result is:

┌──────────────────────────────────────┐
│          vhost-device-gpio           │
│                                      │
│ libgpiod (Rust), libgpiod-sys (Rust) │ ─────────────►  libgpiod (C)
│           (static linking)           │ (dynamic link)      ▲
└──────────────────────────────────────┘                     │
                   ▲                           the usual libgpiod recipe
                   │
Quoted 2 lines

this is the build result of this recipe

Aha. Yes, I see why my dependency investigation got tangled up in the "normal" libgpiod in meta-openembedded.

Quoted 5 lines

Overall, the generation of bindings at build time is fairly common in the Rust ecosystem. parsec in meta-security, for example, also does the same thing. There the situation seems to be solved by putting parsec into it's own layer within the meta-security repo.

Layers with a single or few recipes are a pet peeve of mine :)

Quoted 11 lines
Quoted 6 lines

Either way, we used to do this same dance with meta-security, and we did that via SKIP_RECIPE. So that's how I'd solve this. But obviously none of the core packagesgroups, etc, in meta-virt can have the vhost* packages if that is the case. Barring that, we add the dependency, if it becomes a widespread use case, it'll end up in core anyway.

This would require users of the layer to undo the SKIP_RECIPE? Or am I misunderstanding what you mean? Just trying to understand the proposal, I got no opinions on the best solution to resolve this. I am happy with what seems best for the greater world.

It is similar to a layer, but it keeps everything centralized. It'll automatically
be undone if meta-clang is available (with the appropriate changes of course).

We used to have this for selinux and security:

SKIP_RECIPE[cri-o] ?= "${@bb.utils.contains('BBFILE_COLLECTIONS', 'security', bb.utils.contains('BBFILE_COLLECTIONS', 'selinux', '', 'Depends on libselinux from meta-selinux which is not included', d), 'Depends on libseccomp from meta-security which is not included', d)}"

SKIP_RECIPE[cri-o] ?= "${@bb.utils.contains('BBFILE_COLLECTIONS', 'selinux', '', 'Depends on libselinux from meta-selinux which is not included', d)}"

Cheers,

Bruce

Quoted 9 lines
Quoted 4 lines

But I still need to understand this a bit better before I will firmly land one way
or the other.

Let me know if you got further questions :)

- Erik

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
#6 lore raw
Quoted 148 lines · Bruce Ashfield
Quoted 113 lines · Erik Schilling
Quoted 67 lines · Bruce Ashfield
Quoted 56 lines · Erik Schilling
Quoted 54 lines · Mikko Rapeli

Hi,

Quoted 30 lines · Erik Schilling

This adds recipes for the first tagged release of the vhost-device daemons of the rust-vmm project.

While the initial release was done for all daemons at the same time, the daemons all have indepentend version numbers and will be released on their own schedules in the future. Therefore, I splitted them into independent recipes.

---
These are a bunch of daemons that implement various vhost-user virtio devices. Currently, they are mostly tested with QEMU, but we are also working on Xen support (most bits are upstream already).
---
Changes in v2:
- Added README.md to explain generation of dependency .inc files
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 README.md                                          |  14 ++
 .../vhost-device/vhost-device-gpio-crates.inc      | 184 +++++++++++++++
 .../vhost-device/vhost-device-gpio_0.1.0.bb        |  20 ++
 .../vhost-device/vhost-device-i2c-crates.inc       | 126 ++++++++++
 .../vhost-device/vhost-device-i2c_0.1.0.bb         |  16 ++
 .../vhost-device/vhost-device-rng-crates.inc       | 158 +++++++++++++
 .../vhost-device/vhost-device-rng_0.1.0.bb         |  17 ++
 .../vhost-device/vhost-device-scsi-crates.inc      | 166 +++++++++++++
 .../vhost-device/vhost-device-scsi_0.1.0.bb        |  16 ++
 .../vhost-device/vhost-device-vsock-crates.inc     | 258 +++++++++++++++++++++
 .../vhost-device/vhost-device-vsock_0.1.0.bb       |  16 ++
 11 files changed, 991 insertions(+)

<snip>

recipes-extended/vhost-device/vhost-device-gpio_0.1.0.bb line 11

Quoted 13 lines

+++ b/recipes-extended/vhost-device/vhost-device-gpio_0.1.0.bb

recipes-extended/vhost-device/vhost-device-gpio_0.1.0.bb new file +11 -0
@@ -0,0 +1,20 @@
+SUMMARY = "vhost gpio backend device"
+DESCRIPTION = "A vhost-user backend that emulates a VirtIO GPIO device"
+HOMEPAGE = "https://github.com/rust-vmm/vhost-device"
+LICENSE = "Apache-2.0 | BSD-3-Clause"
+LIC_FILES_CHKSUM = "\
+    file://LICENSE-APACHE;md5=3b83ef96387f14655fc854ddc3c6bd57 \
+    file://LICENSE-BSD-3-Clause;md5=2489db1359f496fff34bd393df63947e \
+"
+DEPENDS += "libgpiod"
+# libgpiod-sys generates bindings using bindgen, which depends on clang
+DEPENDS += "clang-native"

As Richard mentioned on #yocto, this recipe adds a new layer dependency from meta-virtualization to meta-clang. This could be documented and test build jobs changed to include meta-clang, or these recipes could be moved to build conditionally only when meta-clang is available by moving the recipes to directory dynamic-layers/meta-clang/recipes-extended

Quoted 6 lines
Quoted 1 line

https://autobuilder.yoctoproject.org/typhoon/#/builders/121/builds/1528/steps/23/logs/stdio

Hm... I guess moving vhost-device-gpio to dynamic-layers/ is the least invasive option?

@Bruce: Which option do you prefer? I can draft a patch.

Definitely not a dynamic layer :)

Quoted 8 lines

Can you expand on the dependency a bit more for me ? I find it odd that libgpiod is in meta-oe, but there's no mention (that I can see) about any clang dependencies.

I know very little about the way rust is stitching the bits together.

Should libgpod really be in the DEPENDS ? Is libgpiod-sys a clang thing ? And libgpiod is somehow conditionally using it ?

Yeah, this is a bit confusing...

Here is a (hopefully) better attempt at explaining what is going on:

vhost-device-gpio depends on libgpiod (the Rust crate, not the C lib). which in its turn depends on libgpiod-sys - a helper crate that provides binding to the libgpiod (C) lib.

Now, libgpiod-sys does not really consist of any _real_ code. Instead, it is a recipe to generate the bindings at build time. This happens by reading the pkg-config info from libgpiod (the C lib), parsing the headers and linking to it.

So: libgpiod (the C lib) - as it is in meta-oe - does not depend on clang-native, only libgpiod-sys (the Rust lib) does.

The final result is two dependencies being required for building
libgpiod-sys: libclang (for bindgen) and libgpiod (the C lib) (for pkg-config, the headers and linking).

In Rust - in contrast to how C libs are typically packaged - libgpiod (the Rust lib) and libgpiod-sys (Rust lib again) are built and linked into vhost-device-gpio all during the build of this recipe. So the dependencies are required here.

The final result is:

┌──────────────────────────────────────┐
│          vhost-device-gpio           │
│                                      │
│ libgpiod (Rust), libgpiod-sys (Rust) │ ─────────────►  libgpiod (C)
│           (static linking)           │ (dynamic link)      ▲
└──────────────────────────────────────┘                     │
                   ▲                           the usual libgpiod recipe
                   │
Quoted 2 lines

this is the build result of this recipe

Aha. Yes, I see why my dependency investigation got tangled up in the "normal" libgpiod in meta-openembedded.

Quoted 5 lines

Overall, the generation of bindings at build time is fairly common in the Rust ecosystem. parsec in meta-security, for example, also does the same thing. There the situation seems to be solved by putting parsec into it's own layer within the meta-security repo.

Layers with a single or few recipes are a pet peeve of mine :)

Quoted 11 lines
Quoted 6 lines

Either way, we used to do this same dance with meta-security, and we did that via SKIP_RECIPE. So that's how I'd solve this. But obviously none of the core packagesgroups, etc, in meta-virt can have the vhost* packages if that is the case. Barring that, we add the dependency, if it becomes a widespread use case, it'll end up in core anyway.

This would require users of the layer to undo the SKIP_RECIPE? Or am I misunderstanding what you mean? Just trying to understand the proposal, I got no opinions on the best solution to resolve this. I am happy with what seems best for the greater world.

It is similar to a layer, but it keeps everything centralized. It'll automatically
be undone if meta-clang is available (with the appropriate changes of course).

We used to have this for selinux and security:

Quoted 8 lines

SKIP_RECIPE[cri-o] ?= "${@bb.utils.contains('BBFILE_COLLECTIONS', 'security', bb.utils.contains('BBFILE_COLLECTIONS', 'selinux', '', 'Depends on libselinux from meta-selinux which is not included', d), 'Depends on libseccomp from meta-security which is not included', d)}"

SKIP_RECIPE[cri-o] ?= "${@bb.utils.contains('BBFILE_COLLECTIONS', 'selinux', '', 'Depends on libselinux from meta-selinux which is not included', d)}"

Ah. Did not know this works within a recipe! Patch posted:

https://lore.kernel.org/r/[email protected]

Thanks!

- Erik

#7 lore raw
In reply to Erik Schilling

README.md

Quoted 32 lines · Erik Schilling

This adds recipes for the first tagged release of the vhost-device daemons of the rust-vmm project.

While the initial release was done for all daemons at the same time, the daemons all have indepentend version numbers and will be released on their own schedules in the future. Therefore, I splitted them into independent recipes.

---
These are a bunch of daemons that implement various vhost-user virtio devices. Currently, they are mostly tested with QEMU, but we are also working on Xen support (most bits are upstream already).
---
Changes in v2:
- Added README.md to explain generation of dependency .inc files
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 README.md                                          |  14 ++
 .../vhost-device/vhost-device-gpio-crates.inc      | 184 +++++++++++++++
 .../vhost-device/vhost-device-gpio_0.1.0.bb        |  20 ++
 .../vhost-device/vhost-device-i2c-crates.inc       | 126 ++++++++++
 .../vhost-device/vhost-device-i2c_0.1.0.bb         |  16 ++
 .../vhost-device/vhost-device-rng-crates.inc       | 158 +++++++++++++
 .../vhost-device/vhost-device-rng_0.1.0.bb         |  17 ++
 .../vhost-device/vhost-device-scsi-crates.inc      | 166 +++++++++++++
 .../vhost-device/vhost-device-scsi_0.1.0.bb        |  16 ++
 .../vhost-device/vhost-device-vsock-crates.inc     | 258 +++++++++++++++++++++
 .../vhost-device/vhost-device-vsock_0.1.0.bb       |  16 ++
 11 files changed, 991 insertions(+)
README.md +0 -0

Eh... Not sure how this happened... This should obviously have gone to the vhost-device folder...

Will send a follow-up fix.

- Erik