Presentation is loading. Please wait.

Presentation is loading. Please wait.

Hacking on Lguest Rusty Russell IBM Linux Technology Center (OzLabs)

Similar presentations


Presentation on theme: "Hacking on Lguest Rusty Russell IBM Linux Technology Center (OzLabs)"— Presentation transcript:

1 Hacking on Lguest Rusty Russell IBM Linux Technology Center (OzLabs)

2 5 Minute Lguest Mastery Simplest virtualization possible Linux-on-linux 32-bit x86 only Code documented!

3 5 Minute Lguest Mastery Launcher loads/services Guest: –Documentation/lguest/lguest.c Guest kernel has lg support –drivers/lguest/lguest{,_asm,_bus}.c Host kernel has lg module –drivers/lguest/*.c

4 5 Minute Lguest Mastery Launcher: –Documentation/lguest/lguest.c –Writes to /dev/lguest: LHCALL_INITIALIZE LHCALL_IRQ LHCALL_GETDMA LHCALL_BREAK –Reads to run Guest –Handles devices, net/char input

5 5 Minute Lguest Mastery Guest: –drivers/lguest/lguest{,_asm,_bus}.c –Special lguest_net/block/console drivers –Makes "hypercalls" to Host: See include/linux/lguest.h unsigned long hcall(unsigned long call, unsigned long arg1, unsigned long arg2, unsigned long arg3)

6 5 Minute Lguest Mastery Host: –drivers/lguest/*.c –Switches to Guest, switched back in any interrupt or hypercall –Handles traps and hypercalls –Returns to Launcher on DMA out to "devices"

7 1 Minute Lguest Mastery Launcher Host /dev/lguest

8 1 Minute Lguest Mastery Launcher Host write():

9 1 Minute Lguest Mastery Launcher Host write(): LHREQ_INITIALIZE pages-of-memory address of top-level pagetable address to start executing PAGE_OFFSET for kernel

10 1 Minute Lguest Mastery Launcher Host read(): unsigned long dmainfo[2]

11 1 Minute Lguest Mastery Launcher Host read(): unsigned long dmainfo[2] -> EAGAIN (interrupted by waker) -> ENOENT (guest died) -> >0 (dma from guest)

12 1 Minute Lguest Mastery Launcher Host Guest

13 1 Minute Lguest Mastery Launcher Host Guest eax=LHCALL_LGUEST_INIT edx=address of lguest_data ebx=0 ecx=0

14 1 Minute Lguest Mastery Launcher Host Guest int 15 eax=LHCALL_LGUEST_INIT edx=address of lguest_data ebx=0 ecx=0

15 The Plan

16

17 Features

18 Features: Simple S-gname: Write a new hypercall which prints your name using printk(). S-lzzz: Implement a new control sequence ^Z^Z^Z

19 Features: Simple S-lnetst: Fix Launcher to warn if discarding packets when LGUEST_DEVICE_S_ACTIVE S-lstatus: Print out device status when 'status' comes in the control fd

20 Features: Simple S-greboothook: Reboot hook in Guest S-lshutdown: Launcher clean exit on Guest shutdown. S-lreboot: Have the Launcher "reboot" itself when the final read returns -ELOOP. S-lctrlzzz: Suspend when told to by the control fd

21 Features: Medium M-hiofix: Fix lguest I/O bug for shared pages M-lsuspend: Suspend Guest into memory file M-lrestore: Restore Guest from memory file

22 Features: Advanced A-lmatchmem: Print matching memory among Guests A-lsharemem: Share exported matching memory A-grtc: Implement /dev/rtc for the Guest

23 Legal Statement This work represents the views of the author(s) and does not necessarily reflect the views of IBM Corporation. The following terms are trademarks or registered trademarks of International Business Machines Corporation in the United States and/or other countries: IBM (logo). A full list of U.S. trademarks owned by IBM may be found at http://www.ibm.com/legal/copytrade.shtml. Linux is a registered trademark of Linus Torvalds. Other company, product, and service names may be trademarks or service marks of others.


Download ppt "Hacking on Lguest Rusty Russell IBM Linux Technology Center (OzLabs)"

Similar presentations


Ads by Google