UML: User-Mode Linux

UML: User-Mode Linux

PLUG presentation

by

Frank Sorenson

June 9, 2004

User-Mode Linux

Introduction and Architecture

Booting and Running a UML

UML in-depth

Development

Resources

UML: Introduction

UML is a port of Linux to Linux

OS system call interface, not hardware interface

Full-blown Linux kernel with scheduler, VM, networking, fs, etc.

Binaries execute natively on host CPU

'official architecture'

Developed separately

Requires patches to run correctly

History

UML development began in February 1999 by Jeff Dike

Linux architecture/target

Under active development

Win32 and Sparc platforms started (status unknown)

Kernel architecture

UML Kernel Architecture

UML Modes: Tracing Thread

Tracing Thread (TT)

Each UML process has corresponding host process

Host kernel switches context to TT, TT switches context to process, then back again

Four context switches, plus signal delivery and return

UML Modes: SKAS mode

Separate Kernel Address Space (SKAS) mode

UML kernel has separate process and address space (processes can't address kernel memory)

Two context switches (much faster than TT mode)

Requires modification to ptrace on host kernel

ptrace

Process debugger

Kernel capability allowing one process to intercept signals and syscalls of another process

used by gdb, strace, etc.

TT mode

TT calls PTRACE_SYSCALL on new UML process and waits

Each process will switch to kernel mode for host calls, then back to userspace for tracing

ptrace

SKAS mode

Kernel process handles tracing and switches the single userspace process between UML processes

Creates empty address space using /proc/mm, not using new host process

Fewer processes appear on host

Running/Booting UML

Host kernel requires patches for SKAS mode and other useful fixes

UML kernel binary

Filesystems (root, swap, others)

Networking

Build and execute UML startup command line

Compiling UML kernel binary

Official kernel.org sources

UML patches (2.4.24-1 most stable)

other patches

Configure and build

make xconfig ARCH=um

make dep ARCH=um

make linux ARCH=um

Produces 'linux', a binary to run on your Linux machine

Root Filesystems

Download existing filesystems

Use root filesystem utility

rootstrap, UML Builder, etc.

Create your own filesystem

dd can create empty file

mkfs on the empty file

loopback mount filesystem file

copy in files

Single-service root filesystem

bind chroot

Booting a UML

Create command line

executable: ./linux

allocate memory: mem=64M

misc options: devfs=mount fakehd umid=myuml initrd=<initrd image>

add disks: ubd0=root_fs ubd1=swap_fs ubd2=/dev/cdrom ubd3=/dev/fd0

set up console: con0=fd0,fd1 con=xterm

networking: eth0=tuntap,tapdev,MAC,IP

runlevel: single

UML in-depth

Filesystems

Mount something from the host with hostfs/humfs

COW filesystems

Using sparse files

Security

Run UML as a user

chroot (jail_uml)

Single-service UMLs

No modules

Read-only filesystem ('chmod -w')

UML in-depth

Set 'nice' value when starting

cpucap

I/O token buckets

Startup UML in background using screen or conserver

uml-utilities (uml-mconsole, etc.)

UML console

UML modes

TT mode

SKAS mode

Top on the host, and the UML console

TuxRocks.com (my UML server)

UML Development

Numerous contributors to UML

uml-devel and uml-users mailing lists

Improvements

hostfs/humfs

AIO (Asynchronous I/O)

I/O token buckets

sysemu context switch reduction

kernel debugging

PERFORMANCE

My projects

UML performance

yucon

Web-based management for both user and admin

Easy console access and UML control through ssh

UML debugging (kernel panic on devel versions of UML)

UML add-ons (uml status, exec, etc.)

Networking improvements

yucon

Resources

Web pages

user-mode-linux.sf.net

usermodelinux.org

http://www.user-mode-linux.org/~blaisorblade/

http://perso.wanadoo.fr/laurent.vivier/UML/

http://www.theshore.net/~caker/uml/tips_and_notes.html

irc: irc.oftc.net #uml

mailing lists

user-mode-linux-devel

user-mode-linux-user

CD

Filesystems

Debian, Gentoo, RH9, FC1

UML Kernels

2.4.26, 2.6.6

Presentation

Source for compiling

UML startup scripts

run 'install' from CD to start

edit 'config', and run 'setup_uml'

Live – Run a UML right from CD

UML: User-Mode Linux

UML: User-Mode Linux

PLUG presentation

by

Frank Sorenson

June 9, 2004

Frank Sorenson

2004-02-18T15:25:33

Frank Sorenson