From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45696) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZP3TJ-0004bh-Qv for qemu-devel@nongnu.org; Tue, 11 Aug 2015 02:55:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZP3T7-0007pj-Mp for qemu-devel@nongnu.org; Tue, 11 Aug 2015 02:55:41 -0400 Received: from greensocs.com ([193.104.36.180]:38840) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZP3T7-0007pZ-CJ for qemu-devel@nongnu.org; Tue, 11 Aug 2015 02:55:29 -0400 Message-ID: <55C99C5D.9000309@greensocs.com> Date: Tue, 11 Aug 2015 08:55:25 +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> In-Reply-To: <55C8CE36.1070208@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed 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: Paolo Bonzini , qemu-devel@nongnu.org, mttcg@greensocs.com Cc: alex.bennee@linaro.org, mark.burton@greensocs.com, a.rigo@virtualopensystems.com, guillaume.delbergue@greensocs.com On 10/08/2015 18:15, Paolo Bonzini wrote: > > 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! :) oops :). > >> @@ -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). I had a double lock with the reset handler from vexpress-a15. I don't really remember why. But I hacked that. It's fixed now :) Thanks, Fred > Paolo >