From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55461) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1eWr-0002sF-Bs for qemu-devel@nongnu.org; Mon, 30 Jun 2014 12:34:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1eWm-0007Gn-9X for qemu-devel@nongnu.org; Mon, 30 Jun 2014 12:34:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57310) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1eWm-0007Ga-00 for qemu-devel@nongnu.org; Mon, 30 Jun 2014 12:34:00 -0400 Message-ID: <53B19162.6060709@redhat.com> Date: Mon, 30 Jun 2014 18:33:38 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1404136749-523-1-git-send-email-sebastian.tanase@openwide.fr> <1404136749-523-3-git-send-email-sebastian.tanase@openwide.fr> In-Reply-To: <1404136749-523-3-git-send-email-sebastian.tanase@openwide.fr> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC PATCH V3 2/6] icount: Add align option to icount List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sebastian Tanase , qemu-devel@nongnu.org Cc: kwolf@redhat.com, peter.maydell@linaro.org, aliguori@amazon.com, wenchaoqemu@gmail.com, quintela@redhat.com, mjt@tls.msk.ru, mst@redhat.com, stefanha@redhat.com, armbru@redhat.com, lcapitulino@redhat.com, michael@walle.cc, alex@alex.org.uk, crobinso@redhat.com, afaerber@suse.de, rth@twiddle.net Il 30/06/2014 15:59, Sebastian Tanase ha scritto: > The align option is used for activating the align algorithm > in order to synchronise the host clock and the guest clock. > > Signed-off-by: Sebastian Tanase > Tested-by: Camille B=C3=A9gu=C3=A9 > --- > cpus.c | 13 +++++++++++++ > include/qemu-common.h | 1 + > qemu-options.hx | 15 +++++++++++++-- > vl.c | 4 ++++ > 4 files changed, 31 insertions(+), 2 deletions(-) > > diff --git a/cpus.c b/cpus.c > index dcca96a..3fa8ce7 100644 > --- a/cpus.c > +++ b/cpus.c > @@ -448,13 +448,24 @@ void configure_icount(QemuOpts *opts, Error **err= p) > vmstate_register(NULL, 0, &vmstate_timers, &timers_state); > option =3D qemu_opt_get(opts, "shift"); > if (!option) { > + if (qemu_opt_get(opts, "align") !=3D NULL) { > + error_setg(errp, "Please specify shift option when using a= lign"); > + } > return; > } > + icount_align_option =3D qemu_opt_get_bool(opts, "align", false); > /* When using -icount shift, the shift option will be > misinterpreted as a boolean */ > if (strcmp(option, "on") =3D=3D 0 || strcmp(option, "off") =3D=3D = 0) { > error_setg(errp, "The shift option must be a number or auto"); > } > + /* When using icount [shift=3D]N|auto -icount align, shift becomes > + align therefore we have to specify align=3Don|off. > + We do however inform the user whenever the case. */ > + if (strcmp(option, "align") =3D=3D 0) { > + error_setg(errp, "Please specify align=3Don or off so as not " > + "to create confusion between the shift and align options"); > + } Can you prepare a follow-up (on top of this patch) that instead adds=20 proper error handling to the strtol call below? Then these strcmps can=20 probably go away. Paolo