From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33755) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEfRK-00089N-Rk for qemu-devel@nongnu.org; Mon, 13 Jul 2015 11:14:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZEfRH-0001Uy-DZ for qemu-devel@nongnu.org; Mon, 13 Jul 2015 11:14:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51777) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEfRH-0001Uc-7s for qemu-devel@nongnu.org; Mon, 13 Jul 2015 11:14:39 -0400 References: <1435855010-30882-1-git-send-email-jjherne@linux.vnet.ibm.com> <1435855010-30882-2-git-send-email-jjherne@linux.vnet.ibm.com> <55956A2E.4020806@redhat.com> <55A3CEAF.6030504@linux.vnet.ibm.com> From: Paolo Bonzini Message-ID: <55A3D5D8.7070902@redhat.com> Date: Mon, 13 Jul 2015 17:14:32 +0200 MIME-Version: 1.0 In-Reply-To: <55A3CEAF.6030504@linux.vnet.ibm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: jjherne@linux.vnet.ibm.com, afaerber@suse.de, amit.shah@redhat.com, dgilbert@redhat.com, borntraeger@de.ibm.com, quintela@redhat.com, qemu-devel@nongnu.org On 13/07/2015 16:43, Jason J. Herne wrote: >>> >>> + CPU_FOREACH(cpu) { >>> + async_run_on_cpu(cpu, cpu_throttle_thread, NULL); >>> + } >>> + >>> + timer_mod(throttle_timer, >>> qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL_RT) + >>> + CPU_THROTTLE_TIMESLICE); >>> +} >> >> This could cause callbacks to pile up I think. David, do you have any >> idea how to fix it? > > I'm not sure how callbacks can pile up here. If the vcpus are running > then their thread's will execute the callbacks. If they are not running > then the use of QEMU_CLOCK_VIRTUAL_RT will prevent the callbacks from > stacking because the timer is not running, right? Couldn't the iothread starve the VCPUs? They need to take the iothread lock in order to process the callbacks. Paolo