From patchwork Fri Nov 7 10:32:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Dovgalyuk X-Patchwork-Id: 408039 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id A4FC814012A for ; Fri, 7 Nov 2014 21:34:52 +1100 (AEDT) Received: from localhost ([::1]:59335 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmgsU-00060g-Qr for incoming@patchwork.ozlabs.org; Fri, 07 Nov 2014 05:34:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49969) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xmgpz-0001eS-RO for qemu-devel@nongnu.org; Fri, 07 Nov 2014 05:32:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xmgpt-0008S2-5N for qemu-devel@nongnu.org; Fri, 07 Nov 2014 05:32:15 -0500 Received: from mail.ispras.ru ([83.149.199.45]:49123) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xmgps-0008Rm-UY for qemu-devel@nongnu.org; Fri, 07 Nov 2014 05:32:09 -0500 Received: from [10.10.150.171] (unknown [85.142.117.224]) by mail.ispras.ru (Postfix) with ESMTPSA id 2BE80540151; Fri, 7 Nov 2014 13:32:08 +0300 (MSK) To: qemu-devel@nongnu.org From: Pavel Dovgalyuk Date: Fri, 07 Nov 2014 13:32:12 +0300 Message-ID: <20141107103212.6136.5251.stgit@PASHA-ISP> In-Reply-To: <20141107103123.6136.18545.stgit@PASHA-ISP> References: <20141107103123.6136.18545.stgit@PASHA-ISP> User-Agent: StGit/0.16 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 83.149.199.45 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 Subject: [Qemu-devel] [RFC PATCH v4 08/25] icount: improve enable/disable ticks X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 Reviewed-by: Paolo Bonzini --- 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);