[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [RFC PATCH 00/11] aio: Introduce handler type to fix ne
From: |
Fam Zheng |
Subject: |
Re: [Qemu-block] [RFC PATCH 00/11] aio: Introduce handler type to fix nested aio_poll for dataplane |
Date: |
Thu, 23 Jul 2015 19:43:36 +0800 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Thu, 07/23 10:15, Paolo Bonzini wrote:
>
>
> On 23/07/2015 08:32, Fam Zheng wrote:
> >
> > What is realized in this series is similar except the "disable, poll,
> > enable"
> > method, instead the bit mask of interesting client types is passed to
> > aio_poll() (to be exact, passed to aio_poll_clients()). That is because,
> > aio_poll may release the AioContext lock around ppoll, avoiding state will
> > make
> > the interface clearer.
>
> However, this means that you must keep the AioContext lock during all
> the long-running operations. Is this actually necessary? The original
> purpose of keeping the lock (which didn't quite work) was to block out
> dataplane operations.
I don't really see how we can avoid taking the lock around nested aio_poll
either way. Could you elaborate how it works in your original proposal?
>
> Also, this requirements means you really need the AioContext lock to be
> recursive. This is not a huge deal, but I'd prefer that requirement not
> to be too ingrained.
Regarding the AioContext lock, I see the point that it's an obstacle to
enabling virtio-scsi-dataplane MMIO.
Thinking out loud, maybe the recursive lock is too general: as you said, it has
always been used under BQL to block dataplane operations, instead of being
arbitrarily used by all kinds of threads. I'm wondering if we could just
replace it with some pause / resume mechanism of the dataplane iothreads (e.g.
iothread_pause / iothread_resume, a bit similar to block_job_pause)? That way,
aio_context_acquire can be dropped by:
/* @pause_owner_thread: a callback which will be called when _main thread_
* wants exclusively operate on the AioContext, for example with a nested
* aio_poll().
* @resume_owner_thread: a callback which will be called when _main thread_
* has done the exclusive operation.
*/
AioContext *aio_context_new(AioContextPauseResumeFn *pause_owner_thread,
AioContextPauseResumeFn *resume_owner_thread,
void *opaque,
Error **errp):
/* Try to pause the owning thread */
void aio_context_pause(AioContext *ctx, Error **errp);
/* Try to resume the paused owning thread, cannot fail */
void aio_context_resume(AioContext *ctx);
Then, in iothread.c:
iothread->ctx = aio_context_new(iothread_pause, iothread_resume,
iothread, &local_err);
Where iothread_pause can block the thread with a QemuCond.
Fam
- [Qemu-block] [RFC PATCH 00/11] aio: Introduce handler type to fix nested aio_poll for dataplane, Fam Zheng, 2015/07/23
- [Qemu-block] [RFC PATCH 01/11] aio: Introduce "type" in aio_set_fd_handler and aio_set_event_notifier, Fam Zheng, 2015/07/23
- [Qemu-block] [RFC PATCH 02/11] aio: Save type to AioHandler, Fam Zheng, 2015/07/23
- [Qemu-block] [RFC PATCH 04/11] aio-win32: Implement aio_poll_clients, Fam Zheng, 2015/07/23
- [Qemu-block] [RFC PATCH 08/11] dataplane: Mark host notifiers' client type as "dataplane", Fam Zheng, 2015/07/23
- [Qemu-block] [RFC PATCH 11/11] block: Only poll block layer fds in bdrv_aio_poll, Fam Zheng, 2015/07/23
- Re: [Qemu-block] [RFC PATCH 00/11] aio: Introduce handler type to fix nested aio_poll for dataplane, Paolo Bonzini, 2015/07/23
- Re: [Qemu-block] [RFC PATCH 00/11] aio: Introduce handler type to fix nested aio_poll for dataplane,
Fam Zheng <=
[Qemu-block] [RFC PATCH 09/11] block: Introduce bdrv_aio_poll, Fam Zheng, 2015/07/23
[Qemu-block] [RFC PATCH 06/11] nbd: Mark fd handlers client type as "nbd server", Fam Zheng, 2015/07/23
[Qemu-block] [RFC PATCH 10/11] block: Replace nested aio_poll with bdrv_aio_poll, Fam Zheng, 2015/07/23
[Qemu-block] [RFC PATCH 05/11] block: Mark fd handlers as "protocol", Fam Zheng, 2015/07/23
[Qemu-block] [RFC PATCH 03/11] aio-posix: Introduce aio_poll_clients, Fam Zheng, 2015/07/23
[Qemu-block] [RFC PATCH 07/11] aio: Mark ctx->notifier's client type as "context", Fam Zheng, 2015/07/23