Bug 253087 - Timeout of bufdaemon happens at shutdown time with -CURRENT amd64 and VirtualBox VM
Summary: Timeout of bufdaemon happens at shutdown time with -CURRENT amd64 and Virtual...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-virtualization (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-29 22:35 UTC by Yasuhiro Kimura
Modified: 2021-02-16 19:46 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yasuhiro Kimura 2021-01-29 22:35:41 UTC
[Host]
CPU: Intel Core i7 9700 3.00GHz
OS: 64bit Windows 10 20H2
VirtualBox: 6.1.18

[VM]
CPU: 4 core
Mem: 8GB
HDD: 100GB

Since December I've been experiencing the problem that timeout of bufdaemon happens at shutdown time with -CURRENT amd64 and VirtualBox VM under above conditions. The problem happens when I login the VM and do something to certain extent. For example the problem is reproducible by doing `make buildworld`.

The same problem was reported by AMD Ryzen users at freebsd-current ML and fix for the CPU was already committed. But in my case CPU is Intel and fix for AMD Ryzen doesn't solve the problem of course. So I tried bisect of source tree and found that following commit is the source of the problem.

----------------------------------------------------------------------
commit 84eaf2ccc6aa05da7b7389991d3023698b756e3f
Author: Konstantin Belousov <kib@FreeBSD.org>
Date:   Mon Dec 21 19:02:31 2020 +0200

    x86: stop punishing VMs with low priority for TSC timecounter
    
    I suspect that virtualization techniques improved from the time when we
    have to effectively disable TSC use in VM.  For instance, it was reported
    (complained) in https://github.com/JuliaLang/julia/issues/38877 that
    FreeBSD is groundlessly slow on AWS with some loads.
    
    Remove the check and start watching for complaints.
    
    Reviewed by:    emaste, grehan
    Discussed with: cperciva
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D27629
----------------------------------------------------------------------

I confirmed that the problem still happens with f17fc5439f517d06ac8976f53354789cde5a7427 committed at Fri Jan 29 09:34:27 2021 -0500 but reverting above one fixes the problem. Moreover same problem happens with 40cb0344eb27e0bb9a112ff50812a7e77816d6be of stable/13 committed at Thu Jan 28 18:59:57 2021 -0500 and and reverting above one also fixes the problem.

Cc-ing the committer of 84eaf2ccc6aa05da7b7389991d3023698b756e3f
Comment 1 Yasuhiro Kimura 2021-02-16 19:46:48 UTC
Following is detailed step of reproducing this problem.

1.  Download FreeBSD-14-CURRENT-20210211-c511a5ab53b-256609-disc1.iso from FreeBSD.org download server (https://download.freebsd.org/)

2.  Create new VirtualBox VM with following settings. -- (*1)

    General:
      Name: FreeBSD
      Operating System: FreeBSD (64-bit)
    System:
      Base Memory: 8192 MB
      Processors: 4
      Boot Order: Hard Disk
      EFI: Enabled
      Acceleration: VT-x/AMD-V, Nested Paging
    Display:
      Video Memory: 16 MB
      Graphic Controller: VMSVGA
      Remote Desktop Server: Disabled
      Recording: Disabled
    Storage:
      Controller: AHCI
        SATA Port 0: FreeBSD.vdi (Normal 100GB)
        SATA Port 1: [Optical Drive] FreeBSD-14-CURRENT-20210211-c511a5ab53b-256609-disc1.iso 
    Audio:
      Disabled
    Network:
      Adapter 1: Intal PRO/1000 MT Desktop (Bridged Adapter, Realtek PCIe GBE Family Controller)
    USB:
      USB Controller: OHCI EHCI
      Device Filters: 0 (0 active)
    Shared folders:
      None

3.  Start VM

4.  Install OS with following settings. -- (*2)

    * Use default keymap
    * Install base, kernel and lib32
    * Select 'Auto (ZFS)' as partitioning
    * Change 2 items of ZFS configuration
      - Partition scheme -> GPT (UEF1)
      - Swap Size -> 8g
    * Select 'stripe' as Virtual Device Type
    * Select 'ada0: VBOX HEADDISK'
    * Configure 'em0' as following
      IPv4: manual configuration
      IPv6: disabled
    * Set Time Zone to 'Asia/Japan'
    * Enable 'sshd', 'ntpdate', 'ntpd' and 'dumpdev'
    * No security hardening options
    * Don't add user accounts
    * Do nothing at final configuration
    * Don't do manual configuration
    * Reboot

5.  Login as root

6.  cd /usr

7.  pkg install git-tiny

8.  git clone https://git.freebsd.org/src.git

9.  cd src

10. make -j 4 buildworld

11 shutdown -h now

Note: (*1),(*2)
Not sure if each setting affects the problem. I just wrote what I did while creating VM and installing OS.