Monday, June 11, 2012
Sunday, April 15, 2012
Perf KVM
===================
Thanks to supriya kannery for documenting perf kvm
RPM
=====
[root @]# rpm -qa | grep perf
perf-2.6.32-131.0.15.el6.x86_64
Preparation:
==========
Before running perf kvm in host, need to save files /proc/modules and /proc/kallsyms from guest into host.
One of the easiest methods is as follows:
> start VM with host portforwarding
start guest
> Login to the guest and save modules and kallsyms
cat /proc/modules > /tmp/modules
cat /proc/modules > /tmp/kallsyms
>> From host get the above two files.
scp -P 5555 root@localhost:/tmp/kallsyms guest-kallsyms
scp -P 5555 root@localhost:/tmp/modules guest-modules
Note: if directly scp from /proc/modules, zero sized files are copied. Hence first save /proc/xx into locate files in guest and then copy to host.
Start recording events in guest and host
===========================
perf kvm --host --guest --guestkallsyms=guest-kallsyms --guestmodules=guest-modules record -a -o perf.data
Output will be stored in perf.data.kvm if both --host and --guest are specified. If only --host is specified the file will be named perf.data.host and if only --guest is specified file will be named perf.data.guest
On pressing Ctl+C or SIGINT perf stops recording.
Report the events:
===============
perf kvm --host --guest --guestkallsyms=guest-kallsyms --guestmodules=guest-modules report -i perf.data --force
Note: without using --force I couldn't collect report even though the recorded file and report was generated using same userid or root. This might be a bug to be looked at. But for now, reporting works with --force option.
Sample results:
[root]# perf kvm --host --guest --guestmodules=guest-modules report -i perf.data.kvm --force > analyse
[root]# cat analyse
# Events: 7K cycles
#
# Overhead Command Shared Object Symbol
# ........ ............ ................. .....................................
#
95.06% vi vi [.] 0x48287
0.61% init [kernel.kallsyms] [k] intel_idle
0.36% vi libc-2.12.so [.] _wordcopy_fwd_aligned
0.32% vi libc-2.12.so [.] __strlen_sse42
0.14% swapper [kernel.kallsyms] [k] intel_idle
0.13% init [kernel.kallsyms] [k] uhci_irq
0.11% perf [kernel.kallsyms] [k] generic_exec_single
0.11% init [kernel.kallsyms] [k] tg_shares_up
0.10% qemu-kvm [kernel.kallsyms] [k] tg_shares_up
[root]# perf report --sort comm,dso -i perf.data.kvm --force > highlevel
[root]# cat highlevel
# Events: 7K cycles
#
# Overhead Command Shared Object
# ........ ............ .................
#
95.06% vi vi
1.55% init [kernel.kallsyms]
0.75% vi [kernel.kallsyms]
0.69% vi libc-2.12.so
0.50% perf [kernel.kallsyms]
0.30% swapper [kernel.kallsyms]
0.19% ps [kernel.kallsyms]
0.17% qemu-kvm [kernel.kallsyms]
0.09% events/5 [kernel.kallsyms]
0.09% events/1 [kernel.kallsyms]
0.09% events/24 [kernel.kallsyms]
0.08% ps libc-2.12.so
0.08% events/25 [kernel.kallsyms]
0.07% kondemand/8 [kernel.kallsyms]
0.07% kondemand/23 [kernel.kallsyms]
0.07% perf libc-2.12.so
0.07% watchdog/26 [kernel.kallsyms]
0.01% kondemand/15 [kernel.kallsyms]
0.01% ksoftirqd/18 [kernel.kallsyms]
0.01% perf [nfs]
0.01% ps libproc-3.2.8.so
0.01% qemu-kvm [unknown]
0.01% qemu-kvm qemu-kvm
0.00% sleep [kernel.kallsyms]
0.00% awk [kernel.kallsyms]
Thursday, May 5, 2011
KVM Autotest
The KVM-Autotest system is a client test for the autotest framework. Its main purpose is to serve as an automated regression testing tool for KVM developers, and for doing regular automated testing of KVM (provided you use it with the server testing infrastructure).
How to setup KVM Autotest
---------------------------------
Please find below steps to setup KVM Autotest.
1. Get autotest git
git clone git://github.com/autotest/autotest.git
2. Packages required.
yum install qemu-kvm qemu-kvm-tools syslinux
3. cd autotest/client/tests/kvm
4. ./get_started.py
Recommend to select "N" for all. It does basic setup to get started.
5. mkdir /tmp/kvm_autotest_root/isos/linux
6. mount your required iso here.
mount -t nfs < your iso> /tmp/kvm_autotest_root/isos/linux
7. get md5sum, md5sum_1M of your iso.
md5sum
dd if=
or
./autotest/client/tools/cd_hash.py
8. cd autotest/client/tests/kvm
Here 3 files needs to be changed
1. tests.cfg
2. edit guest-os.cfg
3. base.cfg
tests.cfg:
qemu_binary = /usr/bin/qemu-kvm
qemu_img_binary = /usr/bin/qemu-img
only raw
only virtio_net
only virtio_blk
only smp2
only no_pci_assignable
only smallpages
only RHEL.6.64
only unattended_install.cdrom, boot, shutdown
base.cfg
You can make change base.cfg as per your requirement.
for ex: nics, network_mode = tap/user, script = qemu-ifup/qemu-ifup-ipv6, ..... etc.
I recommend to try with Redhat guest once, before ubuntu.
edit iso name, md5sum, md5sum_1m in .
guest-os.cfg
ex:
- 6.64:
no setup
nic_hotplug:
modprobe_module =
block_hotplug:
modprobe_module =
image_name = rhel6-64
unattended_install:
unattended_file = unattended/RHEL-6-series.ks
#floppy = images/rhel60-64/ks.vfd
cdrom_unattended = images/rhel61-64/ks.iso
kernel = images/rhel61-64/vmlinuz
initrd = images/rhel61-64/initrd.img
unattended_install.cdrom:
cdrom_cd1 = isos/linux/RHEL-6.0-x86_64-DVD.iso../.
md5sum_cd1 = f7141396c6a19399d63e8c195354317d
md5sum_1m_cd1 = b060eeef63e2c8700db54ae02056e80c
9. run ../../common_lib/cartesian_config.py control --verbose
if your setup is fine, dictionaries will get generated.
10. run your basic guest install test:
../../bin/autotest control --verbose
For more details:
http://www.linux-kvm.org/page/KVM-Autotest
Tuesday, July 27, 2010
Virtualization new era starts with KVM...
KVM links: KVM website, KVM whitepaper, Qumranet,
KVM is a patch to the Linux kernel that is more like VServer, Solaris containers, or microkernels [see footnote], where the OS still sits directly on the hardware. Some aspects of the current KVM release (mostly pulled from their FAQ):
- KVM guest OSs appear as a process and can be managed with top, kill, etc.
- KVM requires either a VT capable Intel processor or an SVM capable AMD processor (which is a currently a big limitation for grid providers but this will become less and less of an issue as older clusters are phased out).
- Uses QEMU for guest instantiation, but is not an emulator itself
- Runs Windows 32bit already (with no apci)
- I have yet to figure out if it relies on these kernel enhancements for OS level virtualization
- The current implementation should probably be seen as a preview, Fraser Campbell reports that it was “decidedly slow” when he tried it.
Tuesday, June 22, 2010
memory ballooning
Certain guests (only Linux at the moment) have a balloon driver, so the host can have the guest allocate a certain amount of memory which the guest won't be able to use anymore and it can then be freed on the host.
Below command gives the information regarding free memory. Using balloon command you can change guest machine to change it’s memory allocation to the specified amount in MB which is 800MB in the below example.
(qemu) info balloon
The syntax for the command to actually perform memory ballooning is as follows.
(qemu) balloon 800
What is QEMU ?
QEMU is a FAST! processor emulator using dynamic translation to achieve good emulation speed.
QEMU supports two operating modes:
User-mode emulation allows a process built for one CPU to be executed on another (performing dynamic translation of the instructions for the host CPU and converting Linux system calls appropriately).
Full System mode emulation allows emulation of a full system,(for example a PC), including one or several processors and various peripherals. It can be used to launch different Operating Systems without rebooting the PC or to debug system code. including processor and assorted peripherals.
For system emulation, the following hardware targets are supported:
- PC (x86 or x86_64 processor)
- ISA PC (old style PC without PCI bus)
- PREP (PowerPC processor)
- G3 Beige PowerMac (PowerPC processor)
- Mac99 PowerMac (PowerPC processor, in progress)
- Sun4m/Sun4c/Sun4d (32-bit Sparc processor)
- Sun4u/Sun4v (64-bit Sparc processor, in progress)
- Malta board (32-bit and 64-bit MIPS processors)
- MIPS Magnum (64-bit MIPS processor)
- ARM Integrator/CP (ARM)
- ARM Versatile baseboard (ARM)
- ARM RealView Emulation/Platform baseboard (ARM)
- Spitz, Akita, Borzoi, Terrier and Tosa PDAs (PXA270 processor)
- Luminary Micro LM3S811EVB (ARM Cortex-M3)
- Luminary Micro LM3S6965EVB (ARM Cortex-M3)
- Freescale MCF5208EVB (ColdFire V2).
- Arnewsh MCF5206 evaluation board (ColdFire V2).
- Palm Tungsten|E PDA (OMAP310 processor)
- N800 and N810 tablets (OMAP2420 processor)
- MusicPal (MV88W8618 ARM processor)
- Gumstix "Connex" and "Verdex" motherboards (PXA255/270).
- Siemens SX1 smartphone (OMAP310 processor)
- Syborg SVP base model (ARM Cortex-A8).
- AXIS-Devboard88 (CRISv32 ETRAX-FS).
- Petalogix Spartan 3aDSP1800 MMU ref design (MicroBlaze).
For user emulation, x86, PowerPC, ARM, 32-bit MIPS, Sparc32/64, ColdFire(m68k), CRISv32 and MicroBlaze CPUs are supported.
$ git://git.sv.gnu.org/qemu.git or http://git.sv.gnu.org/r/qemu.git
$ $ cd qemu
$ ./configure
$ make
$ make install
QEMU usage:
This command will create a 500MB hard disk image in QEMU's "qcow" format
qemu-img create -f qcow c.img 500M$ qemu-img create -f qcow c.img 128MIn this command the -f option is for the disk image format. The following formats are supported: raw, qcow, cow, vmdk and cloop. See also: .img and .iso.
Formating 'c.img', fmt=qcow, size=131072 kB
$
Now you have an emulated disk (c.img) and a CD-ROM from which you can install your operating system. The next step is to install the operating system on your hard disk. This is done simply with
qemu:$ qemu -hda c.img -cdrom linux.iso -boot d
This will boot a virtual machine with 64MB of memory, booting from c.img.
$ qemu -hda c.img -boot c -m 64 -vnc :1
Wednesday, May 5, 2010
Top 10 stupid questions people ask you obvious situations
Stupid Question:- Hey, what are you doing here?
Answer:- Dont u know, I sell tickets in black over here..
2. In the bus: A heavy lady wearing pointed high-heeled shoes steps on your feet…
Stupid Question:- Sorry, did that hurt?
Answer:- No, not at all, I’m on local anesthesia…..why don’t you try again.
3. At a funeral: One of the teary-eyed people ask…
Stupid Question:- Why, why him, of all people.
Answer:- Why? Would it rather have been you?
4. At a restaurant: When you ask the waiter
Stupid Question:- Is the “Butter Paneer Masala” good??
Answer:- No, its terrible and made of adulterated cement.
We occasionally also spit in it.
5. At a family get-together: When some distant aunt meets you after years
Stupid Question:-Munna,Chickoo, you’ve become so big.
Answer:- Well you haven’t particularly shrunk yourself.
6. When a friend announces her wedding, and you ask…
Stupid Question:- Is the guy you’re marrying good?
Answer:- No,he’s a miserable wife-beating isensitive lout…it’s just the money.
7. When you get woken up at midnight by a phone call…
Stupid Question:- Sorry. were you sleeping?
Answer:- No. I was doing research on whether the Zulu tribes in Africa marry or not. You thought I was sleeping…. you dumb witted moron.
8. When you see a friend/colleague with evidently shorter hair…
Stupid Question:- Hey have you had a haircut?
Answer:- No, its autumn and I’m shedding……
9. At the dentist when he’s sticking pointed objects in your mouth…
Stupid Question:- Tell me if it hurts?
Answer:- No it wont. It will just bleed.
10. You are smoking a cigarette and a cute woman in your office asks…
Stupid Question:- Oh, so you smoke.
Answer:- Gosh, it’s a miracle …………it was a piece of chalk and now it’s in flames!!!
