[kvm-devel] kvm-commits mailing list
Commits to the kvm subversion repository are now sent to a mailing list, [EMAIL PROTECTED] If you wish to track development closely, you can subscribe to the mailing list. Please note that development occurs on several branches; not every commit will be available in the next release. http://kvm.sourceforge.net/lists.html -- error compiling committee.c: too many arguments to function - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
[kvm-devel] lost ticks in linux
Hi all, Just recently started playing with kvm and used my linux image which was previously running with vmplayer. From what I can tell so far kvm runs noticeably faster compared to vmplayer on the same image. The only issue I've seen so far is with the timer - I get lost ticks, which was not a problem with vmplayer: ... TSC appears to be running slowly. Marking it unstable. Time: acpi_pm clocksource has been installed. ... I don't have this problem if I run it without loading kvm-intel. Also would appreciate suggestions about the kernel config inside KVM - CPU etc. My CPU Core Duo E6600 btw. Thanks, Emil __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] [RFC] Porting KVM to QEMU CVS
Avi Kivity wrote: Anthony Liguori wrote: Any thoughts? SMM continues the tradition of making each x86 generation hackier than before. What happens (probably) is that the virtual hardware unmaps the vga memory when SMM is entered, and uses the physical memory at these addresses (which is not normally accessible) to store the SMI handler code. Doh! SMM uses the VGA memory doesn't it. Now it all makes sense :-) If I disable SMM in the Bochs BIOS, the patch works quite happily with the latest CVS. I've attached the patch for reference. The way to fix this (again, probably) is to: 1. Revert the 0-640K/1MB-end-of-memory slot thing and create just one memory slot for all physical RAM. We lose the VGA optimization here right? 2. Add hacks in the memory slot code to not return a memory slot if the physical address is in the forbidden range. I'm not sure I understand what you mean by this. I guess I have to spend some time and understand how the whole memory slot thing works. 3. Add another hack to disable the first hack when SMM is entered and re-enabled it when SMM is exited (e.g. some ioctl). I'll have to read a little more into SMM. It can be entered at any moment right? I seem to recall that either the VT or SVM spec has special handling for SMIs? Another option to consider would simply be to have the BIOS detect whether or not the emulated hardware supports SMM dynamically (right now, it's a compile time switch). This would let us turn it off in QEMU when KVM is enabled. Is anyone else working on this? I intended to merge qemu once a release is made. However, if you get this working and it is stable, it may make sense to merge sooner as I very much like qemu cvs. I would rather just submit this patch (with the BIOS hack) to QEMU and try and get it picked up in CVS. There are some regressions at the moment in CVS so it may be nice for users to have an 0.8.2 based version available. What do you think? Would be nice to have KVM support in QEMU CVS by the time 2.6.20 rolls out. Regards, Anthony Liguori ? _rombios_.c ? _rombiosl_.c ? biossums ? rombios.s ? rombios.sym ? rombios.txt ? rombios16.bin ? rombios32.bin ? rombios32.out ? rombiosl.s ? rombiosl.sym ? rombiosl.txt Index: BIOS-bochs-latest === RCS file: /cvsroot/bochs/bochs/bios/BIOS-bochs-latest,v retrieving revision 1.141 diff -u -r1.141 BIOS-bochs-latest Binary files /tmp/cvsCh2IkN and BIOS-bochs-latest differ Index: BIOS-bochs-legacy === RCS file: /cvsroot/bochs/bochs/bios/BIOS-bochs-legacy,v retrieving revision 1.5 diff -u -r1.5 BIOS-bochs-legacy Binary files /tmp/cvsQC2QUQ and BIOS-bochs-legacy differ Index: rombios.h === RCS file: /cvsroot/bochs/bochs/bios/rombios.h,v retrieving revision 1.3 diff -u -r1.3 rombios.h --- rombios.h 3 Oct 2006 20:27:30 - 1.3 +++ rombios.h 21 Dec 2006 04:02:40 - @@ -19,7 +19,7 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /* define it to include QEMU specific code */ -//#define BX_QEMU +#define BX_QEMU #ifndef LEGACY # define BX_ROMBIOS32 1 Index: rombios32.c === RCS file: /cvsroot/bochs/bochs/bios/rombios32.c,v retrieving revision 1.8 diff -u -r1.8 rombios32.c --- rombios32.c 3 Oct 2006 20:27:30 - 1.8 +++ rombios32.c 21 Dec 2006 04:02:41 - @@ -38,7 +38,7 @@ //#define BX_USE_EBDA_TABLES /* define it if the (emulated) hardware supports SMM mode */ -#define BX_USE_SMM +//#define BX_USE_SMM #define cpuid(index, eax, ebx, ecx, edx) \ asm volatile (cpuid \ @@ -852,6 +852,11 @@ int ioapic_id, i, len; int mp_config_table_size; +#ifdef BX_QEMU +if (smp_cpus = 1) + return 1; +#endif + #ifdef BX_USE_EBDA_TABLES mp_config_table = (uint8_t *)(ram_size - ACPI_DATA_SIZE - MPTABLE_MAX_SIZE); #else - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
[kvm-devel] [PATCH] Match virtual machine processor vendor to that of the host
Currently, kvm ends up just using the standard qemu cpu initialization. This means that all x86_64 virtual machines appear to have an AuthenticAMD (AMD64) processor. This ends up causing a problem when booting some x86_64 Linux kernels as they attempt to do AMD64 specific initialization for things like performance counters. Since those MSRs aren't supported on the Intel host, the virtual machine is halted. The attached patch makes it so that we check the actual cpu type of the host and then provide the same cpu type for the virtual machine. Jeremy Index: qemu/exec-all.h === --- qemu/exec-all.h (revision 4142) +++ qemu/exec-all.h (working copy) @@ -603,3 +603,7 @@ } #endif + +#ifdef USE_KVM +#include qemu-kvm.h +#endif --- qemu/target-i386/helper2.c (revision 4142) +++ qemu/target-i386/helper2.c (working copy) @@ -141,6 +141,9 @@ #ifdef USE_KQEMU kqemu_init(env); #endif +#ifdef USE_KVM +kvm_cpu_init(env); +#endif return env; } --- qemu/qemu-kvm.c (revision 4142) +++ qemu/qemu-kvm.c (working copy) @@ -590,6 +590,56 @@ .io_window = kvm_io_window, }; +static inline unsigned int cpuid_ebx(unsigned int op) +{ +unsigned int eax, ebx; +__asm__ volatile + (movl %%ebx, %%esi\n\t + cpuid\n\t + xchgl %%ebx, %%esi + : =a (eax), =S (ebx) + : 0 (op)); +return ebx; +} + +static void kvm_update_cpuid(CPUState *env) +{ +int family, model, stepping; + +/* we need to differentiate intel vs amd processors here. + * FIXME: should match more cpuid capabilities here */ +switch (cpuid_ebx(0)) { +case 0x756e6547: /* Intel */ +env-cpuid_vendor1 = 0x756e6547; /* Genu */ +env-cpuid_vendor2 = 0x49656e69; /* ineI */ +env-cpuid_vendor3 = 0x6c65746e; /* ntel */ +family = 6; +model = 15; +stepping = 3; +break; +case 0x68747541: /* AMD */ +env-cpuid_vendor1 = 0x68747541; /* Auth */ +env-cpuid_vendor2 = 0x69746e65; /* enti */ +env-cpuid_vendor3 = 0x444d4163; /* cAMD */ +family = 6; +model = 2; +stepping = 3; +break; +default: +/* we don't know what it is, just return */ +return; +break; +} + +env-cpuid_version = (family 8) | (model 4) | stepping; +} + +int kvm_cpu_init(CPUState *env) +{ +kvm_update_cpuid(env); +return 0; +} + int kvm_qemu_init() { /* Try to initialize kvm */ Index: qemu/qemu-kvm.h === --- qemu/qemu-kvm.h (revision 4142) +++ qemu/qemu-kvm.h (working copy) @@ -10,4 +10,6 @@ int kvm_cpu_exec(CPUState *env); int kvm_update_debugger(CPUState *env); +int kvm_cpu_init(CPUState *env); + #endif - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
[kvm-devel] [PATCH] Support for QEMU's CVS
Howdy, The attached patch forward ports the KVM patch to QEMU's CVS. The only significant change needed was hacking the Bochs BIOS to dynamically disable SMM support if KVM is enabled. This was done by using one of the Bochs DEBUG ports. Probably not the best long term solution but it works. The patch is minimal (no VMDK changes, no migration, etc.). This is to ease upstream integration. I am able to boot both a Windows and FC5 guest (under SVM). You'll need the BIOS (binary file can't be included in diff) from: http://www.cs.utexas.edu/~aliguori/bios.bin I reckon some changes still need to be made for CVS inclusion but I think it's at least appropriate to send to qemu-devel and begin the review process. Regards, Anthony Liguori diff -r 2eac80033ea0 Makefile.target --- a/Makefile.target Tue Dec 19 09:31:34 2006 + +++ b/Makefile.target Wed Dec 20 23:01:25 2006 -0600 @@ -204,8 +204,8 @@ OBJS+= libqemu.a OBJS+= libqemu.a # cpu emulator library -LIBOBJS=exec.o kqemu.o translate-op.o translate-all.o cpu-exec.o\ -translate.o op.o +LIBOBJS=exec.o kqemu.o qemu-kvm.o translate-op.o translate-all.o cpu-exec.o\ +translate.o op.o ifdef CONFIG_SOFTFLOAT LIBOBJS+=fpu/softfloat.o else @@ -331,6 +331,10 @@ SOUND_HW += fmopl.o adlib.o SOUND_HW += fmopl.o adlib.o endif AUDIODRV+= wavcapture.o +ifdef CONFIG_KVM_KERNEL_INC +DEFINES += -I $(CONFIG_KVM_KERNEL_INC) +LIBS += -lkvm +endif # SCSI layer VL_OBJS+= scsi-disk.o cdrom.o lsi53c895a.o @@ -490,6 +494,9 @@ op_helper.o: op_helper.c op_helper.o: op_helper.c $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $ endif + +qemu-kvm.o: qemu-kvm.c + $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $ cpu-exec.o: cpu-exec.c $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $ diff -r 2eac80033ea0 configure --- a/configure Tue Dec 19 09:31:34 2006 + +++ b/configure Wed Dec 20 23:01:25 2006 -0600 @@ -89,6 +89,7 @@ bsd=no bsd=no linux=no kqemu=no +kvm=no profiler=no cocoa=no check_gfx=yes @@ -222,6 +223,8 @@ for opt do ;; --disable-kqemu) kqemu=no ;; + --enable-kvm) kvm=yes + ;; --enable-profiler) profiler=yes ;; --enable-cocoa) cocoa=yes ; coreaudio=yes ; sdl=no @@ -264,6 +267,7 @@ echo echo echo kqemu kernel acceleration support: echo --disable-kqemu disable kqemu support +echo --enable-kvm enable kernel virtual machine support echo echo Advanced options (experts only): echo --source-path=PATH path of source code [$source_path] @@ -576,6 +580,7 @@ fi fi echo FMOD support $fmod $fmod_support echo kqemu support $kqemu +echo kvm support $kvm echo Documentation $build_docs [ ! -z $uname_release ] \ echo uname -r $uname_release @@ -799,6 +804,13 @@ interp_prefix1=`echo $interp_prefix | interp_prefix1=`echo $interp_prefix | sed s/%M/$target_cpu/g` echo #define CONFIG_QEMU_PREFIX \$interp_prefix1\ $config_h +configure_kvm() { + if test $kvm = yes -a $target_softmmu = yes -a $cpu = $target_cpu ; then +echo #define USE_KVM 1 $config_h +echo CONFIG_KVM_KERNEL_INC=$kernel_path/include $config_mak + fi +} + if test $target_cpu = i386 ; then echo TARGET_ARCH=i386 $config_mak echo #define TARGET_ARCH \i386\ $config_h @@ -806,6 +818,7 @@ if test $target_cpu = i386 ; then if test $kqemu = yes -a $target_softmmu = yes -a $cpu = i386 ; then echo #define USE_KQEMU 1 $config_h fi + configure_kvm elif test $target_cpu = arm -o $target_cpu = armeb ; then echo TARGET_ARCH=arm $config_mak echo #define TARGET_ARCH \arm\ $config_h @@ -837,6 +850,7 @@ elif test $target_cpu = x86_64 ; the if test $kqemu = yes -a $target_softmmu = yes -a $cpu = x86_64 ; then echo #define USE_KQEMU 1 $config_h fi + configure_kvm elif test $target_cpu = mips -o $target_cpu = mipsel ; then echo TARGET_ARCH=mips $config_mak echo #define TARGET_ARCH \mips\ $config_h diff -r 2eac80033ea0 cpu-all.h --- a/cpu-all.h Tue Dec 19 09:31:34 2006 + +++ b/cpu-all.h Wed Dec 20 23:01:25 2006 -0600 @@ -826,6 +826,7 @@ extern int phys_ram_fd; extern int phys_ram_fd; extern uint8_t *phys_ram_base; extern uint8_t *phys_ram_dirty; +extern uint8_t *bios_mem; /* physical memory access */ #define TLB_INVALID_MASK (1 3) diff -r 2eac80033ea0 cpu-exec.c --- a/cpu-exec.c Tue Dec 19 09:31:34 2006 + +++ b/cpu-exec.c Wed Dec 20 23:01:25 2006 -0600 @@ -33,6 +33,11 @@ #undef EIP #include signal.h #include sys/ucontext.h +#endif + +#ifdef USE_KVM +#include qemu-kvm.h +extern int kvm_allowed; #endif int tb_invalidated_flag; @@ -457,6 +462,12 @@ int cpu_exec(CPUState *env1) } #endif +#ifdef USE_KVM +if (kvm_allowed) { +kvm_cpu_exec(env); +longjmp(env-jmp_env, 1); +} +#endif T0 = 0; /* force lookup of first TB */ for(;;) { #if defined(__sparc__) !defined(HOST_SOLARIS) diff -r 2eac80033ea0 exec.c --- a/exec.c Tue Dec 19