qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Weil <sw@weilnetz.de>
To: Alexander Graf <agraf@suse.de>, QEMU Developers <qemu-devel@nongnu.org>
Cc: Bharat Bhushan <bharat.bhushan@freescale.com>,
	"qemu-ppc@nongnu.org list:PowerPC" <qemu-ppc@nongnu.org>,
	Fabien Chouteau <chouteau@adacore.com>
Subject: Re: [Qemu-devel] [PATCH 1.7 v2 2/2] PPC: BookE: Make FIT/WDT timers at best millisecond grained
Date: Tue, 26 Nov 2013 07:20:59 +0100	[thread overview]
Message-ID: <52943DCB.9000609@weilnetz.de> (raw)
In-Reply-To: <1385416015-22775-3-git-send-email-agraf@suse.de>

Am 25.11.2013 22:46, schrieb Alexander Graf:
> The default granularity for the FIT timer on 440 is on every 0x1000th
> transition of TB from 0 to 1. Translated that means 48828 times a second.
>
> Since interrupts are quite expensive for 440 and we don't really care
> about the accuracy of the FIT to that significance, let's force FIT and
> WDT to at best millisecond granularity.
>
> This basically restores behavior as it was in QEMU 1.6, where timers
> could only deal with millisecond granularities at all.
>
> This patch greatly improves performance with the 440 target and restores
> roughly the same performance level that QEMU 1.6 had for me.
>
> Signed-off-by: Alexander Graf <agraf@suse.de>
>
> ---
>
> v1 -> v2:
>
>   - s/microseconds/milliseconds/g
> ---
>  hw/ppc/ppc_booke.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/hw/ppc/ppc_booke.c b/hw/ppc/ppc_booke.c
> index 56c4196..b421620 100644
> --- a/hw/ppc/ppc_booke.c
> +++ b/hw/ppc/ppc_booke.c
> @@ -174,6 +174,12 @@ static void booke_update_fixed_timer(CPUPPCState         *env,
>  
>      if (*next == now) {
>          (*next)++;
> +    } else {
> +        /*
> +         * There's no point to fake any granularity that's more fine grained
> +         * than milliseconds. Anything beyond that just overloads the system.
> +         */
> +        *next = MAX(*next, now + SCALE_MS);
>      }
>  
>      /* Fire the next timer */

Reviewed-by: Stefan Weil <sw@weilnetz.de>

Looking closer at the code above, I think that the 'if' part (*next)++
could be removed because the 'else' part does a better job with *next =
*next + SCALE_MS when *next == now. This might further improve the
performance. Maybe I am wrong and the guest expects the next timer
interrupt immediately in this case, then delaying it one millisecond
would be bad.

If you decide to make a v3 patch with this modification, you may use my
reviewed-by, too.

I cannot say much to patch 1 because I don't know the BookE hardware.
The code looks good.

Regards,
Stefan

      reply	other threads:[~2013-11-26  6:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-25 21:46 [Qemu-devel] [PATCH 1.7 v2 0/2] PPC: Fix BookE timer performance regression Alexander Graf
2013-11-25 21:46 ` [Qemu-devel] [PATCH 1.7 v2 1/2] PPC: Make BookE FIT/WDT timers more lazy Alexander Graf
2013-11-25 21:46 ` [Qemu-devel] [PATCH 1.7 v2 2/2] PPC: BookE: Make FIT/WDT timers at best millisecond grained Alexander Graf
2013-11-26  6:20   ` Stefan Weil [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=52943DCB.9000609@weilnetz.de \
    --to=sw@weilnetz.de \
    --cc=agraf@suse.de \
    --cc=bharat.bhushan@freescale.com \
    --cc=chouteau@adacore.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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 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).