qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What is bs->reqs_lock for?


From: Paolo Bonzini
Subject: Re: What is bs->reqs_lock for?
Date: Tue, 18 Aug 2020 08:16:09 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0

On 13/08/20 18:34, Vladimir Sementsov-Ogievskiy wrote:
> I thought bs is attached to one aio context and aio context attached to
> one iothread.

For now yes, but with multiqueue there would be many iothreads sending
requests to the AioContext.  The BDS would still have a "home"
aiocontext to request socket readiness events, but
io_uring/linux_aio/threadpool requests could be issued from any iothread.

> And all normal request processing of the bs is done in this one iothread.
> And when we need to access bs externally, we do it in
> aio_context_acquire / aio_context_release, which protects from parallel
> access to BlockDriverState fields...
> 
> But you say, that block/io.c is not protected by AioContext lock..
> Does it mean that everything must be thread-safe in block/io.c and all
> block drivers?

Yes.

> 
> Are tracked_requests different from other fields? A lot of other
> BlockDriverState
> fields are not protected by any mutex.. For example: total_sectors,
> file, backing..

Rules are documented in include/block/block_int.h.  It seems however
that never_freeze was blindly added at the end.

Paolo

> Could you give an example of parallel access to tracked_requests?
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]