Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wayland displaying using shared memory between virtual machines #473

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jkuro-tii
Copy link
Contributor

@jkuro-tii jkuro-tii commented Feb 13, 2024

Description of changes

Add memory sharing mechanism between virtual machines and use it for wayland/waypipe displaying.

Main changes:

Host

  • Added the shared memory manager within QEMU.
  • Direct Memory Mapping via SysBus:
    • Modified QEMU's code to map shared memory directly into the VM's memory address space using the SysBus interface.
  • Option for Defining Shared Memory Manager:
    • Added an option to QEMU for defining a shared memory manager when running VMs.
  • BigPages Area Allocation:
    • Allocated shared memory within the BigPages area for optimized memory usage.

GUI and app VMs

  1. Linux Driver for Shared Memory and Interrupts:

    • Added a Linux driver to manage shared memory operations and interrupts and creating the /dev/ivshmem device.
  2. Memsocket Application for Inter-VM Communication:

    • Introduced the memsocket application to facilitate socket data forwarding between VMs.
  3. Integration with Waypipe:

    • Modified Waypipe service options to interface with the memsocket application, enabling seamless communication between VMs.

Checklist for things done

  • Summary of the proposed changes in the PR description
  • More detailed description in the commit message(s)
  • Commits are squashed into relevant entities - avoid a lot of minimal dev time commits in the PR
  • Contribution guidelines followed
  • Ghaf documentation updated with the commit - https://tiiuae.github.io/ghaf/
  • PR linked to architecture documentation and requirement(s) ticket id
  • Test procedure described (or includes tests). Select one or more:
    • Tested on Lenovo X1 x86_64
    • Tested on Jetson Orin NX or AGX aarch64
    • Tested on Polarfire riscv64
  • Author has run nix flake check --accept-flake-config and it passes
  • All automatic Github Action checks pass - see actions
  • Author has added reviewers and removed PR draft status

Testing

Run Chromium and other wayland enabled application. Verify that they execute and display properly.
Run performance tests described in documentation

Jira ticket:

https://ssrc.atlassian.net/browse/SP-3805

Documentation:

https://ssrc.atlassian.net/wiki/spaces/~62552e6ffdb60b006927ad98/blog/2022/09/29/612958326/Memory+sharing+between+virtual+machines
https://ssrc.atlassian.net/wiki/spaces/~62552e6ffdb60b006927ad98/pages/825720835/Wayland+displaying+with+shared+memory

Summary of performance

Playing YouTube is smooth, up to a resolution of 2160p. 
CPU consumption by the memsocket application is below 5%, usually 3-6%.
iperf results are presented in documentation

@jkuro-tii jkuro-tii temporarily deployed to internal-build-workflow February 13, 2024 10:17 — with GitHub Actions Inactive
@jkuro-tii jkuro-tii force-pushed the jkuro-add-wayland-shm-lenovo_rebase branch from d6017d1 to eef36be Compare February 13, 2024 10:19
@jkuro-tii jkuro-tii temporarily deployed to internal-build-workflow February 13, 2024 10:19 — with GitHub Actions Inactive
@jenninikko
Copy link
Collaborator

Are you planning to add documentation to the repository?

vilvo

This comment was marked as resolved.

@jkuro-tii

This comment was marked as resolved.

@jkuro-tii

This comment was marked as outdated.

@vilvo

This comment was marked as outdated.

@jkuro-tii

This comment was marked as outdated.

@vilvo

This comment was marked as outdated.

@vilvo

This comment was marked as outdated.

@vilvo

This comment was marked as outdated.

@jkuro-tii

This comment was marked as outdated.

@jkuro-tii

This comment was marked as outdated.

@vilvo

This comment was marked as outdated.

@jkuro-tii

This comment was marked as outdated.

@vilvo

This comment was marked as outdated.

@jkuro-tii jkuro-tii force-pushed the jkuro-add-wayland-shm-lenovo_rebase branch from eef36be to 6224584 Compare February 20, 2024 08:21
@jkuro-tii jkuro-tii temporarily deployed to internal-build-workflow February 20, 2024 08:21 — with GitHub Actions Inactive
@jkuro-tii

This comment was marked as outdated.

@vilvo

This comment was marked as outdated.

@vilvo

This comment was marked as outdated.

@vilvo

This comment was marked as outdated.

@vilvo

This comment was marked as off-topic.

@jkuro-tii jkuro-tii requested a deployment to external-build-workflow October 16, 2024 06:46 — with GitHub Actions Waiting
@jkuro-tii jkuro-tii force-pushed the jkuro-add-wayland-shm-lenovo_rebase branch from 0b4c908 to 24cadf4 Compare October 16, 2024 10:48
@jkuro-tii jkuro-tii temporarily deployed to internal-build-workflow October 16, 2024 10:48 — with GitHub Actions Inactive
@jkuro-tii jkuro-tii requested a deployment to external-build-workflow October 16, 2024 10:48 — with GitHub Actions Waiting
@jkuro-tii
Copy link
Contributor Author

Updates:

  • Refactored Nix code by consolidating most host and VM configuration changes into a single file, improving maintainability.

  • Added support for shared memory on the host system, enabling any application utilizing Unix Sockets (e.g. gRPC) to seamlessly run on both the host and within a virtual machine (VM).

  • Implemented the shared memory driver in the NixOS build as a kernel module instead of a kernel patch, simplifying maintenance and eliminating the need for kernel rebuilding.

  • Replaced the hardcoded ghaf user ID (1000) with a configurable parameter, increasing flexibility.

@jkuro-tii jkuro-tii force-pushed the jkuro-add-wayland-shm-lenovo_rebase branch from 24cadf4 to 0811965 Compare October 16, 2024 11:40
@jkuro-tii jkuro-tii temporarily deployed to internal-build-workflow October 16, 2024 11:40 — with GitHub Actions Inactive
@jkuro-tii jkuro-tii requested a deployment to external-build-workflow October 16, 2024 11:40 — with GitHub Actions Waiting
@jkuro-tii jkuro-tii temporarily deployed to internal-build-workflow October 17, 2024 06:12 — with GitHub Actions Inactive
@jkuro-tii jkuro-tii requested a deployment to external-build-workflow October 17, 2024 06:12 — with GitHub Actions Waiting
@jkuro-tii jkuro-tii force-pushed the jkuro-add-wayland-shm-lenovo_rebase branch from a058a32 to b42c14f Compare October 17, 2024 06:13
@jkuro-tii jkuro-tii temporarily deployed to internal-build-workflow October 17, 2024 06:13 — with GitHub Actions Inactive
@jkuro-tii jkuro-tii requested a deployment to external-build-workflow October 17, 2024 06:13 — with GitHub Actions Waiting
@tiiuae tiiuae deleted a comment Oct 18, 2024
@jkuro-tii jkuro-tii temporarily deployed to internal-build-workflow October 23, 2024 07:43 — with GitHub Actions Inactive
@jkuro-tii jkuro-tii requested a deployment to external-build-workflow October 23, 2024 07:43 — with GitHub Actions Waiting
gangaram-tii and others added 2 commits October 25, 2024 14:46
Signed-off-by: Jaroslaw Kurowski <[email protected]>

Fixed PR problems

Signed-off-by: Jaroslaw Kurowski <[email protected]>
Signed-off-by: Jaroslaw Kurowski <[email protected]>
@jkuro-tii jkuro-tii force-pushed the jkuro-add-wayland-shm-lenovo_rebase branch from 2ac570d to c465fc9 Compare October 25, 2024 10:50
@jkuro-tii jkuro-tii temporarily deployed to internal-build-workflow October 25, 2024 10:50 — with GitHub Actions Inactive
@jkuro-tii jkuro-tii requested a deployment to external-build-workflow October 25, 2024 10:50 — with GitHub Actions Waiting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants