From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44938) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wx0KH-0001hC-8y for qemu-devel@nongnu.org; Tue, 17 Jun 2014 16:49:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wx0KD-0005dD-13 for qemu-devel@nongnu.org; Tue, 17 Jun 2014 16:49:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61808) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wx0KC-0005d3-PH for qemu-devel@nongnu.org; Tue, 17 Jun 2014 16:49:48 -0400 Message-ID: <53A0A9E2.5040706@redhat.com> Date: Tue, 17 Jun 2014 14:49:38 -0600 From: Eric Blake MIME-Version: 1.0 References: <1403021756-15960-1-git-send-email-mst@redhat.com> <1403021756-15960-79-git-send-email-mst@redhat.com> In-Reply-To: <1403021756-15960-79-git-send-email-mst@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="H6uv41aR8uOIu3tjmNkT4kdjcMFm1OLOt" Subject: Re: [Qemu-devel] [PULL 078/103] memory: add error propagation to file-based RAM allocation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" , qemu-devel@nongnu.org Cc: Peter Maydell , Eduardo Habkost , Juan Quintela , Hu Tao , Orit Wasserman , Anthony Liguori , Jan Kiszka , Paolo Bonzini , =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= , Wanlong Gao This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --H6uv41aR8uOIu3tjmNkT4kdjcMFm1OLOt Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 06/17/2014 11:41 AM, Michael S. Tsirkin wrote: > From: Paolo Bonzini >=20 > Right now, -mem-path will fall back to RAM-based allocation in some > cases. This should never happen with "-object memory-file", prepare > the code by adding correct error propagation. >=20 > Signed-off-by: Paolo Bonzini > Signed-off-by: Hu Tao > Acked-by: Michael S. Tsirkin > --- > @@ -1035,7 +1036,8 @@ static void *file_ram_alloc(RAMBlock *block, > } > =20 > if (kvm_enabled() && !kvm_has_sync_mmu()) { > - fprintf(stderr, "host lacks kvm mmu notifiers, -mem-path unsup= ported\n"); > + error_setg(errp, > + "host lacks kvm mmu notifiers, -mem-path unsupporte= d\n"); Please drop the trailing \n in a followup patch. > ram_addr_t qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr,= > - const char *mem_path) > + const char *mem_path, > + Error **errp) > { > RAMBlock *new_block; > =20 > if (xen_enabled()) { > - fprintf(stderr, "-mem-path not supported with Xen\n"); > - exit(1); > + error_setg(errp, "-mem-path not supported with Xen\n"); > + return -1; > } > =20 > if (phys_mem_alloc !=3D qemu_anon_ram_alloc) { > @@ -1280,16 +1286,22 @@ ram_addr_t qemu_ram_alloc_from_file(ram_addr_t = size, MemoryRegion *mr, > * phys_mem_alloc, but we haven't bothered to provide > * a hook there. > */ > - fprintf(stderr, > - "-mem-path not supported with this accelerator\n"); > - exit(1); > + error_setg(errp, > + "-mem-path not supported with this accelerator\n");= Two more instances. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --H6uv41aR8uOIu3tjmNkT4kdjcMFm1OLOt 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/ iQEcBAEBCAAGBQJToKniAAoJEKeha0olJ0NqiYQH/2mRbjRcEF65pj4EOsDH4kUx wQN+eA3Whl+EePXrRr5vHCl1+0QiH3PO4bNytV2roKoCEDjhh24O3Mmm3/slo4u/ Z1hZbppuSoUHZkD7cqJ8OSkmb/CZDj+Wa/cmqF5xo/ldTLve3qC9aC24FePPKTVJ 54QE7vyU3v1oGY/fxGeKWrdtWUvvOCgwlzTJzq4Th/3upxztdZBYeUOXiAj77CGn jKeDb006EofuwalR3bWNIFLTltIbqQa1kx3R5WyDRv+q5XwYVv+h66oGuBmu3c4X uZNiqIU5rebKX5kpfmYrMSMC9tmmolESWb+xIbcY8bdNv76W+dskmxGId0mXpHM= =cnr9 -----END PGP SIGNATURE----- --H6uv41aR8uOIu3tjmNkT4kdjcMFm1OLOt--