Page MenuHomeFreeBSD

bhyve: [snapshot] Add .pe_snapshot method for PCI 'hostbridge'
ClosedPublic

Authored by gusev.vitaliy_gmail.com on May 15 2023, 2:03 PM.
Tags
Referenced Files
Unknown Object (File)
Jan 15 2024, 10:29 AM
Unknown Object (File)
Dec 20 2023, 12:42 AM
Unknown Object (File)
Dec 10 2023, 7:27 PM
Unknown Object (File)
Nov 25 2023, 3:14 AM
Unknown Object (File)
Nov 11 2023, 4:09 PM
Unknown Object (File)
Nov 8 2023, 10:52 PM
Unknown Object (File)
Sep 15 2023, 2:53 PM
Unknown Object (File)
Sep 6 2023, 4:26 AM

Details

Summary

Related to multiple devices support.

There is no error when dump doesn't have it, but to be more consistent this PCI devices should be saved as well.

Sponsored by: vStack

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

rew added a subscriber: rew.

not sure that devices should define a snapshot handler when not supported by the device.

pci_snapshot() could be setup to silently ignore devices that dont implement snapshot functionality.

either way, I don't have a preference

This revision is now accepted and ready to land.May 15 2023, 5:39 PM
In D40108#913423, @rew wrote:

not sure that devices should define a snapshot handler when not supported by the device.

At least it saves pdi.pi_cfgdata. Do you think it is waste doing and .pi_cfgdata can not be changed by guest OS or be changed between bhyve versions ?

pci_snapshot() could be setup to silently ignore devices that dont implement snapshot functionality.

either way, I don't have a preference

Currently it is mandatory to have .pe_snapshot(). Some devices do not support save/restore, for example, virtio-scsi. And if allow to be .pe_snapshot() as optional, bhyve process will be snapshotted, but result snapshot can not be resumed properly.

In D40108#913423, @rew wrote:

not sure that devices should define a snapshot handler when not supported by the device.

At least it saves pdi.pi_cfgdata.

I meant original code does not save PCI 'hostbridge' device at all.

At least it saves pdi.pi_cfgdata. Do you think it is waste doing and .pi_cfgdata can not be changed by guest OS or be changed between bhyve versions ?

I don't know off the top of my head - haven't looked at it that close.

Currently it is mandatory to have .pe_snapshot(). Some devices do not support save/restore, for example, virtio-scsi. And if allow to be .pe_snapshot() as optional, bhyve process will be snapshotted, but result snapshot can not be resumed properly.

Alright.

Why don't we call pci_snapshot_pci_dev unconditionally even if pe_snapshot is NULL?

Why don't we call pci_snapshot_pci_dev unconditionally even if pe_snapshot is NULL?

If .pe_snapshot() is NULL, save stage must fail. Otherwise it will succeed for PCI devices that still don't support suspend/resume, but resume will be Undefined behavior (UB).