On Sun, 10 May 2020, Maciej W. Rozycki wrote: > On Thu, 7 May 2020, Mikulas Patocka wrote: > > > > > I've created this patch that adds a global macro/variable > > > > serial_port_needs_delay. I've also deleted UPQ_DELAY_BEFORE_READ and test > > > > serial_port_needs_delay directly in io_serial_in, so that the compiler > > > > will optimize it out on non-alpha architectures. > > > > > > That's not good, what about systems with hundreds of serial ports? > > > > I doubt that someone will conect hundreds of serial ports to such an old > > alpha machine :) > > It would be good if PCI serial ports (on add-on cards) were unaffected. After reading the Alpha specification, I am convinced that the issue is not timing, but reordering or merging of accesses to the MMIO space. So, we need a barrier before a write (mandated by memory-barriers.txt), after a read (mandated by memory-barriers.txt) and between write and read (mandated by the alpha spec). The performance of serial ports could be improved if we changed it to use read_relaxed and write_relaxed (the serial port never does DMA, so we don't have to deal with DMA ordering). Mikulas