From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPHC6-0000iT-BO for qemu-devel@nongnu.org; Tue, 11 Aug 2015 17:34:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZPHC3-0006ze-2M for qemu-devel@nongnu.org; Tue, 11 Aug 2015 17:34:50 -0400 Received: from greensocs.com ([193.104.36.180]:60533) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPHC2-0006z7-PZ for qemu-devel@nongnu.org; Tue, 11 Aug 2015 17:34:46 -0400 Message-ID: <55CA6A6E.9030205@greensocs.com> Date: Tue, 11 Aug 2015 23:34:38 +0200 From: Frederic Konrad MIME-Version: 1.0 References: <1439220437-23957-1-git-send-email-fred.konrad@greensocs.com> <1439220437-23957-10-git-send-email-fred.konrad@greensocs.com> <55C8CE36.1070208@redhat.com> <8737zph9dy.fsf@linaro.org> In-Reply-To: <8737zph9dy.fsf@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC PATCH V7 09/19] Drop global lock during TCG code execution List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?QWxleCBCZW5uw6ll?= , Paolo Bonzini Cc: mttcg@greensocs.com, guillaume.delbergue@greensocs.com, mark.burton@greensocs.com, qemu-devel@nongnu.org, a.rigo@virtualopensystems.com On 11/08/2015 22:12, Alex Benn=C3=A9e wrote: > Paolo Bonzini writes: > >> On 10/08/2015 17:27, fred.konrad@greensocs.com wrote: >>> void qemu_mutex_lock_iothread(void) >>> { >>> - atomic_inc(&iothread_requesting_mutex); >>> - /* In the simple case there is no need to bump the VCPU thread o= ut of >>> - * TCG code execution. >>> - */ >>> - if (!tcg_enabled() || qemu_in_vcpu_thread() || >>> - !first_cpu || !first_cpu->thread) { >>> - qemu_mutex_lock(&qemu_global_mutex); >>> - atomic_dec(&iothread_requesting_mutex); >>> - } else { >>> - if (qemu_mutex_trylock(&qemu_global_mutex)) { >>> - qemu_cpu_kick_thread(first_cpu); >>> - qemu_mutex_lock(&qemu_global_mutex); >>> - } >>> - atomic_dec(&iothread_requesting_mutex); >>> - qemu_cond_broadcast(&qemu_io_proceeded_cond); >>> - } >>> - iothread_locked =3D true; >> "iothread_locked =3D true" must be kept. Otherwise... yay! :) >> > Also if qemu_cond_broadcast(&qemu_io_proceeded_cond) is being dropped > there is no point keeping the guff around in qemu_tcg_wait_io_event. > Yes good point. BTW this leads to high consumption of host CPU eg: 100% per VCPU thread a= s the VCPUs thread are no longer waiting for qemu_io_proceeded_cond. Fred