qemu-devel
[Top][All Lists]
Advanced

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

Block I/O in the middle of guest code execution


From: Arnabjyoti Kalita
Subject: Block I/O in the middle of guest code execution
Date: Tue, 13 Jul 2021 10:22:27 +0530

Hello Stefan/all,

I was reading your blog post on the QEMU overall architecture (link - "http://blog.vmsplice.net/2011/03/qemu-internals-overall-architecture-and.html") and I have a few questions with regards to executing I/O operations (block I/O) in the middle of guest code execution.

I am running QEMU version 5.0.1 and my target and host architecture is x86-64. I am using the virtio-blk block driver frontend with a qcow2 image file as a backing file storage.

I want to do something like below (in TCG) -

static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, TranslationBlock *itb)
{
           log_cpu_state(cpu, flags);
           qemu_log_unlock(logfile);
    }
           #endif /* DEBUG_DISAS */
           if (cond is true) {
               virtio_blk_data_plane_handle_output(vdev, vq);  <- calling block I/O function here
           }
           ret = tcg_qemu_tb_exec(env, tb_ptr);
           cpu->can_do_io = 1;
           last_tb = (TranslationBlock *)(ret & ~TB_EXIT_MASK);
           .......
}

I have a few questions regarding this.

- Is it possible to call block I/O functions like this? Or do I have to "call" it from the event loop (main_loop_wait) ?

- Making a change like this requires me to actually finish the block operation first before I start executing the next TCG block. I see that "virtio_blk_data_plane_handle_output" makes a lot of aio thread usages and coroutines. How do I make this call synchronous and essentially run it in the same thread?

Thank you very much.

Best Regards,
Arnabjyoti Kalita






reply via email to

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