Skip to contentSkip to conversation

Disk IO using QEMU

DISCUSSION Alkesh Shah 2 participants 2 messages Apr 19, 2007

lore
Share & tools
lore
#0 lore raw

Hi,

I am trying to understand how Disk I/O actually works in HVM. From what I understand, whenever a disk i/o takes place in a guest OS, a VMEXIT occurs. The hypervisor than executes some handler, which sets up an event pending bit for the event channel communicating with the QEMU-DM in the Domain 0. QEMU-DM than emulates these I/O instructions.

Specifically, I wanted to know -
1. The functions that are called in this process.... or the files that I need to look at in order to understand the exact flow.
2. Since, QEMU-DM handles both the display as well as the disk I/O, is the same event channel port used for communication between hypervisor and qemu-dm for both display and disk i/o?

Thank you for you help.

Regards,
Alkesh Shah

#1 lore raw
Quoted 20 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Alkesh Shah
Sent: 19 April 2007 05:18
To: [email protected]
Subject: [Xen-devel] Disk IO using QEMU

Hi,

I am trying to understand how Disk I/O actually works in HVM. From what
I understand, whenever a disk i/o takes place in a guest OS, a VMEXIT occurs. The hypervisor than executes some handler, which sets up an event pending bit for the event channel communicating with the QEMU-DM
in the Domain 0. QEMU-DM than emulates these I/O instructions.

Quoted 4 lines

Specifically, I wanted to know -
1. The functions that are called in this process.... or the files that
I need to look at in order to understand the exact flow.

The IO instruction is intercepted by the hardware in the processor, which forms a IOIO vmexit, which ends up in the relevant part of vmexit_handler in .../xen/arch/x86/hvm/{vmx/vmx.c,svm/svm.c}. Form there it goes to generic hvm-code (hvm_send_pio or some such), which does some parsing and then does the event stuff.

In QEMU it comes in to .../tools/ioemu/target-i386-dm/helper2.c, which then (after some function calls) does the IO operation - that's essentially a function table of 65536 entries (times 3 for different sized), and eventually ends up in .../tools/ioemu/hw/ide.c.

Quoted 4 lines

2. Since, QEMU-DM handles both the display as well as the disk I/O, is
the same event channel port used for communication between hypervisor and qemu-dm for both display and disk i/o?

To quote Little Britain's Vicky Pollard, "Yeah, but no, but yeah, but ..."

Yes, qemu-dm is responsible for the video output too. But it's (for most parts) not using the event-channel to display the data - it's using a shared memory buffer that is just compared to see if it's changed since last time every few milliseconds. If it's changed, it gets redrawn. So the event-channel used for IO operations isn't involved in the display updates [other than when there is a mode-change or some other IO operation to the graphics processor, but that's a rare occurrence relatively speaking].

--
Mats

Quoted 13 lines

Thank you for you help.

Regards,
Alkesh Shah

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel