]>
git.karo-electronics.de Git - karo-tx-linux.git/log
Pekka Enberg [Wed, 20 Jul 2011 13:28:31 +0000 (16:28 +0300)]
kvm tools, qcow: Fix copy-on-write image corruption
We don't handle refcount table properly so make sure we only write to clusters
that have the "copied" flag set.
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Wed, 20 Jul 2011 11:21:12 +0000 (14:21 +0300)]
kvm tools: Update max VCPU limit
Use the newly introduced KVM_CAP_MAX_VCPUS to determine max VCPU count
the kernel side supports.
Using more VCPUs than the recommended limit will issue a warning, using more
than the absolute maximum will limit it down to the absolute maximum.
Note this patch contains a hack to define KVM_CAP_MAX_VCPUS and should be
removed when the kernel patch is merged with mainline.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Aneesh Kumar K.V [Thu, 7 Jul 2011 08:44:04 +0000 (14:14 +0530)]
tools/kvm: Use kernel header version of net/9p/9p.h
don't do a copy of the kernel header
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Aneesh Kumar K.V [Thu, 7 Jul 2011 08:44:03 +0000 (14:14 +0530)]
net/9p: Remove structure not used in the code
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Mon, 18 Jul 2011 10:59:19 +0000 (18:59 +0800)]
kvm tools: Add '-Wunused-result' to WARNINGS
This makes GCC catch warn_unused_result explicitly.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Sun, 17 Jul 2011 08:57:04 +0000 (16:57 +0800)]
kvm tools: Initialize MAC and IP address for uip properly
- Drop static initialization
- Use {host,guet}_{ip,mac} to initialize
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Sun, 17 Jul 2011 08:57:03 +0000 (16:57 +0800)]
kvm tools: Initialize MAC address for virtio net properly
- Drop static initialization
- Move the initializtion out of tap init
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Sun, 17 Jul 2011 08:57:02 +0000 (16:57 +0800)]
kvm tools: Rename --host-ip-addr to --host-ip
This patch makes the network options more consistent.
We are having:
--host-ip
--host-mac
--guest-ip
--guest-mac
now.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Sun, 17 Jul 2011 08:57:01 +0000 (16:57 +0800)]
kvm tools: Introduce --host-mac option
The --host-mac option sets up MAC address of host.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Sun, 17 Jul 2011 08:57:00 +0000 (16:57 +0800)]
kvm tools: Introduce --guest-ip option
The --guest-ip option tells which IP address to give guest through DHCP.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Sun, 17 Jul 2011 08:56:59 +0000 (16:56 +0800)]
kvm tools: Handle DHCP package in gernal UDP processing path
DHCP packages are handled by the hypervisor, they are not sent to remote
servers. In contrast, all other non-DHCP UDP packages are sent to remote
servers.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Sun, 17 Jul 2011 08:56:58 +0000 (16:56 +0800)]
kvm tools: Get DNS information from host in uip_init()
Use uip_dhcp_get_dns() in uip_init() to get DNS information from host
for DHCP.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Sun, 17 Jul 2011 08:56:57 +0000 (16:56 +0800)]
kvm tools: Introduce uip_tx_do_ipv4_udp_dhcp()
uip_tx_do_ipv4_udp_dhcp() is used to handle DHCP packages from guest.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Sun, 17 Jul 2011 08:56:56 +0000 (16:56 +0800)]
kvm tools: Introduce uip_dhcp_make_pkg()
This patch cooks a DHCP package.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Sun, 17 Jul 2011 08:56:55 +0000 (16:56 +0800)]
kvm tools: Fill all DHCP options
The following DHCP options are filled.
- MSG_TYPE
- SERVER_ID
- LEASE_TIME
- SUBMASK
- ROUTER
- DNS_SERVER
- DOMAIN_NAME
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Sun, 17 Jul 2011 08:56:54 +0000 (16:56 +0800)]
kvm tools: Fill DHCP options with domain name and DNS server IP
Domain name and DNS server IP address are filled.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Sun, 17 Jul 2011 08:56:53 +0000 (16:56 +0800)]
kvm tools: Get domain name and nameserver from host
This patch get domain name and nameserver information from host config
file /etc/resolv.conf.
Guest can obtain DNS information through DHCP.
Signed-off-by: Asias He <asias.hejun@gmail.com>
[ penberg@kernel.org: check fscanf() for errors ]
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Sun, 17 Jul 2011 08:56:52 +0000 (16:56 +0800)]
kvm tools: Add helpers to tell the type of a DHCP message
If DHCP DISCOVER or DHCP REQUEST is found, reply with DHCP OFFER or DHCP
ACK respectively.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Sun, 17 Jul 2011 08:56:51 +0000 (16:56 +0800)]
kvm tools: Add helper to tell if a UDP package is a DHCP package
This patch checks:
- sport and dport
- magic cookie
to detemine whether a UDP package is a DHCP package.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Sun, 17 Jul 2011 08:56:50 +0000 (16:56 +0800)]
kvm tools: Introduce struct uip_dhcp
struct uip_dhcp is used to present DHCP package
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Sun, 17 Jul 2011 08:56:49 +0000 (16:56 +0800)]
kvm tools: Introduce uip_udp_make_pkg()
This helper cooks a ethernet package and virtio header for UDP.
This patch also makes uip_udp_socket_thread() shorter.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Sat, 16 Jul 2011 09:28:23 +0000 (12:28 +0300)]
kvm tools: Implement VIRTIO_BLK_T_GET_ID
Return device id when requested by virtio-blk.
Device id is currently based on the device information and the inode
number of the underlying disk image.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Tue, 12 Jul 2011 18:42:21 +0000 (21:42 +0300)]
kvm tools: Use writev() in xwritev()
This patch fixes a typo in xwritev(). Luckily the function is not used so the
problem is only latent. Spotted during code review.
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Tue, 12 Jul 2011 14:34:33 +0000 (17:34 +0300)]
kvm tools: Update README
Update required kernel config options and git info.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Cyrill Gorcunov [Sun, 10 Jul 2011 21:52:53 +0000 (01:52 +0400)]
kvm tools, bios: Make sure IRQ handlers segment is properly set
The mini bios is copied at predefined place and should have
constant segment address.
Without this patch cs value varies depending on which code
is compiled and how big bios is, it's kinda flowing error
which is not triggered yet by a pure luck.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Aneesh Kumar K.V [Sun, 10 Jul 2011 18:23:21 +0000 (23:53 +0530)]
kvm tools, 9p: WSTAT don't use open fid
We should use full path instead of fd. WSTAT can operate on
unopen fid.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Aneesh Kumar K.V [Sun, 10 Jul 2011 17:59:16 +0000 (23:29 +0530)]
kvm tools, 9p: Add error handling to protocol handlers
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Sun, 10 Jul 2011 12:41:55 +0000 (15:41 +0300)]
kvm tools: Fix leaked descriptors
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sun, 10 Jul 2011 12:36:11 +0000 (15:36 +0300)]
kvm tools, qcow: I/O error on compressed sectors
We currently don't support compressed sectors in QCOW images so warn the user
about it and return a I/O error.
Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sat, 9 Jul 2011 12:15:52 +0000 (15:15 +0300)]
kvm tools, qcow: Flush only dirty L2 tables
This patch improves qcow_l2_cache_write() to only flush dirty L2 tables.
Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sat, 9 Jul 2011 07:58:37 +0000 (10:58 +0300)]
kvm tools, qcow: Delayed L2 table writeout
This patch delays writeout for new L2 tables like we do for L1 tables. If a L2
table has non-allocated clusters, we mark that in the in-memory L2 table but
don't actually write it to disk until the L2 table is thrown out of LRU cache
or when qcow_disk_flush() is called. That makes writes to new clusters volatile
before VIRTIO_BLK_T_FLUSH is issued without corrupting the QCOW image on I/O
error.
Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sat, 9 Jul 2011 07:49:16 +0000 (10:49 +0300)]
kvm tools, qcow: Use big endian order for L2 table entries
Don't keep the in-memory array in CPU byte order to simplify delayed L2 table
writeout.
Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sat, 9 Jul 2011 07:37:58 +0000 (10:37 +0300)]
kvm tools, qcow: Don't fdatasync() L2 table writeout
There's now now point in making sure new L2 tables actually hit the disk before
we write out data to clusters because they are not visible on-disk until
qcow_disk_flush() is called which flushes the L1 table.
Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sat, 9 Jul 2011 07:23:07 +0000 (10:23 +0300)]
kvm tools, qcow: Delayed L1 table writeout
This patch moves L1 table writeout to qcow_disk_flush(). The rationale here is
that while writes to clusters that don't have L2 table allocated on-disk are
volatile until VIRTIO_BLK_T_FLUSH is issued, we never corrupt the disk image.
Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sat, 9 Jul 2011 07:15:12 +0000 (10:15 +0300)]
kvm tools, qcow: Introduce qcow_disk_flush()
This patch introduces a QCOW specific qcow_disk_flush() in preparation for
delaying QCOW metadata writeout until VIRTIO_BLK_T_FLUSH time.
Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sat, 9 Jul 2011 11:04:12 +0000 (14:04 +0300)]
kvm tools, qcow: Fix locking issues
The virtio_blk_do_io() function can enter the QCOW code through
disk_image__{read,write,flush}() from multiple threads because it uses a thread
pool for I/O requests. Thus, use locking to make the QCOW2 code thread-safe.
Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sat, 9 Jul 2011 11:23:47 +0000 (14:23 +0300)]
kvm tools, qcow: Use 'struct qcow_l2_table' instead of untyped array
This patch converts disk/qcow.c to use 'struct qcow_l2_table' for tracking
dirty L2 tables later on in this series.
Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sat, 9 Jul 2011 11:13:51 +0000 (14:13 +0300)]
kvm tools, qcow: Rename struct qcow_l2_cache to struct qcow_l2_table
This patch renames 'struct qcow_l2_cache' to 'struct qcow_l2_table' in
preparation for replacing the untyped L2 table arrays with the struct.
Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Konstantin Khlebnikov [Sun, 10 Jul 2011 12:13:27 +0000 (16:13 +0400)]
kvm tools: fix instances enumeration
Calling readdir() with NULL dirp leads to segfault.
Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
[ penberg@kernel.org: use 'while' instead of 'for' ]
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Sat, 9 Jul 2011 23:58:19 +0000 (07:58 +0800)]
kvm tools: Move uip to net directory
This mirrors what the kernel already has.
Suggested-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Sat, 9 Jul 2011 23:58:18 +0000 (07:58 +0800)]
kvm tools: Make virtio net work on older kernels
Some old kernels do not support TUNSETVNETHDRSZ ioctl which modifies the virtio
net header size. The default header size should work, so let's go on if the
TUNSETVNETHDRSZ ioctl is not supported and just give a warnning.
Reported-by: John Floren <john@jfloren.net>
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sat, 9 Jul 2011 07:12:30 +0000 (10:12 +0300)]
kvm tools: Add KVMTOOLS-VERSION-FILE to .gitignore
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Sat, 9 Jul 2011 06:57:30 +0000 (09:57 +0300)]
kvm tools: Rename debug options under 'kvm run'
Rename debug options to make them consistent with each other.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Sat, 9 Jul 2011 06:57:29 +0000 (09:57 +0300)]
kvm tools: Rename command source files
Rename kvm-[command] into builtin-[command] to prevent
clashes with non-command files such as kvm-cpu.h
Suggested-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Fri, 8 Jul 2011 22:25:28 +0000 (01:25 +0300)]
kvm tools: Don't sort command-list.txt for help text
This patch removes the alphabetical sorting from util/generate-cmdlist.h so
that 'kvm run' command, for example, is displayed first:
$ ./kvm
usage: kvm [--version] [--help] COMMAND [ARGS]
The most commonly used kvm commands are:
run Start the virtual machine
pause Pause/resume the virtual machine
version Print the version of the kernel tree kvm tools
list Print a list of running instances on the host.
debug Print debug information from a running instance
balloon Inflate or deflate the virtio balloon
See 'kvm help COMMAND' for more information on a specific command.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Fri, 8 Jul 2011 21:56:12 +0000 (00:56 +0300)]
kvm tools: Properly add 'kvm balloon' to command list
Also adds some documentation.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Fri, 8 Jul 2011 21:56:11 +0000 (00:56 +0300)]
kvm tools: Update 'kvm pause' documentation
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Fri, 8 Jul 2011 21:56:10 +0000 (00:56 +0300)]
kvm tools: Properly add 'kvm debug' to command list
Also adds some basic documentation.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Fri, 8 Jul 2011 21:56:09 +0000 (00:56 +0300)]
kvm tools: Properly add 'kvm list' to command list
Also adds some basic documentation.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Fri, 8 Jul 2011 21:56:08 +0000 (00:56 +0300)]
kvm tools: Add 'kvm version' command
Add a 'kvm version' command which prints the version of the kernel
used to build kvm tools.
Part of the code is based on and was loaned from perf.
Suggested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Thu, 7 Jul 2011 18:12:45 +0000 (21:12 +0300)]
kvm tools: Fix guest single-stepping setup
"K. Watts" writes:
When the singlestep is enabled the ioctl to sent out when the kvm_cpu
is initialized (kvm-cpu.c in the for loop that gets each vcpu built).
When the ioct goes out the CPU is sitting at the initialization vector
of 0xf000:0xfff0 on CPU #0 and 0x000000 on the other SMP CPUs. The
new host kernel code that handles setting the TF was changed in 2.6.32
and again at 2.6.38. 2.6.32 seems just flat broken, but 2.6.38 checks
that the linear address of the RIP matches what it was when the
KVM_GUESTDBG_SINGLESTEP flag was set. Because the kvm-tool doesn't
start the CPU at the initialization vector (0xfff0) (0x7c00 for the
MBR and where ever you guys map the linux kernel to) they don't match
and the host kernel won't set the trap flag.
Basically the debug and singlestep ioclts need to happen after the CPU
has been initialized. I moved kvm_cpu__enable_singlestep to happen in
kvm_cpu__reset_vcpu after the registers are set (EIP points to boot
address) and the TRAP flags get set and all is good with the world.
Singlestepping is disabled when the guest issues a CLI because the
Linux host doesn't support features in new Intel and AMD CPUs. We can
sort of "shadow" the interrupt mask and still get the CPU to trap out
at ever instruction even when the guest has disabled interrupts on the
CPU. I have to get the bios disk handler working completely first,
but that may be my next task so that we can trace all the CPU
instructions. My current hack is to just re-enable the trap flag
every time a VMEXIT occurs. I get enough instructions to get me by.
This patch fixes the problem by moving the kvm_cpu__enable_singlestep() into
kvm_cpu__start().
Suggested-by: K. Watts <traetox@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Tue, 5 Jul 2011 09:35:45 +0000 (12:35 +0300)]
kvm tools: Clean ghost pid files in 'kvm list'
When running 'kvm list', first make sure that the guest process
is up and running before printing the entry.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Tue, 5 Jul 2011 09:35:44 +0000 (12:35 +0300)]
kvm tools: Export kvm__remove_pidfile
This will allow cleaning up ghost pid files outside of the module.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Sun, 3 Jul 2011 15:38:10 +0000 (18:38 +0300)]
kvm tools: Allow pausing and debugging all running instances
Add a 'kvm [debug,pause] all' command to allow pausing or debugging
all running guests on a host.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Sun, 3 Jul 2011 15:38:09 +0000 (18:38 +0300)]
kvm tools: Add 'kvm list' command
Use 'kvm list' to list running virtual guest.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Sun, 3 Jul 2011 15:38:08 +0000 (18:38 +0300)]
kvm tools: Add instance enumerator
Add API kvm__enumerate_instances() to enumerate running guest
instances.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Sun, 3 Jul 2011 15:38:07 +0000 (18:38 +0300)]
kvm tools: Give guest instances default name
Name instances which aren't specifically named by the user (using
the --name flag) with the following pattern: 'guest-<pid>'
Suggested-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Sun, 3 Jul 2011 15:38:06 +0000 (18:38 +0300)]
kvm tools: Fix home dir resolution
Previous code didn't properly resolve home directory.
Resolve user's home dir using the $HOME enviroment variable.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sat, 2 Jul 2011 10:53:10 +0000 (13:53 +0300)]
Merge commit 'v3.0-rc5' into kvm/core
Sasha Levin [Sat, 2 Jul 2011 23:52:11 +0000 (02:52 +0300)]
kvm tools: Stop VCPUs before freeing struct kvm
Not stopping VCPUs before leads to seg faults and other errors due to
synchronization between threads.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Sat, 2 Jul 2011 23:52:10 +0000 (02:52 +0300)]
kvm tools: Add 'kvm balloon' command
Add a command to allow easily inflate/deflate the balloon driver in running
instances.
Usage:
kvm balloon [command] [instance name] [size]
command is either inflate or deflate, and size is represented in MB.
Target instance must be named (started with '--name').
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Sat, 2 Jul 2011 23:52:09 +0000 (02:52 +0300)]
kvm tools: Advise memory allocated for guest RAM as KSM mergable
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Sat, 2 Jul 2011 23:52:08 +0000 (02:52 +0300)]
kvm tools: Add virtio-balloon device
From the virtio spec:
The virtio memory balloon device is a primitive device for managing guest
memory: the device asks for a certain amount of memory, and the guest supplies
it (or withdraws it, if the device has more than it asks for). This allows the
guest to adapt to changes in allowance of underlying physical memory.
To activate the virtio-balloon device run kvm tools with the '--balloon'
command line parameter.
Current implementation listens for two signals:
- SIGKVMADDMEM: Adds 1M to the balloon driver (inflate). This will decrease
available memory within the guest.
- SIGKVMDELMEM: Remove 1M from the balloon driver (deflate). This will
increase available memory within the guest.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Sat, 2 Jul 2011 23:52:07 +0000 (19:52 -0400)]
kvm tools: Provide instance name when running 'kvm pause'
Instead of sending a signal to the first instance found, send it
to a specific instance.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Sat, 2 Jul 2011 23:52:06 +0000 (19:52 -0400)]
kvm tools: Provide instance name when running 'kvm debug'
Instead of sending a signal to the first instance found, send it
to a specific instance.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Sat, 2 Jul 2011 23:52:05 +0000 (19:52 -0400)]
kvm tools: Allow giving instance names
This will allow tracking instance names and sending commands
to specific instances if multiple instances are running.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Sat, 2 Jul 2011 23:52:04 +0000 (19:52 -0400)]
kvm tools: Process virtio-blk requests in parallel
Process multiple requests within a virtio-blk device's vring
in parallel.
Doing so may improve performance in cases when a request which can
be completed using data which is present in a cache is queued after
a request with un-cached data.
bonnie++ benchmarks have shown a 6% improvement with reads, and 2%
improvement in writes.
Suggested-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Sat, 2 Jul 2011 23:52:03 +0000 (19:52 -0400)]
kvm tools: Don't dynamically allocate threadpool jobs
To allow efficient use of shorter-term threadpool jobs, don't
allocate them dynamically upon creation. Instead, store them
within 'job' structures.
This will prevent some overhead creating/destroying jobs which live
for a short time.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Aneesh Kumar K.V [Tue, 28 Jun 2011 06:56:50 +0000 (12:26 +0530)]
tools/kvm/9p: return EOPNOTSUPP if the handler is not implemented
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Aneesh Kumar K.V [Tue, 28 Jun 2011 06:56:49 +0000 (12:26 +0530)]
tools/kvm/9p: Add encode/decode routines for protocol data
The protocol data is in little-endian format.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:36 +0000 (16:47 +0800)]
kvm tools: Introduce struct net_dev_operations
virtio_net_{tx, rx}_thread can use ops->{tx, rx} to send and recevie
network package in both tap mode and user mode.
Suggested-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:35 +0000 (16:47 +0800)]
kvm tools: Make default host ip address to 192.168.33.1
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:34 +0000 (16:47 +0800)]
kvm tools: Make default network mode to user mode
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:33 +0000 (16:47 +0800)]
kvm tools: Make virtio net work with user mode network
- Call uip_rx() and uip_tx() in virtio_net_rx_thread() and
virtio_net_tx_thread() if user mode network is enabled.
- Initialize uip in virtio_net__init() if user mode network is enabled.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:32 +0000 (16:47 +0800)]
kvm tools: Change default guest MAC address to 00:15:15:15:15:15
This patch makes guest MAC address the last portion of
default guest IP address which is 192.168.33.15.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:31 +0000 (16:47 +0800)]
kvm tools: Introduce -net {user, tap, none} options for virtio net
Use '-net user' to enable user model network, which enables plain user
without speical privileges to use network in guest.
Use '-net tap' to enable tap based network, which requres special
privileges.
Use '-net none' to disable virtio net.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:30 +0000 (16:47 +0800)]
kvm tools: Reanme net_device to net_dev
This patch makes virtio net device's name convention consistent with others in
virtio/*.c. struct {net_dev, blk_dev, con_dev, rng_dev, p9_dev}.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:29 +0000 (16:47 +0800)]
kvm tools: Add MACRO for user and tap mode for virtio net
This patch prepares the user and tap mode for virtio net.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:28 +0000 (16:47 +0800)]
kvm tools: Introduce uip_rx() for uip
This patch implement rx interface for uip. uip_rx() can be called in
virtio_net_rx_thread().
It is a consumer of the ethernet used buffer. It sleeps until there is
used buffer avaiable and copy ethernet data into virtio iov buffers
which provided by virtio_net_rx_thread().
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:27 +0000 (16:47 +0800)]
kvm tools: Introduce uip_tx() for uip
This patch implement tx interface for uip. uip_tx() can be called in
virtio_net_tx_thread().
It dispatches ethernet frame to ARP or IP handling code.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:26 +0000 (16:47 +0800)]
kvm tools: Introduce uip_init() for uip
- Initialize TCP/UDP socket list, ethernet buffer list.
- Allocate memory for ethernet buffer.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:25 +0000 (16:47 +0800)]
kvm tools: Add TCP support for uip
- Implement uip_tx_do_ipv4_tcp() to send TCP package to remote host.
- Implement uip_tcp_socket_thread() to receive TCP package from
remote host.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:24 +0000 (16:47 +0800)]
kvm tools: Implement uip_csum_tcp() to calculate TCP checksum
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:23 +0000 (16:47 +0800)]
kvm tools: Add helper to allocate and get TCP initial sequence number
Guest's initial sequence number can be found in the SYN package that
guest send to us to intialize a TCP session.
Remote server's initial sequence number is faked. RFC 793 specifies
that the ISN should be viewed as a 32-bit counter that increments
by one every 4 microseconds. For simplicity's sake, current
implementation in uip just returns a constant.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:22 +0000 (16:47 +0800)]
kvm tools: Add helpers to test whether SYN or FIN bit is set.
This patch adds too helpers uip_tcp_is_syn(), uip_tcp_is_fin() to check if SYN and
FIN bit is set.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:21 +0000 (16:47 +0800)]
kvm tools: Add helper to return start address of TCP payload
uip_tcp_payload() returns start address of TCP payload in a TCP package.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:20 +0000 (16:47 +0800)]
kvm tools: Add helpers to return TCP {header, total, payload} length
This patch adds three helpers uip_tcp_hdrlen(), uip_tcp_len(),
uip_tcp_payloadlen() to return TCP header length, TCP totoal
length, and tcp payload length.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:19 +0000 (16:47 +0800)]
kvm tools: Introduce struct uip_tcp_socket
struct uip_tcp_socket is used to present every session
between guest and remote host.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:18 +0000 (16:47 +0800)]
kvm tools: Introduce struct uip_tcp to present TCP package.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:17 +0000 (16:47 +0800)]
kvm tools: Add UDP support for uip
- Implement uip_tx_do_ipv4_udp() to send UDP package to remote host.
- Implement uip_udp_socket_thread() to receive UDP package from
remote host.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:16 +0000 (16:47 +0800)]
kvm tools: Implement uip_csum_udp() to calculate UDP checksum
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:15 +0000 (16:47 +0800)]
kvm tools: Add helper to return ethernet header length
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:14 +0000 (16:47 +0800)]
kvm tools: Add two helpers to return UDP {header, total} length
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:13 +0000 (16:47 +0800)]
kvm tools: Introduce struct uip_udp_socket
struct uip_udp_socket is used to present every "connection" between
guest and remote host.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:12 +0000 (16:47 +0800)]
kvm tools: Introduce struct uip_pseudo_hdr to present UDP pseudo header
This pseudo header is used for UDP checksum.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:11 +0000 (16:47 +0800)]
kvm tools: Introduce struct uip_udp to present UDP package
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:10 +0000 (16:47 +0800)]
kvm tools: Add ICMP support for uip
- Introduce struct uip_icmp to present ICMP package
- Implement uip_csum_icmp() to calculate ICMP checksum
- Current ICMP implementation in uip does not really send ICMP package
to remote host in question, instead it just fake a ICMP reply to fool guest.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 29 Jun 2011 08:47:09 +0000 (16:47 +0800)]
kvm tools: Implement IP checksum for uip
Other protocal, e.g. TCP, UDP, ICMP, can use uip_csum() to make
checsksum as well.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
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>
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>