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

Uhyve: Speed up serial output #1468

Merged
merged 2 commits into from
Jan 14, 2025
Merged

Uhyve: Speed up serial output #1468

merged 2 commits into from
Jan 14, 2025

Conversation

jounathaen
Copy link
Member

  • Uhyve: Use the SerialBufferWrite hypercall instead of the Uart hypercall: This reduces the number of serial output related hypercalls by ~3x.

Attention:

@jounathaen jounathaen force-pushed the serial_buffer_hypercall branch 3 times, most recently from 9437f94 to ea7ebb9 Compare December 2, 2024 13:30
@jounathaen jounathaen marked this pull request as ready for review December 2, 2024 13:31
@jounathaen jounathaen requested a review from mkroening December 2, 2024 13:32
Copy link
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

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

I don't feel good about including heapless since we have come so far without it, but I can't think of anything better. 👍

Regarding the general approach, it would be a lot nicer to have a proper io::BufWriter, but core::io is too far away still. (The most up-to-date approach I could find is wcampbell0x2a/no-std-io2, and even that has issues.

So leaving io::BufWriter aside, it might still be worthwhile to have this buffering strategy take place outside arch such that all serial ports can take advantage of it. For those that can't, the overhead will probably not be too bad, I think. Avoiding the \n check here by extracting this into external flush calls would also be nice sometime in the future when we have nice core::io abstractions.

@jounathaen
Copy link
Member Author

I agree with all your points. Especially, the unification of some IO functions across the architectures is desirable. But I'd still propose to merge this now and enhance later on.

@mkroening
Copy link
Member

But I'd still propose to merge this now and enhance later on.

Yeah, sure, but this is blocked on #1393.

Copy link
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

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

Could you rebase this, since #1393 is merged? :)

@jounathaen jounathaen force-pushed the serial_buffer_hypercall branch 3 times, most recently from f793bb4 to 766972f Compare January 13, 2025 13:03
Copy link
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

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

Would it make sense to move this to the arch-independent part Console (src/console.rs#L15-L17)?

That would drastically reduce the code duplication, make the code simpler, and avoid clippy::large_enum_variant. The additional overhead of doing an extra copy for byte-wise serial devices is probably negligible, I'd expect.

@mkroening mkroening self-assigned this Jan 13, 2025
@mkroening mkroening force-pushed the serial_buffer_hypercall branch from febbd13 to 383d77f Compare January 13, 2025 16:39
Copy link
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

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

Thanks!

Will merge after the CI on the first commit is green. :)

@mkroening mkroening force-pushed the serial_buffer_hypercall branch from 5e75e62 to b8cfb3b Compare January 13, 2025 16:43
Copy link
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

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

The output of the second commit is wrong. I'll look for the new line issue tomorrow.

@mkroening mkroening force-pushed the serial_buffer_hypercall branch from 1e64ff2 to 6004cfb Compare January 14, 2025 09:15
@mkroening mkroening enabled auto-merge January 14, 2025 09:37
@mkroening mkroening added this pull request to the merge queue Jan 14, 2025
Merged via the queue into main with commit 27b3706 Jan 14, 2025
13 checks passed
@mkroening mkroening deleted the serial_buffer_hypercall branch January 23, 2025 09:11
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.

2 participants