Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Mar 2021 11:07:23 -0600
From:      Kyle Evans <kevans@freebsd.org>
To:        Yasuhiro Kimura <yasu@utahime.org>
Cc:        FreeBSD Current <freebsd-current@freebsd.org>
Subject:   Re: Waiting for bufdaemon
Message-ID:  <CACNAnaHDTeDmNWXTSU4TzF9C_CUpT_3Vr3GgmhjSqWaGWtjXBg@mail.gmail.com>
In-Reply-To: <20210309.015021.2131122829257392547.yasu@utahime.org>
References:  <CACNAnaEPJftb_1Jg94zpR4AoU5TKEjbXuYcAA0ByUmL0=hPQCg@mail.gmail.com> <YEVpwXGS5UBA8P44@kib.kiev.ua> <20210309.005732.1808108188909983665.yasu@utahime.org> <20210309.015021.2131122829257392547.yasu@utahime.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Mar 8, 2021 at 10:51 AM Yasuhiro Kimura <yasu@utahime.org> wrote:
>
> From: Yasuhiro Kimura <yasu@utahime.org>
> Subject: Re: Waiting for bufdaemon
> Date: Tue, 09 Mar 2021 00:57:32 +0900 (JST)
>
> > But still one question remains. Why have the value of
> > kern.timecounter.hardware and kern.timecounter.tc.ACPI-fast.counter
> > changed by applying the patch? My understanding is that it only makes
> > 'kern.timecounter.hardware' loader tunable that can be configured with
> > loader.conf. Is it unexpected side effect? Or is everything expected
> > result?
>
> Oops, I made a mistake.
>
> > If I do it with unpatched kernel, I get following result.
>
> This isn't correct. I did it with reverted kernel (i.e. 705d06b289e of
> main + revert of 84eaf2ccc6a). If I do it with really unpatch kernel,
> I get same result as patched one.
>
> Sorry for noise.
>

I've tried tracking down exactly what the problem is that causes the
symptoms we're seeing, but no luck so far. I'm eyeballing the
following patch which partially reverts kib's 84eaf2ccc6aa05 ("x86:
stop punishing VMs with low priority for TSC timecounter") and only
punishes VirtualBox guests.

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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACNAnaHDTeDmNWXTSU4TzF9C_CUpT_3Vr3GgmhjSqWaGWtjXBg>