All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: [Qemu-devel] Re: [PATCH 2/3] Correct alarm deadline computation
Date: Tue, 01 Feb 2011 14:01:56 +0100	[thread overview]
Message-ID: <4D480444.6070801@siemens.com> (raw)
In-Reply-To: <1296510679-12268-3-git-send-email-pbonzini@redhat.com>

On 2011-01-31 22:51, Paolo Bonzini wrote:
> When the QEMU_CLOCK_HOST clock was added, computation of its
> deadline was added to qemu_next_deadline, which is correct but
> incomplete.
> 
> I noticed this by reading the very convoluted rules whereby
> qemu_next_deadline_dyntick is computed, which miss QEMU_CLOCK_HOST
> when use_icount is true.  This patch inlines qemu_next_deadline
> into qemu_next_deadline_dyntick, and then corrects the logic to skip
> only QEMU_CLOCK_VIRTUAL when use_icount is true.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  qemu-timer.c |   15 +++++++++++----
>  1 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/qemu-timer.c b/qemu-timer.c
> index 60283a8..c19d0a2 100644
> --- a/qemu-timer.c
> +++ b/qemu-timer.c
> @@ -724,11 +724,18 @@ static uint64_t qemu_next_deadline_dyntick(void)
>      int64_t delta;
>      int64_t rtdelta;
>  
> -    if (use_icount)
> +    if (!use_icount && active_timers[QEMU_CLOCK_VIRTUAL]) {
> +        delta = active_timers[QEMU_CLOCK_VIRTUAL]->expire_time -
> +                     qemu_get_clock(vm_clock);
> +    } else {
>          delta = INT32_MAX;
> -    else
> -        delta = qemu_next_deadline();
> -
> +    }
> +    if (active_timers[QEMU_CLOCK_HOST]) {
> +        int64_t hdelta = active_timers[QEMU_CLOCK_HOST]->expire_time -
> +                 qemu_get_clock(host_clock);
> +        if (hdelta < delta)
> +            delta = hdelta;
> +    }
>      if (active_timers[QEMU_CLOCK_REALTIME]) {
>          rtdelta = (active_timers[QEMU_CLOCK_REALTIME]->expire_time -
>                   qemu_get_clock_ns(rt_clock));

Looks good to me. I guess this applies without the first patch? Then it
should go in (unless you are working on a new version for 1/3).

Thanks for fixing this.

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux

  reply	other threads:[~2011-02-01 13:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-31 21:51 [Qemu-devel] [PATCH 0/3] Simplify and fix alarm deadline computation Paolo Bonzini
2011-01-31 21:51 ` [Qemu-devel] [PATCH 1/3] use nanoseconds everywhere for timeout computation Paolo Bonzini
2011-01-31 22:17   ` Anthony Liguori
2011-02-01 18:47     ` Aurelien Jarno
2011-02-02  8:04       ` [Qemu-devel] " Paolo Bonzini
2011-02-01 18:38   ` [Qemu-devel] " Aurelien Jarno
2011-01-31 21:51 ` [Qemu-devel] [PATCH 2/3] Correct alarm deadline computation Paolo Bonzini
2011-02-01 13:01   ` Jan Kiszka [this message]
2011-02-01 13:04     ` [Qemu-devel] " Paolo Bonzini
2011-02-01 13:07       ` Jan Kiszka
2011-01-31 21:51 ` [Qemu-devel] [PATCH 3/3] Unify " Paolo Bonzini

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=4D480444.6070801@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=pbonzini@redhat.com \
    --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.