All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: Damien Hedde <damien.hedde@greensocs.com>,
	Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>,
	Luc Michel <luc.michel@greensocs.com>
Subject: Re: [PATCH 0/4] clock: Get rid of clock_get_ns()
Date: Fri, 11 Dec 2020 14:50:50 +0100	[thread overview]
Message-ID: <a958bd8d-81fc-a134-18c4-f54b49f38fa6@amsat.org> (raw)
In-Reply-To: <20201208181554.435-1-peter.maydell@linaro.org>

On 12/8/20 7:15 PM, Peter Maydell wrote:
> This patchseries makes some changes to the clock API:
>  * Remove clock_get_ns()
>  * Add clock_ticks_to_ns() to return number of nanoseconds
>    it will take the clock to tick N times
>  * clock_display_freq() to return prettily-formatted string
>    for showing humans the approximate clock frequency
> 
> This is based on discussions we had about these APIs a little while
> back.  The core driver here is that the clock objects internally
> store the period in units of 2^-32 ns, so both clock_get_ns() and
> clock_get_hz() are inherently returning a rounded-off result, which
> can be badly inaccurate for fast clocks or if you want to multiply it
> by a large tick count.
> 
> Ideally I'd like to get rid of clock_get_hz() as well, but
> that looks trickier than handling clock_get_ns().
> 
> Patch 4 borrows a lot of the concept from one of Philippe's that he
> sent out previously.

Thanks for tackling the clock_get_ns() part. I had some work in
progress I was procrastinating for after the release, but your
patches are much better documented :)

(I also started to get rid of clock_get_hz() but, as you figured,
this is not a trivial task).

> NB: tested with 'make check' and 'make check-acceptance' only.

I hit this issue while testing Huacai's MIPS Loongson3 virt machine
which sets the core freq at 1GHz IIRC. I still have the branch
so I'll test your series (or v2) during the week-end.

Regards,

Phil.


  parent reply	other threads:[~2020-12-11 13:51 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-08 18:15 [PATCH 0/4] clock: Get rid of clock_get_ns() Peter Maydell
2020-12-08 18:15 ` [PATCH 1/4] clock: Introduce clock_ticks_to_ns() Peter Maydell
2020-12-08 23:39   ` Richard Henderson
2020-12-09  8:49     ` Luc Michel
2020-12-09 14:11       ` Richard Henderson
2020-12-09 14:26         ` Peter Maydell
2020-12-09 15:05           ` Richard Henderson
2020-12-10 20:47     ` Peter Maydell
2020-12-11  1:36       ` Richard Henderson
2020-12-08 18:15 ` [PATCH 2/4] target/mips: Don't use clock_get_ns() in clock period calculation Peter Maydell
2020-12-08 23:41   ` Richard Henderson
2020-12-09  8:50   ` Luc Michel
2020-12-08 18:15 ` [PATCH 3/4] clock: Remove clock_get_ns() Peter Maydell
2020-12-08 23:43   ` Richard Henderson
2020-12-09  8:50   ` Luc Michel
2020-12-08 18:15 ` [PATCH 4/4] clock: Define and use new clock_display_freq() Peter Maydell
2020-12-08 23:50   ` Richard Henderson
2020-12-09  8:50   ` Luc Michel
2020-12-11 13:50 ` Philippe Mathieu-Daudé [this message]
2020-12-11 14:01   ` [PATCH 0/4] clock: Get rid of clock_get_ns() Peter Maydell

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=a958bd8d-81fc-a134-18c4-f54b49f38fa6@amsat.org \
    --to=f4bug@amsat.org \
    --cc=aleksandar.rikalo@syrmia.com \
    --cc=damien.hedde@greensocs.com \
    --cc=luc.michel@greensocs.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.