Patchwork [1/3] qemu_next_deadline should not consider host-time timers

login
register
mail settings
Submitter Paolo Bonzini
Date March 5, 2011, 5:14 p.m.
Message ID <1299345255-577-2-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/85538/
State New
Headers show

Comments

Paolo Bonzini - March 5, 2011, 5:14 p.m.
It is purely for icount-based virtual timers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 qemu-timer.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)
Jan Kiszka - March 5, 2011, 6:07 p.m.
On 2011-03-05 18:14, Paolo Bonzini wrote:
> It is purely for icount-based virtual timers.

How about renaming the function to clarify its scope?

Jan

> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  qemu-timer.c |    7 +------
>  1 files changed, 1 insertions(+), 6 deletions(-)
> 
> diff --git a/qemu-timer.c b/qemu-timer.c
> index 88c7b28..06fa507 100644
> --- a/qemu-timer.c
> +++ b/qemu-timer.c
> @@ -689,16 +689,11 @@ int64_t qemu_next_deadline(void)
>      /* To avoid problems with overflow limit this to 2^32.  */
>      int64_t delta = INT32_MAX;
>  
> +    assert(use_icount);
>      if (active_timers[QEMU_CLOCK_VIRTUAL]) {
>          delta = active_timers[QEMU_CLOCK_VIRTUAL]->expire_time -
>                       qemu_get_clock_ns(vm_clock);
>      }
> -    if (active_timers[QEMU_CLOCK_HOST]) {
> -        int64_t hdelta = active_timers[QEMU_CLOCK_HOST]->expire_time -
> -                 qemu_get_clock_ns(host_clock);
> -        if (hdelta < delta)
> -            delta = hdelta;
> -    }
>  
>      if (delta < 0)
>          delta = 0;
Paolo Bonzini - March 9, 2011, 1:40 p.m.
On 03/05/2011 07:07 PM, Jan Kiszka wrote:
> On 2011-03-05 18:14, Paolo Bonzini wrote:
>> It is purely for icount-based virtual timers.
>
> How about renaming the function to clarify its scope?

Will do.

Paolo

Patch

diff --git a/qemu-timer.c b/qemu-timer.c
index 88c7b28..06fa507 100644
--- a/qemu-timer.c
+++ b/qemu-timer.c
@@ -689,16 +689,11 @@  int64_t qemu_next_deadline(void)
     /* To avoid problems with overflow limit this to 2^32.  */
     int64_t delta = INT32_MAX;
 
+    assert(use_icount);
     if (active_timers[QEMU_CLOCK_VIRTUAL]) {
         delta = active_timers[QEMU_CLOCK_VIRTUAL]->expire_time -
                      qemu_get_clock_ns(vm_clock);
     }
-    if (active_timers[QEMU_CLOCK_HOST]) {
-        int64_t hdelta = active_timers[QEMU_CLOCK_HOST]->expire_time -
-                 qemu_get_clock_ns(host_clock);
-        if (hdelta < delta)
-            delta = hdelta;
-    }
 
     if (delta < 0)
         delta = 0;