Re: [Qemu-devel] [PATCH v2] qemu_mutex_iothread_locked not correctly synchronized

2015-11-26 Thread David Engraf
Am 25.11.2015 um 17:16 schrieb Paolo Bonzini: On 25/11/2015 16:48, David Engraf wrote: Indeed, TLS handling is broken. The address of iothread_locked is always the same between threads and I can see that a different thread sets iothread_locked to false, thus my current thread uses an invalid

Re: [Qemu-devel] [PATCH v2] qemu_mutex_iothread_locked not correctly synchronized

2015-11-26 Thread Stefan Weil
Am 26.11.2015 um 10:12 schrieb David Engraf: > Am 25.11.2015 um 17:16 schrieb Paolo Bonzini: >> >> >> On 25/11/2015 16:48, David Engraf wrote: >>> >>> Indeed, TLS handling is broken. The address of iothread_locked is >>> always >>> the same between threads and I can see that a different thread

Re: [Qemu-devel] [PATCH v2] qemu_mutex_iothread_locked not correctly synchronized

2015-11-26 Thread David Engraf
Am 26.11.2015 um 12:25 schrieb Stefan Weil: Am 26.11.2015 um 10:12 schrieb David Engraf: Am 25.11.2015 um 17:16 schrieb Paolo Bonzini: On 25/11/2015 16:48, David Engraf wrote: Indeed, TLS handling is broken. The address of iothread_locked is always the same between threads and I can see

Re: [Qemu-devel] [PATCH v2] qemu_mutex_iothread_locked not correctly synchronized

2015-11-25 Thread David Engraf
Am 25.11.2015 um 15:36 schrieb Paolo Bonzini: On 25/11/2015 15:04, David Engraf wrote: No, you don't. Who is reading iothread_locked during qemu_cond_wait_iothread? No one, because it is a thread-local variable whose address is never taken. prepare_mmio_access is reading

Re: [Qemu-devel] [PATCH v2] qemu_mutex_iothread_locked not correctly synchronized

2015-11-25 Thread Paolo Bonzini
On 25/11/2015 16:48, David Engraf wrote: > > Indeed, TLS handling is broken. The address of iothread_locked is always > the same between threads and I can see that a different thread sets > iothread_locked to false, thus my current thread uses an invalid state. > I will have to check why my

Re: [Qemu-devel] [PATCH v2] qemu_mutex_iothread_locked not correctly synchronized

2015-11-25 Thread David Engraf
Hi Paolo, please check the new version. I removed changing the iothread_locked variable. But I still need to set the correct value of iothread_locked when using qemu_cond_wait. This will fix my race condition on Windows when prepare_mmio_access is called and checks if the lock is already held by

Re: [Qemu-devel] [PATCH v2] qemu_mutex_iothread_locked not correctly synchronized

2015-11-25 Thread David Engraf
Am 25.11.2015 um 14:26 schrieb Paolo Bonzini: On 25/11/2015 13:31, David Engraf wrote: Hi Paolo, please check the new version. I removed changing the iothread_locked variable. But I still need to set the correct value of iothread_locked when using qemu_cond_wait. No, you don't. Who is

Re: [Qemu-devel] [PATCH v2] qemu_mutex_iothread_locked not correctly synchronized

2015-11-25 Thread Paolo Bonzini
On 25/11/2015 13:31, David Engraf wrote: > Hi Paolo, > > please check the new version. I removed changing the iothread_locked > variable. But I still need to set the correct value of iothread_locked > when using qemu_cond_wait. No, you don't. Who is reading iothread_locked during

Re: [Qemu-devel] [PATCH v2] qemu_mutex_iothread_locked not correctly synchronized

2015-11-25 Thread Paolo Bonzini
On 25/11/2015 15:04, David Engraf wrote: >>> >> >> No, you don't. Who is reading iothread_locked during >> qemu_cond_wait_iothread? No one, because it is a thread-local variable >> whose address is never taken. > > prepare_mmio_access is reading iothread_locked by using >