From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43870) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRgFE-0006MI-0j for qemu-devel@nongnu.org; Thu, 03 Oct 2013 06:35:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VRgF8-0007Lj-0S for qemu-devel@nongnu.org; Thu, 03 Oct 2013 06:34:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47012) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRgF7-0007Lf-Oy for qemu-devel@nongnu.org; Thu, 03 Oct 2013 06:34:49 -0400 Message-ID: <524D4853.5030907@redhat.com> Date: Thu, 03 Oct 2013 12:34:59 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1380119568-5530-1-git-send-email-lilei@linux.vnet.ibm.com> <5242FAE8.6030807@redhat.com> <52442C16.7000200@linux.vnet.ibm.com> <524CEC9A.6050602@linux.vnet.ibm.com> <524D2985.8050301@redhat.com> <524D46E0.7010002@linux.vnet.ibm.com> In-Reply-To: <524D46E0.7010002@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 0/8 RFC] migration: Introduce side channel for RAM List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Lei Li Cc: aarcange@redhat.com, quintela@redhat.com, qemu-devel@nongnu.org, mrhines@linux.vnet.ibm.com, mdroth@linux.vnet.ibm.com, anthony@codemonkey.ws, lagarcia@br.ibm.com, rcj@linux.vnet.ibm.com 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