Hi Felix, > You're adding more failure cases here. But the callers of this > function currently don't check for errors. We'll need to fix that. > If the copy times out or fails otherwise, we should not pretend that > the migration succeeded. [...] We'll need to put all the migration > pages and clear the migrate->dst array before calling > migrate_vma_finalize. Also pass the error code back to the caller.
Fixed in v6: both svm_migrate_vma_to_vram() and svm_migrate_vma_to_ram() now check the copy_done() return. On error the dst pages are released (VRAM pages via svm_migrate_put_vram_page, system pages unmapped + unlocked + put) and migrate->dst is cleared before migrate_vma_finalize(), so a failed copy can no longer complete as a successful migration. The error propagates to the caller. The cleanup loops are the same logic the copy functions already run on their own error paths, factored into helpers (svm_migrate_vram_pages_put / svm_migrate_ram_pages_put) so both error paths share them. Re-verified on the MI50/Thunderbolt repro: SIGBUS, drain ~9s, clean removal, re-enumerates on re-power. Regards, Olivier
