beckus / qemu_stm32

QEMU with an STM32 microcontroller implementation
http://beckus.github.io/qemu_stm32/
Other
524 stars 144 forks source link

WIP: Fix slow event loop #30

Closed kousu closed 5 years ago

kousu commented 5 years ago

It is possible for stm32_uart_rx_timer_expire() to happen before stm32_uart_receive(). In this case, stm32_uart_receive() can jam, running at the rate of the core qemu event loop, which, experimentally, is 1Hz. This makes I/O to a virtual USART device appear so slow as to not be happening at all, or maybe it triggers #7.

This patch address this by resetting the I/O timer every time it expires (much like javascript's setTimeout loops). For my use case, this completely eliminates the flaky I/O issues I've been having with qemu_stm32.

beckus commented 5 years ago

Great, thanks for identifying and fixing this!