Skip to content

deps: bump uart_16550 to 0.6.0#565

Open
phip1611 wants to merge 2 commits into
rust-osdev:mainfrom
phip1611:uart
Open

deps: bump uart_16550 to 0.6.0#565
phip1611 wants to merge 2 commits into
rust-osdev:mainfrom
phip1611:uart

Conversation

@phip1611

@phip1611 phip1611 commented Jun 14, 2026

Copy link
Copy Markdown
Member

Let's use the latest and greatest version

@phip1611 phip1611 self-assigned this Jun 14, 2026
@phip1611 phip1611 changed the title deps: bump uart_16550 to 0.6.0 + streamline as workspace dep deps: bump uart_16550 to 0.6.0 Jun 14, 2026
@phip1611 phip1611 requested a review from phil-opp June 14, 2026 19:51
@phip1611 phip1611 requested a review from Freax13 June 14, 2026 19:54
phip1611 added 2 commits June 14, 2026 22:19
Uart16550 has a layout of (32 /* size*/, 4 /* align*/) whereas the old
SerialPort had (2, 2). The test shows that this small change is
sufficient to fail the test with the old stack size. We slightly increase
the stack therefore.
const BOOTLOADER_CONFIG: BootloaderConfig = {
let mut config = BootloaderConfig::new_default();
config.kernel_stack_size = 3000;
config.kernel_stack_size = 3032;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@phil-opp @Freax13 please take a look. I do not know enough about the current test structure. This change is in a dedicated commit. WDYT?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Judging by the generated assembly, my guess is that most of the stack usage seems to come from Result<T, Uart16550TtyError>. Uart16550TtyError is quite big (36 bytes). On lower optimization levels, the compiler isn't very smart about this and allocates a variable slot on the stack for every function call that returns Result<T, Uart16550TtyError>.

Let's add some safety margin to make sure this doesn't get tripped by future small regressions. How about 4000?

@Freax13 Freax13 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for your contribution!

Comment thread common/src/serial.rs
use core::fmt;
use uart_16550::backend::PioBackend;

pub struct SerialPort {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we replace SerialPort with Uart16550Tty? Both implement core::fmt::Write, so I don't see much of a reason to keep SerialPort around. Uart16550Tty also does the \n to \r\n conversion SerialPort does.

const BOOTLOADER_CONFIG: BootloaderConfig = {
let mut config = BootloaderConfig::new_default();
config.kernel_stack_size = 3000;
config.kernel_stack_size = 3032;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Judging by the generated assembly, my guess is that most of the stack usage seems to come from Result<T, Uart16550TtyError>. Uart16550TtyError is quite big (36 bytes). On lower optimization levels, the compiler isn't very smart about this and allocates a variable slot on the stack for every function call that returns Result<T, Uart16550TtyError>.

Let's add some safety margin to make sure this doesn't get tripped by future small regressions. How about 4000?

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