Hi Stefan, thanks for the review. I took note of your comments.

On Thu, 2022-02-03 at 10:53 +0000, Stefan Hajnoczi wrote:
> > Some background on my workload: I'm using IDE emulation, the guest is an
> > old RTOS that doesn't support virtio, using 'aio=native' isn't possible
> > either (unaligned IO accesses).
> 
> I thought QEMU's block layer creates bounce buffers for unaligned
> accesses, handling both memory buffer alignment and LBA alignment
> necessary for aio=native,cache=none?

See block/file-posix.c:raw_co_prw() {

    /*
     * When using O_DIRECT, the request must be aligned to be able to use
     * either libaio or io_uring interface. If not fail back to regular thread
     * pool read/write code which emulates this for us if we set
     * QEMU_AIO_MISALIGNED.
     */
    if (s->needs_alignment && !bdrv_qiov_is_aligned(bs, qiov))
        type |= QEMU_AIO_MISALIGNED;
    else if (s->use_linux_io_uring)
        return luring_co_submit(...);
    else if (s->use_linux_aio)
        return laio_co_submit(...);

    return raw_thread_pool_submit(..., handle_aiocb_rw, ...);
}

bdrv_qiov_is_aligned() returns 'false' on my use-case.

I believe what you're referring to happens in handle_aiocb_rw(), but it's too
late then.

Thanks,

-- 
Nicolás Sáenz


Reply via email to