Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Mar 2021 14:31:15 -0500
From:      Ed Maste <emaste@freebsd.org>
To:        Kyle Evans <kevans@freebsd.org>
Cc:        Yasuhiro Kimura <yasu@utahime.org>, FreeBSD Current <freebsd-current@freebsd.org>
Subject:   Re: Waiting for bufdaemon
Message-ID:  <CAPyFy2D-c559fQTtF%2B5kE_tPt8dFqDSGuWr6GfpDkG1fykwCbA@mail.gmail.com>
In-Reply-To: <CACNAnaHDTeDmNWXTSU4TzF9C_CUpT_3Vr3GgmhjSqWaGWtjXBg@mail.gmail.com>
References:  <CACNAnaEPJftb_1Jg94zpR4AoU5TKEjbXuYcAA0ByUmL0=hPQCg@mail.gmail.com> <YEVpwXGS5UBA8P44@kib.kiev.ua> <20210309.005732.1808108188909983665.yasu@utahime.org> <20210309.015021.2131122829257392547.yasu@utahime.org> <CACNAnaHDTeDmNWXTSU4TzF9C_CUpT_3Vr3GgmhjSqWaGWtjXBg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 8 Mar 2021 at 12:07, Kyle Evans <kevans@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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPyFy2D-c559fQTtF%2B5kE_tPt8dFqDSGuWr6GfpDkG1fykwCbA>