From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40653) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEh0c-0003Qc-67 for qemu-devel@nongnu.org; Fri, 23 Jan 2015 11:23:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YEh0V-0005Io-8L for qemu-devel@nongnu.org; Fri, 23 Jan 2015 11:22:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33042) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEh0V-0005Hj-0X for qemu-devel@nongnu.org; Fri, 23 Jan 2015 11:22:51 -0500 Message-ID: <54C27558.1080503@redhat.com> Date: Fri, 23 Jan 2015 09:22:48 -0700 From: Eric Blake MIME-Version: 1.0 References: <1418347746-15829-1-git-send-email-liang.z.li@intel.com> <1418347746-15829-4-git-send-email-liang.z.li@intel.com> In-Reply-To: <1418347746-15829-4-git-send-email-liang.z.li@intel.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="QnGrH1of6fRE10lhcmL9Alh9guedJ0lMT" Subject: Re: [Qemu-devel] [v3 03/13] migration: Add the framework of muti-thread decompression List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liang Li , qemu-devel@nongnu.org Cc: yang.z.zhang@intel.com, lcapitulino@redhat.com, armbru@redhat.com, dgilbert@redhat.com, quintela@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --QnGrH1of6fRE10lhcmL9Alh9guedJ0lMT Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 12/11/2014 06:28 PM, Liang Li wrote: In addition to David's catches: s/muti/multi/ in the subject line. Commit message feels sparse - is the one subject line really all we need to know about this framework? > Signed-off-by: Liang Li > Signed-off-by: Yang Zhang > --- > arch_init.c | 70 +++++++++++++++++++++++++++++++++++= ++++++++ > include/migration/migration.h | 4 +++ > migration.c | 15 ++++++++++ > 3 files changed, 89 insertions(+) >=20 > =20 > +/* using compressBound() to calculate the buffer size needed to save t= he > + * compressed data, to support the maximun TARGET_PAGE_SIZE bytes of > + * data, we need more 15 bytes, use 16 to align the data. > + */ > +#define COMPRESS_BUF_SIZE (TARGET_PAGE_SIZE + 16) > + > static int ram_load(QEMUFile *f, void *opaque, int version_id) > { > int flags =3D 0, ret =3D 0; > static uint64_t seq_iter; > + int len =3D 0; > + uint8_t compbuf[COMPRESS_BUF_SIZE]; > =20 Ouch - you stack-allocated more than a page of data. This is in general bad practice (and you should use the heap for any function that requires more than 4k of data) because there are some architectures (cough: windows) where exceeding the stack by more than a page risks silent termination of the application rather than a graceful SIGSEGV (if you can even call a stack overflow SIGSEGV graceful). Especially true when using helper threads, which typically have smaller stacks than the main application. > seq_iter++; > =20 > @@ -1201,6 +1259,18 @@ static int ram_load(QEMUFile *f, void *opaque, i= nt version_id) > =20 > qemu_get_buffer(f, host, TARGET_PAGE_SIZE); > break; > + case RAM_SAVE_FLAG_COMPRESS_PAGE: > + host =3D host_from_stream_offset(f, addr, flags); > + if (!host) { > + error_report("Illegal RAM offset " RAM_ADDR_FMT, addr)= ; s/Illegal/Invalid/ (the user isn't breaking a law, merely a constraint). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --QnGrH1of6fRE10lhcmL9Alh9guedJ0lMT Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJUwnVYAAoJEKeha0olJ0NqZr4H/0znmuyQvqT57m5CesGjvlSC uGPEOM7enrC83KcPA5v4UYFkGRLtUM5WVfieoudYx4vdqWzRiRS42kMpioeX8QHl ozr5poBVLt2pAKzTgeIjU2UgQ+eGpdkbBGsAKdqvG4xxwzGunwzImxZ50j5dWF/x wndD6+qMc/SVmtn/zcrNNXj7lETpKqmUugaplO8SrIJ2g7m2ZKTR/NYffcPpogxv usDB6bkVmte7N+rcMyT3WFDAH5eRFJ/OyEAmVbuxzmHpt5Z6Uci4VprBqYrtSEk2 69Ex/jt3MB7U1U0D5cEcbv2hD7rNAOYt2S75XHehZwY0Z5Pho2Z+R9Mj7BfUUNk= =+yA1 -----END PGP SIGNATURE----- --QnGrH1of6fRE10lhcmL9Alh9guedJ0lMT--