From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:37236) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RiXve-0005kj-0m for qemu-devel@nongnu.org; Wed, 04 Jan 2012 15:59:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RiXvc-0000aU-NP for qemu-devel@nongnu.org; Wed, 04 Jan 2012 15:59:21 -0500 Received: from e32.co.us.ibm.com ([32.97.110.150]:40619) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RiXvc-0000a9-Ht for qemu-devel@nongnu.org; Wed, 04 Jan 2012 15:59:20 -0500 Received: from /spool/local by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 4 Jan 2012 13:59:18 -0700 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q04KxE2V129492 for ; Wed, 4 Jan 2012 13:59:15 -0700 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q04KxE8Q021527 for ; Wed, 4 Jan 2012 13:59:14 -0700 Message-ID: <4F04BDA1.2060907@linux.vnet.ibm.com> Date: Wed, 04 Jan 2012 14:59:13 -0600 From: Michael Roth MIME-Version: 1.0 References: <1325604879-15862-1-git-send-email-owasserm@redhat.com> <1325604879-15862-5-git-send-email-owasserm@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v5 4/9] Add host_from_stream_offset_versioned function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: blauwirbel@gmail.com, Orit Wasserman , qemu-devel@nongnu.org, quintela@redhat.com On 01/04/2012 06:00 AM, Stefan Hajnoczi wrote: > On Tue, Jan 3, 2012 at 3:34 PM, Orit Wasserman wrote: >> +static inline void *host_from_stream_offset_versioned(int version_id, >> + QEMUFile *f, ram_addr_t offset, int flags) >> +{ >> + void *host; >> + if (version_id == 3) { >> + host = qemu_get_ram_ptr(offset); >> + } else { >> + host = host_from_stream_offset(f, offset, flags); >> + } >> + if (!host) { >> + fprintf(stderr, "Failed to convert RAM address to host" >> + " for offset 0x%lX!\n", offset); >> + abort(); >> + } > > Please use RAM_ADDR_FMT instead of %lX. > > Aborting isn't ideal but I guess there is nothing else we can do at this point. > Currently we we return -EINVAL to qemu_loadvm_state() when !host, which prints potentially useful warnings and exits gracefully for migration, and for savevm we print the warnings and fire up the main_loop with vcpus paused... Not sure what the rationale is for the latter, but it may have some utility (debugging maybe?). In any case, since the error paths are covered in some fashion I don't think we should resort to aborting here, maybe just print the warnings and check for NULL return in the callers as before. > Stefan >