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, Jan 22, 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
Unknown Object (File)
Nov 5 2024, 10:21 AM
Unknown Object (File)
Oct 4 2024, 11:59 AM
Unknown Object (File)
Oct 4 2024, 9:27 AM
Unknown Object (File)
Oct 4 2024, 2:03 AM

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