Re: patch review: avoid com delay() in VMs

Christoph Badura <[email protected]>
Newsgroups gmane.os.netbsd.devel.kernel
Message-ID <[email protected]>
On Wed, Feb 05, 2025 at 09:34:21AM -0800, Jason Thorpe wrote:
> > On Feb 4, 2025, at 11:40 PM, Simon Burge <[email protected]> wrote:
> > Emile `iMil' Heitor wrote:
> > --- a/sys/dev/ic/com.c
> > +++ b/sys/dev/ic/com.c
> > @@ -589,8 +589,15 @@ com_attach_subr(struct com_softc *sc)
> >                        break;
> >                }
> > 
> > +               if (!inside_vm_guest()) {
> > +                       /*
> > +                        * Wait for output to finish.  No need for
> > +                        * a delay on virtual machines.
> > +                        */
> > +                       delay(10000);
> 
> As for the com(4)-specific bit: why are we inserting a blanket
> 10ms delay *at all*?  If we’re concerned about garbling
> output-in-progress on real hardware, isn’t there some register we
> can look at, or something?

That is a good question.  That delay was already present when cgd@ checked
in rev 1.1.  With no good explanation.

LSR bits 5 (THRE) and 6 (TSRE/TEMT) have been available since the original
INS8250 for checking if the transmitter is completely empty.

Why it didn't loop on those bits is anyone's guess.

--chris
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.