[vbox-dev] how does i/o routed from host kernel to user space?

Huihong Luo huisinro at yahoo.com
Sat Jul 16 04:01:48 GMT 2011


Perhaps, I should ask this way:
 
Is VirtualBox.exe looping around and continuously polling (send ioctl to kernel) for i/o requests? or whether the kernel notifies the user mode when there are i/o exits?

--- On Thu, 7/14/11, Huihong Luo <huisinro at yahoo.com> wrote:


From: Huihong Luo <huisinro at yahoo.com>
Subject: Re: [vbox-dev] how does i/o routed from host kernel to user space?
To: vbox-dev at virtualbox.org, "Klaus Espenlaub" <klaus.espenlaub at oracle.com>
Date: Thursday, July 14, 2011, 10:25 AM







Klaus,
 
Thanks for the info. I am aware of those, I'd appreciate if you can dig into more detains on Host kernel => VMM ==> disk emulation layer.
 
Disk emulation code is executed in a user process, how does the i/o traverse this path? In general, it is not easy for kernel to call a function inside another process.
 
What I meant to implement is a Windows disk driver for offline disk access, for example, one can mount a vdi file as disk C:\. Usually this kind of driver is implemented as kernel, but I want to move the core storage code to user space, so I need to find out if vbox uses some undocumented way of forwarding kernel calls to use space.


--- On Thu, 7/14/11, Klaus Espenlaub <klaus.espenlaub at oracle.com> wrote:


From: Klaus Espenlaub <klaus.espenlaub at oracle.com>
Subject: Re: [vbox-dev] how does i/o routed from host kernel to user space?
To: vbox-dev at virtualbox.org
Date: Thursday, July 14, 2011, 10:12 AM


On 14.07.2011 17:45, Huihong Luo wrote:
> As I understand, when vm performs i/o, the i/o requests traps to the
> host kernel (assuming VT-x/AMD-V). This i/o must be sent to user mode
> VirtualBox.exe for processing. Throgh what mechanism the user mode
> callback functions are invoked? The user mode performs pooling? Address
> space switching? Interprocess communications? ...

The VM machinery is in src/VBox/VMM. If you want to look at it from the device emulation side, look at src/VBox/Devices (as this is about storage, the Storage subdir is probably most interesting).

> I really wanted to find this out. I am exploring doing a user mode
> virtual disk driver for vbox. so the same vbox code can be used to mount
> virtual disks, and vbox can have an integrated interface on Windows for
> virtual disk mounting.

I don't understand what you're exactly trying to achieve - the IDE/SATA/SCSI/SAS device emulations generally use DrvVD (which is 100% userland) for all image accesses (host floppy/DVD uses a different driver), so that already is a single implementation, which uses the VD support (see include/VBox/vd.h) for a uniform interface to all disk image formats. The VD framework is very flexible and powerful. It handles complete stacks of base and diff images and so on. Sample code how to use the VD framework directly is e.g. in the vbox-img tool.

Klaus

_______________________________________________
vbox-dev mailing list
vbox-dev at virtualbox.org
http://vbox.innotek.de/mailman/listinfo/vbox-dev

-----Inline Attachment Follows-----


_______________________________________________
vbox-dev mailing list
vbox-dev at virtualbox.org
http://vbox.innotek.de/mailman/listinfo/vbox-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20110715/ac9ac695/attachment.html>


More information about the vbox-dev mailing list