qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] timer.h: Provide better monotonic time
@ 2017-04-18 19:18 Pranith Kumar
  2017-06-02 12:24 ` Peter Maydell
  0 siblings, 1 reply; 4+ messages in thread
From: Pranith Kumar @ 2017-04-18 19:18 UTC (permalink / raw)
  To: Paolo Bonzini, Cao jin, Alex Bennée, Michael Tokarev,
	Edgar E. Iglesias, open list:All patches CC here

Tested and confirmed that the stretch i386 debian qcow2 image on a
raspberry pi 2 works.

Fixes: LP#: 893208 <https://bugs.launchpad.net/qemu/+bug/893208/>
Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
 include/qemu/timer.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index 8a1eb74839..1b518bca30 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -1020,10 +1020,9 @@ static inline int64_t cpu_get_host_ticks(void)
 /* The host CPU doesn't have an easily accessible cycle counter.
    Just return a monotonically increasing value.  This will be
    totally wrong, but hopefully better than nothing.  */
-static inline int64_t cpu_get_host_ticks (void)
+static inline int64_t cpu_get_host_ticks(void)
 {
-    static int64_t ticks = 0;
-    return ticks++;
+    return get_clock();
 }
 #endif
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] timer.h: Provide better monotonic time
  2017-04-18 19:18 [Qemu-devel] [PATCH] timer.h: Provide better monotonic time Pranith Kumar
@ 2017-06-02 12:24 ` Peter Maydell
  2017-06-05  9:27   ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2017-06-02 12:24 UTC (permalink / raw)
  To: Pranith Kumar
  Cc: Paolo Bonzini, Cao jin, Alex Bennée, Michael Tokarev,
	Edgar E. Iglesias, open list:All patches CC here

On 18 April 2017 at 20:18, Pranith Kumar <bobby.prani@gmail.com> wrote:
> Tested and confirmed that the stretch i386 debian qcow2 image on a
> raspberry pi 2 works.
>
> Fixes: LP#: 893208 <https://bugs.launchpad.net/qemu/+bug/893208/>
> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
> ---
>  include/qemu/timer.h | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/include/qemu/timer.h b/include/qemu/timer.h
> index 8a1eb74839..1b518bca30 100644
> --- a/include/qemu/timer.h
> +++ b/include/qemu/timer.h
> @@ -1020,10 +1020,9 @@ static inline int64_t cpu_get_host_ticks(void)
>  /* The host CPU doesn't have an easily accessible cycle counter.
>     Just return a monotonically increasing value.  This will be
>     totally wrong, but hopefully better than nothing.  */
> -static inline int64_t cpu_get_host_ticks (void)
> +static inline int64_t cpu_get_host_ticks(void)
>  {
> -    static int64_t ticks = 0;
> -    return ticks++;
> +    return get_clock();
>  }
>  #endif

Hmm, it looks like this patch got lost. Paolo, did you want to
give it a reviewed-by? From the discussion on v1 it sounded
like you had the best grip on the timer code ;-)

(Does the comment on the function need updating ?)

thanks
-- PMM

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] timer.h: Provide better monotonic time
  2017-06-02 12:24 ` Peter Maydell
@ 2017-06-05  9:27   ` Paolo Bonzini
  2017-06-07 14:30     ` Peter Maydell
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2017-06-05  9:27 UTC (permalink / raw)
  To: Peter Maydell, Pranith Kumar
  Cc: Cao jin, Alex Bennée, Michael Tokarev, Edgar E. Iglesias,
	open list:All patches CC here



On 02/06/2017 14:24, Peter Maydell wrote:
> On 18 April 2017 at 20:18, Pranith Kumar <bobby.prani@gmail.com> wrote:
>> Tested and confirmed that the stretch i386 debian qcow2 image on a
>> raspberry pi 2 works.
>>
>> Fixes: LP#: 893208 <https://bugs.launchpad.net/qemu/+bug/893208/>
>> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
>> ---
>>  include/qemu/timer.h | 5 ++---
>>  1 file changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/include/qemu/timer.h b/include/qemu/timer.h
>> index 8a1eb74839..1b518bca30 100644
>> --- a/include/qemu/timer.h
>> +++ b/include/qemu/timer.h
>> @@ -1020,10 +1020,9 @@ static inline int64_t cpu_get_host_ticks(void)
>>  /* The host CPU doesn't have an easily accessible cycle counter.
>>     Just return a monotonically increasing value.  This will be
>>     totally wrong, but hopefully better than nothing.  */
>> -static inline int64_t cpu_get_host_ticks (void)
>> +static inline int64_t cpu_get_host_ticks(void)
>>  {
>> -    static int64_t ticks = 0;
>> -    return ticks++;
>> +    return get_clock();
>>  }
>>  #endif
> 
> Hmm, it looks like this patch got lost. Paolo, did you want to
> give it a reviewed-by? From the discussion on v1 it sounded
> like you had the best grip on the timer code ;-)

Sure:

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

> (Does the comment on the function need updating ?)

Apart from "totally", it's still pretty correct. :)

Thanks,

Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] timer.h: Provide better monotonic time
  2017-06-05  9:27   ` Paolo Bonzini
@ 2017-06-07 14:30     ` Peter Maydell
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2017-06-07 14:30 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Pranith Kumar, Cao jin, Alex Bennée, Michael Tokarev,
	Edgar E. Iglesias, open list:All patches CC here

On 5 June 2017 at 10:27, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
>
> On 02/06/2017 14:24, Peter Maydell wrote:
>> On 18 April 2017 at 20:18, Pranith Kumar <bobby.prani@gmail.com> wrote:
>>> Tested and confirmed that the stretch i386 debian qcow2 image on a
>>> raspberry pi 2 works.
>>>
>>> Fixes: LP#: 893208 <https://bugs.launchpad.net/qemu/+bug/893208/>
>>> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
>>> ---
>>>  include/qemu/timer.h | 5 ++---
>>>  1 file changed, 2 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/include/qemu/timer.h b/include/qemu/timer.h
>>> index 8a1eb74839..1b518bca30 100644
>>> --- a/include/qemu/timer.h
>>> +++ b/include/qemu/timer.h
>>> @@ -1020,10 +1020,9 @@ static inline int64_t cpu_get_host_ticks(void)
>>>  /* The host CPU doesn't have an easily accessible cycle counter.
>>>     Just return a monotonically increasing value.  This will be
>>>     totally wrong, but hopefully better than nothing.  */
>>> -static inline int64_t cpu_get_host_ticks (void)
>>> +static inline int64_t cpu_get_host_ticks(void)
>>>  {
>>> -    static int64_t ticks = 0;
>>> -    return ticks++;
>>> +    return get_clock();
>>>  }
>>>  #endif
>>
>> Hmm, it looks like this patch got lost. Paolo, did you want to
>> give it a reviewed-by? From the discussion on v1 it sounded
>> like you had the best grip on the timer code ;-)
>
> Sure:
>
> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
>
>> (Does the comment on the function need updating ?)
>
> Apart from "totally", it's still pretty correct. :)

Thanks. I'll apply this to my arm queue since in practice only
ARM hosts are affected by this change.

-- PMM

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-07 14:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-18 19:18 [Qemu-devel] [PATCH] timer.h: Provide better monotonic time Pranith Kumar
2017-06-02 12:24 ` Peter Maydell
2017-06-05  9:27   ` Paolo Bonzini
2017-06-07 14:30     ` Peter Maydell

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