Page MenuHomeFreeBSD

bhyve: [snapshot] Remove init_snapshot() and initialize static vars directly
ClosedPublic

Authored by gusev.vitaliy_gmail.com on Oct 17 2023, 2:55 PM.
Tags
Referenced Files
Unknown Object (File)
Wed, Apr 23, 8:19 PM
Unknown Object (File)
Sat, Apr 5, 5:53 PM
Unknown Object (File)
Feb 4 2025, 11:00 AM
Unknown Object (File)
Jan 26 2025, 8:01 PM
Unknown Object (File)
Jan 22 2025, 12:02 AM
Unknown Object (File)
Nov 15 2024, 9:18 AM
Unknown Object (File)
Nov 12 2024, 4:26 PM
Unknown Object (File)
Nov 12 2024, 3:56 PM

Details

Reviewers
corvink
rew
jhb
markj
Group Reviewers
bhyve
Summary

vCPU-s threads are starting before init_snapshot() is called. That can lead
to VM hangs in waiting of userspace vcpu_lock mutex.

init_snapshot() only initializes static variables (mutex, cv) and that code can be
optimized and removed.

Fixes: 9a9a248964696 ("bhyve: init checkput before caph_enter")

Sponsored by: vStack

Test Plan

Compile bhyve with BHYVE_SNAPSHOT.

Run VM with 8 vCPU-s:

bhyve \
        -AHPw \
        -c 8 -m 128M \
        -s 0,hostbridge \
        -s 31,lpc \
        -l com1,stdio \
        -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI_CODE.fd \
        efi

Run several times and each time type "reset" command in UEFI shell.

Without patch UEFI shell sometimes hangs after "reset" command and bhyve vCPU threads are trying to acquire userspace vcpu_lock mutex-es (snapshot.c).

Patched version works as expected.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped