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
F106199562: D40108.diff
Fri, Dec 27, 1:12 AM
Unknown Object (File)
Oct 2 2024, 10:20 PM
Unknown Object (File)
Oct 2 2024, 9:12 PM
Unknown Object (File)
Oct 2 2024, 8:57 PM
Unknown Object (File)
Oct 1 2024, 6:51 AM
Unknown Object (File)
Sep 28 2024, 10:14 AM
Unknown Object (File)
Sep 27 2024, 5:31 PM
Unknown Object (File)
Sep 25 2024, 11: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 Skipped
Unit
Tests Skipped

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).