From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43958) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZMZDw-0004K4-IY for qemu-devel@nongnu.org; Tue, 04 Aug 2015 06:13:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZMZDt-0006kA-QL for qemu-devel@nongnu.org; Tue, 04 Aug 2015 06:13:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47071) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZMZDt-0006hu-If for qemu-devel@nongnu.org; Tue, 04 Aug 2015 06:13:29 -0400 Date: Tue, 4 Aug 2015 11:13:26 +0100 From: "Richard W.M. Jones" Message-ID: <20150804101326.GS29283@redhat.com> References: <1438609948-3744-1-git-send-email-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="PaC+lnGZu4KSIdY4" Content-Disposition: inline In-Reply-To: <1438609948-3744-1-git-send-email-lvivier@redhat.com> Subject: Re: [Qemu-devel] [PATCH] i6300esb: correctly convert watchdog clock ticks into nanoseconds List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laurent Vivier Cc: Paolo Bonzini , qemu-devel@nongnu.org, David Gibson --PaC+lnGZu4KSIdY4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Aug 03, 2015 at 03:52:28PM +0200, Laurent Vivier wrote: > + /* A 33 Mhz clock gives a 30 ns tick, > + * convert timeout from ticks to ns > */ > - timeout = muldiv64(get_ticks_per_sec(), timeout, 33000000); > + timeout *= 30; I see that you've just posted a v2 of this patch. However here are the results of testing the above version. I used the attached test script which automates things, mostly. All times are in seconds. Requested timeout Observed timeout 60 58 120 120 250 249 270 271 500 501 [note 1] 520 522 1010 1016 1030 1035 2046 2058 2500 ioctl: WDIOC_SETTIMEOUT: error setting timeout: Invalid argument [note 2] [note 1] I'm not worried about the timeout being off by a few seconds, as that could easily be caused by inaccuracies in the test framework. [note 2] Maximum setting for i6300esb Linux driver is 2046, see linux.git/drivers/watchdog/i6300esb.c but note that the printed messages in the driver relating to the range of the timeout are not accurate. This patch looks good to me. I will test the v2 patch shortly. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v --PaC+lnGZu4KSIdY4 Content-Type: application/x-sh Content-Disposition: attachment; filename="i6300esb-test.sh" Content-Transfer-Encoding: quoted-printable #!/bin/bash -=0A=0Aset -e=0Aset -x=0A=0A# A git clone of the watchdog test = framework:=0A# http://git.annexia.org/?p=3Dwatchdog-test-framework.git;a=3D= summary=0A# compiled on the host.=0Atf=3D/home/rjones/d/watchdog-test-frame= work=0A=0A# The qemu binary we want to test.=0Aqemu=3D/home/rjones/d/qemu/x= 86_64-softmmu/qemu-system-x86_64=0A=0A# Build a CentOS 7.1 VM which will ru= n the tests.=0Acd /tmp=0Avirt-builder centos-7.1 \=0A --upload $tf/watch= dog-test:/root=0A=0Afor timeout in 60 120 250 270 500 520 1010 1030 2046 25= 00=0Ado=0A # Install a firstboot script which will run the test and=0A = # display output on the serial console.=0A virt-customize -a centos-7.= 1.img \=0A --firstboot-command "=0A /root/watchdog-test -= -timeout $timeout --yes=0A "=0A=0A # Boot the guest.=0A $qemu -nod= efconfig -nodefaults -display none \=0A -machine pc,accel=3Dkvm:tc= g \=0A -cpu host \=0A -m 1024 \=0A -hda centos-7= =2E1.img \=0A -watchdog i6300esb \=0A -watchdog-action po= weroff \=0A -serial stdio=0A echo=0A echo =3D=3D=3D qemu exi= ted =3D=3D=3D=0Adone=0A --PaC+lnGZu4KSIdY4--