Waiting for bufdaemon

Ed Maste emaste at freebsd.org
Mon Mar 8 19:31:43 UTC 2021


On Mon, 8 Mar 2021 at 12:07, Kyle Evans <kevans at freebsd.org> wrote:
>
> diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c
> index 68fc57e6ea7..6f25360a67c 100644
> --- a/sys/x86/x86/tsc.c
> +++ b/sys/x86/x86/tsc.c
> @@ -501,7 +501,12 @@ test_tsc(int adj_max_count)
>         uint64_t *data, *tsc;
>         u_int i, size, adj;
>
> -       if ((!smp_tsc && !tsc_is_invariant) || vm_guest)
> +       /*
> +        * Misbehavior of TSC under VirtualBox has been observed.  In
> +        * particular, threads doing small (~1 second) sleeps may miss their
> +        * wakeup and hang around in sleep state, causing hangs on shutdown.
> +        */
> +       if ((!smp_tsc && !tsc_is_invariant) || vm_guest == VM_GUEST_VBOX)
>                 return (-100);
>         size = (mp_maxid + 1) * 3;
>         data = malloc(sizeof(*data) * size * N, M_TEMP, M_WAITOK);

This seems like a sensible change to me. To make it explicilty clear
what the comment/workaround applies to, maybe rewrite it as:

       if (!smp_tsc && !tsc_is_invariant)
               return (-100);
       /*
        * Misbehavior of TSC under VirtualBox has been observed.  In
        * particular, threads doing small (~1 second) sleeps may miss their
        * wakeup and hang around in sleep state, causing hangs on shutdown.
        */
       if (vm_guest == VM_GUEST_VBOX)
               return (-100);


More information about the freebsd-current mailing list