From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39960) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLd0E-0003x6-Nt for qemu-devel@nongnu.org; Thu, 06 Mar 2014 13:26:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLczx-00056r-61 for qemu-devel@nongnu.org; Thu, 06 Mar 2014 13:26:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60347) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLczw-00056M-U7 for qemu-devel@nongnu.org; Thu, 06 Mar 2014 13:26:25 -0500 Message-ID: <5318BDC8.4020004@redhat.com> Date: Thu, 06 Mar 2014 11:26:16 -0700 From: Eric Blake MIME-Version: 1.0 References: <1388704234-22498-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1388704234-22498-3-git-send-email-xiawenc@linux.vnet.ibm.com> <20140106172315.62a68140@redhat.com> In-Reply-To: <20140106172315.62a68140@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="fQCohGOJtX5OOhkF9Isb1DWg1rwluWrUQ" Subject: Re: [Qemu-devel] [RFC PATCH V2 2/5] qapi: add event helper functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino , Wenchao Xia Cc: mreitz@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --fQCohGOJtX5OOhkF9Isb1DWg1rwluWrUQ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 01/06/2014 03:23 PM, Luiz Capitulino wrote: > On Fri, 3 Jan 2014 07:10:31 +0800 > Wenchao Xia wrote: >=20 >> This file hold some functions that do not need to be generated. >> >> Signed-off-by: Wenchao Xia >> --- >> +static void timestamp_put(QDict *qdict) >> +{ >> + int err; >> + QObject *obj; >> + qemu_timeval tv; >> + >> + err =3D qemu_gettimeofday(&tv); >> + if (err < 0) { >> + return; >> + } >=20 > Hmm, I see this has always existed (and I guess I did it myself), but i= t's > not quite right. Sending an event w/o time info wouldn't be complaint t= o > the protocol spec. It's a good idea to fix this now. We have three opti= ons: >=20 > 1. abort() >=20 > 2. Skip sending the event altogether >=20 > 3. Add a bogus time value (say seconds=3D0 and microseconds=3D0) >=20 > I don't know what's best, but I guess I'd do item 3. Although I wonder > if zero is any better then no info at all (it's certainly complaint, bu= t > not a valid info). Maybe skip the event then? I have a patch pending[1] for libvirt (missed libvirt 1.2.2, but will be in 1.2.3) that exposes raw qemu events through libvirt-qemu.so (basically, as a debugging aid, similar to libvirt's 'virsh qemu-monitor-command', it will add 'virsh qemu-monitor-event'). In my implementation, I documented that seconds=3D-1 implies a missing timestam= p (at which point microseconds is ignored, but can be set to 0). So I'm in favor of option 3, but with -1 rather than 0 for seconds. [1]https://www.redhat.com/archives/libvir-list/2014-February/msg00000.htm= l --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --fQCohGOJtX5OOhkF9Isb1DWg1rwluWrUQ 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/ iQEcBAEBCAAGBQJTGL3IAAoJEKeha0olJ0Nq2gQH/3hQtSZEvD4Y3KHvLgucDS17 rcALnTgwZPYMrVvKjUHABdL8r20pH9f9nkvJPncnhyDb1md3lfwvIMDcJ5MFlUc8 UI/D5ZvCFAnkVreWJvtn2C9313iMQHES6XCJhi9xTYZMO+8G4Pl30Cf7tA+mBjH/ /invD07Fy73A2csLwyPvMqNytbhJPmBtSSOo+7Sy7QGNonJcsJuk886r5HsV7TdQ wQ3B7sIdcU26qqzEdVXlH869Bzo9AAMn1IOMRygdRngCwN0o24SAhFEnjlSNlGDR vs3mHjsbCuVgWNDzFIchvKwXG2is9drP6OQbIaYX+QcjMJpGWUkXY1MVgOrmW3g= =j07w -----END PGP SIGNATURE----- --fQCohGOJtX5OOhkF9Isb1DWg1rwluWrUQ--