From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57235) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZOpjz-0006e9-Nd for qemu-devel@nongnu.org; Mon, 10 Aug 2015 12:16:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZOpjw-0008O7-In for qemu-devel@nongnu.org; Mon, 10 Aug 2015 12:15:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47905) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZOpjw-0008Nx-ER for qemu-devel@nongnu.org; Mon, 10 Aug 2015 12:15:56 -0400 References: <1439220437-23957-1-git-send-email-fred.konrad@greensocs.com> <1439220437-23957-10-git-send-email-fred.konrad@greensocs.com> From: Paolo Bonzini Message-ID: <55C8CE36.1070208@redhat.com> Date: Mon, 10 Aug 2015 18:15:50 +0200 MIME-Version: 1.0 In-Reply-To: <1439220437-23957-10-git-send-email-fred.konrad@greensocs.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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: fred.konrad@greensocs.com, qemu-devel@nongnu.org, mttcg@greensocs.com Cc: mark.burton@greensocs.com, alex.bennee@linaro.org, a.rigo@virtualopensystems.com, guillaume.delbergue@greensocs.com 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 out 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 = true; "iothread_locked = true" must be kept. Otherwise... yay! :) > @@ -125,8 +128,10 @@ void tlb_flush_page(CPUState *cpu, target_ulong addr) > can be detected */ > void tlb_protect_code(ram_addr_t ram_addr) > { > + qemu_mutex_lock_iothread(); > cpu_physical_memory_test_and_clear_dirty(ram_addr, TARGET_PAGE_SIZE, > DIRTY_MEMORY_CODE); > + qemu_mutex_unlock_iothread(); > } > Not needed anymore. > diff --git a/target-i386/misc_helper.c b/target-i386/misc_helper.c > index 52c5d65..55f63bf 100644 > --- a/target-i386/misc_helper.c > +++ b/target-i386/misc_helper.c None of this is needed anymore either! :) > + /* > + * Some device's reset needs to grab the global_mutex. So just release it > + * here. > + */ > + qemu_mutex_unlock_iothread(); > /* reset all devices */ > QTAILQ_FOREACH_SAFE(re, &reset_handlers, entry, nre) { > re->func(re->opaque); > } > + qemu_mutex_lock_iothread(); Should never have been true? (And, I think, it was pointed out in a previous version too). Paolo