qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <lvivier@redhat.com>
To: "Richard W.M. Jones" <rjones@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org, David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [Qemu-devel] [PATCH] i6300esb: correctly convert watchdog clock ticks into nanoseconds
Date: Tue, 4 Aug 2015 12:25:37 +0200	[thread overview]
Message-ID: <55C09321.2080500@redhat.com> (raw)
In-Reply-To: <20150804101326.GS29283@redhat.com>



On 04/08/2015 12:13, Richard W.M. Jones wrote:
> 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]

Thank you Rich.

> [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.

The driver put 1024 in the counter for 1 second.

So for 520 seconds, we have ((520 * 1024) << 15) * 30 ns = 523 seconds
      2036 seconds          ((2046 * 1024) << 15) * 30 ns = 2059 seconds

So the emulation seems correct.

> [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.

I have no preference of which patch to include in QEMU.

This one is nicer but request the same kind of modification in other
devices, the V2 is a trivial bug fix (currently timer overflow at 256
seconds). I just want to have the bug fixed...

Laurent

      reply	other threads:[~2015-08-04 10:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-03 13:52 [Qemu-devel] [PATCH] i6300esb: correctly convert watchdog clock ticks into nanoseconds Laurent Vivier
2015-08-03 14:28 ` Laurent Vivier
2015-08-03 14:46   ` Richard W.M. Jones
2015-08-03 15:02     ` Paolo Bonzini
2015-08-03 15:13       ` Laurent Vivier
2015-08-03 15:18         ` Paolo Bonzini
2015-08-03 15:35           ` Laurent Vivier
2015-08-03 16:06             ` Paolo Bonzini
2015-08-03 15:06     ` Laurent Vivier
2015-08-04  8:27 ` [Qemu-devel] [PATCH][TRIVIAL] i6300esb: fix timer overflow Laurent Vivier
2015-08-04 13:47   ` Richard W.M. Jones
2015-08-05  0:01   ` David Gibson
2015-09-06 10:29   ` Michael Tokarev
2015-09-06 14:35     ` Paolo Bonzini
2015-09-06 14:41       ` Laurent Vivier
2015-08-04 10:13 ` [Qemu-devel] [PATCH] i6300esb: correctly convert watchdog clock ticks into nanoseconds Richard W.M. Jones
2015-08-04 10:25   ` Laurent Vivier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55C09321.2080500@redhat.com \
    --to=lvivier@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).