Skip to contentSkip to conversation

Support for QEMU's CVS

PATCH In review Anthony Liguori 3 participants 5 messages Dec 21, 2006 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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

Makefile.target +9 -2
diff -r 2eac80033ea0 Makefile.target
@@ -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 $@ $<
configure +14 -0
diff -r 2eac80033ea0 configure
@@ -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
cpu-all.h +1 -0
diff -r 2eac80033ea0 cpu-all.h
@@ -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)
cpu-exec.c +11 -0
diff -r 2eac80033ea0 cpu-exec.c
@@ -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)
exec.c +19 -0
diff -r 2eac80033ea0 exec.c
@@ -69,6 +69,10 @@
 #define TARGET_PHYS_ADDR_SPACE_BITS 32
 #endif
 
+#ifdef USE_KVM
+extern int kvm_allowed;
+#endif
+
 TranslationBlock tbs[CODE_GEN_MAX_BLOCKS];
 TranslationBlock *tb_phys_hash[CODE_GEN_PHYS_HASH_SIZE];
 int nb_tbs;
@@ -82,6 +86,7 @@ int phys_ram_fd;
 int phys_ram_fd;
 uint8_t *phys_ram_base;
 uint8_t *phys_ram_dirty;
+uint8_t *bios_mem;
 
 CPUState *first_cpu;
 /* current CPU in the current thread. It is only valid inside
@@ -1043,6 +1048,11 @@ int cpu_breakpoint_insert(CPUState *env,
     if (env->nb_breakpoints >= MAX_BREAKPOINTS)
         return -1;
     env->breakpoints[env->nb_breakpoints++] = pc;
+
+#ifdef USE_KVM
+    if (kvm_allowed)
+	kvm_update_debugger(env);
+#endif
     
     breakpoint_invalidate(env, pc);
     return 0;
@@ -1066,6 +1076,11 @@ int cpu_breakpoint_remove(CPUState *env,
     if (i < env->nb_breakpoints)
       env->breakpoints[i] = env->breakpoints[env->nb_breakpoints];
 
+#ifdef USE_KVM
+    if (kvm_allowed)
+	kvm_update_debugger(env);
+#endif
+    
     breakpoint_invalidate(env, pc);
     return 0;
 #else
@@ -1084,6 +1099,10 @@ void cpu_single_step(CPUState *env, int 
         /* XXX: only flush what is necessary */
         tb_flush(env);
     }
+#ifdef USE_KVM
+    if (kvm_allowed)
+	kvm_update_debugger(env);
+#endif
 #endif
 }
 
hw/cirrus_vga.c +117 -0

170 lines not on this page · raw message

hw/pc.c +50 -0

89 lines not on this page · raw message

hw/usb-hid.c +3 -1
diff -r 2eac80033ea0 hw/usb-hid.c
@@ -169,7 +169,9 @@ static const uint8_t qemu_tablet_config_
 	0x81,       /*  u8  ep_bEndpointAddress; IN Endpoint 1 */
  	0x03,       /*  u8  ep_bmAttributes; Interrupt */
  	0x08, 0x00, /*  u16 ep_wMaxPacketSize; */
-	0x03,       /*  u8  ep_bInterval; (255ms -- usb 2.0 spec) */
+	/* Temporarily increase usb polling interval to prevent cpu
+	 * saturation (3 ms is way too often for kvm) */
+	0x33,       /*  u8  ep_bInterval; (255ms -- usb 2.0 spec) */
 };
 
 static const uint8_t qemu_mouse_hid_report_descriptor[] = {
hw/vga.c +73 -0

114 lines not on this page · raw message

hw/vga_int.h +1 -0
diff -r 2eac80033ea0 hw/vga_int.h
@@ -174,5 +174,6 @@ void vga_draw_cursor_line_32(uint8_t *d1
                              unsigned int color0, unsigned int color1,
                              unsigned int color_xor);
 
+void *vga_update_vram(VGAState *s, void *vga_ram_base, int vga_ram_size);
 extern const uint8_t sr_mask[8];
 extern const uint8_t gr_mask[16];

diff -r 2eac80033ea0 pc-bios/bios.bin
Binary file pc-bios/bios.bin has changed

pc-bios/bios.diff +12 -4
diff -r 2eac80033ea0 pc-bios/bios.diff
@@ -4,7 +4,7 @@ retrieving revision 1.3
 retrieving revision 1.3
 diff -u -w -r1.3 rombios.h
 --- rombios.h	3 Oct 2006 20:27:30 -0000	1.3
-+++ rombios.h	1 Nov 2006 19:16:34 -0000
++++ rombios.h	21 Dec 2006 04:57:58 -0000
 @@ -19,7 +19,7 @@
  //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
  
@@ -20,14 +20,22 @@ retrieving revision 1.8
 retrieving revision 1.8
 diff -u -w -r1.8 rombios32.c
 --- rombios32.c	3 Oct 2006 20:27:30 -0000	1.8
-+++ rombios32.c	1 Nov 2006 19:16:34 -0000
-@@ -852,6 +852,11 @@
++++ rombios32.c	21 Dec 2006 04:57:59 -0000
+@@ -757,6 +757,7 @@
+         pci_config_writeb(d, 0x80, 0x01); /* enable PM io space */
+         pm_sci_int = pci_config_readb(d, PCI_INTERRUPT_LINE);
+ #ifdef BX_USE_SMM
++	if (inb(INFO_PORT) == 1)
+         smm_init(d);
+ #endif
+         acpi_enabled = 1;
+@@ -852,6 +853,11 @@
      int ioapic_id, i, len;
      int mp_config_table_size;
  
 +#ifdef BX_QEMU
 +    if (smp_cpus <= 1)
-+        return;
++	return;
 +#endif
 +
  #ifdef BX_USE_EBDA_TABLES
target-i386/cpu.h +18 -3
diff -r 2eac80033ea0 target-i386/cpu.h
@@ -155,14 +155,18 @@
 #define HF_MP_MASK           (1 << HF_MP_SHIFT)
 #define HF_EM_MASK           (1 << HF_EM_SHIFT)
 #define HF_TS_MASK           (1 << HF_TS_SHIFT)
+#define HF_IOPL_MASK         (3 << HF_IOPL_SHIFT)
 #define HF_LMA_MASK          (1 << HF_LMA_SHIFT)
 #define HF_CS64_MASK         (1 << HF_CS64_SHIFT)
 #define HF_OSFXSR_MASK       (1 << HF_OSFXSR_SHIFT)
+#define HF_VM_MASK           (1 << HF_VM_SHIFT)
 #define HF_HALTED_MASK       (1 << HF_HALTED_SHIFT)
 #define HF_SMM_MASK          (1 << HF_SMM_SHIFT)
 
-#define CR0_PE_MASK  (1 << 0)
-#define CR0_MP_MASK  (1 << 1)
+#define CR0_PE_SHIFT 0
+#define CR0_PE_MASK  (1 << CR0_PE_SHIFT)
+#define CR0_MP_SHIFT 1
+#define CR0_MP_MASK  (1 << CR0_MP_SHIFT)
 #define CR0_EM_MASK  (1 << 2)
 #define CR0_TS_MASK  (1 << 3)
 #define CR0_ET_MASK  (1 << 4)
@@ -179,7 +183,8 @@
 #define CR4_PAE_MASK  (1 << 5)
 #define CR4_PGE_MASK  (1 << 7)
 #define CR4_PCE_MASK  (1 << 8)
-#define CR4_OSFXSR_MASK (1 << 9)
+#define CR4_OSFXSR_SHIFT 9
+#define CR4_OSFXSR_MASK (1 << CR4_OSFXSR_SHIFT)
 #define CR4_OSXMMEXCPT_MASK  (1 << 10)
 
 #define PG_PRESENT_BIT	0
@@ -490,6 +495,9 @@ typedef struct CPUX86State {
     target_ulong kernelgsbase;
 #endif
 
+#ifdef USE_KVM
+    uint64_t tsc; /* time stamp counter */
+#endif
     uint64_t pat;
 
     /* temporary data for USE_CODE_COPY mode */
@@ -528,6 +536,13 @@ typedef struct CPUX86State {
     int kqemu_enabled;
     int last_io_time;
 #endif
+
+#ifdef USE_KVM
+#define BITS_PER_LONG (8 * sizeof (long))
+#define NR_IRQ_WORDS (256/ BITS_PER_LONG)
+    unsigned long kvm_interrupt_bitmap[NR_IRQ_WORDS];
+#endif
+
     /* in order to simplify APIC support, we leave this pointer to the
        user */
     struct APICState *apic_state;
target-i386/helper.c +41 -1

86 lines not on this page · raw message

vl.c +53 -1

119 lines not on this page · raw message

vl.h +5 -0
diff -r 2eac80033ea0 vl.h
@@ -149,6 +149,7 @@ extern int graphic_depth;
 extern int graphic_depth;
 extern const char *keyboard_layout;
 extern int kqemu_allowed;
+extern int kvm_allowed;
 extern int win2k_install_hack;
 extern int usb_enabled;
 extern int smp_cpus;
@@ -161,6 +162,10 @@ extern int no_quit;
 #define BIOS_SIZE (128 * 1024)
 #else
 #define BIOS_SIZE ((256 + 64) * 1024)
+#endif
+
+#if USE_KVM
+#define KVM_EXTRA_PAGES 3
 #endif
 
 /* keyboard/mouse support */
qemu-kvm.c new file +648 -0

648 lines not on this page · raw message

qemu-kvm.h new file +13 -0
diff -r 2eac80033ea0 qemu-kvm.h
@@ -0,0 +1,13 @@
+#ifndef QEMU_KVM_H
+#define QEMU_KVM_H
+
+#include "kvmctl.h"
+
+int kvm_qemu_init(void);
+int kvm_qemu_create_context(void);
+void kvm_qemu_destroy(void);
+void kvm_load_registers(CPUState *env);
+int kvm_cpu_exec(CPUState *env);
+int kvm_update_debugger(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.php&p=sourceforge&CID=DEVDEV

_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 13 lines · Anthony Liguori

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).

Quoted 7 lines

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.

There are four issues I can see:

- if there are multiple sources of kvm userspace, there are bound to be problems with incompatible kernel API and userspace, especially as I have plans for extensive changes to the API. I'll go and implement a version check now, so that doesn't become a barrier to anything. A submission to qemu-devel should include this check.

- the API changes are bound to cause more churn than necessary. I guess we can live with that though.

- the patch contains some qemu changes that date from the days we did V2E, and are therefore unnecessary. I'll point them out below.

- where does libkvm live? an external package?

hw/usb-hid.c static const uint8_t qemu_tablet_config_ · line 175

Quoted 12 lines

diff -r 2eac80033ea0 hw/usb-hid.c

hw/usb-hid.c +3 -1
@@ -169,7 +169,9 @@ static const uint8_t qemu_tablet_config_
 	0x81,       /*  u8  ep_bEndpointAddress; IN Endpoint 1 */
  	0x03,       /*  u8  ep_bmAttributes; Interrupt */
  	0x08, 0x00, /*  u16 ep_wMaxPacketSize; */
-	0x03,       /*  u8  ep_bInterval; (255ms -- usb 2.0 spec) */
+	/* Temporarily increase usb polling interval to prevent cpu
+	 * saturation (3 ms is way too often for kvm) */
+	0x33,       /*  u8  ep_bInterval; (255ms -- usb 2.0 spec) */
 

This might be a good change for qemu, but on the other hand this is a kvm deficiency that is forced on non-kvm users.

Quoted 7 lines

diff -r 2eac80033ea0 target-i386/helper.c

target-i386/helper.c +0 -0
@@ -184,7 +186,15 @@ static inline void get_ss_esp_from_tss(u
     if (!(env->tr.flags & DESC_P_MASK))
         cpu_abort(env, "invalid tss");
     type = (env->tr.flags >> DESC_TYPE_SHIFT) & 0xf;

target-i386/helper.c static inline void get_ss_esp_from_tss(u · line 198

Quoted 10 lines
target-i386/helper.c +8 -0
+#ifdef USE_KVM
+    /*
+     * Bit 1 is the Busy bit.  We believe it is legal to interrupt into a busy
+     * segment
+     */
+    if ((kvm_allowed && (type & 5) != 1) || (type & 7) != 1)
+#else
     if ((type & 7) != 1)
+#endif
 

This is unnecessary now. However I also think it is correct (e.g. the #else part can be eliminated)

target-i386/helper.c static inline void check_io(int addr, in · line 515

Quoted 7 lines
target-i386/helper.c +5 -0
+#ifdef USE_KVM
+	/* Probable qemu bug: 11 is a valid segment type */
+        ((env->tr.flags >> DESC_TYPE_SHIFT) & 0xd) != 9 ||
+#else
         ((env->tr.flags >> DESC_TYPE_SHIFT) & 0xf) != 9 ||
+#endif

Ditto.

Quoted 5 lines
         env->tr.limit < 103)
         goto fail;
     io_offset = lduw_kernel(env->tr.base + 0x66);
target-i386/helper.c +0 -0
@@ -839,6 +854,13 @@ static void do_interrupt64(int intno, in
     uint32_t e1, e2, e3, ss;

target-i386/helper.c static void do_interrupt64(int intno, in · line 864

Quoted 10 lines
target-i386/helper.c +7 -0
     target_ulong old_eip, esp, offset;
 
+#ifdef USE_KVM
+    if (kvm_allowed) {
+	    printf("%s: unexpect\n", __FUNCTION__);
+	    exit(-1);
+    }
+#endif
+
 

Unnecessary, I think.

Quoted 4 lines
target-i386/helper.c +0 -0
     has_error_code = 0;
     if (!is_int && !is_hw) {
         switch(intno) {

target-i386/helper.c void do_interrupt_user(int intno, int is · line 1153

Quoted 10 lines
target-i386/helper.c +6 -0
@@ -1122,6 +1144,12 @@ void do_interrupt_user(int intno, int is
     int dpl, cpl;
     uint32_t e2;
 
+#ifdef USE_KVM
+    if (kvm_allowed) {
+	    printf("%s: unexpect\n", __FUNCTION__);
+	    exit(-1);
+    }
+#endif
 

Ditto.

Quoted 4 lines
target-i386/helper.c +0 -0
     dt = &env->idt;
     ptr = dt->base + (intno * 8);
     e2 = ldl_kernel(ptr + 4);

target-i386/helper.c void do_interrupt(int intno, int is_int, · line 1184

Quoted 10 lines
target-i386/helper.c +6 -0
@@ -1147,6 +1175,12 @@ void do_interrupt(int intno, int is_int,
 void do_interrupt(int intno, int is_int, int error_code, 
                   target_ulong next_eip, int is_hw)
 {
+#ifdef USE_KVM
+    if (kvm_allowed) {
+	printf("%s: unexpect\n", __FUNCTION__);
+	exit(-1);
+    }
+#endif
 

Ditto.

Quoted 4 lines
target-i386/helper.c +0 -0
     if (loglevel & CPU_LOG_INT) {
         if ((env->cr[0] & CR0_PE_MASK)) {
             static int count;

target-i386/helper.c void helper_ljmp_protected_T0_T1(int nex · line 2001

Quoted 10 lines
target-i386/helper.c +6 -0
@@ -1958,6 +1992,12 @@ void helper_ljmp_protected_T0_T1(int nex
         cpu_x86_load_seg_cache(env, R_CS, (new_cs & 0xfffc) | cpl,
                        get_seg_base(e1, e2), limit, e2);
         EIP = new_eip;
+#ifdef USE_KVM
+        if (kvm_allowed && (e2 & DESC_L_MASK)) {
+            env->exception_index = -1;
+            cpu_loop_exit();   
+        }       
+#endif
 

Ditto.

Signature · 8 lines
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.php&p=sourceforge&CID=DEVDEV

A message that is not in the archive (sent off-list or not yet received): 458A4AA7.1000705-atKUWr5tajBWk0Htik3J/[email protected]

#4 lore raw
Quoted 1 line · Avi Kivity

- where does libkvm live? an external package?

I'd suggest an additional package, too, for kvm-specific but not essential things like kvm_stat and the test code (perhaps kvm-utils ?)

- James

Signature · 8 lines
James Morris
<jmorris-gx6/[email protected]>

-------------------------------------------------------------------------
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.php&p=sourceforge&CID=DEVDEV
#5 lore raw
In reply to a message not in the archive
Quoted 7 lines · Avi Kivity

There are four issues I can see:

- if there are multiple sources of kvm userspace, there are bound to be problems with incompatible kernel API and userspace, especially as I have plans for extensive changes to the API. I'll go and implement a version check now, so that doesn't become a barrier to anything. A submission to qemu-devel should include this check.

With KQEMU, you have to pair a version of KQEMU with the appropriate version of QEMU. I don't think there's much of a problem doing something like this for KVM for the short term until API gets more stable (provided there's a version check so the error is useful to the user).

Quoted 2 lines

- the API changes are bound to cause more churn than necessary. I guess we can live with that though.

Yeah, I don't think this is a huge problem.

Quoted 2 lines

- the patch contains some qemu changes that date from the days we did V2E, and are therefore unnecessary. I'll point them out below.

Right, I noticed a few things that seemed unnecessary.

Quoted 1 line

- where does libkvm live? an external package?

I would think an external package.

There are a couple more issues I know of:

- kqemu and kvm don't play very well together at the moment. We need
to revisit some of the logic to ensure that kqemu and kvm are never enabled at the same time.

- the USE_KVM guards are probably unnecessary. We should be able to
isolate all of the libkvmctl specific stuff to qemu-kvm.c and then stub things out as needed.

Quoted 7 lines
Quoted 7 lines

diff -r 2eac80033ea0 hw/usb-hid.c

hw/usb-hid.c Wed Dec 20 23:01:25 2006 -0600 renamed from hw/usb-hid.c Tue Dec 19 09:31:34 2006 +0000 +0 -0
@@ -169,7 +169,9 @@ static const uint8_t qemu_tablet_config_
     0x81,       /*  u8  ep_bEndpointAddress; IN Endpoint 1 */
      0x03,       /*  u8  ep_bmAttributes; Interrupt */
      0x08, 0x00, /*  u16 ep_wMaxPacketSize; */
Quoted 8 lines

hw/usb-hid.c Wed Dec 20 23:01:25 2006 -0600 static const uint8_t qemu_tablet_config_ · line 175

Quoted 5 lines
hw/usb-hid.c Wed Dec 20 23:01:25 2006 -0600 renamed from hw/usb-hid.c Tue Dec 19 09:31:34 2006 +0000 +3 -1
-    0x03,       /*  u8  ep_bInterval; (255ms -- usb 2.0 spec) */
+    /* Temporarily increase usb polling interval to prevent cpu
+     * saturation (3 ms is way too often for kvm) */
+    0x33,       /*  u8  ep_bInterval; (255ms -- usb 2.0 spec) */
 

This might be a good change for qemu, but on the other hand this is a kvm deficiency that is forced on non-kvm users.

Brad Campbell (who wrote the original HID description) has recently posted a patch that changes the interval to 0x20. 0x03 was causing a performance problems with Windows guests (there's a pretty recent thread on qemu-devel about it).

How did you arrive at 0x33 btw? IIRC, Brad stopped at 0x20 as he saw no performance improvement beyond it. If KVM needs at least 0x33 then provided there is no negative impact to QEMU I don't really see a problem with it.

kqemu is bound to have the same issue FWIW.

Regards,

Anthony Liguori

-------------------------------------------------------------------------
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.php&p=sourceforge&CID=DEVDEV

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw
Quoted 9 lines · Anthony Liguori
Quoted 7 lines · Avi Kivity

There are four issues I can see:

- if there are multiple sources of kvm userspace, there are bound to be problems with incompatible kernel API and userspace, especially as I have plans for extensive changes to the API. I'll go and implement a version check now, so that doesn't become a barrier to anything. A submission to qemu-devel should include this check.

Quoted 6 lines

With KQEMU, you have to pair a version of KQEMU with the appropriate version of QEMU. I don't think there's much of a problem doing something like this for KVM for the short term until API gets more stable (provided there's a version check so the error is useful to the user).

The version check is now in.

Quoted 22 lines
Quoted 16 lines

hw/usb-hid.c Wed Dec 20 23:01:25 2006 -0600 static const uint8_t qemu_tablet_config_ · line 175

Quoted 13 lines

diff -r 2eac80033ea0 hw/usb-hid.c

hw/usb-hid.c Wed Dec 20 23:01:25 2006 -0600 renamed from hw/usb-hid.c Tue Dec 19 09:31:34 2006 +0000 +3 -1
@@ -169,7 +169,9 @@ static const uint8_t qemu_tablet_config_
     0x81,       /*  u8  ep_bEndpointAddress; IN Endpoint 1 */
      0x03,       /*  u8  ep_bmAttributes; Interrupt */
      0x08, 0x00, /*  u16 ep_wMaxPacketSize; */
-    0x03,       /*  u8  ep_bInterval; (255ms -- usb 2.0 spec) */
+    /* Temporarily increase usb polling interval to prevent cpu
+     * saturation (3 ms is way too often for kvm) */
+    0x33,       /*  u8  ep_bInterval; (255ms -- usb 2.0 spec) */
 

This might be a good change for qemu, but on the other hand this is a kvm deficiency that is forced on non-kvm users.

Brad Campbell (who wrote the original HID description) has recently posted a patch that changes the interval to 0x20. 0x03 was causing a performance problems with Windows guests (there's a pretty recent thread on qemu-devel about it).

Quoted 4 lines

How did you arrive at 0x33 btw? IIRC, Brad stopped at 0x20 as he saw no performance improvement beyond it. If KVM needs at least 0x33 then provided there is no negative impact to QEMU I don't really see a problem with it.

It's just a random number, the first I tried. 0x20 would probably work just as well (30 interrupts/sec)

Signature · 8 lines
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.php&p=sourceforge&CID=DEVDEV