Re: [Qemu-devel] [PATCH 02/10] qemu-thread: introduce QemuLockCnt

2017-02-02 Thread Emilio G. Cota
Just noticed the message above mistakenly sat in my outbox for nearly 2 months. Just flushed it, so do not be surprised by its original date. Sorry for the noise, Emilio

Re: [Qemu-devel] [PATCH 02/10] qemu-thread: introduce QemuLockCnt

2017-02-02 Thread Emilio G. Cota
On Tue, Nov 29, 2016 at 12:46:59 +0100, Paolo Bonzini wrote: > A QemuLockCnt comprises a counter and a mutex, with primitives > to increment and decrement the counter, and to take and release the > mutex. It can be used to do lock-free visits to a data structure > whenever mutexes would be too

[Qemu-devel] [PATCH 02/10] qemu-thread: introduce QemuLockCnt

2017-01-12 Thread Paolo Bonzini
A QemuLockCnt comprises a counter and a mutex, with primitives to increment and decrement the counter, and to take and release the mutex. It can be used to do lock-free visits to a data structure whenever mutexes would be too heavy-weight and the critical section is too long for RCU. This could

[Qemu-devel] [PATCH 02/10] qemu-thread: introduce QemuLockCnt

2017-01-12 Thread Paolo Bonzini
A QemuLockCnt comprises a counter and a mutex, with primitives to increment and decrement the counter, and to take and release the mutex. It can be used to do lock-free visits to a data structure whenever mutexes would be too heavy-weight and the critical section is too long for RCU. This could

Re: [Qemu-devel] [PATCH 02/10] qemu-thread: introduce QemuLockCnt

2017-01-11 Thread Stefan Hajnoczi
On Wed, Jan 04, 2017 at 02:26:17PM +0100, Paolo Bonzini wrote: > +/* Decrement a counter, and return locked if it is decremented to zero. > + * It is impossible for the counter to become nonzero while the mutex > + * is taken. > + */ > +bool qemu_lockcnt_dec_and_lock(QemuLockCnt *lockcnt) > +{ > +

Re: [Qemu-devel] [PATCH 02/10] qemu-thread: introduce QemuLockCnt

2017-01-11 Thread Paolo Bonzini
On 11/01/2017 17:35, Stefan Hajnoczi wrote: > On Wed, Jan 04, 2017 at 02:26:17PM +0100, Paolo Bonzini wrote: >> +/* Decrement a counter, and return locked if it is decremented to zero. >> + * It is impossible for the counter to become nonzero while the mutex >> + * is taken. >> + */ >> +bool

Re: [Qemu-devel] [PATCH 02/10] qemu-thread: introduce QemuLockCnt

2017-01-11 Thread Stefan Hajnoczi
On Wed, Jan 04, 2017 at 02:26:17PM +0100, Paolo Bonzini wrote: > +/* Decrement a counter, and return locked if it is decremented to zero. > + * It is impossible for the counter to become nonzero while the mutex > + * is taken. > + */ > +bool qemu_lockcnt_dec_and_lock(QemuLockCnt *lockcnt) > +{ > +

Re: [Qemu-devel] [PATCH 02/10] qemu-thread: introduce QemuLockCnt

2017-01-11 Thread Paolo Bonzini
On 11/01/2017 16:48, Fam Zheng wrote: > On Wed, 01/04 14:26, Paolo Bonzini wrote: >> +For example, QEMU uses QemuLockCnt to manage an AioContext's list of >> +bottom halves and file descriptor handlers. Modifications to the list >> +of file descriptor handlers are rare. Creation of a new

Re: [Qemu-devel] [PATCH 02/10] qemu-thread: introduce QemuLockCnt

2017-01-11 Thread Fam Zheng
On Wed, 01/04 14:26, Paolo Bonzini wrote: > +For example, QEMU uses QemuLockCnt to manage an AioContext's list of > +bottom halves and file descriptor handlers. Modifications to the list > +of file descriptor handlers are rare. Creation of a new bottom half is > +frequent and can happen on a

[Qemu-devel] [PATCH 02/10] qemu-thread: introduce QemuLockCnt

2017-01-04 Thread Paolo Bonzini
A QemuLockCnt comprises a counter and a mutex, with primitives to increment and decrement the counter, and to take and release the mutex. It can be used to do lock-free visits to a data structure whenever mutexes would be too heavy-weight and the critical section is too long for RCU. This could

[Qemu-devel] [PATCH 02/10] qemu-thread: introduce QemuLockCnt

2016-12-21 Thread Paolo Bonzini
A QemuLockCnt comprises a counter and a mutex, with primitives to increment and decrement the counter, and to take and release the mutex. It can be used to do lock-free visits to a data structure whenever mutexes would be too heavy-weight and the critical section is too long for RCU. This could

Re: [Qemu-devel] [PATCH 02/10] qemu-thread: introduce QemuLockCnt

2016-11-30 Thread Stefan Hajnoczi
On Tue, Nov 29, 2016 at 12:46:59PM +0100, Paolo Bonzini wrote: > A QemuLockCnt comprises a counter and a mutex, with primitives > to increment and decrement the counter, and to take and release the > mutex. It can be used to do lock-free visits to a data structure > whenever mutexes would be too

Re: [Qemu-devel] [PATCH 02/10] qemu-thread: introduce QemuLockCnt

2016-11-29 Thread Eric Blake
On 11/29/2016 05:46 AM, Paolo Bonzini wrote: > A QemuLockCnt comprises a counter and a mutex, with primitives > to increment and decrement the counter, and to take and release the > mutex. It can be used to do lock-free visits to a data structure > whenever mutexes would be too heavy-weight and

[Qemu-devel] [PATCH 02/10] qemu-thread: introduce QemuLockCnt

2016-11-29 Thread Paolo Bonzini
A QemuLockCnt comprises a counter and a mutex, with primitives to increment and decrement the counter, and to take and release the mutex. It can be used to do lock-free visits to a data structure whenever mutexes would be too heavy-weight and the critical section is too long for RCU. This could