]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
13 years agokvm tools: Add IPV4 support for uip
Asias He [Wed, 29 Jun 2011 08:47:08 +0000 (16:47 +0800)]
kvm tools: Add IPV4 support for uip

- Introduce struct uip_ip to present IP package

- Add a helper uip_ip_len() to return totoal length of a IP package

- Add a helper uip_ip_hdrlen() to return the IP header length

- Currently, uip does not support IP options
  Drop IP package if IP header length is not 20 bytes which means it
  contains IP options.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add ARP support for uip
Asias He [Wed, 29 Jun 2011 08:47:07 +0000 (16:47 +0800)]
kvm tools: Add ARP support for uip

- Introduce struct uip_arp to present ARP package
- uip_tx_do_arp()
  Clone incoming ARP ethernet frame, if ARP is requesting
  host IP address, tell guest host MAC address.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Introduce ethernet frame buffer system for uip
Asias He [Wed, 29 Jun 2011 08:47:06 +0000 (16:47 +0800)]
kvm tools: Introduce ethernet frame buffer system for uip

- uip_buf_get_free()
  Get a free buffer from buffer pool, sleep if there is no free buffer.

- uip_buf_get_used()
  Get a used buffer from buffer pool, sleep if there is no used buffer.

- uip_buf_set_free()
  Set a buffer as free, so it can be reused by the buffer producer.

- uip_buf_set_used()
  Set a buffer as used, uip rx code will inject the ethernet frame in
  this buffer into guest.

- uip_buf_clone()
  Get a free buffer, and clone data into it.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agotools/kvm/9p: Add error handling
Aneesh Kumar K.V [Sun, 19 Jun 2011 10:24:04 +0000 (15:54 +0530)]
tools/kvm/9p: Add error handling

return error via RERROR message

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
13 years agotools/kvm/9p: Make the 9p handler void return
Aneesh Kumar K.V [Sun, 19 Jun 2011 10:24:03 +0000 (15:54 +0530)]
tools/kvm/9p: Make the 9p handler void return

Error is reported via RERROR message.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
13 years agotools/kvm/9p: Add error protocol reply
Aneesh Kumar K.V [Sun, 19 Jun 2011 09:09:59 +0000 (14:39 +0530)]
tools/kvm/9p: Add error protocol reply

Add RERROR and use that in open on failure

NOTE: All the protocol operation should handle like this.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
13 years agotools/kvm/9p: check the iov count with the read/write count
Aneesh Kumar K.V [Sun, 19 Jun 2011 09:44:35 +0000 (15:14 +0530)]
tools/kvm/9p: check the iov count with the read/write count

Make sure we don't read/write more than what is requested
from client.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
13 years agotools/kvm/9p: Simplify the handler
Aneesh Kumar K.V [Sat, 18 Jun 2011 17:49:08 +0000 (23:19 +0530)]
tools/kvm/9p: Simplify the handler

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
13 years agotools/kvm/9p: Fix the pdu len.
Aneesh Kumar K.V [Sat, 18 Jun 2011 17:49:07 +0000 (23:19 +0530)]
tools/kvm/9p: Fix the pdu len.

The TSTAT output formwat is wS. So not sure whey we
need sizeof(u16)*2 in pdu length.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
13 years agotools/kvm/9p: Don't follow symlink on server
Aneesh Kumar K.V [Sat, 18 Jun 2011 17:49:06 +0000 (23:19 +0530)]
tools/kvm/9p: Don't follow symlink on server

Use lstat instead of stat

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
13 years agotools/kvm/virtio: Add new iov helper
Aneesh Kumar K.V [Sat, 18 Jun 2011 17:49:05 +0000 (23:19 +0530)]
tools/kvm/virtio: Add new iov helper

This add the in and out iovec to seperate array

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
13 years agotools/kvm/9p: Use the same #define as the kernel
Aneesh Kumar K.V [Sun, 19 Jun 2011 09:13:16 +0000 (14:43 +0530)]
tools/kvm/9p: Use the same #define as the kernel

Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agotools/kvm/9p: Always include system header before kernel headers
Aneesh Kumar K.V [Sat, 18 Jun 2011 15:37:28 +0000 (21:07 +0530)]
tools/kvm/9p: Always include system header before kernel headers

Otherwise many things can break, such as mapping of stat to stat64

Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Use ioeventfd in virtio-9p
Sasha Levin [Fri, 17 Jun 2011 22:28:25 +0000 (18:28 -0400)]
kvm tools: Use ioeventfd in virtio-9p

Use ioeventfd to receive virt queue notifications within virtio-9p.
This should prevent exits on 9p commands.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm run: Add 'panic=1' to default kernel options
Pekka Enberg [Fri, 17 Jun 2011 21:39:20 +0000 (00:39 +0300)]
kvm run: Add 'panic=1' to default kernel options

Now that we support machine reset via i8042, add 'panic=1' to default kernel
options to make sure we exit the hypervisor if the guest kernel panics.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Implement keyboard reset method
Sasha Levin [Fri, 17 Jun 2011 20:41:28 +0000 (16:41 -0400)]
kvm tools: Implement keyboard reset method

Implement the keyboard reset method which allows guest kernel
to reboot the guest using the keyboard controller.

This will allow guest kernel to reboot the guest when it needs to,
for example - kernel panic (when passing "panic=1" as kernel parameter).

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agotools/kvm/9p: Add support for multiple 9p export dirs
Aneesh Kumar K.V [Fri, 17 Jun 2011 18:11:22 +0000 (23:41 +0530)]
tools/kvm/9p: Add support for multiple 9p export dirs

Acked-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Fix broken terminal when kvm exits because of a signal
Anton Vorontsov [Fri, 17 Jun 2011 16:10:46 +0000 (20:10 +0400)]
kvm tools: Fix broken terminal when kvm exits because of a signal

Issuing 'killall kvm' leaves the terminal on which kvm was running in
a broken state. This is because atexit(3) handlers are not called if
a process terminates because of a signal.

Installing a proper handler for the TERM signal fixes the issue.

p.s. The rest of the kvm tools use signal(2), and not sigaction(2), so
     I continue the tradition.

Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Fix attempt to free mmaped memory
Sasha Levin [Fri, 17 Jun 2011 11:13:16 +0000 (07:13 -0400)]
kvm tools: Fix attempt to free mmaped memory

Framebuffer memory which was mmap() is being free() at the shutdown
of the guest, leading to glibc errors.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Update README with instructions for Arch Linux
Emil Renner Berthing [Thu, 16 Jun 2011 15:47:35 +0000 (17:47 +0200)]
kvm tools: Update README with instructions for Arch Linux

Signed-off-by: Emil Renner Berthing <esmil@mailme.dk>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools, qcow: Use fdatasync() instead of sync_file_range()
Pekka Enberg [Thu, 16 Jun 2011 14:18:58 +0000 (17:18 +0300)]
kvm tools, qcow: Use fdatasync() instead of sync_file_range()

As explained by Christoph Hellwig, sync_file_range() is not sufficient to
guarantee that Qcow image metadata is never corrupted:

  On Thu, Jun 16, 2011 at 12:34:04PM +0300, Pekka Enberg wrote:
  > Hi Christoph,
  >
  > On Thu, Jun 16, 2011 at 09:21:03AM +0300, Pekka Enberg wrote:
  > >> And btw, we use sync_file_range()
  >
  > On Thu, Jun 16, 2011 at 12:24 PM, Christoph Hellwig <hch@infradead.org> wrote:
  > > Which doesn't help you at all. ?sync_file_range is just a hint for VM
  > > writeback, but never commits filesystem metadata nor the physical
  > > disk's write cache. ?In short it's a completely dangerous interface, and
  > > that is pretty well documented in the man page.
  >
  > Doh - I didn't read it carefully enough and got hung up with:
  >
  >     Therefore, unless the application is strictly performing overwrites of
  >     already-instantiated disk blocks, there are no guarantees that the data will
  >     be available after a crash.
  >
  > without noticing that it obviously doesn't work with filesystems like
  > btrfs that do copy-on-write.

  You also missed:

  " This system call does not flush disk write caches and thus does not
    provide any data integrity on systems with volatile disk write
    caches."

  so it's not safe if you either have a cache, or are using btrfs, or
  are using a sparse image, or are using an image preallocated using
  fallocate/posix_fallocate.

  > What's the right thing to do here? Is fdatasync() sufficient?

  Yes.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Signal only one thread when injecting console interrupts
Sasha Levin [Wed, 15 Jun 2011 21:33:06 +0000 (17:33 -0400)]
kvm tools: Signal only one thread when injecting console interrupts

Send signals only to the thread which handles console injection
instead of the entire process.

This prevents every single thread from having to ignore SIGALRM
and will help scaling when running large amount of VCPU threads.

Tested-by: Asias He <asias.hejun@gmail.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Suggested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Fix 'kvm run' on 32-bit machines with >2 GB of RAM
Pekka Enberg [Thu, 16 Jun 2011 14:04:31 +0000 (17:04 +0300)]
kvm tools: Fix 'kvm run' on 32-bit machines with >2 GB of RAM

This patch fixes the following nasty 'kvm run' startup problem that's caused by
'long' and 'u64' mixup in the code:

  $ ./kvm run
    Fatal: out of memory

Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add IO delay option
Prasad Joshi [Fri, 10 Jun 2011 10:35:20 +0000 (11:35 +0100)]
kvm tools: Add IO delay option

Add a command line debug option to add a fix amount of delay in read and
write operation.

From Ingo "the delays are *constant* [make sure you use a high-res timers
kernel], so they do not result in nearly as much measurement noise as real
block IO does.
[...]
This way you are basically 'emulating' a real disk drive but you will
emulate uniform latencies, which makes measurements a lot more
reliable - while still relevant to the end result."

Suggested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Prasad Joshi <prasadjoshi124@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add 'kvm pause' command
Sasha Levin [Fri, 3 Jun 2011 14:22:29 +0000 (17:22 +0300)]
kvm tools: Add 'kvm pause' command

This patch adds a 'kvm debug' command that's currently an alias for

  kill -USR2 `pidof kvm`

Which pauses a guest (freezes all VCPU threads) or resumes a paused
guest.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Use double buffering with SDL
Sasha Levin [Thu, 9 Jun 2011 20:48:17 +0000 (16:48 -0400)]
kvm tools: Use double buffering with SDL

Page flip every time we copy the buffer over instead of invalidating
rects.
This should improve performance by letting hardware do the page
flipping.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Fix some SDL keyboard translations
Sasha Levin [Thu, 9 Jun 2011 20:48:16 +0000 (16:48 -0400)]
kvm tools: Fix some SDL keyboard translations

This patch adds unmapped '<', '>', '|', '-', '+' and '='
which are quite useful in linux.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add WERROR to Makefile for disabling -Werror
Pekka Enberg [Wed, 8 Jun 2011 14:29:12 +0000 (17:29 +0300)]
kvm tools: Add WERROR to Makefile for disabling -Werror

This patch adds a WERROR variable to Makefile that can be used as follows:

  make WERROR=0

to disable '-Werror' while building. This is useful while doing 'git bisect',
for example.

Suggested-by: Ingo Molnar <mingo@elte.hu>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Makefile cleanups
Pekka Enberg [Wed, 8 Jun 2011 14:20:46 +0000 (17:20 +0300)]
kvm tools: Makefile cleanups

Use immediate evaluation (":=") instead of deferred evaluation ("=") and tidy
up things while we're there.

Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Reform bios make rules
Cyrill Gorcunov [Tue, 7 Jun 2011 19:41:16 +0000 (23:41 +0400)]
kvm tools: Reform bios make rules

Put bios code into bios.s and adjust makefile
rules accordingly. It's more natural than bios-rom.S
(which is now simply a container over real bios code).

Also improve bios deps in Makefile.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Get rid of spaces in ld script
Cyrill Gorcunov [Tue, 7 Jun 2011 19:41:15 +0000 (23:41 +0400)]
kvm tools: Get rid of spaces in ld script

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Delete dangling cursor from int10
Cyrill Gorcunov [Tue, 7 Jun 2011 19:41:14 +0000 (23:41 +0400)]
kvm tools: Delete dangling cursor from int10

Noone use it anymore. Also cleanup comment on
int10 as well, int10_handler routine do all
the hard work.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Introduce vidmode parmeter
Cyrill Gorcunov [Tue, 7 Jun 2011 20:22:18 +0000 (00:22 +0400)]
kvm tools: Introduce vidmode parmeter

Usually this might be set by loader but since
we're the loader lets allow to specify vesa
mode as well.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Options parser to handle hex numbers
Cyrill Gorcunov [Tue, 7 Jun 2011 19:41:12 +0000 (23:41 +0400)]
kvm tools: Options parser to handle hex numbers

Some kernel parameters are convenient if passed in
hex form so our options parser should handle even
such form of input.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm, ui: Kill fb_write() function
Pekka Enberg [Tue, 7 Jun 2011 19:48:32 +0000 (22:48 +0300)]
kvm, ui: Kill fb_write() function

This patch kills fb_write() and related functions because they're no longer
called as of commit 6768f73 ("kvm tools, vesa: Use guest-mapped memory for
framebuffer").

Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: John Floren <john@jfloren.net>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools, ui: Add simple keyboard support to SDL UI
Pekka Enberg [Mon, 6 Jun 2011 19:51:44 +0000 (22:51 +0300)]
kvm tools, ui: Add simple keyboard support to SDL UI

This patch wires up hw/i8042.c to the SDL UI for simple guest keyboard support.

Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: John Floren <john@jfloren.net>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add QCOW level2 caching support
Prasad Joshi [Mon, 6 Jun 2011 19:58:24 +0000 (20:58 +0100)]
kvm tools: Add QCOW level2 caching support

QCOW uses two tables level1 (L1) table and level2 (L2) table. The L1 table
points to offset of L2 table. When a QCOW image is probed, the L1 table is
cached in the memory to avoid reading it from disk on every access. This
caching improves the performance.

The similar performance improvement can be observed when L2 tables are cached.
It is impossible to cache all of the L2 tables because of the memory
constraint. The patch adds L2 table caching capability for up to 32 L2 tables,
it uses combination of RB tree and List to manage the L2 cached tables. The
link list implementation helps in building simple LRU structure and RB tree
helps to search cached table efficiently.

To calculate the performance numbers, the VM was started with following
command line arguments

$ ./kvm run -d /dev/shm/kvm_ubuntu_server.qcow2 --params "root=/dev/vda1" \
> -m 2048

Without Cache
=============
$ fio fio-mixed.job
[...]
fio-sync: (groupid=3, jobs=1): err= 0: pid=563
  read : io=102400KB, bw=31239KB/s, iops=429 , runt=  3278msec
    clat (usec): min=4 , max=31668 , avg=1663.94, stdev=1810.37
     lat (usec): min=281 , max=658022 , avg=162456.88, stdev=242272.58
    bw (KB/s) : min=21536, max=29322, per=20.77%, avg=25956.50, stdev=2755.33
  write: io=34688KB, bw=13235KB/s, iops=183 , runt=  2621msec
    clat (usec): min=77 , max=1619 , avg=431.80, stdev=343.81
     lat (usec): min=78 , max=1620 , avg=433.11, stdev=343.83
    bw (KB/s) : min=11168, max=14447, per=26.34%, avg=13246.00, stdev=1293.73
[...]
Run status group 0 (all jobs):
   READ: io=409600KB, aggrb=74594KB/s, minb=19096KB/s, maxb=20917KB/s,
mint=5013msec, maxt=5491msec
  WRITE: io=139552KB, aggrb=42624KB/s, minb=10263KB/s, maxb=14463KB/s,
mint=2414msec, maxt=3274msec

Run status group 1 (all jobs):
   READ: io=409600KB, aggrb=146442KB/s, minb=37489KB/s, maxb=48680KB/s,
mint=2154msec, maxt=2797msec
  WRITE: io=133296KB, aggrb=59613KB/s, minb=15328KB/s, maxb=16774KB/s,
mint=2041msec, maxt=2236msec

Run status group 2 (all jobs):
   READ: io=409600KB, aggrb=7178KB/s, minb=1837KB/s, maxb=1840KB/s,
mint=56961msec, maxt=57057msec
  WRITE: io=139136KB, aggrb=2446KB/s, minb=600KB/s, maxb=661KB/s,
mint=56238msec, maxt=56880msec

Run status group 3 (all jobs):
   READ: io=409600KB, aggrb=124954KB/s, minb=31988KB/s, maxb=37704KB/s,
mint=2781msec, maxt=3278msec
  WRITE: io=137936KB, aggrb=50286KB/s, minb=12447KB/s, maxb=13885KB/s,
mint=2621msec, maxt=2743msec

Disk stats (read/write):
  vda: ios=118760/16273, merge=0/107354, ticks=159260/658290, in_queue=817410,
util=94.37%
[...]

With Cache
==========
$ fio fio-mixed.job
[...]
fio-sync: (groupid=3, jobs=1): err= 0: pid=573
  read : io=102400KB, bw=76704KB/s, iops=1018 , runt=  1335msec
    clat (usec): min=0 , max=66131 , avg=591.46, stdev=2582.59
     lat (usec): min=66 , max=123396 , avg=25609.49, stdev=38397.57
    bw (KB/s) : min=58208, max=59584, per=34.55%, avg=58896.00, stdev=972.98
  write: io=35600KB, bw=29373KB/s, iops=381 , runt=  1212msec
    clat (usec): min=11 , max=2661 , avg=169.58, stdev=191.60
     lat (usec): min=11 , max=2663 , avg=170.91, stdev=191.78
    bw (KB/s) : min=27104, max=37664, per=29.98%, avg=32384.00, stdev=7467.05
[...]
Run status group 0 (all jobs):
   READ: io=409600KB, aggrb=140562KB/s, minb=35984KB/s, maxb=44450KB/s,
mint=2359msec, maxt=2914msec
  WRITE: io=138816KB, aggrb=124722KB/s, minb=31502KB/s, maxb=40180KB/s,
mint=893msec, maxt=1113msec

Run status group 1 (all jobs):
   READ: io=409600KB, aggrb=231151KB/s, minb=59174KB/s, maxb=96111KB/s,
mint=1091msec, maxt=1772msec
  WRITE: io=141936KB, aggrb=137268KB/s, minb=32340KB/s, maxb=44496KB/s,
mint=813msec, maxt=1034msec

Run status group 2 (all jobs):
   READ: io=409600KB, aggrb=9211KB/s, minb=2358KB/s, maxb=2363KB/s,
mint=44367msec, maxt=44468msec
  WRITE: io=129808KB, aggrb=2931KB/s, minb=707KB/s, maxb=797KB/s,
mint=43331msec, maxt=44285msec

Run status group 3 (all jobs):
   READ: io=409600KB, aggrb=170453KB/s, minb=43636KB/s, maxb=78545KB/s,
mint=1335msec, maxt=2403msec
  WRITE: io=138256KB, aggrb=108012KB/s, minb=27648KB/s, maxb=37931KB/s,
mint=879msec, maxt=1280msec

Disk stats (read/write):
  vda: ios=120698/16690, merge=0/114742, ticks=113170/304480, in_queue=417560,
util=93.26%
[...]

Summary
=======
Read  bandwidth increased by 1.2 to 1.8 times
Write bandwidth increased by 1.1 to 2.9 times
Read  latency   decreased by small margin of 0.2
Write latency   decreased by 0.4

Signed-off-by: Prasad Joshi <prasadjoshi124@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Kill libvnc dependency from hw/i8042.c
Pekka Enberg [Mon, 6 Jun 2011 19:47:05 +0000 (22:47 +0300)]
kvm tools: Kill libvnc dependency from hw/i8042.c

This patch kills the libvnc dependency from hw/i8042.c so we can use the same
hardware driver for SDL UI.

Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: John Floren <john@jfloren.net>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools, vesa: Use guest-mapped memory for framebuffer
Pekka Enberg [Mon, 6 Jun 2011 13:48:50 +0000 (16:48 +0300)]
kvm tools, vesa: Use guest-mapped memory for framebuffer

This patch converts hw/vesa.c to use guest-mapped memory for framebuffer and
drops the slow MMIO emulation. This speeds up framebuffer accesses
considerably. Please note that this can be optimized even more with the
KVM_GET_DIRTY_LOG ioctl() as explained by Alexander Graf.

Cc: Alexander Graf <agraf@suse.de>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: John Floren <john@jfloren.net>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add MMIO coalescing support
Sasha Levin [Fri, 3 Jun 2011 19:51:08 +0000 (22:51 +0300)]
kvm tools: Add MMIO coalescing support

Coalescing MMIO allows us to avoid an exit every time we have a
MMIO write, instead - MMIO writes are coalesced in a ring which
can be flushed once an exit for a different reason is needed.
A MMIO exit is also trigged once the ring is full.

Coalesce all MMIO regions registered in the MMIO mapper.
Add a coalescing handler under kvm_cpu.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools, vesa: Fix 'ah' access in int10_vesa()
Pekka Enberg [Fri, 3 Jun 2011 19:30:06 +0000 (22:30 +0300)]
kvm tools, vesa: Fix 'ah' access in int10_vesa()

This patch fixes access to 'ah' in int10_vesa() by masking the high bits.

Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: John Floren <john@jfloren.net>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools, vesa: Cleanup code in bios/int10.c
Pekka Enberg [Fri, 3 Jun 2011 19:28:56 +0000 (22:28 +0300)]
kvm tools, vesa: Cleanup code in bios/int10.c

This patch cleans up the code in bios/int10.c without changing functionality.

Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: John Floren <john@jfloren.net>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools, ui: Add support for SDL framebuffer output target
Pekka Enberg [Fri, 3 Jun 2011 15:28:24 +0000 (18:28 +0300)]
kvm tools, ui: Add support for SDL framebuffer output target

This patch adds support for SDL based framebuffer. Use the '--sdl' command line
option to enable the feature.

Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: John Floren <john@jfloren.net>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools, ui: Move VNC specific framebuffer code to ui/vnc.c
Pekka Enberg [Fri, 3 Jun 2011 13:50:29 +0000 (16:50 +0300)]
kvm tools, ui: Move VNC specific framebuffer code to ui/vnc.c

This patch makes use of 'struct framebuffer' and moves the VNC code to ui/vnc.c
in preparation for other framebuffer output targets.

Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: John Floren <john@jfloren.net>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools, ui: Add framebuffer infrastructure
Pekka Enberg [Fri, 3 Jun 2011 13:45:45 +0000 (16:45 +0300)]
kvm tools, ui: Add framebuffer infrastructure

This patch introduces 'struct framebuffer' and related API as a preparational
step to killing libvnc dependency from hw/vesa.c.

Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: John Floren <john@jfloren.net>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Use vesa reserved space for strings and modes
Sasha Levin [Wed, 1 Jun 2011 15:10:42 +0000 (18:10 +0300)]
kvm tools: Use vesa reserved space for strings and modes

As defined in the spec, the reserved space in struct vesa_general_info
should be used to store vesa oem string an a list of possible modes.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools, i8042: Fix device init failure
Pekka Enberg [Thu, 2 Jun 2011 13:33:57 +0000 (16:33 +0300)]
kvm tools, i8042: Fix device init failure

This patch fixes the following device init failure:

  [    0.945942] usbcore: registered new interface driver sisusb
  [    0.947349] i8042: PNP: No PS/2 controller found. Probing ports directly.
  [    0.949033] i8042: [0] 20 -> i8042 (command)
  [    0.950370] i8042: [57]      -- i8042 (timeout)
  [    1.521143] i8042: Can't read CTR while initializing i8042
  [    1.522495] i8042: probe of i8042 failed with error -5

The kbd_out() function was taking 32 bits instead of 8 bits for 'outb'. This
caused kbd_write_command() to receive bogus 'val' which meant that
I8042_CMD_CTL_RCTR case in the switch statement was never executed.

Cc: Ingo Molnar <mingo@elte.hu>
Acked-by: Sasha Levin <levinsasha928@gmail.com>
Tested-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools, i8042: Use kernel command names
Pekka Enberg [Thu, 2 Jun 2011 10:47:44 +0000 (13:47 +0300)]
kvm tools, i8042: Use kernel command names

This patch renames the command constants in hw/i8042.c to use similar names as
in <linux/i8042.h>. Note: we cannot use <linux/i8042.h> constants directly
because they include the command and data.

Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokmv tools, i8042: Use kernel status register bit names
Pekka Enberg [Thu, 2 Jun 2011 10:43:07 +0000 (13:43 +0300)]
kmv tools, i8042: Use kernel status register bit names

This patch renames the status register bit constant names to be identical with
drivers/input/serio/i8042.h. This makes code review easier.

Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools, i8042: Sort status register bits
Pekka Enberg [Thu, 2 Jun 2011 10:39:55 +0000 (13:39 +0300)]
kvm tools, i8042: Sort status register bits

This patch sorts the status register bits in preparation for switching over to
kernel constant names.

Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Use constants for i8042 register numbers
Pekka Enberg [Thu, 2 Jun 2011 10:24:41 +0000 (13:24 +0300)]
kvm tools: Use constants for i8042 register numbers

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add 'kvm debug' command
Pekka Enberg [Thu, 2 Jun 2011 09:11:28 +0000 (12:11 +0300)]
kvm tools: Add 'kvm debug' command

This patch adds a 'kvm debug' command that's currently an alias for

  kill -3 `pidof kvm`

which prints out debugging diagnostics for guests.

Suggested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add support for PS/2 keyboard system
John Floren [Wed, 1 Jun 2011 14:53:56 +0000 (17:53 +0300)]
kvm tools: Add support for PS/2 keyboard system

Add support for PS/2 keyboard system with AUX device (aka mouse).
The device works with vnc, the guest must be started with the
'--vnc' parameter for the device to be initialized.

Signed-off-by: John Floren <john@jfloren.net>
[ turn into patch and clean up code ]
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Use brlock in MMIO and IOPORT
Sasha Levin [Mon, 30 May 2011 17:27:58 +0000 (20:27 +0300)]
kvm tools: Use brlock in MMIO and IOPORT

Use brlock to protect mmio and ioport modules and make them
update-safe.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add debug mode to brlock
Sasha Levin [Mon, 30 May 2011 17:27:57 +0000 (20:27 +0300)]
kvm tools: Add debug mode to brlock

Adds a debug mode which allows to switch the brlock into
a big rwlock.
This can be used to verify we don't end up with a BKL kind
of lock with the current brlock implementation.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add rwlock wrapper
Sasha Levin [Mon, 30 May 2011 17:27:56 +0000 (20:27 +0300)]
kvm tools: Add rwlock wrapper

Adds a rwlock wrapper which like the mutex wrapper makes rwlock calls
similar to their kernel counterparts.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add a brlock
Sasha Levin [Mon, 30 May 2011 17:27:55 +0000 (20:27 +0300)]
kvm tools: Add a brlock

brlock is a lock which is very cheap for reads, but very expensive
for writes.
This lock will be used when updates are very rare and reads are
common.
This lock is currently implemented by stopping the guest while
performing the updates. We assume that the only threads which
read from the locked data are VCPU threads, and the only writer
isn't a VCPU thread.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Pause/resume guest using SIGUSR2
Sasha Levin [Mon, 30 May 2011 17:27:54 +0000 (20:27 +0300)]
kvm tools: Pause/resume guest using SIGUSR2

Make SIGUSR2 pause/resume a guest, this allows to easily test
pausing a guest.
Can be tested using cmdline 'kill -USR2 $(pidof kvm)'.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add APIs to allow pausing guests
Sasha Levin [Mon, 30 May 2011 17:27:52 +0000 (20:27 +0300)]
kvm tools: Add APIs to allow pausing guests

Allow pausing and unpausing guests running on the host.
Pausing a guest means that none of the VCPU threads are running
KVM_RUN until they are unpaused.

The following API functions are added:
 void kvm__pause(void);
 void kvm__continue(void);
 void kvm__notify_paused(void);

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Remove wrong global definition of kvm
Sasha Levin [Mon, 30 May 2011 17:27:51 +0000 (20:27 +0300)]
kvm tools: Remove wrong global definition of kvm

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Use correct value for user signal base
Sasha Levin [Mon, 30 May 2011 17:27:50 +0000 (20:27 +0300)]
kvm tools: Use correct value for user signal base

The bug has caused us to exit gracefully when receiving SIGUSR2.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Fix virtio net build breakage on 32-bit
Ingo Molnar [Sun, 29 May 2011 12:51:48 +0000 (14:51 +0200)]
kvm tools: Fix virtio net build breakage on 32-bit

* Sasha Levin <levinsasha928@gmail.com> wrote:

> Use ioeventfds to receive notifications of IO events in virtio-net.
> Doing so prevents an exit every time we receive/send a packet.
>
> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
> ---
>  tools/kvm/virtio/net.c |   22 ++++++++++++++++++++++
>  1 files changed, 22 insertions(+), 0 deletions(-)

This needs the fix below to build on 32-bit.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Fix up common QCOW function names
Pekka Enberg [Sun, 29 May 2011 08:57:19 +0000 (11:57 +0300)]
kvm tools: Fix up common QCOW function names

This patch renames functions that are used to both QCOW1 and QCOW2 to use the
'qcow' prefix instead of the 'qcow1' prefix.

Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Use ioeventfd in virtio-rng
Sasha Levin [Fri, 27 May 2011 16:18:40 +0000 (19:18 +0300)]
kvm tools: Use ioeventfd in virtio-rng

Use ioeventfds to receive notifications of IO events in virtio-rng.
Doing so prevents an exit every time we need to supply randomness
to the guest.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
[ penberg@kernel.org: kill debugging printf ]
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Use ioeventfd in virtio-net
Sasha Levin [Fri, 27 May 2011 16:18:39 +0000 (19:18 +0300)]
kvm tools: Use ioeventfd in virtio-net

Use ioeventfds to receive notifications of IO events in virtio-net.
Doing so prevents an exit every time we receive/send a packet.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Use ioeventfd in virtio-blk
Sasha Levin [Fri, 27 May 2011 16:18:38 +0000 (19:18 +0300)]
kvm tools: Use ioeventfd in virtio-blk

Use ioeventfds to receive notifications of IO events in virtio-blk.
Doing so prevents an exit every time we read/write from/to the
virtio disk.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add ioeventfd support
Sasha Levin [Fri, 27 May 2011 16:18:37 +0000 (19:18 +0300)]
kvm tools: Add ioeventfd support

ioeventfd is way provided by KVM to receive notifications about
reads and writes to PIO and MMIO areas within the guest.

Such notifications are usefull if all we need to know is that
a specific area of the memory has been changed, and we don't need
a heavyweight exit to happen.

The implementation uses epoll to scale to large number of ioeventfds.

Benchmarks ran on a seperate (non boot) 1GB virtio-blk device, formatted
as ext4, using bonnie++.

cmd line:
# bonnie++ -d temp/ -c 2 -s 768 -u 0

Before:
Version  1.96       ------Sequential Output------ --Sequential Input- --Random-
Concurrency   2     -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
tux            768M   498  99 381127  74 269712  48  2871  99 717109  50 +++++ +++
Latency             18368us   31063us   21281us    3017us    6875us     251ms
Version  1.96       ------Sequential Create------ --------Random Create--------
tux                 -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16 +++++ +++ +++++ +++ +++++ +++ +++++ +++ +++++ +++ +++++ +++
Latency               148us     588us    2792us    1547us    1543us     218us

After:
Version  1.96       ------Sequential Output------ --Sequential Input- --Random-
Concurrency   2     -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
tux            768M   499  99 459779  73 350689  54  2997  99 860395  58 +++++ +++
Latency             17194us   14619us   26358us    4055us    7890us   44122us
Version  1.96       ------Sequential Create------ --------Random Create--------
tux                 -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16 +++++ +++ +++++ +++ +++++ +++ +++++ +++ +++++ +++ +++++ +++
Latency               135us     567us    2564us     134us    1500us     231us

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Exit VCPU thread only when SIGKVMEXIT is received
Sasha Levin [Thu, 26 May 2011 14:25:46 +0000 (17:25 +0300)]
kvm tools: Exit VCPU thread only when SIGKVMEXIT is received

Currently the VCPU loop would exit when the thread received any signal.

Change behaviour to exit only when SIGKVMEXIT is received. This change
prevents from the guest to terminate when unrelated signals are processed
by the thread (for example, when attaching a debugger).

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Prevent double assignment of guest memory info
Sasha Levin [Thu, 26 May 2011 14:25:45 +0000 (17:25 +0300)]
kvm tools: Prevent double assignment of guest memory info

Use values calculated and assigned to local variables instead
of ignoring them.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Use more readable name for ioport mutex
Pekka Enberg [Thu, 26 May 2011 15:59:59 +0000 (18:59 +0300)]
kvm tools: Use more readable name for ioport mutex

This patch renames the mutex in iport.c to 'ioport_mutex' and documents which
data it is used to protect.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Use dynamic IO port allocation in virtio-net
Sasha Levin [Thu, 26 May 2011 10:30:11 +0000 (13:30 +0300)]
kvm tools: Use dynamic IO port allocation in virtio-net

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Use dynamic IO port allocation in virtio-console
Sasha Levin [Thu, 26 May 2011 10:30:10 +0000 (13:30 +0300)]
kvm tools: Use dynamic IO port allocation in virtio-console

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Use dynamic IO port allocation in 9p driver
Sasha Levin [Thu, 26 May 2011 10:30:09 +0000 (13:30 +0300)]
kvm tools: Use dynamic IO port allocation in 9p driver

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Use dynamic IO port allocation in vesa driver
Sasha Levin [Thu, 26 May 2011 10:30:08 +0000 (13:30 +0300)]
kvm tools: Use dynamic IO port allocation in vesa driver

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add support for multiple virtio-rng devices
Sasha Levin [Thu, 26 May 2011 10:30:07 +0000 (13:30 +0300)]
kvm tools: Add support for multiple virtio-rng devices

Since multiple hardware rng devices of the same type are currently
unsupported by the kernel, this serves more as an example of a basic
virtio driver under kvm tools and can be used to debug the PCI layer.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Use ioport context to control blk devices
Sasha Levin [Thu, 26 May 2011 10:30:06 +0000 (13:30 +0300)]
kvm tools: Use ioport context to control blk devices

Since ioports now has the ability to pass context to its
callbacks, we can implement multiple blk devices more efficiently.

We can get a ptr to the 'current' blk dev on each ioport call, which
means that we don't need to keep track of the blk device allocation
and ioport distribution within the module.

The advantages are easier management of multiple blk devices and
removal of any hardcoded limits to the amount of possible blk
devices.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add basic ioport dynamic allocation
Sasha Levin [Thu, 26 May 2011 10:30:05 +0000 (13:30 +0300)]
kvm tools: Add basic ioport dynamic allocation

Add a very simple allocation of ioports.

This prevents the need to coordinate ioports between different
modules.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add optional parameter used in ioport callbacks
Sasha Levin [Thu, 26 May 2011 10:30:04 +0000 (13:30 +0300)]
kvm tools: Add optional parameter used in ioport callbacks

Allow specifying an optional parameter when registering an
ioport range. The callback functions provided by the registering
module will be called with the same parameter.

This may be used to keep context during callbacks on IO operations.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Code cleanups to hw/vesa.c
Pekka Enberg [Mon, 23 May 2011 14:52:51 +0000 (17:52 +0300)]
kvm tools: Code cleanups to hw/vesa.c

Tidy up the code in hw/vesa.c:

  - Make videomem local to hw/vesa.c

  - Remove debugging printf() calls

  - Fix up coding style issues

Cc: John Floren <john@jfloren.net>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Drop unused vars from int10.c code
Cyrill Gorcunov [Mon, 23 May 2011 14:39:17 +0000 (18:39 +0400)]
kvm tools: Drop unused vars from int10.c code

There is a couple of functions which defines 'ah' variable but
never use it in real so that gcc 4.6.x series does complain on
me as

  CC       bios/bios-rom.bin
  bios/int10.c: In function ‘int10_putchar’:
  bios/int10.c:86:9: error: variable ‘ah’ set but not used [-Werror=unused-but-set-variable]
  bios/int10.c: In function ‘int10_vesa’:
  bios/int10.c:96:9: error: variable ‘ah’ set but not used [-Werror=unused-but-set-variable]
  cc1: all warnings being treated as errors

so get rid of them.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
CC: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Initialize and use VESA and VNC
John Floren [Mon, 23 May 2011 12:15:18 +0000 (15:15 +0300)]
kvm tools: Initialize and use VESA and VNC

Requirements - Kernel compiled with:
CONFIG_FB_BOOT_VESA_SUPPORT=y
CONFIG_FB_VESA=y
CONFIG_FRAMEBUFFER_CONSOLE=y

Start VNC server by starting kvm tools with "--vnc".
Connect to the VNC server by running: "vncviewer :0".

Since there is no support for input devices at this time,
it may be useful starting kvm tools with an additional
' -p "console=ttyS0" ' parameter so that it would be possible
to use a serial console alongside with a graphic one.

Signed-off-by: John Floren <john@jfloren.net>
[ turning code into patches and cleanup ]
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Update makefile and feature tests
John Floren [Mon, 23 May 2011 12:15:17 +0000 (15:15 +0300)]
kvm tools: Update makefile and feature tests

Update feature tests to test for libvncserver.

VESA support doesn't get compiled in unless libvncserver
is installed.

Signed-off-by: John Floren <john@jfloren.net>
[ turning code into patches and cleanup ]
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add VESA device
John Floren [Mon, 23 May 2011 12:15:16 +0000 (15:15 +0300)]
kvm tools: Add VESA device

Add a simple VESA device which simply moves a framebuffer
from guest kernel to a VNC server.

VESA device PCI code is very similar to virtio-* PCI code.

Signed-off-by: John Floren <john@jfloren.net>
[ turning code into patches and cleanup ]
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add video mode to kernel initialization
John Floren [Mon, 23 May 2011 12:15:15 +0000 (15:15 +0300)]
kvm tools: Add video mode to kernel initialization

Allow setting video mode in guest kernel.

For possible values see Documentation/fb/vesafb.txt

Signed-off-by: John Floren <john@jfloren.net>
[ turning code into patches and cleanup ]
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add BIOS INT10 handler
John Floren [Mon, 23 May 2011 12:15:14 +0000 (15:15 +0300)]
kvm tools: Add BIOS INT10 handler

INT10 handler is a basic implementation of BIOS video services.

The handler implements a VESA interface which is initialized at
the very beginning of loading the kernel.

Signed-off-by: John Floren <john@jfloren.net>
[ turning code into patches and cleanup ]
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Release memory allocated during virtio block initialization
Prasad Joshi [Sun, 22 May 2011 16:24:07 +0000 (17:24 +0100)]
kvm tools: Release memory allocated during virtio block initialization

Add a new function virtio_blk__delete() goes through array of block
devices and releases memory allocated for block device.

Signed-off-by: Prasad Joshi <prasadjoshi124@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add a wrapper function to initialize all virtio block devices
Prasad Joshi [Sun, 22 May 2011 16:24:06 +0000 (17:24 +0100)]
kvm tools: Add a wrapper function to initialize all virtio block devices

The patch moves the code for initialization of all of the virtio block
devices to virtio subsystem.

Signed-off-by: Prasad Joshi <prasadjoshi124@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Close the disk images after the guest shuts down
Prasad Joshi [Sun, 22 May 2011 16:24:05 +0000 (17:24 +0100)]
kvm tools: Close the disk images after the guest shuts down

Signed-off-by: Prasad Joshi <prasadjoshi124@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add a wrapper function to open disk images
Prasad Joshi [Sun, 22 May 2011 16:24:04 +0000 (17:24 +0100)]
kvm tools: Add a wrapper function to open disk images

The patch was suggested by Ingo to move the disk image subsystem code
from the kvm-run.c file. The code to open all of the specified disk
images is now moved to a wrapper function in disk/core.c.

Signed-off-by: Prasad Joshi <prasadjoshi124@gmail.com>
Suggested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Drop dummy PCI ioport registrations
Pekka Enberg [Sun, 22 May 2011 07:55:20 +0000 (10:55 +0300)]
kvm tools: Drop dummy PCI ioport registrations

There's no point in registering dummy ops for PCI ioports because pci__init()
registers the real ones before we enter the guest kernel.

Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Print out a warning on io-port re-registration
Cyrill Gorcunov [Sat, 21 May 2011 12:16:51 +0000 (16:16 +0400)]
kvm tools: Print out a warning on io-port re-registration

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools, 9p: Test for tuncation result
Cyrill Gorcunov [Sat, 21 May 2011 12:10:34 +0000 (16:10 +0400)]
kvm tools, 9p: Test for tuncation result

Without 'ret' usage I get

 | cyrill@sun kvm $ make
 |  CC       virtio/9p.o
 | virtio/9p.c: In function ‘virtio_p9_wstat’:
 | virtio/9p.c:448:6: error: variable ‘res’ set but not used [-Werror=unused-but-set-variable]
 | cc1: all warnings being treated as errors
 | make: *** [virtio/9p.o] Error 1

so add a basic check for ftruncate result, this eliminate warning and
we might need to use 'res' status later in caller code.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Acked-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Don't register dummy ops for serial ports
Pekka Enberg [Sat, 21 May 2011 12:01:05 +0000 (15:01 +0300)]
kvm tools: Don't register dummy ops for serial ports

The serial8250__init() function registers ops for all serial ports before we
start running the guest kernel so drop the dummy op registrations.

Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools, serial: Register 0x2e8 ioport
Pekka Enberg [Sat, 21 May 2011 12:04:10 +0000 (15:04 +0300)]
kvm tools, serial: Register 0x2e8 ioport

We already register ioports for 0x2f8 and 0x3e8 and mark them as inactive so
mark 0x2e8 ioport as such as well.  This is a preparational step to dropping
serial port dummy registrations from ioport__setup_legacy().

Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Modify ioport to use interval rbtree
Sasha Levin [Sat, 21 May 2011 08:51:51 +0000 (11:51 +0300)]
kvm tools: Modify ioport to use interval rbtree

Currently the ioport implementation is based on a USHRT_MAX length
array of ptrs to ioport_operations.

Instead, use an interval rbtree to map the ioports to
ioport_operations.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Fix rbtree-interval balancing
Sasha Levin [Sat, 21 May 2011 08:51:50 +0000 (11:51 +0300)]
kvm tools: Fix rbtree-interval balancing

Augmentation is started on the pre-rotation node found in the search,
augment the rotated node instead.

Max high is the max of max highs below it, not the max of highs below it.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Cleanup e820 code
Sasha Levin [Fri, 20 May 2011 14:23:05 +0000 (17:23 +0300)]
kvm tools: Cleanup e820 code

Several cleanups in the patch:
 - Use kernel headers for e820 types and definitions.
 - A byte sized entry count for e820 enteries was used,
this should be dword sized. Update in-memory layout and
bios code to fix it.
 - Use struct e820map to calculate offsets used by bios code.

Reviewed-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Update README
Asias He [Thu, 19 May 2011 07:45:27 +0000 (15:45 +0800)]
kvm tools: Update README

This patch updates:

- kernel configuration options
- kvm command line options
- authors

in README.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add virtio-9p
Sasha Levin [Fri, 20 May 2011 08:37:09 +0000 (11:37 +0300)]
kvm tools: Add virtio-9p

Overview:
9p allows for simple RPC based resource sharing over
different transports (in our case, virtio).

This is the implementation of (most of) the original
9p2000 protocol, without the .u or the .l extensions.

How to use:
1. Make sure kernel is compiled with:
    CONFIG_NET_9P=y
    CONFIG_NET_9P_VIRTIO=y
    CONFIG_NET_9P_DEBUG=y (At least until code is stable)
    CONFIG_9P_FS=y

2. Start KVM with '--virtio-9p <dirname>'. What happens now is that
a virtio transport with the name 'kvm_9p' is created. The server side
of the transport maps dirname to the root of the file system.

3. Within the guest, mount the fs:
mount -t 9p -otrans=virtio kvm_9p <local_dir> -oversion=9p2000
This will mount the 9p server to local_dir.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Copy net/9p/9p.h
Sasha Levin [Fri, 20 May 2011 08:37:08 +0000 (11:37 +0300)]
kvm tools: Copy net/9p/9p.h

Header could not be included directly because among some minor
issues, the original header declared the same function twice:
int p9_errstr2errno(char *errstr, int len);
int p9_errstr2errno(char *, int);

A patch has been sent to 9P maintainers, this header should
be removed once the patch is in.

Until then, use a modified copy of the header.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>