tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

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



On Wed, Feb 05, 2025 at 09:34:21AM -0800, Jason Thorpe wrote:
> > On Feb 4, 2025, at 11:40 PM, Simon Burge <simonb%NetBSD.org@localhost> 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


Home | Main Index | Thread Index | Old Index