From owner-freebsd-current@freebsd.org Mon Mar 8 17:07:38 2021 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0C7FD577E8F for ; Mon, 8 Mar 2021 17:07:38 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DvPsj6zM1z4sm8 for ; Mon, 8 Mar 2021 17:07:37 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id DE3E0C4DC for ; Mon, 8 Mar 2021 17:07:37 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f176.google.com with SMTP id j3so8003868qtj.12 for ; Mon, 08 Mar 2021 09:07:37 -0800 (PST) X-Gm-Message-State: AOAM533PjNc1ywg+4rcieSkozs8ylbkOCKBca89siYtP+D57Mh7bqjWo 7KX9tS+XDJ4RYEfbr9y+KWfZJFTNjmw1tyFHufc= X-Google-Smtp-Source: ABdhPJw1LrOUJVSgy8swEP/5MAAclJrG46nsIzCeQam5IOKHSi6dtRNHau76EYnA2uHaxYATg5xC59xtV+/ejbuohf0= X-Received: by 2002:ac8:5947:: with SMTP id 7mr21616990qtz.60.1615223257369; Mon, 08 Mar 2021 09:07:37 -0800 (PST) MIME-Version: 1.0 References: <20210309.005732.1808108188909983665.yasu@utahime.org> <20210309.015021.2131122829257392547.yasu@utahime.org> In-Reply-To: <20210309.015021.2131122829257392547.yasu@utahime.org> From: Kyle Evans Date: Mon, 8 Mar 2021 11:07:23 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Waiting for bufdaemon To: Yasuhiro Kimura Cc: FreeBSD Current Content-Type: text/plain; charset="UTF-8" X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 17:07:38 -0000 On Mon, Mar 8, 2021 at 10:51 AM Yasuhiro Kimura wrote: > > From: Yasuhiro Kimura > 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);