[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 16/19] block: protect modification of dirty bitm
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 16/19] block: protect modification of dirty bitmaps with a mutex |
Date: |
Tue, 27 Jun 2017 16:26:43 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 |
On 27/06/2017 16:20, Vladimir Sementsov-Ogievskiy wrote:
> I'm likely not right, but for me introducing this mutex looks like dirty
> bitmaps may be accessed from concurrent threads. So for me it looks
> strange that only accessors are protected by the mutex and not the whole
> transactions.
There must be something else protecting the whole transaction.
> One example I've wrote above, other examples from code: are
> qmp_block_dirty_bitmap** functions:
>
> bdrv_create_dirty_bitmap() {
>
> bdrv_find_dirty_bitmap()
>
> ....
>
> bdrv_dirty_bitmaps_lock(bs);
> QLIST_INSERT_HEAD(&bs->dirty_bitmaps, bitmap, list);
> bdrv_dirty_bitmaps_unlock(bs);
>
> }
>
> - we protect inserting into list from other threads, but what prevent
> creating bitmap with the same name from other thread after
> bdrv_find_dirty_bitmap() and before bdrv_dirty_bitmaps_lock() ?
It's like a read-write lock.
The write side is invoked under the 'big QEMU lock' so there cannot be
two concurrent writes.
A bitmap can be written to after bdrv_find_dirty_bitmap returns, but
only if _you_ tell another thread about the bitmap you've just created.
If that doesn't happen, the bitmap cannot change. And it can also
disappear because _your_ thread is the one with the big QEMU lock.
Paolo
- [Qemu-devel] [PATCH 16/19] block: protect modification of dirty bitmaps with a mutex, (continued)
- [Qemu-devel] [PATCH 16/19] block: protect modification of dirty bitmaps with a mutex, Paolo Bonzini, 2017/06/05
- Re: [Qemu-devel] [PATCH 16/19] block: protect modification of dirty bitmaps with a mutex, Vladimir Sementsov-Ogievskiy, 2017/06/26
- Re: [Qemu-devel] [PATCH 16/19] block: protect modification of dirty bitmaps with a mutex, Paolo Bonzini, 2017/06/26
- Re: [Qemu-devel] [PATCH 16/19] block: protect modification of dirty bitmaps with a mutex, Vladimir Sementsov-Ogievskiy, 2017/06/27
- Re: [Qemu-devel] [PATCH 16/19] block: protect modification of dirty bitmaps with a mutex, Paolo Bonzini, 2017/06/27
- Re: [Qemu-devel] [PATCH 16/19] block: protect modification of dirty bitmaps with a mutex, Vladimir Sementsov-Ogievskiy, 2017/06/27
- Re: [Qemu-devel] [PATCH 16/19] block: protect modification of dirty bitmaps with a mutex, Paolo Bonzini, 2017/06/27
- Re: [Qemu-devel] [PATCH 16/19] block: protect modification of dirty bitmaps with a mutex, Vladimir Sementsov-Ogievskiy, 2017/06/27
- Re: [Qemu-devel] [PATCH 16/19] block: protect modification of dirty bitmaps with a mutex, Paolo Bonzini, 2017/06/27
- Re: [Qemu-devel] [PATCH 16/19] block: protect modification of dirty bitmaps with a mutex, Vladimir Sementsov-Ogievskiy, 2017/06/27
- Re: [Qemu-devel] [PATCH 16/19] block: protect modification of dirty bitmaps with a mutex,
Paolo Bonzini <=
- Re: [Qemu-devel] [PATCH 16/19] block: protect modification of dirty bitmaps with a mutex, Vladimir Sementsov-Ogievskiy, 2017/06/27
- Re: [Qemu-devel] [PATCH 16/19] block: protect modification of dirty bitmaps with a mutex, Paolo Bonzini, 2017/06/27
- Re: [Qemu-devel] [PATCH 16/19] block: protect modification of dirty bitmaps with a mutex, Vladimir Sementsov-Ogievskiy, 2017/06/27
- Re: [Qemu-devel] [PATCH 16/19] block: protect modification of dirty bitmaps with a mutex, Vladimir Sementsov-Ogievskiy, 2017/06/27
- Re: [Qemu-devel] [PATCH 16/19] block: protect modification of dirty bitmaps with a mutex, Paolo Bonzini, 2017/06/27
[Qemu-devel] [PATCH 15/19] migration/block: reset dirty bitmap before reading, Paolo Bonzini, 2017/06/05
[Qemu-devel] [PATCH 18/19] block: split BlockAcctStats creation and setup, Paolo Bonzini, 2017/06/05
[Qemu-devel] [PATCH 19/19] block: make accounting thread-safe, Paolo Bonzini, 2017/06/05