Re: Changes to UART ns8250

From: Ian Lepore <ian_at_FreeBSD.org>
Date: Mon, 07 Oct 2013 14:26:23 -0600
On Mon, 2013-10-07 at 13:15 -0700, Adrian Chadd wrote:
> Hi,
> 
> You should add:
> 
> *[snip]
> * a DELAY(1) or something.
> 

Why?  Why oh why do people write 
  
 while (!read_some_status_register())
    DELAY(n);

when DELAY() is implemented as, roughly:

  while (read_some_counter_register() < something)
     continue;

The whole point of DELAY() is to busy-wait.  

What might be nice is some function that we can call in such a loop such
as cpu_busywait(), so that when running in an emulated or virtualized
environment the emulator or hypervisor could use that as a hint to do
something smart.

-- Ian
Received on Mon Oct 07 2013 - 18:26:34 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:42 UTC