From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51250) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xta0W-0004Rp-48 for qemu-devel@nongnu.org; Wed, 26 Nov 2014 05:39:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xta0P-0008Ds-0C for qemu-devel@nongnu.org; Wed, 26 Nov 2014 05:39:36 -0500 Received: from mail.ispras.ru ([83.149.199.45]:34881) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xta0O-0008Dk-PQ for qemu-devel@nongnu.org; Wed, 26 Nov 2014 05:39:28 -0500 From: Pavel Dovgalyuk Date: Wed, 26 Nov 2014 13:39:31 +0300 Message-ID: <20141126103931.7772.57467.stgit@PASHA-ISP> In-Reply-To: <20141126103841.7772.11864.stgit@PASHA-ISP> References: <20141126103841.7772.11864.stgit@PASHA-ISP> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [RFC PATCH v5 08/31] icount: improve enable/disable ticks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, alex.bennee@linaro.org, mark.burton@greensocs.com, real@ispras.ru, batuzovk@ispras.ru, maria.klimushenkova@ispras.ru, pavel.dovgaluk@ispras.ru, pbonzini@redhat.com, afaerber@suse.de, fred.konrad@greensocs.com 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. Reviewed-by: Paolo Bonzini Signed-off-by: Pavel Dovgalyuk --- cpus.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cpus.c b/cpus.c index 492e19a..43ae7fc 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);