Re: Waiting for bufdaemon

From: Kyle Evans <kevans_at_freebsd.org>
Date: Mon, 8 Mar 2021 11:07:23 -0600
On Mon, Mar 8, 2021 at 10:51 AM Yasuhiro Kimura <yasu_at_utahime.org> wrote:
>
> From: Yasuhiro Kimura <yasu_at_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
_at__at_ -501,7 +501,12 _at__at_ 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);
Received on Mon Mar 08 2021 - 16:07:38 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:27 UTC