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)
Fri, May 10, 5:18 PM
Unknown Object (File)
Jan 11 2024, 12:18 PM
Unknown Object (File)
Dec 20 2023, 8:21 AM
Unknown Object (File)
Dec 10 2023, 12:01 AM
Unknown Object (File)
Oct 25 2023, 1:33 AM
Unknown Object (File)
Oct 17 2023, 4:11 PM
Unknown Object (File)
Oct 17 2023, 3:11 PM
Unknown Object (File)
Oct 17 2023, 3:10 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