[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 4/8] qcow2-threads: split out generic path
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
Re: [Qemu-devel] [PATCH v2 4/8] qcow2-threads: split out generic path |
Date: |
Fri, 14 Dec 2018 08:51:12 +0000 |
14.12.2018 2:28, Paolo Bonzini wrote:
> On 11/12/18 17:43, Vladimir Sementsov-Ogievskiy wrote:
>> + ThreadPool *pool = aio_get_thread_pool(bdrv_get_aio_context(bs));
>> +
>> + while (s->nb_threads >= QCOW2_MAX_THREADS) {
>> + qemu_co_queue_wait(&s->thread_task_queue, NULL);
>> + }
>> +
>> + s->nb_threads++;
>> + ret = thread_pool_submit_co(pool, func, arg);
>> + s->nb_threads--;
>> +
>> + qemu_co_queue_next(&s->thread_task_queue);
>
> What lock is protecting this manipulation? I'd rather avoid adding more
> users of the AioContext lock, especially manipulation of CoQueues.
>
> One possibility is to do the s->lock unlock/lock here, and then also
> rely on that in patch 8.
>
> Paolo
>
Hm, can you please give more details? It's refactoring commit, so, do you mean
that there is an existing bug? We are in coroutine, so, it's not safe to call
qemu_co_queue_next?
I feel, I don't understand the future without AioContext lock, and how it
influence
contexts/threads/coroutines.. So, from this context, s->thread_task_queue may be
accessed from other thread, when we are here, and calling qemu_co_queue_next
from
our aio context? But from where? /Sorry for may be stupid questions/
--
Best regards,
Vladimir
- [Qemu-devel] [PATCH v2 0/8] qcow2: encryption threads, Vladimir Sementsov-Ogievskiy, 2018/12/11
- [Qemu-devel] [PATCH v2 3/8] qcow2-threads: use thread_pool_submit_co, Vladimir Sementsov-Ogievskiy, 2018/12/11
- [Qemu-devel] [PATCH v2 6/8] qcow2: qcow2_co_preadv: skip using hd_qiov when possible, Vladimir Sementsov-Ogievskiy, 2018/12/11
- [Qemu-devel] [PATCH v2 5/8] qcow2: qcow2_co_preadv: improve locking, Vladimir Sementsov-Ogievskiy, 2018/12/11
- [Qemu-devel] [PATCH v2 8/8] qcow2: do encryption in threads, Vladimir Sementsov-Ogievskiy, 2018/12/11
- [Qemu-devel] [PATCH v2 7/8] qcow2: bdrv_co_pwritev: move encryption code out of the lock, Vladimir Sementsov-Ogievskiy, 2018/12/11
- [Qemu-devel] [PATCH v2 4/8] qcow2-threads: split out generic path, Vladimir Sementsov-Ogievskiy, 2018/12/11
- [Qemu-devel] [PATCH v2 2/8] qcow2: add separate file for threaded data processing functions, Vladimir Sementsov-Ogievskiy, 2018/12/11
- [Qemu-devel] [PATCH v2 1/8] qcow2.h: add missing include, Vladimir Sementsov-Ogievskiy, 2018/12/11
- Re: [Qemu-devel] [PATCH v2 0/8] qcow2: encryption threads, Daniel P . Berrangé, 2018/12/11
- Re: [Qemu-devel] [PATCH v2 0/8] qcow2: encryption threads, Vladimir Sementsov-Ogievskiy, 2018/12/17