Re: [RFC PATCH 2/2] migration/multifd: Move semaphore release into main thread

2023-11-16 Thread Fabiano Rosas
Juan Quintela writes: > Peter Xu wrote: >> On Thu, Nov 09, 2023 at 01:58:56PM -0300, Fabiano Rosas wrote: >>> We cannot operate on the multifd semaphores outside of the multifd >>> channel thread >>> because multifd_save_cleanup() can run in parallel and >>> attempt to destroy the mutexes, which

Re: [RFC PATCH 2/2] migration/multifd: Move semaphore release into main thread

2023-11-16 Thread Juan Quintela
Fabiano Rosas wrote: > Fabiano Rosas writes: > >> Peter Xu writes: >> >>> On Thu, Nov 09, 2023 at 01:58:56PM -0300, Fabiano Rosas wrote: >> I think we historically stumbled upon the fact that qemu_thread_join() >> is not the same as pthread_join(). The former takes a pointer and is not >> safe

Re: [RFC PATCH 2/2] migration/multifd: Move semaphore release into main thread

2023-11-16 Thread Juan Quintela
Fabiano Rosas wrote: > Peter Xu writes: > >> On Thu, Nov 09, 2023 at 01:58:56PM -0300, Fabiano Rosas wrote: >>> We cannot operate on the multifd semaphores outside of the multifd >>> channel thread >>> because multifd_save_cleanup() can run in parallel and >>> attempt to destroy the mutexes, whic

Re: [RFC PATCH 2/2] migration/multifd: Move semaphore release into main thread

2023-11-16 Thread Juan Quintela
Peter Xu wrote: > On Thu, Nov 09, 2023 at 01:58:56PM -0300, Fabiano Rosas wrote: >> We cannot operate on the multifd semaphores outside of the multifd >> channel thread >> because multifd_save_cleanup() can run in parallel and >> attempt to destroy the mutexes, which causes an assert. >> >> Looki

Re: [RFC PATCH 2/2] migration/multifd: Move semaphore release into main thread

2023-11-14 Thread Peter Xu
On Mon, Nov 13, 2023 at 10:50:39PM -0300, Fabiano Rosas wrote: > Peter Xu writes: > > > On Fri, Nov 10, 2023 at 09:05:41AM -0300, Fabiano Rosas wrote: > > > > [...] > > > >> > Then assuming we have a clear model with all these threads issue fixed > >> > (no > >> > matter whether we'd shrink 2N t

Re: [RFC PATCH 2/2] migration/multifd: Move semaphore release into main thread

2023-11-13 Thread Fabiano Rosas
Peter Xu writes: > On Fri, Nov 10, 2023 at 09:05:41AM -0300, Fabiano Rosas wrote: > > [...] > >> > Then assuming we have a clear model with all these threads issue fixed (no >> > matter whether we'd shrink 2N threads into N threads), then what we need to >> > do, IMHO, is making sure to join() al

Re: [RFC PATCH 2/2] migration/multifd: Move semaphore release into main thread

2023-11-13 Thread Peter Xu
On Fri, Nov 10, 2023 at 09:05:41AM -0300, Fabiano Rosas wrote: [...] > > Then assuming we have a clear model with all these threads issue fixed (no > > matter whether we'd shrink 2N threads into N threads), then what we need to > > do, IMHO, is making sure to join() all of them before destroying

Re: [RFC PATCH 2/2] migration/multifd: Move semaphore release into main thread

2023-11-10 Thread Fabiano Rosas
Fabiano Rosas writes: > Peter Xu writes: > >> On Thu, Nov 09, 2023 at 01:58:56PM -0300, Fabiano Rosas wrote: >>> We cannot operate on the multifd semaphores outside of the multifd >>> channel thread >>> because multifd_save_cleanup() can run in parallel and >>> attempt to destroy the mutexes, wh

Re: [RFC PATCH 2/2] migration/multifd: Move semaphore release into main thread

2023-11-10 Thread Fabiano Rosas
Peter Xu writes: > On Thu, Nov 09, 2023 at 01:58:56PM -0300, Fabiano Rosas wrote: >> We cannot operate on the multifd semaphores outside of the multifd >> channel thread >> because multifd_save_cleanup() can run in parallel and >> attempt to destroy the mutexes, which causes an assert. >> >> Loo

Re: [RFC PATCH 2/2] migration/multifd: Move semaphore release into main thread

2023-11-09 Thread Peter Xu
On Thu, Nov 09, 2023 at 01:58:56PM -0300, Fabiano Rosas wrote: > We cannot operate on the multifd semaphores outside of the multifd > channel thread > because multifd_save_cleanup() can run in parallel and > attempt to destroy the mutexes, which causes an assert. > > Looking at the places where we

[RFC PATCH 2/2] migration/multifd: Move semaphore release into main thread

2023-11-09 Thread Fabiano Rosas
We cannot operate on the multifd semaphores outside of the multifd channel thread because multifd_save_cleanup() can run in parallel and attempt to destroy the mutexes, which causes an assert. Looking at the places where we use the semaphores aside from the migration thread, there's only the TLS h