From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49959) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8V7W-0000sZ-1q for qemu-devel@nongnu.org; Thu, 02 Jun 2016 12:05:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b8V7Q-0006E2-Vs for qemu-devel@nongnu.org; Thu, 02 Jun 2016 12:05:16 -0400 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]:36761) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8V7Q-0006Dt-MJ for qemu-devel@nongnu.org; Thu, 02 Jun 2016 12:05:12 -0400 Received: by mail-lf0-x244.google.com with SMTP id h68so5569235lfh.3 for ; Thu, 02 Jun 2016 09:05:12 -0700 (PDT) References: <1459870344-16773-1-git-send-email-alex.bennee@linaro.org> <1459870344-16773-10-git-send-email-alex.bennee@linaro.org> <570C19AB.5020106@gmail.com> <87oa7j7f8p.fsf@linaro.org> From: Sergey Fedorov Message-ID: <57505935.9000706@gmail.com> Date: Thu, 2 Jun 2016 19:05:09 +0300 MIME-Version: 1.0 In-Reply-To: <87oa7j7f8p.fsf@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [RFC v2 09/11] tcg: add kick timer for single-threaded vCPU emulation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Alex_Benn=c3=a9e?= Cc: mttcg@listserver.greensocs.com, fred.konrad@greensocs.com, a.rigo@virtualopensystems.com, cota@braap.org, qemu-devel@nongnu.org, mark.burton@greensocs.com, pbonzini@redhat.com, jan.kiszka@siemens.com, rth@twiddle.net, peter.maydell@linaro.org, claudio.fontana@huawei.com, Peter Crosthwaite On 02/06/16 19:00, Alex Bennée wrote: > Sergey Fedorov writes: >> On 05/04/16 18:32, Alex Bennée wrote: >>> @@ -1179,6 +1198,14 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) >>> } >>> } >>> >>> + /* Set to kick if we have to do more than one vCPU */ >>> + if (CPU_NEXT(first_cpu)) { >>> + kick_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, kick_tcg_thread, &kick_timer); >>> + timer_mod(kick_timer, >>> + qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + >>> + NANOSECONDS_PER_SECOND / 10); >>> + } >>> + >> I think cpu_ticks_init() could be more natural place to put this >> initialization in. > It would be but I need somewhere to keep kick_timer and doing it inside > the thread function keeps it nice and local. Fair enough. By the way, this kick timer is only required for round-robin single-threaded CPU loop, right? Kind regards, Sergey