From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LuYaC-0007ve-Gl for qemu-devel@nongnu.org; Thu, 16 Apr 2009 16:53:16 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LuYa8-0007v0-Rr for qemu-devel@nongnu.org; Thu, 16 Apr 2009 16:53:16 -0400 Received: from [199.232.76.173] (port=50312 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LuYa8-0007ut-PD for qemu-devel@nongnu.org; Thu, 16 Apr 2009 16:53:12 -0400 Received: from e33.co.us.ibm.com ([32.97.110.151]:33315) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LuYa8-0001kG-Bq for qemu-devel@nongnu.org; Thu, 16 Apr 2009 16:53:12 -0400 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e33.co.us.ibm.com (8.13.1/8.13.1) with ESMTP id n3GKpU0A031471 for ; Thu, 16 Apr 2009 14:51:30 -0600 Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n3GKr6lV173980 for ; Thu, 16 Apr 2009 14:53:06 -0600 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n3GKr56V032703 for ; Thu, 16 Apr 2009 14:53:05 -0600 Message-ID: <49E79AB0.2090903@us.ibm.com> Date: Thu, 16 Apr 2009 15:53:04 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <20090407195126.467365249@localhost.localdomain> <20090407195442.646407971@localhost.localdomain> In-Reply-To: <20090407195442.646407971@localhost.localdomain> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [patch 01/11] qemu: create helper for event notification Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: mtosatti@redhat.com, "qemu-devel@nongnu.org" mtosatti@redhat.com wrote: > Signed-off-by: Marcelo Tosatti > > Index: trunk/vl.c > =================================================================== > --- trunk.orig/vl.c > +++ trunk/vl.c > @@ -1183,9 +1183,8 @@ void qemu_mod_timer(QEMUTimer *ts, int64 > qemu_rearm_alarm_timer(alarm_timer); > } > /* Interrupt execution to force deadline recalculation. */ > - if (use_icount && cpu_single_env) { > - cpu_exit(cpu_single_env); > - } > + if (use_icount) > + qemu_notify_event(); > } > } > > @@ -1338,8 +1337,6 @@ static void host_alarm_handler(int host_ > qemu_get_clock(vm_clock))) || > qemu_timer_expired(active_timers[QEMU_TIMER_REALTIME], > qemu_get_clock(rt_clock))) { > - CPUState *env = next_cpu; > - > #ifdef _WIN32 > struct qemu_alarm_win32 *data = ((struct qemu_alarm_timer*)dwUser)->priv; > SetEvent(data->host_alarm); > @@ -1349,16 +1346,7 @@ static void host_alarm_handler(int host_ > #endif > alarm_timer->flags |= ALARM_FLAG_EXPIRED; > > - if (env) { > - /* stop the currently executing cpu because a timer occured */ > - cpu_exit(env); > -#ifdef USE_KQEMU > - if (env->kqemu_enabled) { > - kqemu_cpu_interrupt(env); > - } > -#endif > - } > - event_pending = 1; > + qemu_notify_event(); > } > } > I always thought next_cpu was used here to cover an explicit race condition. If you're using TCG, and you get a single after running the loop, but before assigning cpu_single_env, then you'll set the interrupt exit request on the old CPU state. You'll eventually exit I guess but you potentially have to run through multiple VCPUs. I'd feel more comfortable if we preserved the behavior here that we had before. -- Regards, Anthony Liguori