From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58781) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2M6s-0004aL-Rg for qemu-devel@nongnu.org; Thu, 25 Jul 2013 10:01:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V2M6r-0008SP-DJ for qemu-devel@nongnu.org; Thu, 25 Jul 2013 10:01:38 -0400 Received: from david.siemens.de ([192.35.17.14]:29513) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2M6r-0008SJ-3z for qemu-devel@nongnu.org; Thu, 25 Jul 2013 10:01:37 -0400 Message-ID: <51F12FB8.5050003@siemens.com> Date: Thu, 25 Jul 2013 16:01:28 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <1374396185-10870-1-git-send-email-pingfank@linux.vnet.ibm.com> <20130725120530.GJ21033@stefanha-thinkpad.redhat.com> <51F11AFB.9040008@siemens.com> <51F11B94.8090400@redhat.com> <51F11C63.40007@siemens.com> <51F11EA8.9050108@siemens.com> <51F121E1.4060805@redhat.com> <51F122DE.2010801@siemens.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC 0/8] arm AioContext with its own timer stuff List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , Alex Bligh , Liu Ping Fan , qemu-devel , Stefan Hajnoczi , Anthony Liguori , Paolo Bonzini On 2013-07-25 15:31, Stefan Hajnoczi wrote: > On Thu, Jul 25, 2013 at 3:06 PM, Jan Kiszka wrote: >> On 2013-07-25 15:02, Paolo Bonzini wrote: >>> Il 25/07/2013 14:48, Jan Kiszka ha scritto: >>>> The concept of clocks (with start/stop property) and active timers shall >>>> not be mixed, they are independent. >>> >>> Are you referring to this in particular: >>> >>> void pause_all_vcpus(void) >>> { >>> CPUState *cpu = first_cpu; >>> >>> qemu_clock_enable(vm_clock, false); >>> ... >>> } >>> >>> void resume_all_vcpus(void) >>> { >>> CPUState *cpu = first_cpu; >>> >>> qemu_clock_enable(vm_clock, true); >>> ... >>> } >>> >>> where _all_ the vm_clock timer lists need to be stopped at the same time? >> >> Still wrong abstraction: the vm_clock is stopped. And that implies that >> no timer using this clock will fire anymore. > > Perhaps we should split QEMUClock into ClockSource and TimerList. > Instead of using the int type field in TimerList we keep a ClockSource > pointer. > > A ClockSource can be enabled/disabled. > > Then there's the question of ClockSource thread-safety. Host clock is > weird because it notifies listeners when the clock source jumps. Detection can be handled with a per-clock lock, dispatching can continue to run under BQL for now. > vm clock is hard because of icount. True. > > It's also weird to think about multiple threads dispatching timer > callbacks while a ClockSource is disabled. Basically, do we need a > guarantee that timer callbacks have completed and will not be invoked > in any thread after the disable function returns? We need to make sure that no timer callback dispatcher works with a clock value that is past the one at which we stopped. The simple answer to this is a lock... > > But assuming thread-safety is addressed, this would fit the design > you're suggesting. Yes, this looks good. Jan -- Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux