Skip to content

Conversation

@lisongqian
Copy link
Contributor

This patch introduces the Inter-VM shared memory(ivshmem) device
to support sharing a memory region between multiple processes running
different guests and the host.

This patch supports the basic ivshmem functions like ivshmem-plain in QEMU[1].

[1] https://www.qemu.org/docs/master/specs/ivshmem-spec.html

Signed-off-by: Yi Wang [email protected]
Signed-off-by: Songqian Li [email protected]

@lisongqian lisongqian requested a review from a team as a code owner August 29, 2024 08:03
@lisongqian lisongqian force-pushed the upstream/ivshmem branch 3 times, most recently from ad319d6 to bf8f368 Compare August 29, 2024 08:52
@lisongqian lisongqian closed this Aug 29, 2024
@lisongqian lisongqian deleted the upstream/ivshmem branch August 29, 2024 09:04
@lisongqian lisongqian restored the upstream/ivshmem branch August 30, 2024 02:24
@lisongqian
Copy link
Contributor Author

Sorry, I accidentally deleted the branch. Reopen it now.

@rbradford
Copy link
Member

Could you elaborate some more on the use case for this?

@lisongqian
Copy link
Contributor Author

Could you elaborate some more on the use case for this?

Thank you for your review. I add a use case to ivshmem.md. This provides a more detailed usage description of the ivshmem device.

@lisongqian
Copy link
Contributor Author

@rbradford PTAL, I'd appreciate you letting me know of any suggestions.

@rbradford
Copy link
Member

Pinging @cloud-hypervisor/cloud-hypervisor-reviewers - does anybody else that thoughts about this - i'm not sure about whether this fits into the "modern cloud" usescase.

Perhaps this could be behind a feature flag?

Copy link
Contributor

@up2wing up2wing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments added, PTAL.

@up2wing
Copy link
Contributor

up2wing commented Sep 29, 2024

Pinging @cloud-hypervisor/cloud-hypervisor-reviewers - does anybody else that thoughts about this - i'm not sure about whether this fits into the "modern cloud" usescase.

As far as I know, stratovirt uses ivshmem for some kind of sound card[1] and dpdk uses it for zero-copy data sharing. Also, people can easily share memory between guest and host without vm-exit, it's useful for some performance use case.

Perhaps this could be behind a feature flag?

Well in my opinion as this can toggle using command line or config and no harm to performance, a feature flag maybe
not needed?

  1. openeuler-mirror/stratovirt@5f2220a

@lisongqian lisongqian force-pushed the upstream/ivshmem branch 4 times, most recently from 62941ed to a7a4efd Compare October 21, 2024 10:14
@lisongqian
Copy link
Contributor Author

@up2wing Thank you for your review. All comments have fixed, PTAL.

@lisongqian
Copy link
Contributor Author

Perhaps this could be behind a feature flag?

As @up2wing says, ivshmem needs to be enabled by passing a param, I don't think it matters to add a feature flag unless you consider more things? @rbradford

Copy link
Member

@liuw liuw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for being late to the party. Is there a way to test this in the CI so that it doesn't regress?

@liuw
Copy link
Member

liuw commented Oct 22, 2024

Pinging @cloud-hypervisor/cloud-hypervisor-reviewers - does anybody else that thoughts about this - i'm not sure about whether this fits into the "modern cloud" usescase.

Perhaps this could be behind a feature flag?

To me this enables a few interesting use cases.

@lisongqian lisongqian force-pushed the upstream/ivshmem branch 2 times, most recently from 1b699dd to b1776a0 Compare October 23, 2024 08:51
@lisongqian
Copy link
Contributor Author

Sorry for being late to the party. Is there a way to test this in the CI so that it doesn't regress?

I can add a case to test ivshmem device discovery but can't test the device function since our test kernel doesn't have a driver for ivshmem. So I'm not sure if we need to add this test case.

@liuw
Copy link
Member

liuw commented Oct 23, 2024

Sorry for being late to the party. Is there a way to test this in the CI so that it doesn't regress?

I can add a case to test ivshmem device discovery but can't test the device function since our test kernel doesn't have a driver for ivshmem. So I'm not sure if we need to add this test case.

Is there a plan to upstream the said driver?

I think a very basic test case will be to make sure the PCI device shows up correctly in the guest, with the correct BAR configuration. This can be done by checking lspci's output against some expected values.

@lisongqian lisongqian force-pushed the upstream/ivshmem branch 5 times, most recently from 01bb577 to ffcdb4d Compare August 12, 2025 16:07
@likebreath
Copy link
Member

Thank you for the fast turn around. With the latest integration test updates, it appears they caught some actual issues:

thread 'ivshmem::test_ivshmem' panicked at tests/integration.rs:2368:5:
assertion `left == right` failed
  left: "ivshmem device test data read"
 right: ""

@lisongqian lisongqian force-pushed the upstream/ivshmem branch 3 times, most recently from c20e697 to 51ef69c Compare August 13, 2025 17:01
Copy link
Member

@likebreath likebreath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lisongqian Thanks again for the contribution and persistency. I believe we are ready to merge this PR.

@likebreath likebreath added this pull request to the merge queue Aug 14, 2025
@likebreath likebreath moved this from ✅ Done to 👀 In review in Cloud Hypervisor Roadmap Aug 14, 2025
Merged via the queue into cloud-hypervisor:main with commit 9011ff2 Aug 14, 2025
41 checks passed
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in Cloud Hypervisor Roadmap Aug 14, 2025
@lisongqian lisongqian deleted the upstream/ivshmem branch August 15, 2025 02:32
@lisongqian
Copy link
Contributor Author

we

Thank you equally for your continued help. ❤️
Thanks to everyone who helped. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

8 participants