On Mon, Aug 29, 2022 at 12:02:42PM -0500, Scott Cheloha wrote:
> If hv_delay() never causes a vm exit, but tsc_delay() *might* cause a
> vm exit, and both have microsecond or better resolution, then
> hv_delay() is the preferable delay(9) implementation where it is
> available because vm exits have ambiguous overhead.

with hv_delay() currently doing rdmsr I wouldn't say never

> 
> If that seems sensible to you, I'll commit this switch.

There is a msr to allow cpuid to report invariant tsc (0x40000118).
Used by linux but not documented in the hyper-v tlfs.

Without that, tsc delay is never used on hyper-v.  So leave it
as is until someone running hyper-v/azure would like it changed?

> 
> Index: arch/amd64/amd64/tsc.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/amd64/amd64/tsc.c,v
> retrieving revision 1.26
> diff -u -p -r1.26 tsc.c
> --- arch/amd64/amd64/tsc.c    25 Aug 2022 17:38:16 -0000      1.26
> +++ arch/amd64/amd64/tsc.c    29 Aug 2022 16:58:25 -0000
> @@ -109,7 +109,7 @@ tsc_identify(struct cpu_info *ci)
>  
>       tsc_frequency = tsc_freq_cpuid(ci);
>       if (tsc_frequency > 0)
> -             delay_init(tsc_delay, 5000);
> +             delay_init(tsc_delay, 4000);
>  }
>  
>  static inline int
> Index: dev/pv/pvbus.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pv/pvbus.c,v
> retrieving revision 1.25
> diff -u -p -r1.25 pvbus.c
> --- dev/pv/pvbus.c    25 Aug 2022 17:38:16 -0000      1.25
> +++ dev/pv/pvbus.c    29 Aug 2022 16:58:26 -0000
> @@ -320,7 +320,7 @@ pvbus_hyperv(struct pvbus_hv *hv)
>  
>  #if NHYPERV > 0
>       if (hv->hv_features & CPUID_HV_MSR_TIME_REFCNT)
> -             delay_init(hv_delay, 4000);
> +             delay_init(hv_delay, 5000);
>  #endif
>  }
>  
> 
> 

Reply via email to