diff mbox

[RFC,v4,08/25] icount: improve enable/disable ticks

Message ID 20141107103212.6136.5251.stgit@PASHA-ISP
State New
Headers show

Commit Message

Pavel Dovgalyuk Nov. 7, 2014, 10:32 a.m. UTC
This patch eliminates call of the cpu_get_real_ticks while enabling
or disabling the virtual timer in icount mode. These calls are used
for cpu_ticks_offset which is not needed in this mode.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
---
 cpus.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

Comments

Paolo Bonzini Nov. 7, 2014, 11:20 a.m. UTC | #1
On 07/11/2014 11:32, Pavel Dovgalyuk wrote:
> This patch eliminates call of the cpu_get_real_ticks while enabling
> or disabling the virtual timer in icount mode. These calls are used
> for cpu_ticks_offset which is not needed in this mode.
> 
> Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
> ---
>  cpus.c |   12 ++++++++----
>  1 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/cpus.c b/cpus.c
> index 2ec6d75..15ac3a1 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -267,8 +267,10 @@ void cpu_enable_ticks(void)
>      /* Here, the really thing protected by seqlock is cpu_clock_offset. */
>      seqlock_write_lock(&timers_state.vm_clock_seqlock);
>      if (!timers_state.cpu_ticks_enabled) {
> -        timers_state.cpu_ticks_offset -= cpu_get_real_ticks();
> -        timers_state.cpu_clock_offset -= get_clock();
> +        if (!use_icount) {
> +            timers_state.cpu_ticks_offset -= cpu_get_real_ticks();
> +            timers_state.cpu_clock_offset -= get_clock();
> +        }
>          timers_state.cpu_ticks_enabled = 1;
>      }
>      seqlock_write_unlock(&timers_state.vm_clock_seqlock);
> @@ -283,8 +285,10 @@ void cpu_disable_ticks(void)
>      /* Here, the really thing protected by seqlock is cpu_clock_offset. */
>      seqlock_write_lock(&timers_state.vm_clock_seqlock);
>      if (timers_state.cpu_ticks_enabled) {
> -        timers_state.cpu_ticks_offset += cpu_get_real_ticks();
> -        timers_state.cpu_clock_offset = cpu_get_clock_locked();
> +        if (!use_icount) {
> +            timers_state.cpu_ticks_offset += cpu_get_real_ticks();
> +            timers_state.cpu_clock_offset = cpu_get_clock_locked();
> +        }
>          timers_state.cpu_ticks_enabled = 0;
>      }
>      seqlock_write_unlock(&timers_state.vm_clock_seqlock);
> 

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

Patch

diff --git a/cpus.c b/cpus.c
index 2ec6d75..15ac3a1 100644
--- a/cpus.c
+++ b/cpus.c
@@ -267,8 +267,10 @@  void cpu_enable_ticks(void)
     /* Here, the really thing protected by seqlock is cpu_clock_offset. */
     seqlock_write_lock(&timers_state.vm_clock_seqlock);
     if (!timers_state.cpu_ticks_enabled) {
-        timers_state.cpu_ticks_offset -= cpu_get_real_ticks();
-        timers_state.cpu_clock_offset -= get_clock();
+        if (!use_icount) {
+            timers_state.cpu_ticks_offset -= cpu_get_real_ticks();
+            timers_state.cpu_clock_offset -= get_clock();
+        }
         timers_state.cpu_ticks_enabled = 1;
     }
     seqlock_write_unlock(&timers_state.vm_clock_seqlock);
@@ -283,8 +285,10 @@  void cpu_disable_ticks(void)
     /* Here, the really thing protected by seqlock is cpu_clock_offset. */
     seqlock_write_lock(&timers_state.vm_clock_seqlock);
     if (timers_state.cpu_ticks_enabled) {
-        timers_state.cpu_ticks_offset += cpu_get_real_ticks();
-        timers_state.cpu_clock_offset = cpu_get_clock_locked();
+        if (!use_icount) {
+            timers_state.cpu_ticks_offset += cpu_get_real_ticks();
+            timers_state.cpu_clock_offset = cpu_get_clock_locked();
+        }
         timers_state.cpu_ticks_enabled = 0;
     }
     seqlock_write_unlock(&timers_state.vm_clock_seqlock);