On Tue, Aug 15, 2023 at 07:42:24PM -0300, Fabiano Rosas wrote:
> Yep, I see that. I meant explicitly move the code into the loop. Feels a
> bit weird to check the QEMUFile for errors first thing inside the
> function when nothing around it should have touched the QEMUFile.

Valid point.  This reminded me that now we have one indirection into
->ram_save_target_page() which is a hook now.  Putting in the caller will
work for all hooks, even though they're not yet exist.

But since we don't have any other hooks yet, it'll be the same for now.

Acked-by: Peter Xu <pet...@redhat.com>

For the long term: there's one more reason to rework qemu_put_byte()/... to
return error codes.. Then things like save_normal_page() can simply already
return negatives when hit an error.

Fabiano - I see that you've done quite a few patches in reworking migration
code.  I had that for a long time in my todo, but if you're interested feel
free to look into it.

IIUC the idea is introducing another similar layer of API for qemufile (I'd
call it qemu_put_1|2|4|8(), or anything you can come up better with..) then
let migration to switch over to it, with retval reflecting errors.  Then we
should be able to drop this patch along with most of the explicit error
checks for the qemufile spread all over.

-- 
Peter Xu


Reply via email to