Il 03/10/2013 12:28, Lei Li ha scritto: > > The load_hook callback is only be called if the RAM_SAVE_FLAG_HOOK is > received. > To check this flags, it means there would be a check action first in > unix_accept_incoming_migration(), like: > > f = qemu_fopen_pipe(c, "rb"); > flags = qemu_get_be64(f); > if (flags == RAM_SAVE_FLAG_HOOK) { > load_hook(); > ... > } > > Otherwise, the incoming side has no idea whether the special 8-bytes record > (RAM_SAVE_FLAG_HOOK) is sent.
No, ram_load is taking care of checking for RAM_SAVE_FLAG_HOOK. If before_iterate writes the 8 bytes (followed by passing the fd for the pipe's read-side via SCM_RIGHTS), ram_load will call load_hook before it loads any page and load_hook will fetch the fd. Subsequent calls to load_hook will match data written by the sender's save_page hook (so they contain a RAM address, with the 4k page data sent on the pipe). Paolo