From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35651) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WRHnB-0005PN-TL for qemu-devel@nongnu.org; Sat, 22 Mar 2014 05:00:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WRHn6-0002uR-Ng for qemu-devel@nongnu.org; Sat, 22 Mar 2014 05:00:37 -0400 Received: from mail-ee0-x22b.google.com ([2a00:1450:4013:c00::22b]:60136) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WRHn6-0002u7-Fq for qemu-devel@nongnu.org; Sat, 22 Mar 2014 05:00:32 -0400 Received: by mail-ee0-f43.google.com with SMTP id e53so2581955eek.2 for ; Sat, 22 Mar 2014 02:00:31 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <532D512C.3050909@redhat.com> Date: Sat, 22 Mar 2014 10:00:28 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1395429454-24690-1-git-send-email-fred.konrad@greensocs.com> <1395429454-24690-7-git-send-email-fred.konrad@greensocs.com> In-Reply-To: <1395429454-24690-7-git-send-email-fred.konrad@greensocs.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH 06/12] icount: make icount extra computed on icount clock as well. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: fred.konrad@greensocs.com, qemu-devel@nongnu.org Cc: mark.burton@greensocs.com Il 21/03/2014 20:17, fred.konrad@greensocs.com ha scritto: > From: KONRAD Frederic > > This takes icount clock in account for icount extra computation so icount > clock's timers will be triggered at the exact time. > > Signed-off-by: KONRAD Frederic > --- > cpus.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/cpus.c b/cpus.c > index 01c48e9..825d438 100644 > --- a/cpus.c > +++ b/cpus.c > @@ -1292,6 +1292,7 @@ static int tcg_cpu_exec(CPUArchState *env) > if (use_icount) { > int64_t count; > int64_t deadline; > + int64_t icount_deadline; > int decr; > timers_state.qemu_icount -= (cpu->icount_decr.u16.low > + cpu->icount_extra); > @@ -1308,6 +1309,15 @@ static int tcg_cpu_exec(CPUArchState *env) > deadline = INT32_MAX; > } > > + /* > + * Take icount clock deadline in account too, and keep the nearest > + * deadline. > + */ > + icount_deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_ICOUNT); > + if ((icount_deadline >= 0) && (icount_deadline < deadline)) { > + deadline = icount_deadline; > + } > + > count = qemu_icount_round(deadline); > timers_state.qemu_icount += count; > decr = (count > 0xffff) ? 0xffff : count; > Reviewed-by: Paolo Bonzini