| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
Thank you for your contribution!
Sorry, something went wrong.
| use core::fmt; | ||
| use uart_16550::backend::PioBackend; | ||
|
|
||
| pub struct SerialPort { |
There was a problem hiding this comment.
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.
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
Looks to me like it's spinning somewhere. I think it's spinning in receive_bytes_exact.
Sorry, something went wrong.
There was a problem hiding this comment.
could you help me investigating please? I'd love to understand why it fails
Sorry, something went wrong.
There was a problem hiding this comment.
could you help me investigating please? I'd love to understand why it fails
I tried looking into this yesterday. I think it's some kind of race condition in the self-test code. I can't trigger the issue reliably though. Adding artificial system load seems to make it easier to reproduce, but it's still not completely reliable.
For some reason, I had a harder time reproducing the error with the latest HEAD for uart_16550. I'm not sure why.
I might be able to take another look at this later today.
I think my next step is going to be looking at the serial port implementation in QEMU to see if there's anything that could explain the race condition (maybe asynchronous processing?).
Sorry, something went wrong.
There was a problem hiding this comment.
Interesting - the UEFI console takes ownership of the serial device by default. One must therefore disconnect the UEFI console from using the serial device (as long as boot services are active but one wants to use the serial device). I think this is the problem.
The forced disconnct is also fairly easy
Sorry, something went wrong.
There was a problem hiding this comment.
The forced disconnct is also fairly easy
How would one do that?
Here's something interesting: Wrapping the call to Uart16550Tty::new_port in x86_64::instructions::interrupts::without_interrupts fixes the issue. Disabling interrupts in the tty config (config.interrupts = IER::empty();) does not work however.
Sorry, something went wrong.
There was a problem hiding this comment.
The forced disconnct is also fairly easy
How would one do that?
Regarding interrupts:thanks! That's something I can use for my testing and debugging
Sorry, something went wrong.
There was a problem hiding this comment.
BTW I'm preparing an update of the uefi dependency
Sorry, something went wrong.
There was a problem hiding this comment.
Here's something interesting: Wrapping the call to Uart16550Tty::new_port in x86_64::instructions::interrupts::without_interrupts fixes the issue. Disabling interrupts in the tty config (config.interrupts = IER::empty();) does not work however.
Found the issue and fixed/documented everything. v0.8.0 will contain the fix. More info: rust-osdev/uart_16550#69
Sorry, something went wrong.
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.
There was a problem hiding this comment.
LGTM, thanks!
Sorry, something went wrong.
|
I think this caused a regression on real hardware (see #573) because of rust-osdev/uart_16550#65. |
Sorry, something went wrong.
|
Should we release a workaround until a fix is available? |
Sorry, something went wrong.
|
I would be in favor. I see two options: either revert this PR for now or gate the serial printing on check_connected. The latter should fix the hang, but would skip serial output on typical TX/RX/GND serial adapters... |
Sorry, something went wrong.
Let's go with the former. |
Sorry, something went wrong.
Experience has shown that enabling interrupts by default can lead to surprising behavior during initialization. In particular, if THR_EMPTY is enabled, init() may immediately trigger a THR_EMPTY interrupt before the function returns, unless initialization is performed with CPU interrupts disabled [0]. This is valid UART behavior, since the transmitter is empty when the interrupt is enabled, but it means that callers generally need to run the initialization sequence with CPU interrupts disabled to avoid handling an interrupt before init() has returned. Avoid imposing this requirement through the default configuration. Interrupts should instead be configured explicitly by API users according to their use case, without applying a smart or opinionated default selection. [0] rust-osdev/bootloader#565 (comment)
Experience has shown that enabling interrupts by default can lead to surprising behavior during initialization. In particular, if THR_EMPTY is enabled, init() may immediately trigger a THR_EMPTY interrupt before the function returns, unless initialization is performed with CPU interrupts disabled [0]. This is valid UART behavior, since the transmitter is empty when the interrupt is enabled, but it means that callers generally need to run the initialization sequence with CPU interrupts disabled to avoid handling an interrupt before init() has returned. Avoid imposing this requirement through the default configuration. Interrupts should instead be configured explicitly by API users according to their use case, without applying a smart or opinionated default selection. [0] rust-osdev/bootloader#565 (comment)
Experience has shown that enabling interrupts by default can lead to surprising behavior during initialization, unless initialization is performed with CPU interrupts disabled [0]. Let's use a safer and simpler default. [0] rust-osdev/bootloader#565 (comment)
Experience has shown that enabling interrupts by default can lead to surprising behavior during initialization, unless initialization is performed with CPU interrupts disabled [0]. Let's use a safer and simpler default. [0] rust-osdev/bootloader#565 (comment)
Experience has shown that enabling interrupts by default can lead to surprising behavior during initialization, unless initialization is performed with CPU interrupts disabled [0]. Let's use a safer and simpler default. [0] rust-osdev/bootloader#565 (comment)
| Back | FazBrowse Home | New Git URL |
Let's use the latest and greatest version