Skip to content

Conversation

@uran0sH
Copy link
Contributor

@uran0sH uran0sH commented Jul 9, 2025

Summary of the PR

Eventfd is Linux-specific. To support more platforms, we replace it with
the EventNotifier/EventConsumer abstractions.
EventSender and EventReceiver are wrappers that encapsulate eventfd functionality
Use pipefd to replace eventfd in the test.

Requirements

Before submitting your PR, please make sure you addressed the following
requirements:

  • [ x ] All commits in this PR have Signed-Off-By trailers (with
    git commit -s), and the commit message has max 60 characters for the
    summary and max 75 characters for each description line.
  • [ x ] All added/changed functionality has a corresponding unit/integration
    test.
  • [ x ] All added/changed public-facing functionality has entries in the "Upcoming
    Release" section of CHANGELOG.md (if no such section exists, please create one).
  • [ x ] Any newly added unsafe code is properly documented.

@uran0sH
Copy link
Contributor Author

uran0sH commented Jul 9, 2025

@stefano-garzarella stefano-garzarella marked this pull request as draft July 9, 2025 16:34
@stefano-garzarella
Copy link
Member

@uran0sH marked as draft, since we need a new vmm-sys-util release before merging this.

@stefano-garzarella
Copy link
Member

@uran0sH please rebase and check CI (come failures need the new rust version we are updating in the CI, but others are related to format, etc.)

@stefano-garzarella
Copy link
Member

@uran0sH we just merged #309 so you should be able to use the new API requiring 1.87

@stefano-garzarella
Copy link
Member

@uran0sH please check the CI, there some clippy warning to fix, but also some tests blocked for more than 60s. Should I restart the CI or it's an issue we need to fix?

@uran0sH
Copy link
Contributor Author

uran0sH commented Jul 21, 2025

@uran0sH please check the CI, there some clippy warning to fix, but also some tests blocked for more than 60s. Should I restart the CI or it's an issue we need to fix?

I think it's an issue

@uran0sH uran0sH force-pushed the event-abstract branch 2 times, most recently from 27ee193 to 8f825e0 Compare July 22, 2025 16:31
@uran0sH
Copy link
Contributor Author

uran0sH commented Jul 22, 2025

@uran0sH please check the CI, there some clippy warning to fix, but also some tests blocked for more than 60s. Should I restart the CI or it's an issue we need to fix?

I think it's an issue

Fix this issue by changing this line to into_raw_fd() (https://github.com/rust-vmm/vhost/pull/308/files#diff-e1c9dc7802234bc118de8314ec9cacc98066eea325a6f14ff5887ece3466d5a3R96). Because when we use pipe, using as_raw_fd will cause the consumer's fd to be closed, like this (https://github.com/rust-vmm/vhost/pull/308/files#diff-c9eba2d5821720c1f7e164d0d01d85b14040d8f3200fac89607fdd1af09d5491R111). So we need to take the ownership of this fd.

@uran0sH uran0sH force-pushed the event-abstract branch 3 times, most recently from 985bc12 to 3d0aee3 Compare August 5, 2025 14:35
@uran0sH
Copy link
Contributor Author

uran0sH commented Aug 5, 2025

This pr(rust-vmm/vmm-sys-util#246) seems cause the ci failed:

thread 'vhost_user::connection::tests::send_fd' panicked at vhost/src/vhost_user/connection.rs:763:50:
called `Result::unwrap()` on an `Err` value: SocketRetry(Os { code: 105, kind: Uncategorized, message: "No buffer space available" })
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

So I used the version before this PR was merged

@stefano-garzarella
Copy link
Member

This pr(rust-vmm/vmm-sys-util#246) seems cause the ci failed:

thread 'vhost_user::connection::tests::send_fd' panicked at vhost/src/vhost_user/connection.rs:763:50:
called `Result::unwrap()` on an `Err` value: SocketRetry(Os { code: 105, kind: Uncategorized, message: "No buffer space available" })
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

So I used the version before this PR was merged

@uran0sH please open an issue ASAP on the project, we are preparing a release

@uran0sH
Copy link
Contributor Author

uran0sH commented Aug 5, 2025

This pr(rust-vmm/vmm-sys-util#246) seems cause the ci failed:

thread 'vhost_user::connection::tests::send_fd' panicked at vhost/src/vhost_user/connection.rs:763:50:
called `Result::unwrap()` on an `Err` value: SocketRetry(Os { code: 105, kind: Uncategorized, message: "No buffer space available" })
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

So I used the version before this PR was merged

@uran0sH please open an issue ASAP on the project, we are preparing a release

Yeah, see rust-vmm/vmm-sys-util#252

@roypat
Copy link
Member

roypat commented Aug 6, 2025

This pr(rust-vmm/vmm-sys-util#246) seems cause the ci failed:

thread 'vhost_user::connection::tests::send_fd' panicked at vhost/src/vhost_user/connection.rs:763:50:
called `Result::unwrap()` on an `Err` value: SocketRetry(Os { code: 105, kind: Uncategorized, message: "No buffer space available" })
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

So I used the version before this PR was merged

I think this is expected. Looking at the test, it's a negative test:

        // Following communication pattern should not work:
        // Sending side: data(header, body) with fds
        // Receiving side: data(header), data(body) with fds

and indeed, doing recv_with_fds with 0 fds when actually there are fds, causes linux to set MSG_CTRUNC and thus after #252 that is converted into an ENOBUFS (although on MacOS it'll work).

Copy link
Collaborator

@germag germag left a comment

Choose a reason for hiding this comment

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

Update to v0.15.0 which supports sock_ctrl_msg on POSIX and adds
a cross platform event notification that uses EventFd when available
or pipe().

Because sock_ctrl_msg modifies the recv_with_fds, we need to modify the test
in vhost/src/vhost-user/connection.rs at the same time

Signed-off-by: Wenyu Huang <huangwenyuu@outlook.com>
Eventfd is Linux-specific. To support more platforms, we replace it with
the EventNotifier/EventConsumer abstractions.
EventSender and EventReceiver are wrappers that encapsulate eventfd functionality
Use pipefd to replace eventfd in the test.

Signed-off-by: Wenyu Huang <huangwenyuu@outlook.com>
@stefano-garzarella stefano-garzarella enabled auto-merge (rebase) August 27, 2025 08:11
@stefano-garzarella stefano-garzarella merged commit 18bf2a5 into rust-vmm:main Aug 27, 2025
31 checks passed
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.

4 participants