All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/3] trivial changes of timer & cpus
@ 2016-07-29 11:05 Cao jin
  2016-07-29 11:05 ` [Qemu-devel] [PATCH 1/3] timer: update comments Cao jin
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Cao jin @ 2016-07-29 11:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Paolo Bonzini, Peter Maydell, Richard Henderson

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc  Peter Crosthwaite <crosthwaite.peter@gmail.com>
Cc: Richard Henderson <rth@twiddle.net>

Cao jin (3):
  timer: update comments
  cpus: rename local variable to meaningful one
  cpus: update comments

 cpus.c               | 13 +++++++------
 include/qemu/timer.h | 19 ++++++-------------
 2 files changed, 13 insertions(+), 19 deletions(-)

-- 
2.1.0

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

* [Qemu-devel] [PATCH 1/3] timer: update comments
  2016-07-29 11:05 [Qemu-devel] [PATCH 0/3] trivial changes of timer & cpus Cao jin
@ 2016-07-29 11:05 ` Cao jin
  2016-07-29 11:05 ` [Qemu-devel] [PATCH 2/3] cpus: rename local variable to meaningful one Cao jin
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Cao jin @ 2016-07-29 11:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Paolo Bonzini, Peter Maydell

The comments is outdated. The patch has following changes:
1. tense correction.
2. all clock time value is returned in nanoseconds, so, they are same in
precision.
3. virtual clock doesn't use cpu cycles.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
---
 include/qemu/timer.h | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index 930b5d3..9910d22 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -22,23 +22,20 @@
  * @QEMU_CLOCK_REALTIME: Real time clock
  *
  * The real time clock should be used only for stuff which does not
- * change the virtual machine state, as it is run even if the virtual
- * machine is stopped. The real time clock has a frequency of 1000
- * Hz.
+ * change the virtual machine state, as it runs even if the virtual
+ * machine is stopped.
  *
  * @QEMU_CLOCK_VIRTUAL: virtual clock
  *
- * The virtual clock is only run during the emulation. It is stopped
- * when the virtual machine is stopped. Virtual timers use a high
- * precision clock, usually cpu cycles (use ticks_per_sec).
+ * The virtual clock only runs during the emulation. It stops
+ * when the virtual machine is stopped.
  *
  * @QEMU_CLOCK_HOST: host clock
  *
- * The host clock should be use for device models that emulate accurate
+ * The host clock should be used for device models that emulate accurate
  * real time sources. It will continue to run when the virtual machine
  * is suspended, and it will reflect system time changes the host may
- * undergo (e.g. due to NTP). The host clock has the same precision as
- * the virtual clock.
+ * undergo (e.g. due to NTP).
  *
  * @QEMU_CLOCK_VIRTUAL_RT: realtime clock used for icount warp
  *
@@ -77,10 +74,6 @@ struct QEMUTimer {
 extern QEMUTimerListGroup main_loop_tlg;
 
 /*
- * QEMUClockType
- */
-
-/*
  * qemu_clock_get_ns;
  * @type: the clock type
  *
-- 
2.1.0

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

* [Qemu-devel] [PATCH 2/3] cpus: rename local variable to meaningful one
  2016-07-29 11:05 [Qemu-devel] [PATCH 0/3] trivial changes of timer & cpus Cao jin
  2016-07-29 11:05 ` [Qemu-devel] [PATCH 1/3] timer: update comments Cao jin
@ 2016-07-29 11:05 ` Cao jin
  2016-07-29 11:05 ` [Qemu-devel] [PATCH 3/3] cpus: update comments Cao jin
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Cao jin @ 2016-07-29 11:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Paolo Bonzini, Richard Henderson

The function actually returns monotonic time value in nanosecond,
the "ticks" is not suitable.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc  Peter Crosthwaite <crosthwaite.peter@gmail.com>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
---
 cpus.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/cpus.c b/cpus.c
index d4afd93..d534f78 100644
--- a/cpus.c
+++ b/cpus.c
@@ -219,14 +219,14 @@ int64_t cpu_get_ticks(void)
 
 static int64_t cpu_get_clock_locked(void)
 {
-    int64_t ticks;
+    int64_t time;
 
-    ticks = timers_state.cpu_clock_offset;
+    time = timers_state.cpu_clock_offset;
     if (timers_state.cpu_ticks_enabled) {
-        ticks += get_clock();
+        time += get_clock();
     }
 
-    return ticks;
+    return time;
 }
 
 /* return the host CPU monotonic time */
-- 
2.1.0

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

* [Qemu-devel] [PATCH 3/3] cpus: update comments
  2016-07-29 11:05 [Qemu-devel] [PATCH 0/3] trivial changes of timer & cpus Cao jin
  2016-07-29 11:05 ` [Qemu-devel] [PATCH 1/3] timer: update comments Cao jin
  2016-07-29 11:05 ` [Qemu-devel] [PATCH 2/3] cpus: rename local variable to meaningful one Cao jin
@ 2016-07-29 11:05 ` Cao jin
  2016-08-01 11:44 ` [Qemu-devel] [PATCH 0/3] trivial changes of timer & cpus Paolo Bonzini
  2016-09-14  6:47 ` Michael Tokarev
  4 siblings, 0 replies; 10+ messages in thread
From: Cao jin @ 2016-07-29 11:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Paolo Bonzini, Richard Henderson

The returned value of cpu_get_clock() is plused with the offset,
so it is the time elapsed in virtual machine when vm is active.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc  Peter Crosthwaite <crosthwaite.peter@gmail.com>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
---
 cpus.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/cpus.c b/cpus.c
index d534f78..722f503 100644
--- a/cpus.c
+++ b/cpus.c
@@ -191,7 +191,7 @@ int64_t cpu_icount_to_ns(int64_t icount)
     return icount << icount_time_shift;
 }
 
-/* return the host CPU cycle counter and handle stop/restart */
+/* return the host CPU cycle counter */
 /* Caller must hold the BQL */
 int64_t cpu_get_ticks(void)
 {
@@ -229,7 +229,8 @@ static int64_t cpu_get_clock_locked(void)
     return time;
 }
 
-/* return the host CPU monotonic time */
+/* Return the monotonic time elapsed in VM, i.e.,
+ * the time between vm_start and vm_stop */
 int64_t cpu_get_clock(void)
 {
     int64_t ti;
-- 
2.1.0

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

* Re: [Qemu-devel] [PATCH 0/3] trivial changes of timer & cpus
  2016-07-29 11:05 [Qemu-devel] [PATCH 0/3] trivial changes of timer & cpus Cao jin
                   ` (2 preceding siblings ...)
  2016-07-29 11:05 ` [Qemu-devel] [PATCH 3/3] cpus: update comments Cao jin
@ 2016-08-01 11:44 ` Paolo Bonzini
  2016-08-04  4:12   ` Cao jin
  2016-09-14  6:47 ` Michael Tokarev
  4 siblings, 1 reply; 10+ messages in thread
From: Paolo Bonzini @ 2016-08-01 11:44 UTC (permalink / raw)
  To: Cao jin, qemu-devel; +Cc: qemu-trivial, Richard Henderson, Peter Maydell



On 29/07/2016 13:05, Cao jin wrote:
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc  Peter Crosthwaite <crosthwaite.peter@gmail.com>
> Cc: Richard Henderson <rth@twiddle.net>
> 
> Cao jin (3):
>   timer: update comments
>   cpus: rename local variable to meaningful one
>   cpus: update comments
> 
>  cpus.c               | 13 +++++++------
>  include/qemu/timer.h | 19 ++++++-------------
>  2 files changed, 13 insertions(+), 19 deletions(-)
> 

Thanks, these can go in 2.8.

Paolo

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

* Re: [Qemu-devel] [PATCH 0/3] trivial changes of timer & cpus
  2016-08-01 11:44 ` [Qemu-devel] [PATCH 0/3] trivial changes of timer & cpus Paolo Bonzini
@ 2016-08-04  4:12   ` Cao jin
  2016-08-04  9:01     ` Paolo Bonzini
  0 siblings, 1 reply; 10+ messages in thread
From: Cao jin @ 2016-08-04  4:12 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: qemu-trivial, Richard Henderson, Peter Maydell



On 08/01/2016 07:44 PM, Paolo Bonzini wrote:
>
>
> On 29/07/2016 13:05, Cao jin wrote:
>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>> Cc: Peter Maydell <peter.maydell@linaro.org>
>> Cc  Peter Crosthwaite <crosthwaite.peter@gmail.com>
>> Cc: Richard Henderson <rth@twiddle.net>
>>
>> Cao jin (3):
>>    timer: update comments
>>    cpus: rename local variable to meaningful one
>>    cpus: update comments
>>
>>   cpus.c               | 13 +++++++------
>>   include/qemu/timer.h | 19 ++++++-------------
>>   2 files changed, 13 insertions(+), 19 deletions(-)
>>
>
> Thanks, these can go in 2.8.
>
I am fine with the time. Do you want me to repost these after 2.8?

-- 
Yours Sincerely,

Cao jin

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

* Re: [Qemu-devel] [PATCH 0/3] trivial changes of timer & cpus
  2016-08-04  4:12   ` Cao jin
@ 2016-08-04  9:01     ` Paolo Bonzini
  0 siblings, 0 replies; 10+ messages in thread
From: Paolo Bonzini @ 2016-08-04  9:01 UTC (permalink / raw)
  To: Cao jin; +Cc: qemu-devel, qemu-trivial, Richard Henderson, Peter Maydell

> > Thanks, these can go in 2.8.
>
> I am fine with the time. Do you want me to repost these after 2.8?

No, it's okay.

Paolo

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

* Re: [Qemu-devel] [PATCH 0/3] trivial changes of timer & cpus
  2016-07-29 11:05 [Qemu-devel] [PATCH 0/3] trivial changes of timer & cpus Cao jin
                   ` (3 preceding siblings ...)
  2016-08-01 11:44 ` [Qemu-devel] [PATCH 0/3] trivial changes of timer & cpus Paolo Bonzini
@ 2016-09-14  6:47 ` Michael Tokarev
  2016-09-14  6:54   ` Cao jin
  4 siblings, 1 reply; 10+ messages in thread
From: Michael Tokarev @ 2016-09-14  6:47 UTC (permalink / raw)
  To: Cao jin, qemu-devel
  Cc: qemu-trivial, Paolo Bonzini, Richard Henderson, Peter Maydell

29.07.2016 14:05, Cao jin wrote:
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc  Peter Crosthwaite <crosthwaite.peter@gmail.com>
> Cc: Richard Henderson <rth@twiddle.net>
>
> Cao jin (3):
>   timer: update comments
>   cpus: rename local variable to meaningful one
>   cpus: update comments
>
>  cpus.c               | 13 +++++++------
>  include/qemu/timer.h | 19 ++++++-------------
>  2 files changed, 13 insertions(+), 19 deletions(-)

Applied all 3 to -trivial, thanks!

/mjt

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

* Re: [Qemu-devel] [PATCH 0/3] trivial changes of timer & cpus
  2016-09-14  6:47 ` Michael Tokarev
@ 2016-09-14  6:54   ` Cao jin
  2016-09-14  6:56     ` Michael Tokarev
  0 siblings, 1 reply; 10+ messages in thread
From: Cao jin @ 2016-09-14  6:54 UTC (permalink / raw)
  To: Michael Tokarev, qemu-devel
  Cc: qemu-trivial, Paolo Bonzini, Richard Henderson, Peter Maydell

Hi Michael,

I saw Paolo already queued these 3 into his branch and sent the pull 
request.

Cao jin

On 09/14/2016 02:47 PM, Michael Tokarev wrote:
> 29.07.2016 14:05, Cao jin wrote:
>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>> Cc: Peter Maydell <peter.maydell@linaro.org>
>> Cc  Peter Crosthwaite <crosthwaite.peter@gmail.com>
>> Cc: Richard Henderson <rth@twiddle.net>
>>
>> Cao jin (3):
>>   timer: update comments
>>   cpus: rename local variable to meaningful one
>>   cpus: update comments
>>
>>  cpus.c               | 13 +++++++------
>>  include/qemu/timer.h | 19 ++++++-------------
>>  2 files changed, 13 insertions(+), 19 deletions(-)
>
> Applied all 3 to -trivial, thanks!
>
> /mjt
>
>
>
>
>

-- 
Yours Sincerely,

Cao jin

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

* Re: [Qemu-devel] [PATCH 0/3] trivial changes of timer & cpus
  2016-09-14  6:54   ` Cao jin
@ 2016-09-14  6:56     ` Michael Tokarev
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Tokarev @ 2016-09-14  6:56 UTC (permalink / raw)
  To: Cao jin, qemu-devel
  Cc: qemu-trivial, Paolo Bonzini, Richard Henderson, Peter Maydell

14.09.2016 09:54, Cao jin wrote:
> Hi Michael,
>
> I saw Paolo already queued these 3 into his branch and sent the pull
> request.

That's okay, git figure it out.

Thank you for notifying me.

/mjt

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

end of thread, other threads:[~2016-09-14  6:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-29 11:05 [Qemu-devel] [PATCH 0/3] trivial changes of timer & cpus Cao jin
2016-07-29 11:05 ` [Qemu-devel] [PATCH 1/3] timer: update comments Cao jin
2016-07-29 11:05 ` [Qemu-devel] [PATCH 2/3] cpus: rename local variable to meaningful one Cao jin
2016-07-29 11:05 ` [Qemu-devel] [PATCH 3/3] cpus: update comments Cao jin
2016-08-01 11:44 ` [Qemu-devel] [PATCH 0/3] trivial changes of timer & cpus Paolo Bonzini
2016-08-04  4:12   ` Cao jin
2016-08-04  9:01     ` Paolo Bonzini
2016-09-14  6:47 ` Michael Tokarev
2016-09-14  6:54   ` Cao jin
2016-09-14  6:56     ` Michael Tokarev

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.