Page MenuHomeFreeBSD

bhyve: snapshot fix for ahci-cd
AbandonedPublic

Authored by gusev.vitaliy_gmail.com on Sep 1 2020, 11:08 AM.
Tags
Referenced Files
F81966083: D26266.diff
Tue, Apr 23, 9:01 PM
Unknown Object (File)
Sat, Apr 6, 3:30 AM
Unknown Object (File)
Jan 18 2024, 4:39 AM
Unknown Object (File)
Dec 22 2023, 11:14 PM
Unknown Object (File)
Dec 11 2023, 3:38 AM
Unknown Object (File)
Nov 19 2023, 4:19 PM
Unknown Object (File)
Nov 11 2023, 7:23 PM
Unknown Object (File)
Nov 9 2023, 7:18 PM

Details

Summary
Snapshot is interrupted with message:
    "pci_ahci_snapshot: invalid address: ioreq->cfis"

'ioreq->cfis' is NULL when is not initialized and can point
to not relevant address of the finished IO requests. In both
cases snapshot just needs to save NULL.
Test Plan

Suspend finishes without error and then resumed VM keeps working.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

I feel like the better fix for some of this is that the ioreq state should be saved in one place (e.g. in pci_ahci_snapshot_save_queues and pci_ahci_snapshot_restore_queues). This would allow the right logic to force cfis of free I/O requests to be NULL and only save the cfis for busy requests without requiring the true hack.

Doing the pause/resume for ahci-cd is probably the right change though, and I can commit that now.

In D26266#612113, @jhb wrote:

I feel like the better fix for some of this is that the ioreq state should be saved in one place (e.g. in pci_ahci_snapshot_save_queues and pci_ahci_snapshot_restore_queues). This would allow the right logic to force cfis of free I/O requests to be NULL and only save the cfis for busy requests without requiring the true hack.

Fail occurs before pci_ahci_snapshot_save_queues() is called. Current patch also can be as sanity check to prevent access data after request is done. There is no reason to keep wild pointer in free-list requests.

Let's please at least add subroutines for allocating request structures from the freelist and freeing request structures to the freelist, so the assignment aior->cfis = NULL isn't duplicated everywhere. There should also be a comment explaining why that assignment is there. I'd be willing to commit the diff then.

usr.sbin/bhyve/snapshot.c
157

This piece is already committed, the diff should be rebased.