On Saturday, March 19, 2016 05:22:16 AM Konstantin Belousov wrote:
> On Fri, Mar 18, 2016 at 07:48:49PM +0000, John Baldwin wrote:
> >  
> > -   for (x = 0; x < delay; x += 5) {
> > +   for (x = 0; x < delay; x++) {
> >             if ((lapic_read_icr_lo() & APIC_DELSTAT_MASK) ==
> >                 APIC_DELSTAT_IDLE)
> >                     return (1);
> > -           DELAY(5);
> > +           DELAY(1);
> >     }
> >     return (0);
> >  }
> 
> Ideally we would structure the loop differently. I think it is more
> efficient WRT latency to only block execution by ia32_pause(), and
> compare the the getbinuptime() results to calculate spent time, on each
> loop step.

Yes.  I've thought about using the TSC directly to do that, but folks are
worried about the TSC being unstable due to vcpus in a VM migrating
across physical CPUs.  DELAY() does seem to DTRT in that case assuming the
hypervisor doesn't advertise an invariant TSC via cpuid.  We'd have to
essentially duplicate DELAY() (really delay_tc()) inline.

-- 
John Baldwin
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to