[COMMIT master] Remove unneeded printf() in kvm_run()

2009-09-09 Thread Avi Kivity
From: Avi Kivity a...@redhat.com

Snuck in during debugging.

Signed-off-by: Avi Kivity a...@redhat.com
Signed-off-by: Marcelo Tosatti mtosa...@redhat.com

diff --git a/qemu-kvm.c b/qemu-kvm.c
index d554749..7349c8d 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -965,7 +965,6 @@ int kvm_run(kvm_vcpu_context_t vcpu, void *env)
 #endif
 
 if (_env-kvm_cpu_state.regs_modified) {
-printf(%s: cpu %d mp_state %d\n, __func__, _env-cpu_index, 
_env-mp_state);
 kvm_arch_put_registers(_env);
 _env-kvm_cpu_state.regs_modified = 0;
 }
--
To unsubscribe from this list: send the line unsubscribe kvm-commits in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[COMMIT master] qemu-kvm: Install built option roms

2009-09-09 Thread Avi Kivity
From: Jan Kiszka jan.kis...@siemens.com

Based on Avi's version:

Pick up option roms from the build directory if available. As we do not
ship a extboot.bin binary, this also fixes the installation of this rom.

Signed-off-by: Jan Kiszka jan.kis...@siemens.com
Signed-off-by: Marcelo Tosatti mtosa...@redhat.com

diff --git a/Makefile b/Makefile
index bfc4b0f..0850241 100644
--- a/Makefile
+++ b/Makefile
@@ -251,6 +251,9 @@ ifneq ($(BLOBS),)
if [ -f $(SRC_PATH)/pc-bios/$$x ];then \
$(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x $(DESTDIR)$(datadir); 
\
fi \
+   ; if [ -f pc-bios/optionrom/$$x ];then \
+   $(INSTALL_DATA) pc-bios/optionrom/$$x $(DESTDIR)$(datadir); \
+   fi \
done
 endif
$(INSTALL_DIR) $(DESTDIR)$(datadir)/keymaps
--
To unsubscribe from this list: send the line unsubscribe kvm-commits in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[COMMIT master] Handle emulation failure in userspace

2009-09-09 Thread Avi Kivity
From: Mohammed Gamal m.gamal...@gmail.com

Since we return to userspace from KVM on invalid state emulation failure, let
qemu handle it.

Signed-off-by: Mohammed Gamal m.gamal...@gmail.com
Signed-off-by: Marcelo Tosatti mtosa...@redhat.com

diff --git a/qemu-kvm.c b/qemu-kvm.c
index 7349c8d..06efd41 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -1044,6 +1044,14 @@ int kvm_run(kvm_vcpu_context_t vcpu, void *env)
 r = kvm_s390_handle_reset(kvm, vcpu, run);
 break;
 #endif
+   case KVM_EXIT_INTERNAL_ERROR:
+   fprintf(stderr, KVM internal error. Suberror: %d\n,
+   run-internal.suberror);
+   kvm_show_regs(vcpu);
+   if (run-internal.suberror == KVM_INTERNAL_ERROR_EMULATION)
+   fprintf(stderr, emulation failure, check dmesg for details\n);
+   abort();
+   break;
 default:
 if (kvm_arch_run(vcpu)) {
 fprintf(stderr, unhandled vm exit: 0x%x\n, run-exit_reason);
--
To unsubscribe from this list: send the line unsubscribe kvm-commits in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[COMMIT master] Update kvm.h in qemu-kvm tree

2009-09-09 Thread Avi Kivity
From: Mohammed Gamal m.gamal...@gmail.com

Update struct kvm_run and KVM_EXIT_* constants to match the one in the
kernel-space tree

Signed-off-by: Mohammed Gamal m.gamal...@gmail.com
Signed-off-by: Marcelo Tosatti mtosa...@redhat.com

diff --git a/kvm/include/linux/kvm.h b/kvm/include/linux/kvm.h
index ff1025d..801865d 100644
--- a/kvm/include/linux/kvm.h
+++ b/kvm/include/linux/kvm.h
@@ -135,6 +135,10 @@ struct kvm_pit_config {
 #define KVM_EXIT_S390_RESET   14
 #define KVM_EXIT_DCR  15
 #define KVM_EXIT_NMI  16
+#define KVM_EXIT_INTERNAL_ERROR   17
+
+/* For KVM_EXIT_INTERNAL_ERROR */
+#define KVM_INTERNAL_ERROR_EMULATION 1
 
 /* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */
 struct kvm_run {
@@ -221,6 +225,9 @@ struct kvm_run {
__u32 data;
__u8  is_write;
} dcr;
+   struct {
+   __u32 suberror;
+   } internal;
/* Fix the size of the union. */
char padding[256];
};
--
To unsubscribe from this list: send the line unsubscribe kvm-commits in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[COMMIT master] vmxcap: Add tool to query vmx capabilities

2009-09-09 Thread Avi Kivity
From: Avi Kivity a...@redhat.com

This should really be in the kernel, but there are too many of them.

Signed-off-by: Avi Kivity a...@redhat.com
Signed-off-by: Marcelo Tosatti mtosa...@redhat.com

diff --git a/kvm/scripts/vmxcap b/kvm/scripts/vmxcap
new file mode 100755
index 000..50f094b
--- /dev/null
+++ b/kvm/scripts/vmxcap
@@ -0,0 +1,154 @@
+#!/usr/bin/python
+
+MSR_IA32_VMX_BASIC = 0x480
+MSR_IA32_VMX_PINBASED_CTLS = 0x481
+MSR_IA32_VMX_PROCBASED_CTLS = 0x482
+MSR_IA32_VMX_EXIT_CTLS = 0x483
+MSR_IA32_VMX_ENTRY_CTLS = 0x484
+MSR_IA32_VMX_MISC_CTLS = 0x485
+MSR_IA32_VMX_PROCBASED_CTLS2 = 0x48B
+MSR_IA32_VMX_TRUE_PINBASED_CTLS = 0x48D
+MSR_IA32_VMX_TRUE_PROCBASED_CTLS = 0x48E
+MSR_IA32_VMX_TRUE_EXIT_CTLS = 0x48F
+MSR_IA32_VMX_TRUE_ENTRY_CTLS = 0x490
+
+class msr(object):
+def __init__(self):
+try:
+self.f = file('/dev/cpu/0/msr')
+except:
+self.f = file('/dev/msr0')
+def read(self, index, default = None):
+import struct
+self.f.seek(index)
+try:
+return struct.unpack('Q', self.f.read(8))[0]
+except:
+return default
+
+class Control(object):
+def __init__(self, name, bits, cap_msr, true_cap_msr = None):
+self.name = name
+self.bits = bits
+self.cap_msr = cap_msr
+self.true_cap_msr = true_cap_msr
+def read2(self, nr):
+m = msr()
+val = m.read(nr, 0)
+return (val  0x, val  32)
+def show(self):
+print self.name
+mbz, mb1 = self.read2(self.cap_msr)
+tmbz, tmb1 = 0, 0
+if self.true_cap_msr:
+tmbz, tmb1 = self.read2(self.true_cap_msr)
+for bit in sorted(self.bits.keys()):
+zero = not (mbz  (1  bit))
+one = mb1  (1  bit)
+true_zero = not (tmbz  (1  bit))
+true_one = tmb1  (1  bit)
+s= '?'
+if (self.true_cap_msr and true_zero and true_one
+and one and not zero):
+s = 'default'
+elif zero and not one:
+s = 'no'
+elif one and not zero:
+s = 'forced'
+elif one and zero:
+s = 'yes'
+print '  %-40s %s' % (self.bits[bit], s)
+
+controls = [
+Control(
+name = 'pin-based controls',
+bits = {
+0: 'External interrupt exiting',
+3: 'NMI exiting',
+5: 'Virtual NMIs',
+6: 'Activate VMX-preemption timer',
+7: 'Unrestricted guest',
+},
+cap_msr = MSR_IA32_VMX_PINBASED_CTLS,
+true_cap_msr = MSR_IA32_VMX_TRUE_PINBASED_CTLS,
+),
+
+Control(
+name = 'primary processor-based controls',
+bits = {
+2: 'Interrupt window exiting',
+3: 'Use TSC offsetting',
+7: 'HLT exiting',
+9: 'INVLPG exiting',
+10: 'MWAIT exiting',
+11: 'RDPMC exiting',
+12: 'RDTSC exiting',
+15: 'CR3-load exiting',
+16: 'CR3-store exiting',
+19: 'CR8-load exiting',
+20: 'CR8-store exiting',
+21: 'Use TPR shadow',
+22: 'NMI-window exiting',
+23: 'MOV-DR exiting',
+24: 'Unconditional I/O exiting',
+25: 'Use I/O bitmaps',
+27: 'Monitor trap flag',
+28: 'Use MSR bitmaps',
+29: 'MONITOR exiting',
+30: 'PAUSE exiting',
+31: 'Activate secondary control',
+},
+cap_msr = MSR_IA32_VMX_PROCBASED_CTLS,
+true_cap_msr = MSR_IA32_VMX_TRUE_PROCBASED_CTLS,
+),
+
+Control(
+name = 'secondary processor-based controls',
+bits = {
+0: 'Virtualize APIC accesses',
+1: 'Enable EPT',
+2: 'Descriptor-table exiting',
+4: 'Virtualize x2APIC mode',
+5: 'Enable VPID',
+6: 'WBINVD exiting',
+},
+cap_msr = MSR_IA32_VMX_PROCBASED_CTLS2,
+),
+
+Control(
+name = 'VM-Exit controls',
+bits = {
+2: 'Save debug controls',
+9: 'Host address-space size',
+12: 'Load IA32_PERF_GLOBAL_CTRL',
+15: 'Acknowledge interrupt on exit',
+18: 'Save IA32_PAT',
+19: 'Load IA32_PAT',
+20: 'Save IA32_EFER',
+21: 'Load IA32_EFER',
+22: 'Save VMX-preemption timer value',
+},
+cap_msr = MSR_IA32_VMX_EXIT_CTLS,
+true_cap_msr = MSR_IA32_VMX_TRUE_EXIT_CTLS,
+),
+
+Control(
+name = 'VM-Entry controls',
+bits = {
+2: 'Load debug controls',
+9: 'IA-64 mode guest',
+10: 'Entry to SMM',
+11: 'Deactivate dual-monitor treatment',
+13: 'Load IA32_PERF_GLOBAL_CTRL',
+14: 'Load IA32_PAT',
+15: 'Load IA32_EFER',

[COMMIT master] Fix kvm initialization introduced by bad merge ea571d06d8

2009-09-09 Thread Avi Kivity
From: Avi Kivity a...@redhat.com

Signed-off-by: Avi Kivity a...@redhat.com

diff --git a/vl.c b/vl.c
index 557c7dd..c791b07 100644
--- a/vl.c
+++ b/vl.c
@@ -5839,20 +5839,6 @@ int main(int argc, char **argv, char **envp)
 signal(SIGTTIN, SIG_IGN);
 }
 
-if (kvm_enabled()) {
-int ret;
-
-ret = kvm_init(smp_cpus);
-if (ret  0) {
-#if defined(KVM_UPSTREAM) || defined(NO_CPU_EMULATION)
-fprintf(stderr, failed to initialize KVM\n);
-exit(1);
-#endif
-fprintf(stderr, Could not initialize KVM, will disable KVM 
support\n);
-kvm_allowed = 0;
-}
-}
-
 if (pid_file  qemu_create_pidfile(pid_file) != 0) {
 if (daemonize) {
 uint8_t status = 1;
@@ -6013,18 +5999,12 @@ int main(int argc, char **argv, char **envp)
 
 ret = kvm_init(smp_cpus);
 if (ret  0) {
+#if defined(KVM_UPSTREAM) || defined(NO_CPU_EMULATION)
 fprintf(stderr, failed to initialize KVM\n);
 exit(1);
-}
-}
-
-if (kvm_enabled()) {
-int ret;
-
-ret = kvm_init(smp_cpus);
-if (ret  0) {
-fprintf(stderr, failed to initialize KVM\n);
-exit(1);
+#endif
+fprintf(stderr, Could not initialize KVM, will disable KVM 
support\n);
+kvm_allowed = 0;
 }
 }
 
--
To unsubscribe from this list: send the line unsubscribe kvm-commits in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[COMMIT master] Merge branch 'upstream-merge'

2009-09-09 Thread Avi Kivity
From: Avi Kivity a...@redhat.com

* upstream-merge: (68 commits)
  USB: use opaque parameter passing for monitor handle
  Sparc64: use ISA bus for i8042
  Sparc64: remove unused variables
  Make ioport default tables const
  Fix indentation
  When targeting PPU use rlwinm instead of andi. if possible
  Checks in select_soundhw were never intended to accept abbreviations
  Fix Sparse warnings: add static
  esp: handle select without attention
  Include sys-queue.h early to override system queue definitions on BSD
  Shuffle lines to avoid gcc 3 warning about redundant redeclaration
  Bring pcbios, seabios, and vgabios into the tree as git submodules.  Right 
now,
  mips malta: Fix fdc regression and use qdev for i8042 setup
  Introduce QDict unit-tests
  Introduce QDict test data file
  Introduce QString unit-tests
  Introduce QInt unit-tests
  Add check support
  monitor: Update supported types documentation
  monitor: fail when 'i' type is greater than 32-bit
  ...

Signed-off-by: Avi Kivity a...@redhat.com
--
To unsubscribe from this list: send the line unsubscribe kvm-commits in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[COMMIT master] KVM: VMX: Check cpl before emulating debug register access

2009-09-09 Thread Avi Kivity
From: Avi Kivity a...@redhat.com

Debug registers may only be accessed from cpl 0.  Unfortunately, vmx will
code to emulate the instruction even though it was issued from guest
userspace, possibly leading to an unexpected trap later.

Cc: sta...@kernel.org
Signed-off-by: Avi Kivity a...@redhat.com
Signed-off-by: Marcelo Tosatti mtosa...@redhat.com

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index a3f637f..6046e6f 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -621,6 +621,7 @@ void kvm_queue_exception(struct kvm_vcpu *vcpu, unsigned 
nr);
 void kvm_queue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code);
 void kvm_inject_page_fault(struct kvm_vcpu *vcpu, unsigned long cr2,
   u32 error_code);
+bool kvm_require_cpl(struct kvm_vcpu *vcpu, int required_cpl);
 
 int kvm_pic_set_irq(void *opaque, int irq, int level);
 
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 49ef7f5..38a0a81 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2931,6 +2931,8 @@ static int handle_dr(struct kvm_vcpu *vcpu)
unsigned long val;
int dr, reg;
 
+   if (!kvm_require_cpl(vcpu, 0))
+   return 1;
dr = vmcs_readl(GUEST_DR7);
if (dr  DR7_GD) {
/*
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 8b3a169..891234b 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -223,6 +223,19 @@ void kvm_queue_exception_e(struct kvm_vcpu *vcpu, unsigned 
nr, u32 error_code)
 EXPORT_SYMBOL_GPL(kvm_queue_exception_e);
 
 /*
+ * Checks if cpl = required_cpl; if true, return true.  Otherwise queue
+ * a #GP and return false.
+ */
+bool kvm_require_cpl(struct kvm_vcpu *vcpu, int required_cpl)
+{
+   if (kvm_x86_ops-get_cpl(vcpu) = required_cpl)
+   return true;
+   kvm_queue_exception_e(vcpu, GP_VECTOR, 0);
+   return false;
+}
+EXPORT_SYMBOL_GPL(kvm_require_cpl);
+
+/*
  * Load the pae pdptrs.  Return true is they are all valid.
  */
 int load_pdptrs(struct kvm_vcpu *vcpu, unsigned long cr3)
--
To unsubscribe from this list: send the line unsubscribe kvm-commits in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[COMMIT master] KVM: fix misreporting of coalesced interrupts by kvm tracer

2009-09-09 Thread Avi Kivity
From: Gleb Natapov g...@redhat.com

Signed-off-by: Gleb Natapov g...@redhat.com
Signed-off-by: Marcelo Tosatti mtosa...@redhat.com

diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index fd9e166..5694997 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -376,7 +376,7 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int 
delivery_mode,
 
result = !apic_test_and_set_irr(vector, apic);
trace_kvm_apic_accept_irq(vcpu-vcpu_id, delivery_mode,
- trig_mode, vector, result);
+ trig_mode, vector, !result);
if (!result) {
if (trig_mode)
apic_debug(level trig mode repeatedly for 
--
To unsubscribe from this list: send the line unsubscribe kvm-commits in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[COMMIT master] KVM: VMX: call vmx_load_host_state() only if msr is cached

2009-09-09 Thread Avi Kivity
From: Gleb Natapov g...@redhat.com

No need to call it before each kvm_(set|get)_msr_common()

Signed-off-by: Gleb Natapov g...@redhat.com
Signed-off-by: Marcelo Tosatti mtosa...@redhat.com

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 78101dd..49ef7f5 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -1005,9 +1005,9 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, u32 
msr_index, u64 *pdata)
data = vmcs_readl(GUEST_SYSENTER_ESP);
break;
default:
-   vmx_load_host_state(to_vmx(vcpu));
msr = find_msr_entry(to_vmx(vcpu), msr_index);
if (msr) {
+   vmx_load_host_state(to_vmx(vcpu));
data = msr-data;
break;
}
@@ -1064,9 +1064,9 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 
msr_index, u64 data)
}
/* Otherwise falls through to kvm_set_msr_common */
default:
-   vmx_load_host_state(vmx);
msr = find_msr_entry(vmx, msr_index);
if (msr) {
+   vmx_load_host_state(vmx);
msr-data = data;
break;
}
--
To unsubscribe from this list: send the line unsubscribe kvm-commits in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[COMMIT master] KVM: x86 emulator: Add pusha and popa instructions

2009-09-09 Thread Avi Kivity
From: Mohammed Gamal m.gamal...@gmail.com

This adds pusha and popa instructions (opcodes 0x60-0x61), this enables booting
MINIX with invalid guest state emulation on.

Signed-off-by: Mohammed Gamal m.gamal...@gmail.com
Signed-off-by: Marcelo Tosatti mtosa...@redhat.com

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index db0820d..4ffe1b7 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -139,7 +139,8 @@ static u32 opcode_table[256] = {
DstReg | Stack, DstReg | Stack, DstReg | Stack, DstReg | Stack,
DstReg | Stack, DstReg | Stack, DstReg | Stack, DstReg | Stack,
/* 0x60 - 0x67 */
-   0, 0, 0, DstReg | SrcMem32 | ModRM | Mov /* movsxd (x86/64) */ ,
+   ImplicitOps | Stack | No64, ImplicitOps | Stack | No64,
+   0, DstReg | SrcMem32 | ModRM | Mov /* movsxd (x86/64) */ ,
0, 0, 0, 0,
/* 0x68 - 0x6F */
SrcImm | Mov | Stack, 0, SrcImmByte | Mov | Stack, 0,
@@ -1225,6 +1226,44 @@ static int emulate_pop_sreg(struct x86_emulate_ctxt 
*ctxt,
return rc;
 }
 
+static void emulate_pusha(struct x86_emulate_ctxt *ctxt)
+{
+   struct decode_cache *c = ctxt-decode;
+   unsigned long old_esp = c-regs[VCPU_REGS_RSP];
+   int reg = VCPU_REGS_RAX;
+
+   while (reg = VCPU_REGS_RDI) {
+   (reg == VCPU_REGS_RSP) ?
+   (c-src.val = old_esp) : (c-src.val = c-regs[reg]);
+
+   emulate_push(ctxt);
+   ++reg;
+   }
+}
+
+static int emulate_popa(struct x86_emulate_ctxt *ctxt,
+   struct x86_emulate_ops *ops)
+{
+   struct decode_cache *c = ctxt-decode;
+   unsigned long old_esp = c-regs[VCPU_REGS_RSP];
+   int rc = 0;
+   int reg = VCPU_REGS_RDI;
+
+   while (reg = VCPU_REGS_RAX) {
+   if (reg == VCPU_REGS_RSP) {
+   register_address_increment(c, c-regs[VCPU_REGS_RSP],
+   c-op_bytes);
+   --reg;
+   }
+
+   rc = emulate_pop(ctxt, ops, c-regs[reg], c-op_bytes);
+   if (rc != 0)
+   break;
+   --reg;
+   }
+   return rc;
+}
+
 static inline int emulate_grp1a(struct x86_emulate_ctxt *ctxt,
struct x86_emulate_ops *ops)
 {
@@ -1816,6 +1855,14 @@ special_insn:
if (rc != 0)
goto done;
break;
+   case 0x60:  /* pusha */
+   emulate_pusha(ctxt);
+   break;
+   case 0x61:  /* popa */
+   rc = emulate_popa(ctxt, ops);
+   if (rc != 0)
+   goto done;
+   break;
case 0x63:  /* movsxd */
if (ctxt-mode != X86EMUL_MODE_PROT64)
goto cannot_emulate;
--
To unsubscribe from this list: send the line unsubscribe kvm-commits in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[COMMIT master] KVM: VMX: Enhance invalid guest state emulation

2009-09-09 Thread Avi Kivity
From: Mohammed Gamal m.gamal...@gmail.com

- Change returned handle_invalid_guest_state() to return relevant exit codes
- Move triggering the emulation from vmx_vcpu_run() to vmx_handle_exit()
- Return to userspace instead of repeatedly trying to emulate instructions that 
have already failed

Signed-off-by: Mohammed Gamal m.gamal...@gmail.com
Signed-off-by: Marcelo Tosatti mtosa...@redhat.com

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 38a0a81..bf0d00b 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -107,7 +107,6 @@ struct vcpu_vmx {
} rmode;
int vpid;
bool emulation_required;
-   enum emulation_result invalid_state_emulation_result;
 
/* Support for vnmi-less CPUs */
int soft_vnmi_blocked;
@@ -3320,35 +3319,37 @@ static int handle_nmi_window(struct kvm_vcpu *vcpu)
return 1;
 }
 
-static void handle_invalid_guest_state(struct kvm_vcpu *vcpu)
+static int handle_invalid_guest_state(struct kvm_vcpu *vcpu)
 {
struct vcpu_vmx *vmx = to_vmx(vcpu);
enum emulation_result err = EMULATE_DONE;
-
-   local_irq_enable();
-   preempt_enable();
+   int ret = 1;
 
while (!guest_state_valid(vcpu)) {
err = emulate_instruction(vcpu, 0, 0, 0);
 
-   if (err == EMULATE_DO_MMIO)
-   break;
+   if (err == EMULATE_DO_MMIO) {
+   ret = 0;
+   goto out;
+   }
 
if (err != EMULATE_DONE) {
kvm_report_emulation_failure(vcpu, emulation failure);
-   break;
+   vcpu-run-exit_reason = KVM_EXIT_INTERNAL_ERROR;
+   vcpu-run-internal.suberror = 
KVM_INTERNAL_ERROR_EMULATION;
+   ret = 0;
+   goto out;
}
 
if (signal_pending(current))
-   break;
+   goto out;
if (need_resched())
schedule();
}
 
-   preempt_disable();
-   local_irq_disable();
-
-   vmx-invalid_state_emulation_result = err;
+   vmx-emulation_required = 0;
+out:
+   return ret;
 }
 
 /*
@@ -3404,13 +3405,9 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu)
 
trace_kvm_exit(exit_reason, kvm_rip_read(vcpu));
 
-   /* If we need to emulate an MMIO from handle_invalid_guest_state
-* we just return 0 */
-   if (vmx-emulation_required  emulate_invalid_guest_state) {
-   if (guest_state_valid(vcpu))
-   vmx-emulation_required = 0;
-   return vmx-invalid_state_emulation_result != EMULATE_DO_MMIO;
-   }
+   /* If guest state is invalid, start emulating */
+   if (vmx-emulation_required  emulate_invalid_guest_state)
+   return handle_invalid_guest_state(vcpu);
 
/* Access CR3 don't cause VMExit in paging mode, so we need
 * to sync with guest real CR3. */
@@ -3605,11 +3602,10 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu)
if (unlikely(!cpu_has_virtual_nmis()  vmx-soft_vnmi_blocked))
vmx-entry_time = ktime_get();
 
-   /* Handle invalid guest state instead of entering VMX */
-   if (vmx-emulation_required  emulate_invalid_guest_state) {
-   handle_invalid_guest_state(vcpu);
+   /* Don't enter VMX if guest state is invalid, let the exit handler
+  start emulation until we arrive back to a valid state */
+   if (vmx-emulation_required  emulate_invalid_guest_state)
return;
-   }
 
if (test_bit(VCPU_REGS_RSP, (unsigned long *)vcpu-arch.regs_dirty))
vmcs_writel(GUEST_RSP, vcpu-arch.regs[VCPU_REGS_RSP]);
--
To unsubscribe from this list: send the line unsubscribe kvm-commits in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[COMMIT master] KVM: fix compile warnings on s390

2009-09-09 Thread Avi Kivity
From: Heiko Carstens heiko.carst...@de.ibm.com

CC  arch/s390/kvm/../../../virt/kvm/kvm_main.o
arch/s390/kvm/../../../virt/kvm/kvm_main.c: In function 
'__kvm_set_memory_region':
arch/s390/kvm/../../../virt/kvm/kvm_main.c:485: warning: unused variable 'j'
arch/s390/kvm/../../../virt/kvm/kvm_main.c:484: warning: unused variable 
'lpages'
arch/s390/kvm/../../../virt/kvm/kvm_main.c:483: warning: unused variable 'ugfn'

Cc: Carsten Otte co...@de.ibm.com
Signed-off-by: Heiko Carstens heiko.carst...@de.ibm.com
Signed-off-by: Marcelo Tosatti mtosa...@redhat.com

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index c7563f6..6ce5ef3 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -481,9 +481,8 @@ int __kvm_set_memory_region(struct kvm *kvm,
 {
int r;
gfn_t base_gfn;
-   unsigned long npages, ugfn;
-   int lpages;
-   unsigned long i, j;
+   unsigned long npages;
+   unsigned long i;
struct kvm_memory_slot *memslot;
struct kvm_memory_slot old, new;
 
@@ -561,6 +560,9 @@ int __kvm_set_memory_region(struct kvm *kvm,
goto skip_lpage;
 
for (i = 0; i  KVM_NR_PAGE_SIZES - 1; ++i) {
+   unsigned long ugfn;
+   unsigned long j;
+   int lpages;
int level = i + 2;
 
/* Avoid unused variable warning if no large pages */
--
To unsubscribe from this list: send the line unsubscribe kvm-commits in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[COMMIT master] KVM: SVM: Don't map nested_vmcb on INTERCEPT_MSR_PROT

2009-09-09 Thread Avi Kivity
From: Alexander Graf ag...@suse.de

Thanks to Joerg's previous series of cleanups, we now have almost all
information we need to decide what to do on #VMEXIT because we get
the variables from the VMCB on VMRUN.

Unfortunately there's one piece that slipped through the conversion,
namely the MSR intercept which still tries to map the nested VMCB
to find out if MSRs are intercepted.

So let's use the cached value, removing the need for two atomic maps
(which breaks anyways) and fix an oops along the way.

CC: Joerg Roedel joerg.roe...@amd.com
Signed-off-by: Alexander Graf ag...@suse.de
Signed-off-by: Marcelo Tosatti mtosa...@redhat.com

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 2df9b45..a5f90c7 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1427,19 +1427,17 @@ static bool nested_svm_exit_handled_msr(struct vcpu_svm 
*svm)
 {
u32 param = svm-vmcb-control.exit_info_1  1;
u32 msr = svm-vcpu.arch.regs[VCPU_REGS_RCX];
-   struct vmcb *nested_vmcb;
bool ret = false;
u32 t0, t1;
u8 *msrpm;
 
-   nested_vmcb = nested_svm_map(svm, svm-nested.vmcb, KM_USER0);
-   msrpm   = nested_svm_map(svm, svm-nested.vmcb_msrpm, KM_USER1);
+   if (!(svm-nested.intercept  (1ULL  INTERCEPT_MSR_PROT)))
+   return false;
 
-   if (!nested_vmcb || !msrpm)
-   goto out;
+   msrpm = nested_svm_map(svm, svm-nested.vmcb_msrpm, KM_USER0);
 
-   if (!(nested_vmcb-control.intercept  (1ULL  INTERCEPT_MSR_PROT)))
-   return 0;
+   if (!msrpm)
+   goto out;
 
switch (msr) {
case 0 ... 0x1fff:
@@ -1464,8 +1462,7 @@ static bool nested_svm_exit_handled_msr(struct vcpu_svm 
*svm)
ret = msrpm[t1]  ((1  param)  t0);
 
 out:
-   nested_svm_unmap(nested_vmcb, KM_USER0);
-   nested_svm_unmap(msrpm, KM_USER1);
+   nested_svm_unmap(msrpm, KM_USER0);
 
return ret;
 }
--
To unsubscribe from this list: send the line unsubscribe kvm-commits in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[COMMIT master] KVM: Fix coalesced interrupt reporting in IOAPIC

2009-09-09 Thread Avi Kivity
From: Gleb Natapov g...@redhat.com

This bug was introduced by b4a2f5e723e4f7df46731106faf9e2405673c073

Signed-off-by: Gleb Natapov g...@redhat.com
Signed-off-by: Marcelo Tosatti mtosa...@redhat.com

diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c
index e9de458..38a2d20 100644
--- a/virt/kvm/ioapic.c
+++ b/virt/kvm/ioapic.c
@@ -194,6 +194,8 @@ int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, 
int level)
if ((edge  old_irr != ioapic-irr) ||
(!edge  !entry.fields.remote_irr))
ret = ioapic_service(ioapic, irq);
+   else
+   ret = 0; /* report coalesced interrupt */
}
trace_kvm_ioapic_set_irq(entry.bits, irq, ret == 0);
}
--
To unsubscribe from this list: send the line unsubscribe kvm-commits in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[COMMIT master] KVM: remove emulate_popa unused variable

2009-09-09 Thread Avi Kivity
From: Marcelo Tosatti mtosa...@redhat.com

Signed-off-by: Marcelo Tosatti mtosa...@redhat.com

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 4ffe1b7..d226dff 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -1245,7 +1245,6 @@ static int emulate_popa(struct x86_emulate_ctxt *ctxt,
struct x86_emulate_ops *ops)
 {
struct decode_cache *c = ctxt-decode;
-   unsigned long old_esp = c-regs[VCPU_REGS_RSP];
int rc = 0;
int reg = VCPU_REGS_RDI;
 
--
To unsubscribe from this list: send the line unsubscribe kvm-commits in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[COMMIT master] KVM: Use thread debug register storage instead of kvm specific data

2009-09-09 Thread Avi Kivity
From: Avi Kivity a...@redhat.com

Instead of saving the debug registers from the processor to a kvm data
structure, rely in the debug registers stored in the thread structure.
This allows us not to save dr6 and dr7.

Reduces lightweight vmexit cost by 350 cycles, or 11 percent.

Signed-off-by: Avi Kivity a...@redhat.com

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 6046e6f..45226f0 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -362,9 +362,6 @@ struct kvm_vcpu_arch {
u32 pat;
 
int switch_db_regs;
-   unsigned long host_db[KVM_NR_DB_REGS];
-   unsigned long host_dr6;
-   unsigned long host_dr7;
unsigned long db[KVM_NR_DB_REGS];
unsigned long dr6;
unsigned long dr7;
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 891234b..9e3acbd 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3627,14 +3627,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
 
kvm_guest_enter();
 
-   get_debugreg(vcpu-arch.host_dr6, 6);
-   get_debugreg(vcpu-arch.host_dr7, 7);
if (unlikely(vcpu-arch.switch_db_regs)) {
-   get_debugreg(vcpu-arch.host_db[0], 0);
-   get_debugreg(vcpu-arch.host_db[1], 1);
-   get_debugreg(vcpu-arch.host_db[2], 2);
-   get_debugreg(vcpu-arch.host_db[3], 3);
-
set_debugreg(0, 7);
set_debugreg(vcpu-arch.eff_db[0], 0);
set_debugreg(vcpu-arch.eff_db[1], 1);
@@ -3645,15 +3638,14 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
trace_kvm_entry(vcpu-vcpu_id);
kvm_x86_ops-run(vcpu);
 
-   if (unlikely(vcpu-arch.switch_db_regs)) {
-   set_debugreg(0, 7);
-   set_debugreg(vcpu-arch.host_db[0], 0);
-   set_debugreg(vcpu-arch.host_db[1], 1);
-   set_debugreg(vcpu-arch.host_db[2], 2);
-   set_debugreg(vcpu-arch.host_db[3], 3);
+   if (unlikely(vcpu-arch.switch_db_regs || test_thread_flag(TIF_DEBUG))) 
{
+   set_debugreg(current-thread.debugreg0, 0);
+   set_debugreg(current-thread.debugreg1, 1);
+   set_debugreg(current-thread.debugreg2, 2);
+   set_debugreg(current-thread.debugreg3, 3);
+   set_debugreg(current-thread.debugreg6, 6);
+   set_debugreg(current-thread.debugreg7, 7);
}
-   set_debugreg(vcpu-arch.host_dr6, 6);
-   set_debugreg(vcpu-arch.host_dr7, 7);
 
set_bit(KVM_REQ_KICK, vcpu-requests);
local_irq_enable();
--
To unsubscribe from this list: send the line unsubscribe kvm-commits in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-commits] [COMMIT ddd9bbd] Support for multiple -monitor devices

2009-09-09 Thread Jan Kiszka
Avi Kivity wrote:
 On 09/04/2009 05:43 PM, Anthony Liguori wrote:
 From: Jan Kiszkajan.kis...@siemens.com

 Rebased version of Anthony's patch: Allow to specify more than one
 monitor terminal via the -monitor command line switch. This is
 particularly useful when libvirt or some other management tool already
 occupies the primary monitor but you need another one for debugging.
 The current clumsy workaround is to multiplex such additional terminals
 over a qemu character device (e.g. -serial mon:device).


 
 This (as merged into kvm-next) breaks autotest.  Autotest starts 
 qemu-kvm with -monitor unix:/tmp/blah,server,nowait; with this patch it 
 no longer opens the socket (as seen with lsof).  I haven't yet found out 
 why.

Ok, will have a look.

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-commits] [COMMIT ddd9bbd] Support for multiple -monitor devices

2009-09-09 Thread Avi Kivity

On 09/09/2009 02:32 PM, Jan Kiszka wrote:



This (as merged into kvm-next) breaks autotest.  Autotest starts
qemu-kvm with -monitor unix:/tmp/blah,server,nowait; with this patch it
no longer opens the socket (as seen with lsof).  I haven't yet found out
why.
 

Ok, will have a look.

   


I think it's a merge error, not a but in the commit itself.

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-commits] [COMMIT ddd9bbd] Support for multiple -monitor devices

2009-09-09 Thread Avi Kivity

On 09/09/2009 02:42 PM, Avi Kivity wrote:

On 09/09/2009 02:32 PM, Jan Kiszka wrote:



This (as merged into kvm-next) breaks autotest.  Autotest starts
qemu-kvm with -monitor unix:/tmp/blah,server,nowait; with this patch it
no longer opens the socket (as seen with lsof).  I haven't yet found 
out

why.

Ok, will have a look.



I think it's a merge error, not a but in the commit itself.



It is (totally unrelated to monitors, except that it was introduced when 
I merged that commit); fixed.


--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-commits] [COMMIT ddd9bbd] Support for multiple -monitor devices

2009-09-09 Thread Jan Kiszka
Avi Kivity wrote:
 On 09/09/2009 02:42 PM, Avi Kivity wrote:
 On 09/09/2009 02:32 PM, Jan Kiszka wrote:
 This (as merged into kvm-next) breaks autotest.  Autotest starts
 qemu-kvm with -monitor unix:/tmp/blah,server,nowait; with this patch it
 no longer opens the socket (as seen with lsof).  I haven't yet found 
 out
 why.
 Ok, will have a look.

 I think it's a merge error, not a but in the commit itself.

 
 It is (totally unrelated to monitors, except that it was introduced when 
 I merged that commit); fixed.

Fine, tasks-- :)

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: qemu-kvm: kqemu - R.I.P.

2009-09-09 Thread Avi Kivity

On 09/09/2009 02:08 PM, Jan Kiszka wrote:

Signed-off-by: Jan Kiszkajan.kis...@siemens.com

   


Applied, thanks.

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Use propeer way to compile with HELPER_CFLAGS

2009-09-09 Thread Avi Kivity

On 09/09/2009 02:04 PM, Juan Quintela wrote:

This makes the build quiet.

   


Applied, thanks.

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: KVM: SVM: remove needless mmap_sem acquision from nested_svm_map

2009-09-09 Thread Avi Kivity

On 09/08/2009 08:47 PM, Marcelo Tosatti wrote:

nested_svm_map unnecessarily takes mmap_sem around gfn_to_page, since
gfn_to_page / get_user_pages are responsible for it.

   


Applied, thanks.

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH -v2] QEMU-KVM: MCE: Relay UCR MCE to guest

2009-09-09 Thread Avi Kivity

On 09/09/2009 05:28 AM, Huang Ying wrote:

UCR (uncorrected recovery) MCE is supported in recent Intel CPUs,
where some hardware error such as some memory error can be reported
without PCC (processor context corrupted). To recover from such MCE,
the corresponding memory will be unmapped, and all processes accessing
the memory will be killed via SIGBUS.

For KVM, if QEMU/KVM is killed, all guest processes will be killed
too. So we relay SIGBUS from host OS to guest system via a UCR MCE
injection. Then guest OS can isolate corresponding memory and kill
necessary guest processes only. SIGBUS sent to main thread (not VCPU
threads) will be broadcast to all VCPU threads as UCR MCE.

v2:

- Use qemu_ram_addr_from_host instead of self made one to covert from
   host address to guest RAM address. Thanks Anthony Liguori.

   


Patch looks good, but can you clarify the following:


@@ -1877,12 +1995,20 @@ void kvm_hpet_enable_kpit(void)

  int kvm_init_ap(void)
  {
+struct sigaction action;
+
  #ifdef TARGET_I386
  kvm_tpr_opt_setup();
  #endif
  qemu_add_vm_change_state_handler(kvm_vm_state_change_handler, NULL);

  signal(SIG_IPI, sig_ipi_handler);
+
+memset(action, 0, sizeof(action));
+action.sa_flags = SA_SIGINFO;
+action.sa_sigaction = (void (*)(int, siginfo_t*, void*))sigbus_handler;
+sigaction(SIGBUS,action, NULL);
+prctl(PR_MCE_KILL, 1, 1);
  return 0;
  }
   


Why do we need a SIGBUS handler?  kvm vcpu threads will block and 
dequeue a SIGBUG in guest mode, so the handler will never be called, and 
we can't really handle SIGBUS in user mode.


(also, I if we can't handle guest-mode SIGBUS I think it would be nice 
to raise it again so the process terminates due to the SIGBUS).


--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] qemu-kvm: fix error handling in msix vector add

2009-09-09 Thread Avi Kivity

On 09/07/2009 10:05 AM, Mark McLoughlin wrote:

On Sat, 2009-07-25 at 12:30 -0300, Marcelo Tosatti wrote:
   

On Thu, Jul 23, 2009 at 04:34:13PM +0300, Michael S. Tsirkin wrote:
 

When adding a vector fails, the used counter should
not be incremented, otherwise on vector change we will
try to update the routing entry.

Signed-off-by: Michael S. Tsirkinm...@redhat.com
   

Applied, thanks.
 

We need this on stable-0.11 too. See:

   https://bugzilla.redhat.com/519787

   


Added there, thanks.

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] QEMU-KVM: MCE: Relay UCR MCE to guest

2009-09-09 Thread Avi Kivity

On 09/08/2009 11:11 AM, Andi Kleen wrote:



Does this potentially open a security hole for us?  Consider the following:

1) We happen to read guest memory and that causes an MCE.  For instance,
say we're in virtio.c and we read the virtio ring.
2) That should trigger the kernel to generate a sigbus.
3) We catch sigbus, and queue an MCE for delivery.
4) After sigbus handler completes, we're back in virtio.c, what was the
value of the memory operation we just completed?
 

Yes for any errors on accessing qemu internal memory that is not
owned by the guest image you should abort. I thought Ying's patch
did that already though, by aborting if there's no slot match.
   


User-mode qemu access should abort even if accessing guest memory, since 
there no way to recover the thread of execution (need a kernel-style 
exception table for each instruction that accesses guest memory, which 
would be a total overkill).


--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH -v2] QEMU-KVM: MCE: Relay UCR MCE to guest

2009-09-09 Thread Avi Kivity

On 09/09/2009 03:06 PM, Avi Kivity wrote:

On 09/09/2009 05:28 AM, Huang Ying wrote:

UCR (uncorrected recovery) MCE is supported in recent Intel CPUs,
where some hardware error such as some memory error can be reported
without PCC (processor context corrupted). To recover from such MCE,
the corresponding memory will be unmapped, and all processes accessing
the memory will be killed via SIGBUS.

For KVM, if QEMU/KVM is killed, all guest processes will be killed
too. So we relay SIGBUS from host OS to guest system via a UCR MCE
injection. Then guest OS can isolate corresponding memory and kill
necessary guest processes only. SIGBUS sent to main thread (not VCPU
threads) will be broadcast to all VCPU threads as UCR MCE.

v2:

- Use qemu_ram_addr_from_host instead of self made one to covert from
   host address to guest RAM address. Thanks Anthony Liguori.



Patch looks good, but can you clarify the following:


Oh and I forgot - please make MCE injection optional.  Some 
installations may prefer to kill the guest and have the virtualization 
management system restart it rather than trust the guest to handle the 
MCE properly.


--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH -v2] QEMU-KVM: MCE: Relay UCR MCE to guest

2009-09-09 Thread Avi Kivity

On 09/09/2009 03:16 PM, Avi Kivity wrote:
Oh and I forgot - please make MCE injection optional.  Some 
installations may prefer to kill the guest and have the virtualization 
management system restart it rather than trust the guest to handle the 
MCE properly.




Thinking a little more about it, they can configure the guest to 
panic/reboot on MCE rather than kill the affected process if they don't 
trust the guest service control.  So we can enable it unconditionally.


--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: R/W HG memory mappings with kvm?

2009-09-09 Thread Avi Kivity

On 09/01/2009 12:13 AM, Stephen Donnelly wrote:



I'm totally confused now.
 

Sorry about that. The issue is the BUG in gfn_to_pgn where the pfn is
not calculated correctly after looking up the vma.

I still don't see how to get the physical address from the vma, since
vm_pgoff is zero, and the vm_ops are not filled. The vma does not seem
to store the physical base address.
   


So it seems the only place the pfns are stored are in the ptes 
themselves.  Is there an API to recover the ptes from a virtual 
address?  We could use that instead.


--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Live migration between Intel Q6600 and AMD Phenom II

2009-09-09 Thread Andre Przywara

Sterling Windmill wrote:

I've read that it's possible to live migrate KVM guests between Intel

  and AMD CPUs, is it also possible to migrate from a CPU without
 NPT/EPT to the Phenom II that supports NPT?
Yes.
 Will I lose out on
 any of the benefits NPT allows without shutting down and restarting
 the guest?
NPT/EPT is a hypervisor feature, so the guest is unaffected (left alone 
the performance benefit). The guest does it's own paging (the same as on 
native), so the actual hypervisor page handling is not visible to the 
guest. You will immediately benefit from NPT if you migrate from a 
non-EPT/NPT capable host.


Cross-vendor migration experience differs from guest to guest, the most 
important point to look at are the CPUID bits. Start with a conservative 
setting (like -cpu kvm64 if you have a recent qemu-kvm) and if in need 
turn on features that you need (which must be on both hosts).
Also use recent KVM kernel modules, some CVM related bugs have been 
fixed lately.
We have tried migrating several guests without issues between non-NPT 
and NPT hosts.

If you experience problem, feel free to mail me with a description.


Also, any thoughts on how much more performant a 3.0GHz Phenom II will be for 
running KVM guests than the 2.4GHz Intel Q6600?
NPT is faster than shadow paging  on almost all workloads (since it 
avoids most of the #VMEXITs), but since the virtualization 
implementation differs in many details between Intel and AMD, 
performance estimation just based on this single feature is not very 
legitimate.


Regards,
Andre.

--
Andre Przywara
AMD-Operating System Research Center (OSRC), Dresden, Germany
Tel: +49 351 448 3567 12
to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Andrew Bowd; Thomas M. McCoy; Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Upstream build problem

2009-09-09 Thread Lucas Meneghel Rodrigues
Hi folks, it seems that we are still hitting the problem of qemu-kvm
being unable to find the option roms?


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


qemu-kvm still unable to load option rom extboot.bin

2009-09-09 Thread Lucas Meneghel Rodrigues
Hi folks, seems like we are still facing a build problem on qemu-kvm:
The option rom is failing to boot:

09/04 11:12:08 DEBUG|kvm_vm:0384| Running qemu command:
/usr/local/autotest/tests/kvm/qemu -name 'vm1' -monitor 
unix:/tmp/monitor-20090904-111208-9nyy,server,nowait -drive 
file=/usr/local/autotest/tests/kvm/images/fc9-32.qcow2,if=ide,boot=on -net 
nic,vlan=0 -net user,vlan=0 -m 512 -cdrom 
/usr/local/autotest/tests/kvm/isos/linux/Fedora-9-i386-DVD.iso -redir 
tcp:5000::22 -vnc :0
09/04 11:12:08 DEBUG| kvm_utils:0858| (qemu) Could not load option rom 
'extboot.bin'

So qemu is still not able to locate roms when it needs them. The test
could work around this as pointed out by Marcelo, by copying the roms to
the right repository, but that's not desirable, it should be fixed on
the build system appropriately.

I will do my best to allways watch closely the results of daily git
testing and report on problems.

Thanks!

Lucas

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: qemu-kvm still unable to load option rom extboot.bin

2009-09-09 Thread Dor Laor

On 09/09/2009 04:47 PM, Lucas Meneghel Rodrigues wrote:

Hi folks, seems like we are still facing a build problem on qemu-kvm:
The option rom is failing to boot:

09/04 11:12:08 DEBUG|kvm_vm:0384| Running qemu command:
/usr/local/autotest/tests/kvm/qemu -name 'vm1' -monitor 
unix:/tmp/monitor-20090904-111208-9nyy,server,nowait -drive 
file=/usr/local/autotest/tests/kvm/images/fc9-32.qcow2,if=ide,boot=on -net 
nic,vlan=0 -net user,vlan=0 -m 512 -cdrom 
/usr/local/autotest/tests/kvm/isos/linux/Fedora-9-i386-DVD.iso -redir 
tcp:5000::22 -vnc :0
09/04 11:12:08 DEBUG| kvm_utils:0858| (qemu) Could not load option rom 
'extboot.bin'

So qemu is still not able to locate roms when it needs them. The test
could work around this as pointed out by Marcelo, by copying the roms to
the right repository, but that's not desirable, it should be fixed on
the build system appropriately.

I will do my best to allways watch closely the results of daily git
testing and report on problems.


Avi just committed it:
[COMMIT master] qemu-kvm: Install built option roms




Thanks!

Lucas

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Activate Virtualization On Demand

2009-09-09 Thread Alexander Graf
X86 CPUs need to have some magic happening to enable the virtualization
extensions on them. This magic can result in unpleasant results for
users, like blocking other VMMs from working (vmx) or using invalid TLB
entries (svm).

Currently KVM activates virtualization when the respective kernel module
is loaded. This blocks us from autoloading KVM modules without breaking
other VMMs.

To circumvent this problem at least a bit, this patch introduces on
demand activation of virtualization. This means, that instead
virtualization is enabled on creation of the first virtual machine
and disabled on destruction of the last one.

So using this, KVM can be easily autoloaded, while keeping other
hypervisors usable.

Signed-off-by: Alexander Graf ag...@suse.de

--

I've tested the following:

  - shutdown
  - suspend / resume to RAM
  - running VirtualBox while kvm module is loaded
---
 arch/ia64/kvm/kvm-ia64.c|8 ++-
 arch/powerpc/kvm/powerpc.c  |3 +-
 arch/s390/kvm/kvm-s390.c|3 +-
 arch/x86/include/asm/kvm_host.h |2 +-
 arch/x86/kvm/svm.c  |   13 --
 arch/x86/kvm/vmx.c  |7 +++-
 arch/x86/kvm/x86.c  |4 +-
 include/linux/kvm_host.h|2 +-
 virt/kvm/kvm_main.c |   82 +--
 9 files changed, 98 insertions(+), 26 deletions(-)

diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index f6471c8..5fdeec5 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -124,7 +124,7 @@ long ia64_pal_vp_create(u64 *vpd, u64 *host_iva, u64 
*opt_handler)
 
 static  DEFINE_SPINLOCK(vp_lock);
 
-void kvm_arch_hardware_enable(void *garbage)
+int kvm_arch_hardware_enable(void *garbage)
 {
long  status;
long  tmp_base;
@@ -137,7 +137,7 @@ void kvm_arch_hardware_enable(void *garbage)
slot = ia64_itr_entry(0x3, KVM_VMM_BASE, pte, KVM_VMM_SHIFT);
local_irq_restore(saved_psr);
if (slot  0)
-   return;
+   return -EINVAL;
 
spin_lock(vp_lock);
status = ia64_pal_vp_init_env(kvm_vsa_base ?
@@ -145,7 +145,7 @@ void kvm_arch_hardware_enable(void *garbage)
__pa(kvm_vm_buffer), KVM_VM_BUFFER_BASE, tmp_base);
if (status != 0) {
printk(KERN_WARNINGkvm: Failed to Enable VT Support\n);
-   return ;
+   return -EINVAL;
}
 
if (!kvm_vsa_base) {
@@ -154,6 +154,8 @@ void kvm_arch_hardware_enable(void *garbage)
}
spin_unlock(vp_lock);
ia64_ptr_entry(0x3, slot);
+
+   return 0;
 }
 
 void kvm_arch_hardware_disable(void *garbage)
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 95af622..5902bbc 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -78,8 +78,9 @@ int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu 
*vcpu)
return r;
 }
 
-void kvm_arch_hardware_enable(void *garbage)
+int kvm_arch_hardware_enable(void *garbage)
 {
+   return 0;
 }
 
 void kvm_arch_hardware_disable(void *garbage)
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 00e2ce8..5445058 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -74,9 +74,10 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
 static unsigned long long *facilities;
 
 /* Section: not file related */
-void kvm_arch_hardware_enable(void *garbage)
+int kvm_arch_hardware_enable(void *garbage)
 {
/* every s390 is virtualization enabled ;-) */
+   return 0;
 }
 
 void kvm_arch_hardware_disable(void *garbage)
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 6046e6f..b17886f 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -462,7 +462,7 @@ struct descriptor_table {
 struct kvm_x86_ops {
int (*cpu_has_kvm_support)(void);  /* __init */
int (*disabled_by_bios)(void); /* __init */
-   void (*hardware_enable)(void *dummy);  /* __init */
+   int (*hardware_enable)(void *dummy);
void (*hardware_disable)(void *dummy);
void (*check_processor_compatibility)(void *rtn);
int (*hardware_setup)(void);   /* __init */
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index a5f90c7..2f3a388 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -316,7 +316,7 @@ static void svm_hardware_disable(void *garbage)
cpu_svm_disable();
 }
 
-static void svm_hardware_enable(void *garbage)
+static int svm_hardware_enable(void *garbage)
 {
 
struct svm_cpu_data *svm_data;
@@ -325,16 +325,20 @@ static void svm_hardware_enable(void *garbage)
struct desc_struct *gdt;
int me = raw_smp_processor_id();
 
+   rdmsrl(MSR_EFER, efer);
+   if (efer  EFER_SVME)
+   return -EBUSY;
+
if (!has_svm()) {
printk(KERN_ERR svm_cpu_init: err 

Re: [PATCH 3/9] virt/kvm: correct error-handling code

2009-09-09 Thread Avi Kivity

On 07/28/2009 06:53 PM, Julia Lawall wrote:

From: Julia Lawallju...@diku.dk

This code is not executed before file has been initialized to the result of
calling eventfd_fget.  This function returns an ERR_PTR value in an error
case instead of NULL.  Thus the test that file is not NULL is always true.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

//smpl
@match exists@
expression x, E;
statement S1, S2;
@@

x = eventfd_fget(...)
... when != x = E
(
*  if (x == NULL || ...) S1 else S2
|
*  if (x == NULL  ...) S1 else S2
)
///smpl

   


Applied, thanks (yes, old patch, missed it).

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] call kvm_cpu_synchronize_state() on target vcpu

2009-09-09 Thread Gleb Natapov
regs_modified logic doesn't work if io thread calls
kvm_cpu_synchronize_state() since kvm_arch_get_registers()
returns only after vcpu thread is back to kernel. Setting
regs_modified to 1 at this stage causes loading of wrong vcpu
state on the next vcpu_run().

Signed-off-by: Gleb Natapov g...@redhat.com
diff --git a/qemu-kvm.c b/qemu-kvm.c
index 06efd41..9ab0cec 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -874,14 +874,6 @@ int kvm_set_mpstate(kvm_vcpu_context_t vcpu, struct 
kvm_mp_state *mp_state)
 }
 #endif
 
-void kvm_cpu_synchronize_state(CPUState *env)
-{
-if (!env-kvm_cpu_state.regs_modified) {
-kvm_arch_get_registers(env);
-env-kvm_cpu_state.regs_modified = 1;
-}
-}
-
 static int handle_mmio(kvm_vcpu_context_t vcpu)
 {
 unsigned long addr = vcpu-run-mmio.phys_addr;
@@ -1539,6 +1531,22 @@ static void on_vcpu(CPUState *env, void (*func)(void 
*data), void *data)
 qemu_cond_wait(qemu_work_cond);
 }
 
+static void do_kvm_cpu_synchronize_state(void *_env)
+{
+CPUState *env = _env;
+if (!env-kvm_cpu_state.regs_modified) {
+kvm_arch_save_regs(env);
+kvm_arch_load_mpstate(env);
+env-kvm_cpu_state.regs_modified = 1;
+}
+}
+
+void kvm_cpu_synchronize_state(CPUState *env)
+{
+if (!env-kvm_cpu_state.regs_modified)
+on_vcpu(env, do_kvm_cpu_synchronize_state, env);
+}
+
 static void inject_interrupt(void *data)
 {
 cpu_interrupt(current_env, (long) data);
diff --git a/qemu-kvm.h b/qemu-kvm.h
index 2c1730b..32f74b3 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -1153,12 +1153,6 @@ static inline int kvm_sync_vcpus(void)
 return 0;
 }
 
-static inline void kvm_arch_get_registers(CPUState *env)
-{
-kvm_save_registers(env);
-kvm_save_mpstate(env);
-}
-
 static inline void kvm_arch_put_registers(CPUState *env)
 {
 kvm_load_registers(env);
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 4a16887..57c74a2 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -746,7 +746,7 @@ void cpu_dump_state(CPUState *env, FILE *f,
 static const char *seg_name[6] = { ES, CS, SS, DS, FS, GS };
 
 if (kvm_enabled())
-kvm_arch_get_registers(env);
+kvm_cpu_synchronize_state(env);
 
 eflags = env-eflags;
 #ifdef TARGET_X86_64
--
Gleb.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] call kvm_cpu_synchronize_state() on target vcpu

2009-09-09 Thread Avi Kivity

On 09/09/2009 06:33 PM, Gleb Natapov wrote:

regs_modified logic doesn't work if io thread calls
kvm_cpu_synchronize_state() since kvm_arch_get_registers()
returns only after vcpu thread is back to kernel. Setting
regs_modified to 1 at this stage causes loading of wrong vcpu
state on the next vcpu_run().

-static inline void kvm_arch_get_registers(CPUState *env)
-{
-kvm_save_registers(env);
-kvm_save_mpstate(env);
-}
-
   


Please don't drop this, it's part of upstream kvm support which we're 
supported to be moving towards.


--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] call kvm_cpu_synchronize_state() on target vcpu

2009-09-09 Thread Jan Kiszka
Gleb Natapov wrote:
 regs_modified logic doesn't work if io thread calls
 kvm_cpu_synchronize_state() since kvm_arch_get_registers()
 returns only after vcpu thread is back to kernel. Setting
 regs_modified to 1 at this stage causes loading of wrong vcpu
 state on the next vcpu_run().

We need this upstream too, right? Could you file the corresponding patch?

Thanks,
Jan

 
 Signed-off-by: Gleb Natapov g...@redhat.com
 diff --git a/qemu-kvm.c b/qemu-kvm.c
 index 06efd41..9ab0cec 100644
 --- a/qemu-kvm.c
 +++ b/qemu-kvm.c
 @@ -874,14 +874,6 @@ int kvm_set_mpstate(kvm_vcpu_context_t vcpu, struct 
 kvm_mp_state *mp_state)
  }
  #endif
  
 -void kvm_cpu_synchronize_state(CPUState *env)
 -{
 -if (!env-kvm_cpu_state.regs_modified) {
 -kvm_arch_get_registers(env);
 -env-kvm_cpu_state.regs_modified = 1;
 -}
 -}
 -
  static int handle_mmio(kvm_vcpu_context_t vcpu)
  {
  unsigned long addr = vcpu-run-mmio.phys_addr;
 @@ -1539,6 +1531,22 @@ static void on_vcpu(CPUState *env, void (*func)(void 
 *data), void *data)
  qemu_cond_wait(qemu_work_cond);
  }
  
 +static void do_kvm_cpu_synchronize_state(void *_env)
 +{
 +CPUState *env = _env;
 +if (!env-kvm_cpu_state.regs_modified) {
 +kvm_arch_save_regs(env);
 +kvm_arch_load_mpstate(env);
 +env-kvm_cpu_state.regs_modified = 1;
 +}
 +}
 +
 +void kvm_cpu_synchronize_state(CPUState *env)
 +{
 +if (!env-kvm_cpu_state.regs_modified)
 +on_vcpu(env, do_kvm_cpu_synchronize_state, env);
 +}
 +
  static void inject_interrupt(void *data)
  {
  cpu_interrupt(current_env, (long) data);
 diff --git a/qemu-kvm.h b/qemu-kvm.h
 index 2c1730b..32f74b3 100644
 --- a/qemu-kvm.h
 +++ b/qemu-kvm.h
 @@ -1153,12 +1153,6 @@ static inline int kvm_sync_vcpus(void)
  return 0;
  }
  
 -static inline void kvm_arch_get_registers(CPUState *env)
 -{
 -kvm_save_registers(env);
 -kvm_save_mpstate(env);
 -}
 -
  static inline void kvm_arch_put_registers(CPUState *env)
  {
  kvm_load_registers(env);
 diff --git a/target-i386/helper.c b/target-i386/helper.c
 index 4a16887..57c74a2 100644
 --- a/target-i386/helper.c
 +++ b/target-i386/helper.c
 @@ -746,7 +746,7 @@ void cpu_dump_state(CPUState *env, FILE *f,
  static const char *seg_name[6] = { ES, CS, SS, DS, FS, GS };
  
  if (kvm_enabled())
 -kvm_arch_get_registers(env);
 +kvm_cpu_synchronize_state(env);
  
  eflags = env-eflags;
  #ifdef TARGET_X86_64
 --
   Gleb.

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] call kvm_cpu_synchronize_state() on target vcpu

2009-09-09 Thread Gleb Natapov
On Wed, Sep 09, 2009 at 05:47:13PM +0200, Jan Kiszka wrote:
 Gleb Natapov wrote:
  regs_modified logic doesn't work if io thread calls
  kvm_cpu_synchronize_state() since kvm_arch_get_registers()
  returns only after vcpu thread is back to kernel. Setting
  regs_modified to 1 at this stage causes loading of wrong vcpu
  state on the next vcpu_run().
 
 We need this upstream too, right? Could you file the corresponding patch?
 
Upstream is single threaded. It shouldn't suffer from this bug.

 Thanks,
 Jan
 
  
  Signed-off-by: Gleb Natapov g...@redhat.com
  diff --git a/qemu-kvm.c b/qemu-kvm.c
  index 06efd41..9ab0cec 100644
  --- a/qemu-kvm.c
  +++ b/qemu-kvm.c
  @@ -874,14 +874,6 @@ int kvm_set_mpstate(kvm_vcpu_context_t vcpu, struct 
  kvm_mp_state *mp_state)
   }
   #endif
   
  -void kvm_cpu_synchronize_state(CPUState *env)
  -{
  -if (!env-kvm_cpu_state.regs_modified) {
  -kvm_arch_get_registers(env);
  -env-kvm_cpu_state.regs_modified = 1;
  -}
  -}
  -
   static int handle_mmio(kvm_vcpu_context_t vcpu)
   {
   unsigned long addr = vcpu-run-mmio.phys_addr;
  @@ -1539,6 +1531,22 @@ static void on_vcpu(CPUState *env, void (*func)(void 
  *data), void *data)
   qemu_cond_wait(qemu_work_cond);
   }
   
  +static void do_kvm_cpu_synchronize_state(void *_env)
  +{
  +CPUState *env = _env;
  +if (!env-kvm_cpu_state.regs_modified) {
  +kvm_arch_save_regs(env);
  +kvm_arch_load_mpstate(env);
  +env-kvm_cpu_state.regs_modified = 1;
  +}
  +}
  +
  +void kvm_cpu_synchronize_state(CPUState *env)
  +{
  +if (!env-kvm_cpu_state.regs_modified)
  +on_vcpu(env, do_kvm_cpu_synchronize_state, env);
  +}
  +
   static void inject_interrupt(void *data)
   {
   cpu_interrupt(current_env, (long) data);
  diff --git a/qemu-kvm.h b/qemu-kvm.h
  index 2c1730b..32f74b3 100644
  --- a/qemu-kvm.h
  +++ b/qemu-kvm.h
  @@ -1153,12 +1153,6 @@ static inline int kvm_sync_vcpus(void)
   return 0;
   }
   
  -static inline void kvm_arch_get_registers(CPUState *env)
  -{
  -kvm_save_registers(env);
  -kvm_save_mpstate(env);
  -}
  -
   static inline void kvm_arch_put_registers(CPUState *env)
   {
   kvm_load_registers(env);
  diff --git a/target-i386/helper.c b/target-i386/helper.c
  index 4a16887..57c74a2 100644
  --- a/target-i386/helper.c
  +++ b/target-i386/helper.c
  @@ -746,7 +746,7 @@ void cpu_dump_state(CPUState *env, FILE *f,
   static const char *seg_name[6] = { ES, CS, SS, DS, FS, GS 
  };
   
   if (kvm_enabled())
  -kvm_arch_get_registers(env);
  +kvm_cpu_synchronize_state(env);
   
   eflags = env-eflags;
   #ifdef TARGET_X86_64
  --
  Gleb.
 
 -- 
 Siemens AG, Corporate Technology, CT SE 2
 Corporate Competence Center Embedded Linux

--
Gleb.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] call kvm_cpu_synchronize_state() on target vcpu

2009-09-09 Thread Jan Kiszka
Gleb Natapov wrote:
 On Wed, Sep 09, 2009 at 05:47:13PM +0200, Jan Kiszka wrote:
 Gleb Natapov wrote:
 regs_modified logic doesn't work if io thread calls
 kvm_cpu_synchronize_state() since kvm_arch_get_registers()
 returns only after vcpu thread is back to kernel. Setting
 regs_modified to 1 at this stage causes loading of wrong vcpu
 state on the next vcpu_run().
 We need this upstream too, right? Could you file the corresponding patch?

 Upstream is single threaded. It shouldn't suffer from this bug.

Not if you enable iothread support (though I don't remember if that
works now for kvm) + you are also touching shared code here. So qemu-kvm
would benefit from keeping the diff small.

Jan

 
 Thanks,
 Jan

 Signed-off-by: Gleb Natapov g...@redhat.com
 diff --git a/qemu-kvm.c b/qemu-kvm.c
 index 06efd41..9ab0cec 100644
 --- a/qemu-kvm.c
 +++ b/qemu-kvm.c
 @@ -874,14 +874,6 @@ int kvm_set_mpstate(kvm_vcpu_context_t vcpu, struct 
 kvm_mp_state *mp_state)
  }
  #endif
  
 -void kvm_cpu_synchronize_state(CPUState *env)
 -{
 -if (!env-kvm_cpu_state.regs_modified) {
 -kvm_arch_get_registers(env);
 -env-kvm_cpu_state.regs_modified = 1;
 -}
 -}
 -
  static int handle_mmio(kvm_vcpu_context_t vcpu)
  {
  unsigned long addr = vcpu-run-mmio.phys_addr;
 @@ -1539,6 +1531,22 @@ static void on_vcpu(CPUState *env, void (*func)(void 
 *data), void *data)
  qemu_cond_wait(qemu_work_cond);
  }
  
 +static void do_kvm_cpu_synchronize_state(void *_env)
 +{
 +CPUState *env = _env;
 +if (!env-kvm_cpu_state.regs_modified) {
 +kvm_arch_save_regs(env);
 +kvm_arch_load_mpstate(env);
 +env-kvm_cpu_state.regs_modified = 1;
 +}
 +}
 +
 +void kvm_cpu_synchronize_state(CPUState *env)
 +{
 +if (!env-kvm_cpu_state.regs_modified)
 +on_vcpu(env, do_kvm_cpu_synchronize_state, env);
 +}
 +
  static void inject_interrupt(void *data)
  {
  cpu_interrupt(current_env, (long) data);
 diff --git a/qemu-kvm.h b/qemu-kvm.h
 index 2c1730b..32f74b3 100644
 --- a/qemu-kvm.h
 +++ b/qemu-kvm.h
 @@ -1153,12 +1153,6 @@ static inline int kvm_sync_vcpus(void)
  return 0;
  }
  
 -static inline void kvm_arch_get_registers(CPUState *env)
 -{
 -kvm_save_registers(env);
 -kvm_save_mpstate(env);
 -}
 -
  static inline void kvm_arch_put_registers(CPUState *env)
  {
  kvm_load_registers(env);
 diff --git a/target-i386/helper.c b/target-i386/helper.c
 index 4a16887..57c74a2 100644
 --- a/target-i386/helper.c
 +++ b/target-i386/helper.c
 @@ -746,7 +746,7 @@ void cpu_dump_state(CPUState *env, FILE *f,
  static const char *seg_name[6] = { ES, CS, SS, DS, FS, GS 
 };
  
  if (kvm_enabled())
 -kvm_arch_get_registers(env);
 +kvm_cpu_synchronize_state(env);
  
  eflags = env-eflags;
  #ifdef TARGET_X86_64
 --
 Gleb.
 -- 
 Siemens AG, Corporate Technology, CT SE 2
 Corporate Competence Center Embedded Linux
 
 --
   Gleb.

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] call kvm_cpu_synchronize_state() on target vcpu

2009-09-09 Thread Gleb Natapov
regs_modified logic doesn't work if io thread calls
kvm_cpu_synchronize_state() since kvm_arch_get_registers()
returns only after vcpu thread is back to kernel. Setting
regs_modified to 1 at this stage causes loading of wrong vcpu
state on the next vcpu_run().

--
v1-v2:
  do not remove kvm_arch_get_registers(). Change it and use it.
 
Signed-off-by: Gleb Natapov g...@redhat.com
diff --git a/qemu-kvm.c b/qemu-kvm.c
index 06efd41..e2f3b91 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -874,14 +874,6 @@ int kvm_set_mpstate(kvm_vcpu_context_t vcpu, struct 
kvm_mp_state *mp_state)
 }
 #endif
 
-void kvm_cpu_synchronize_state(CPUState *env)
-{
-if (!env-kvm_cpu_state.regs_modified) {
-kvm_arch_get_registers(env);
-env-kvm_cpu_state.regs_modified = 1;
-}
-}
-
 static int handle_mmio(kvm_vcpu_context_t vcpu)
 {
 unsigned long addr = vcpu-run-mmio.phys_addr;
@@ -1539,6 +1531,21 @@ static void on_vcpu(CPUState *env, void (*func)(void 
*data), void *data)
 qemu_cond_wait(qemu_work_cond);
 }
 
+static void do_kvm_cpu_synchronize_state(void *_env)
+{
+CPUState *env = _env;
+if (!env-kvm_cpu_state.regs_modified) {
+kvm_arch_get_registers(env);
+env-kvm_cpu_state.regs_modified = 1;
+}
+}
+
+void kvm_cpu_synchronize_state(CPUState *env)
+{
+if (!env-kvm_cpu_state.regs_modified)
+on_vcpu(env, do_kvm_cpu_synchronize_state, env);
+}
+
 static void inject_interrupt(void *data)
 {
 cpu_interrupt(current_env, (long) data);
diff --git a/qemu-kvm.h b/qemu-kvm.h
index 2c1730b..1c42e82 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -1155,8 +1155,8 @@ static inline int kvm_sync_vcpus(void)
 
 static inline void kvm_arch_get_registers(CPUState *env)
 {
-kvm_save_registers(env);
-kvm_save_mpstate(env);
+kvm_arch_save_regs(env);
+kvm_arch_save_mpstate(env);
 }
 
 static inline void kvm_arch_put_registers(CPUState *env)
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 4a16887..57c74a2 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -746,7 +746,7 @@ void cpu_dump_state(CPUState *env, FILE *f,
 static const char *seg_name[6] = { ES, CS, SS, DS, FS, GS };
 
 if (kvm_enabled())
-kvm_arch_get_registers(env);
+kvm_cpu_synchronize_state(env);
 
 eflags = env-eflags;
 #ifdef TARGET_X86_64
--
Gleb.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] call kvm_cpu_synchronize_state() on target vcpu

2009-09-09 Thread Gleb Natapov
On Wed, Sep 09, 2009 at 05:57:40PM +0200, Jan Kiszka wrote:
 Gleb Natapov wrote:
  On Wed, Sep 09, 2009 at 05:47:13PM +0200, Jan Kiszka wrote:
  Gleb Natapov wrote:
  regs_modified logic doesn't work if io thread calls
  kvm_cpu_synchronize_state() since kvm_arch_get_registers()
  returns only after vcpu thread is back to kernel. Setting
  regs_modified to 1 at this stage causes loading of wrong vcpu
  state on the next vcpu_run().
  We need this upstream too, right? Could you file the corresponding patch?
 
  Upstream is single threaded. It shouldn't suffer from this bug.
 
 Not if you enable iothread support (though I don't remember if that
It can't work with kvm since all vcpu ioctls are called on the thread
that issues them.

 works now for kvm) + you are also touching shared code here. So qemu-kvm
 would benefit from keeping the diff small.
 
The patch doesn't touch shared code. (it is almost impossible to tell
what code is shared and what's not nowadays)

 Jan
 
  
  Thanks,
  Jan
 
  Signed-off-by: Gleb Natapov g...@redhat.com
  diff --git a/qemu-kvm.c b/qemu-kvm.c
  index 06efd41..9ab0cec 100644
  --- a/qemu-kvm.c
  +++ b/qemu-kvm.c
  @@ -874,14 +874,6 @@ int kvm_set_mpstate(kvm_vcpu_context_t vcpu, struct 
  kvm_mp_state *mp_state)
   }
   #endif
   
  -void kvm_cpu_synchronize_state(CPUState *env)
  -{
  -if (!env-kvm_cpu_state.regs_modified) {
  -kvm_arch_get_registers(env);
  -env-kvm_cpu_state.regs_modified = 1;
  -}
  -}
  -
   static int handle_mmio(kvm_vcpu_context_t vcpu)
   {
   unsigned long addr = vcpu-run-mmio.phys_addr;
  @@ -1539,6 +1531,22 @@ static void on_vcpu(CPUState *env, void 
  (*func)(void *data), void *data)
   qemu_cond_wait(qemu_work_cond);
   }
   
  +static void do_kvm_cpu_synchronize_state(void *_env)
  +{
  +CPUState *env = _env;
  +if (!env-kvm_cpu_state.regs_modified) {
  +kvm_arch_save_regs(env);
  +kvm_arch_load_mpstate(env);
  +env-kvm_cpu_state.regs_modified = 1;
  +}
  +}
  +
  +void kvm_cpu_synchronize_state(CPUState *env)
  +{
  +if (!env-kvm_cpu_state.regs_modified)
  +on_vcpu(env, do_kvm_cpu_synchronize_state, env);
  +}
  +
   static void inject_interrupt(void *data)
   {
   cpu_interrupt(current_env, (long) data);
  diff --git a/qemu-kvm.h b/qemu-kvm.h
  index 2c1730b..32f74b3 100644
  --- a/qemu-kvm.h
  +++ b/qemu-kvm.h
  @@ -1153,12 +1153,6 @@ static inline int kvm_sync_vcpus(void)
   return 0;
   }
   
  -static inline void kvm_arch_get_registers(CPUState *env)
  -{
  -kvm_save_registers(env);
  -kvm_save_mpstate(env);
  -}
  -
   static inline void kvm_arch_put_registers(CPUState *env)
   {
   kvm_load_registers(env);
  diff --git a/target-i386/helper.c b/target-i386/helper.c
  index 4a16887..57c74a2 100644
  --- a/target-i386/helper.c
  +++ b/target-i386/helper.c
  @@ -746,7 +746,7 @@ void cpu_dump_state(CPUState *env, FILE *f,
   static const char *seg_name[6] = { ES, CS, SS, DS, FS, 
  GS };
   
   if (kvm_enabled())
  -kvm_arch_get_registers(env);
  +kvm_cpu_synchronize_state(env);
   
   eflags = env-eflags;
   #ifdef TARGET_X86_64
  --
Gleb.
  -- 
  Siemens AG, Corporate Technology, CT SE 2
  Corporate Competence Center Embedded Linux
  
  --
  Gleb.
 
 -- 
 Siemens AG, Corporate Technology, CT SE 2
 Corporate Competence Center Embedded Linux

--
Gleb.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] call kvm_cpu_synchronize_state() on target vcpu

2009-09-09 Thread Avi Kivity

On 09/09/2009 07:01 PM, Gleb Natapov wrote:

regs_modified logic doesn't work if io thread calls
kvm_cpu_synchronize_state() since kvm_arch_get_registers()
returns only after vcpu thread is back to kernel. Setting
regs_modified to 1 at this stage causes loading of wrong vcpu
state on the next vcpu_run().
   


Applied, thanks.

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] call kvm_cpu_synchronize_state() on target vcpu

2009-09-09 Thread Jan Kiszka
Gleb Natapov wrote:
 On Wed, Sep 09, 2009 at 05:57:40PM +0200, Jan Kiszka wrote:
 Gleb Natapov wrote:
 On Wed, Sep 09, 2009 at 05:47:13PM +0200, Jan Kiszka wrote:
 Gleb Natapov wrote:
 regs_modified logic doesn't work if io thread calls
 kvm_cpu_synchronize_state() since kvm_arch_get_registers()
 returns only after vcpu thread is back to kernel. Setting
 regs_modified to 1 at this stage causes loading of wrong vcpu
 state on the next vcpu_run().
 We need this upstream too, right? Could you file the corresponding patch?

 Upstream is single threaded. It shouldn't suffer from this bug.
 Not if you enable iothread support (though I don't remember if that
 It can't work with kvm since all vcpu ioctls are called on the thread
 that issues them.

Yeah, I just recalled all that on_vcpu fuzz and that upstream is still
horribly broken /wrt iothread+kvm. But once that is fixed, we also need
this fix here.

 
 works now for kvm) + you are also touching shared code here. So qemu-kvm
 would benefit from keeping the diff small.

 The patch doesn't touch shared code. (it is almost impossible to tell
 what code is shared and what's not nowadays)

cpu_dump_state() is definitely shared.

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] call kvm_cpu_synchronize_state() on target vcpu

2009-09-09 Thread Gleb Natapov
On Wed, Sep 09, 2009 at 06:21:48PM +0200, Jan Kiszka wrote:
 Gleb Natapov wrote:
  On Wed, Sep 09, 2009 at 05:57:40PM +0200, Jan Kiszka wrote:
  Gleb Natapov wrote:
  On Wed, Sep 09, 2009 at 05:47:13PM +0200, Jan Kiszka wrote:
  Gleb Natapov wrote:
  regs_modified logic doesn't work if io thread calls
  kvm_cpu_synchronize_state() since kvm_arch_get_registers()
  returns only after vcpu thread is back to kernel. Setting
  regs_modified to 1 at this stage causes loading of wrong vcpu
  state on the next vcpu_run().
  We need this upstream too, right? Could you file the corresponding patch?
 
  Upstream is single threaded. It shouldn't suffer from this bug.
  Not if you enable iothread support (though I don't remember if that
  It can't work with kvm since all vcpu ioctls are called on the thread
  that issues them.
 
 Yeah, I just recalled all that on_vcpu fuzz and that upstream is still
 horribly broken /wrt iothread+kvm. But once that is fixed, we also need
 this fix here.
 
This will be done as part of transition to on_vcpu() for vcpu ioctls.

  
  works now for kvm) + you are also touching shared code here. So qemu-kvm
  would benefit from keeping the diff small.
 
  The patch doesn't touch shared code. (it is almost impossible to tell
  what code is shared and what's not nowadays)
 
 cpu_dump_state() is definitely shared.
 
Ah this one line. Yes it is. But I have not good commit message for this
one liner change for upstream :)

--
Gleb.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] call kvm_cpu_synchronize_state() on target vcpu

2009-09-09 Thread Jan Kiszka
Gleb Natapov wrote:
 On Wed, Sep 09, 2009 at 06:21:48PM +0200, Jan Kiszka wrote:
 Gleb Natapov wrote:
 On Wed, Sep 09, 2009 at 05:57:40PM +0200, Jan Kiszka wrote:
 Gleb Natapov wrote:
 On Wed, Sep 09, 2009 at 05:47:13PM +0200, Jan Kiszka wrote:
 Gleb Natapov wrote:
 regs_modified logic doesn't work if io thread calls
 kvm_cpu_synchronize_state() since kvm_arch_get_registers()
 returns only after vcpu thread is back to kernel. Setting
 regs_modified to 1 at this stage causes loading of wrong vcpu
 state on the next vcpu_run().
 We need this upstream too, right? Could you file the corresponding patch?

 Upstream is single threaded. It shouldn't suffer from this bug.
 Not if you enable iothread support (though I don't remember if that
 It can't work with kvm since all vcpu ioctls are called on the thread
 that issues them.
 Yeah, I just recalled all that on_vcpu fuzz and that upstream is still
 horribly broken /wrt iothread+kvm. But once that is fixed, we also need
 this fix here.

 This will be done as part of transition to on_vcpu() for vcpu ioctls.
 
 works now for kvm) + you are also touching shared code here. So qemu-kvm
 would benefit from keeping the diff small.

 The patch doesn't touch shared code. (it is almost impossible to tell
 what code is shared and what's not nowadays)
 cpu_dump_state() is definitely shared.

 Ah this one line. Yes it is. But I have not good commit message for this
 one liner change for upstream :)

That's why I suggested to post the corresponding change also for
upstream. Even if it doesn't need it now, it will one day. :)

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] sync halt state into env

2009-09-09 Thread Gleb Natapov
Was dropped somewhere during merge. Without this info cpus doesn't show
cpu halted state.

Signed-off-by: Gleb Natapov g...@redhat.com
diff --git a/qemu-kvm.h b/qemu-kvm.h
index 1c42e82..4be6afd 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -1157,6 +1157,7 @@ static inline void kvm_arch_get_registers(CPUState *env)
 {
 kvm_arch_save_regs(env);
 kvm_arch_save_mpstate(env);
+env-halted = (env-mp_state == KVM_MP_STATE_HALTED);
 }
 
 static inline void kvm_arch_put_registers(CPUState *env)
--
Gleb.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] sync halt state into env

2009-09-09 Thread Avi Kivity

On 09/09/2009 07:33 PM, Gleb Natapov wrote:

Was dropped somewhere during merge. Without this info cpus doesn't show
cpu halted state.
   


Applied, thanks.

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] call kvm_cpu_synchronize_state() on target vcpu

2009-09-09 Thread Gleb Natapov
On Wed, Sep 09, 2009 at 06:32:57PM +0200, Jan Kiszka wrote:
  The patch doesn't touch shared code. (it is almost impossible to tell
  what code is shared and what's not nowadays)
  cpu_dump_state() is definitely shared.
 
  Ah this one line. Yes it is. But I have not good commit message for this
  one liner change for upstream :)
 
 That's why I suggested to post the corresponding change also for
 upstream. Even if it doesn't need it now, it will one day. :)
 
I looked at the code. This changes doesn't make sense for upstream right
now IMHO. I do agree that this one linear should go into upstream. I'll
think about commit message tonight.

--
Gleb.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


buildbot failure in qemu-kvm on disable_kvm_x86_64_debian_5_0

2009-09-09 Thread qemu-kvm
The Buildbot has detected a new failure of disable_kvm_x86_64_debian_5_0 on 
qemu-kvm.
Full details are available at:
 
http://buildbot.b1-systems.de/qemu-kvm/builders/disable_kvm_x86_64_debian_5_0/builds/42

Buildbot URL: http://buildbot.b1-systems.de/qemu-kvm/

Buildslave for this Build: b1_qemu_kvm_1

Build Reason: 
Build Source Stamp: [branch next] HEAD
Blamelist: Gleb Natapov g...@redhat.com

BUILD FAILED: failed compile

sincerely,
 -The Buildbot

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


buildbot failure in qemu-kvm on disable_kvm_i386_debian_5_0

2009-09-09 Thread qemu-kvm
The Buildbot has detected a new failure of disable_kvm_i386_debian_5_0 on 
qemu-kvm.
Full details are available at:
 
http://buildbot.b1-systems.de/qemu-kvm/builders/disable_kvm_i386_debian_5_0/builds/44

Buildbot URL: http://buildbot.b1-systems.de/qemu-kvm/

Buildslave for this Build: b1_qemu_kvm_2

Build Reason: 
Build Source Stamp: [branch next] HEAD
Blamelist: Gleb Natapov g...@redhat.com

BUILD FAILED: failed compile

sincerely,
 -The Buildbot

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


New kvm.git branch for linux-next

2009-09-09 Thread Avi Kivity
Stephen, please pick up the 'linux-next' branch of kvm.git instead 
'master' as you do now.  This will better reflect what is actually going 
to -next, will cause fewer merge errors, and will improve -next 
bisectability.


(this is actually a symbolic ref to kvm-updates/2.6.32 which will be 
updated when kvm-updates/2.6.33 is created)


--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[ kvm-Bugs-2351676 ] Guests hang periodically on Ubuntu-8.10

2009-09-09 Thread SourceForge.net
Bugs item #2351676, was opened at 2008-11-26 17:59
Message generated for change (Comment added) made by jlokier
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=893831aid=2351676group_id=180599

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Chris Jones (c_jones)
Assigned to: Nobody/Anonymous (nobody)
Summary: Guests hang periodically on Ubuntu-8.10

Initial Comment:
I'm seeing periodic hangs on my guests.  I've been unable so far to find a 
trigger - they always boot fine, but after anywhere from 10 minutes to 24 hours 
they eventually hang completely.

My setup:
  * AMD Athlon X2 4850e (2500 MHz dual core)
  * 4Gig memory
  * Ubuntu 8.10 server, 64-bit
  * KVMs tried:
: kvm-72 (shipped with ubuntu)
: kvm-79 (built myself, --patched-kernel option)
  * Kernels tried:
: 2.6.27.7 (kernel.org, self built)
: 2.6.27-7-server from Ubuntu 8.10 distribution

  In guests
  * Ubuntu 8.10 server, 64-bit (virtual machine install)
  * kernel 2.6.27-7-server from Ubuntu 8.10

I'm running the guests like:
  sudo /usr/local/bin/qemu-system-x86_64\
 -daemonize \
 -no-kvm-irqchip\
 -hda Imgs/ndev_root.img\
 -m 1024\
 -cdrom ISOs/ubuntu-8.10-server-amd64.iso   \
 -vnc :4\
 -net nic,macaddr=DE:AD:BE:EF:04:04,model=e1000 \
 -net tap,ifname=tap4,script=/home/chris/kvm/qemu-ifup.sh 

The problem does not happen if I use -no-kvm.

I've tried some other options that have no effect:
  -no-kvm-pit
  -no-acpi

The disk images are raw format.

When the guests hang, I cannot ping them, and the vnc console us hung.  The 
qemu monitor is still accessible, and the guests recover if I issue a 
system_reset command from the monitor.  However, often, the console will not 
take keyboard after doing so.

When the guest is hung, kvm_stat shows all 0s for the counters:

efer_relo  exits  fpu_reloa  halt_exit  halt_wake  host_stat  hypercall
+insn_emul  insn_emul invlpg   io_exits  irq_exits  irq_windo  largepage
+mmio_exit  mmu_cache  mmu_flood  mmu_pde_z  mmu_pte_u  mmu_pte_w  mmu_recyc
+mmu_shado  nmi_windo   pf_fixed   pf_guest  remote_tl  request_i  signal_ex
+tlb_flush
  0  0  0  0  0  0  0
+0  0  0  0  0  0  0  0
+0  0  0  0  0  0  0  0
+0  0  0  0  0  0

gdb shows two threads - both waiting:

c(gdb) info threads
  2 Thread 0x414f1950 (LWP 422)  0x7f36f07a03e1 in sigtimedwait ()
   from /lib/libc.so.6
  1 Thread 0x7f36f1f306e0 (LWP 414)  0x7f36f084b482 in select ()
   from /lib/libc.so.6
(gdb) thread 1
[Switching to thread 1 (Thread 0x7f36f1f306e0 (LWP 414))]#0  0x7f36f084b482
+in select () from /lib/libc.so.6
(gdb) bt
#0  0x7f36f084b482 in select () from /lib/libc.so.6
#1  0x004094cb in main_loop_wait (timeout=0)
at /home/chris/pkgs/kvm/kvm-79/qemu/vl.c:4719
#2  0x0050a7ea in kvm_main_loop ()
at /home/chris/pkgs/kvm/kvm-79/qemu/qemu-kvm.c:619
#3  0x0040fafc in main (argc=value optimized out,
argv=0x79f41948) at /home/chris/pkgs/kvm/kvm-79/qemu/vl.c:4871
(gdb) thread 2
[Switching to thread 2 (Thread 0x414f1950 (LWP 422))]#0  0x7f36f07a03e1 in
+sigtimedwait () from /lib/libc.so.6
(gdb) bt
#0  0x7f36f07a03e1 in sigtimedwait () from /lib/libc.so.6
#1  0x0050a560 in kvm_main_loop_wait (env=0xc319e0, timeout=0)
at /home/chris/pkgs/kvm/kvm-79/qemu/qemu-kvm.c:284
#2  0x0050aaf7 in ap_main_loop (_env=value optimized out)
at /home/chris/pkgs/kvm/kvm-79/qemu/qemu-kvm.c:425
#3  0x7f36f11ba3ea in start_thread () from /lib/libpthread.so.0
#4  0x7f36f0852c6d in clone () from /lib/libc.so.6
#5  0x in ?? ()


Any clues to help me resolve this would be much appreciated.


--

Comment By: Jamie Lokier (jlokier)
Date: 2009-09-09 19:07

Message:
Following up from my last comments: It turns out theI/O errors were due to
mundane permissions issues.  Qemu doesn't report attempts to write to a
read-only disk image to the guest as that, and I'd accidentally rendered an
image file read-only at the same time as starting to use the external
kvm-88 kernel modules.  Just by recreating it as root.

IDE (ata in the guest) gave I/O errors with obscure messages in the guest.
 SCSI and virtio-blk fared worse: I don't have any explanation of why both
of them resulted in a guest process seemingly perpetually stuck in
sync_page (the same one, 

[PATCH 02/19] KVM test: Migration test cleanup

2009-09-09 Thread Michael Goldish
This should hopefully make the test code a little more readable.

The test is now also more similar to other tests in that it uses a single
'main_vm', which gets cloned, instead of a source and a destination VM.
(This will allow to easily run multiple migration iterations.)

Signed-off-by: Michael Goldish mgold...@redhat.com
---
 client/tests/kvm/kvm_tests.cfg.sample |   11 +
 client/tests/kvm/kvm_tests.py |   86 ++--
 2 files changed, 28 insertions(+), 69 deletions(-)

diff --git a/client/tests/kvm/kvm_tests.cfg.sample 
b/client/tests/kvm/kvm_tests.cfg.sample
index fdf2963..73e929f 100644
--- a/client/tests/kvm/kvm_tests.cfg.sample
+++ b/client/tests/kvm/kvm_tests.cfg.sample
@@ -63,18 +63,9 @@ variants:
 
 - migrate:  install setup
 type = migration
-vms +=  dst
 migration_test_command = help
 kill_vm_on_error = yes
-variants:
-- 1:
-start_vm_for_migration_dst = yes
-migration_src = vm1
-migration_dst = dst
-- 2: 1
-start_vm_for_migration_vm1 = yes
-migration_src = dst
-migration_dst = vm1
+iterations = 2
 
 - autotest: install setup
 type = autotest
diff --git a/client/tests/kvm/kvm_tests.py b/client/tests/kvm/kvm_tests.py
index 4e3391e..1ee7775 100644
--- a/client/tests/kvm/kvm_tests.py
+++ b/client/tests/kvm/kvm_tests.py
@@ -99,45 +99,33 @@ def run_shutdown(test, params, env):
 def run_migration(test, params, env):
 
 KVM migration test:
-
-1) Get two live VMs. One will be the 'source', the other will be the
-'destination'.
-2) Verify if the source VM supports migration. If it does, proceed with
-the test
-3) Send a migration command to the source vm and wait until it's finished.
-4) Kill off the source vm
-3) Log into the destination vm after the migration is finished.
+1) Get a live VM and clone it.
+2) Verify that the source VM supports migration.  If it does, proceed with
+the test.
+3) Send a migration command to the source VM and wait until it's finished.
+4) Kill off the source VM.
+3) Log into the destination VM after the migration is finished.
 4) Compare the output of a reference command executed on the source with
-the output of the same command on the destination machine
+the output of the same command on the destination machine.
 
 @param test: kvm test object.
 @param params: Dictionary with test parameters.
 @param env: Dictionary with the test environment.
 
-src_vm_name = params.get(migration_src)
-vm = kvm_utils.env_get_vm(env, src_vm_name)
+vm = kvm_utils.env_get_vm(env, params.get(main_vm))
 if not vm:
-raise error.TestError(VM '%s' not found in environment % src_vm_name)
+raise error.TestError(VM object not found in environment)
 if not vm.is_alive():
-raise error.TestError(VM '%s' seems to be dead; Test requires a
-   living VM % src_vm_name)
-
-dest_vm_name = params.get(migration_dst)
-dest_vm = kvm_utils.env_get_vm(env, dest_vm_name)
-if not dest_vm:
-raise error.TestError(VM '%s' not found in environment % 
dest_vm_name)
-if not dest_vm.is_alive():
-raise error.TestError(VM '%s' seems to be dead; Test requires a
-   living VM % dest_vm_name)
-
-pre_scrdump_filename = os.path.join(test.debugdir, migration_pre.ppm)
-post_scrdump_filename = os.path.join(test.debugdir, migration_post.ppm)
+raise error.TestError(VM seems to be dead; Test requires a living VM)
 
 # See if migration is supported
 s, o = vm.send_monitor_cmd(help info)
 if not info migrate in o:
 raise error.TestError(Migration is not supported)
 
+dest_vm = vm.clone()
+dest_vm.create(for_migration=True)
+
 # Log into guest and get the output of migration_test_command
 logging.info(Waiting for guest to be up...)
 
@@ -165,54 +153,32 @@ def run_migration(test, params, env):
 # Define some helper functions
 def mig_finished():
 s, o = vm.send_monitor_cmd(info migrate)
-if s:
-return False
-if Migration status: active in o:
-return False
-return True
+return s == 0 and not Migration status: active in o
 
 def mig_succeeded():
 s, o = vm.send_monitor_cmd(info migrate)
-if s == 0 and Migration status: completed in o:
-return True
-return False
+return s == 0 and Migration status: completed in o
 
 def mig_failed():
 s, o = vm.send_monitor_cmd(info migrate)
-if s == 0 and Migration status: failed in o:
-return True
-return False
+return s == 0 and Migration status: failed in o
 
 # Wait for migration to finish
 if not 

[PATCH 03/19] KVM test: scan_results.py: allow parsing and printing of multiple result files

2009-09-09 Thread Michael Goldish
This is useful for printing results of several jobs executing in parallel
(using job.parallel()).

Signed-off-by: Michael Goldish mgold...@redhat.com
---
 client/tests/kvm/scan_results.py |   42 +++--
 1 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/client/tests/kvm/scan_results.py b/client/tests/kvm/scan_results.py
index 95507bd..a22634e 100755
--- a/client/tests/kvm/scan_results.py
+++ b/client/tests/kvm/scan_results.py
@@ -51,28 +51,30 @@ def print_result(result):
 print '%-48s\t\t%s\t%s\t%s' % tuple(map(str, result))
 
 
-def main(resfile):
-print_result(('test', 'status', 'seconds', 'info'))
+def main(resfiles):
+print_result(('Test', 'Status', 'Seconds', 'Info'))
 print_result(('', '--', '---', ''))
 
-f = file(resfile)
-text = f.read()
-f.close()
-
-results = parse_results(text)
-map(print_result, results)
+for resfile in resfiles:
+print '(Result file: %s)' % resfile
+try:
+f = file(resfile)
+text = f.read()
+f.close()
+except IOError:
+print 'Bad result file: %s' % resfile
+return
+results = parse_results(text)
+map(print_result, results)
 
 
 if __name__ == '__main__':
-import sys, os
-
-resfile = '../../results/default/status'
-if len(sys.argv) == 2:
-resfile = sys.argv[1]
-if resfile == '-h' or resfile == '--help' or len(sys.argv)  2:
-print 'usage: %s [ resfile ]' % sys.argv[0]
-sys.exit(0)
-if not os.path.exists(resfile):
-print 'Bad result file: %s' % resfile
-sys.exit(1)
-main(resfile)
+import sys, os, glob
+
+resfiles = glob.glob('../../results/default/status*')
+if len(sys.argv)  1:
+if sys.argv[1] == '-h' or sys.argv[1] == '--help':
+print 'Usage: %s [result files]' % sys.argv[0]
+sys.exit(0)
+resfiles = sys.argv[1:]
+main(resfiles)
-- 
1.5.4.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/19] KVM test: kvm_utils.py: make verify_ip_address_ownership() more robust

2009-09-09 Thread Michael Goldish
Use arping in addition to querying the arp cache.
Under certain circumstances a TCP connection may not trigger an ARP request so
it must be triggered explicitly using arping.

Signed-off-by: Michael Goldish mgold...@redhat.com
---
 client/tests/kvm/kvm_utils.py |   40 ++--
 1 files changed, 18 insertions(+), 22 deletions(-)

diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py
index dfca938..f046810 100644
--- a/client/tests/kvm/kvm_utils.py
+++ b/client/tests/kvm/kvm_utils.py
@@ -152,39 +152,35 @@ def get_mac_ip_pair_from_dict(dict):
 return (None, None)
 
 
-def verify_ip_address_ownership(ip, macs, timeout=3.0):
+def verify_ip_address_ownership(ip, macs, timeout=10.0):
 
-Connect to a given IP address and make sure its MAC address equals one of
-the given MAC address.
+Use arping and the ARP cache to make sure a given IP address belongs to one
+of the given MAC addresses.
 
 @param ip: An IP address.
 @param macs: A list or tuple of MAC addresses.
 @return: True iff ip is assigned to a MAC address in macs.
 
-def check_arp_cache(regex):
-o = commands.getoutput(/sbin/arp -n)
-return bool(re.search(regex, o, re.IGNORECASE))
-
+# Compile a regex that matches the given IP address and any of the given
+# MAC addresses
 mac_regex = |.join((%s) % mac for mac in macs)
 regex = re.compile(r\b%s\b.*\b(%s)\b % (ip, mac_regex))
 
-if check_arp_cache(regex):
+# Check the ARP cache
+o = commands.getoutput(/sbin/arp -n)
+if re.search(regex, o, re.IGNORECASE):
 return True
 
-s = socket.socket()
-s.setblocking(False)
-try:
-s.connect((ip, 5))
-except socket.error:
-pass
-end_time = time.time() + timeout
-while time.time()  end_time:
-time.sleep(0.2)
-if check_arp_cache(regex):
-s.close()
-return True
-s.close()
-return False
+# Get the name of the bridge device for arping
+o = commands.getoutput(/sbin/ip route get %s % ip)
+dev = re.findall(dev\s+\S+, o, re.IGNORECASE)
+if not dev:
+return False
+dev = dev[0].split()[-1]
+
+# Send an ARP request
+o = commands.getoutput(/sbin/arping -f -c 3 -I %s %s % (dev, ip))
+return bool(re.search(regex, o, re.IGNORECASE))
 
 
 # Functions for working with the environment (a dict-like object)
-- 
1.5.4.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/19] KVM test: kvm_subprocess: use kill_process_tree() to close child processes

2009-09-09 Thread Michael Goldish
This is safer than just killing the session leader because some processes seem
to remain alive after their session leader has exited.

Signed-off-by: Michael Goldish mgold...@redhat.com
---
 client/tests/kvm/kvm_subprocess.py |7 ++-
 client/tests/kvm/kvm_vm.py |2 +-
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/client/tests/kvm/kvm_subprocess.py 
b/client/tests/kvm/kvm_subprocess.py
index 07303a8..ba61a8c 100755
--- a/client/tests/kvm/kvm_subprocess.py
+++ b/client/tests/kvm/kvm_subprocess.py
@@ -367,7 +367,7 @@ class kvm_spawn:
 return _locked(self.lock_server_running_filename)
 
 
-def close(self, sig=signal.SIGTERM):
+def close(self, sig=signal.SIGKILL):
 
 Kill the child process if it's alive and remove temporary files.
 
@@ -375,10 +375,7 @@ class kvm_spawn:
 
 # Kill it if it's alive
 if self.is_alive():
-try:
-os.kill(self.get_shell_pid(), sig)
-except:
-pass
+kvm_utils.kill_process_tree(self.get_shell_pid(), sig)
 # Wait for the server to exit
 _wait(self.lock_server_running_filename)
 # Call all cleanup routines
diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
index bd7e0fc..79ca81d 100755
--- a/client/tests/kvm/kvm_vm.py
+++ b/client/tests/kvm/kvm_vm.py
@@ -541,7 +541,7 @@ class VM:
 # If the VM isn't dead yet...
 logging.debug(Cannot quit normally; sending a kill to close the 
   deal...)
-kvm_utils.safe_kill(self.process.get_pid(), 9)
+kvm_utils.kill_process_tree(self.process.get_pid(), 9)
 # Wait for the VM to be really dead
 if kvm_utils.wait_for(self.is_dead, 5, 0.5, 0.5):
 logging.debug(VM is down)
-- 
1.5.4.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/19] KVM test: kvm_utils.py: add kill_process_tree()

2009-09-09 Thread Michael Goldish
Signed-off-by: Michael Goldish mgold...@redhat.com
---
 client/tests/kvm/kvm_utils.py |   17 +
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py
index f046810..f686a53 100644
--- a/client/tests/kvm/kvm_utils.py
+++ b/client/tests/kvm/kvm_utils.py
@@ -265,6 +265,23 @@ def safe_kill(pid, signal):
 return False
 
 
+def kill_process_tree(pid, sig=signal.SIGKILL):
+Signal a process and all of its children.
+
+If the process does not exist -- return.
+
+@param pid: The pid of the process to signal.
+@param sig: The signal to send to the processes.
+
+if not safe_kill(pid, signal.SIGSTOP):
+return
+children = commands.getoutput(ps --ppid=%d -o pid= % pid).split()
+for child in children:
+kill_process_tree(int(child), sig)
+safe_kill(pid, sig)
+safe_kill(pid, signal.SIGCONT)
+
+
 def get_latest_kvm_release_tag(release_dir):
 
 Fetches the latest release tag for KVM.
-- 
1.5.4.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/19] KVM test: kvm_subprocess: get rid of get_pid() (replace it with get_shell_pid())

2009-09-09 Thread Michael Goldish
Don't differentiate between the PID of the subprocess and the PID of the shell
running it.

Signed-off-by: Michael Goldish mgold...@redhat.com
---
 client/tests/kvm/kvm_subprocess.py |   38 +--
 client/tests/kvm/kvm_tests.py  |2 +-
 2 files changed, 7 insertions(+), 33 deletions(-)

diff --git a/client/tests/kvm/kvm_subprocess.py 
b/client/tests/kvm/kvm_subprocess.py
index ba61a8c..d142ed9 100755
--- a/client/tests/kvm/kvm_subprocess.py
+++ b/client/tests/kvm/kvm_subprocess.py
@@ -290,10 +290,12 @@ class kvm_spawn:
 return self.id
 
 
-def get_shell_pid(self):
+def get_pid(self):
 
-Return the PID of the subshell process, or None if not available.
-The subshell is the shell that runs the command.
+Return the PID of the process.
+
+Note: this may be the PID of the shell process running the user given
+command.
 
 try:
 file = open(self.shell_pid_filename, r)
@@ -304,34 +306,6 @@ class kvm_spawn:
 return None
 
 
-def get_pid(self, index=0):
-
-Try to get and return the PID of a child process of the subshell.
-This is usually the PID of the process executed in the subshell.
-There are 3 exceptions:
-- If the subshell couldn't start the process for some reason, no
-  PID can be returned.
-- If the subshell is running several processes in parallel,
-  multiple PIDs can be returned.  Use the index parameter in this
-  case.
-- Before starting the process, after the process has terminated,
-  or while running shell code that doesn't start any processes --
-  no PID can be returned.
-
-@param index: The index of the child process whose PID is requested.
-Normally this should remain 0.
-@return: The PID of the child process, or None if none could be found.
-
-parent_pid = self.get_shell_pid()
-if not parent_pid:
-return None
-pids = commands.getoutput(ps --ppid %d -o pid= % parent_pid).split()
-try:
-return int(pids[index])
-except:
-return None
-
-
 def get_status(self):
 
 Wait for the process to exit and return its exit status, or None
@@ -375,7 +349,7 @@ class kvm_spawn:
 
 # Kill it if it's alive
 if self.is_alive():
-kvm_utils.kill_process_tree(self.get_shell_pid(), sig)
+kvm_utils.kill_process_tree(self.get_pid(), sig)
 # Wait for the server to exit
 _wait(self.lock_server_running_filename)
 # Call all cleanup routines
diff --git a/client/tests/kvm/kvm_tests.py b/client/tests/kvm/kvm_tests.py
index deab59e..c2bfb8a 100644
--- a/client/tests/kvm/kvm_tests.py
+++ b/client/tests/kvm/kvm_tests.py
@@ -688,7 +688,7 @@ def run_timedrift(test, params, env):
   output_prefix=(host load %d)  % i,
   timeout=0.5))
 # Set the CPU affinity of the load process
-pid = host_load_sessions[-1].get_shell_pid()
+pid = host_load_sessions[-1].get_pid()
 set_cpu_affinity(pid, cpu_mask)
 
 # Sleep for a while (during load)
-- 
1.5.4.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/19] KVM test: kvm_config.py: remove unused function get_match_block_indices()

2009-09-09 Thread Michael Goldish
Signed-off-by: Michael Goldish mgold...@redhat.com
---
 client/tests/kvm/kvm_config.py |   27 ---
 1 files changed, 0 insertions(+), 27 deletions(-)

diff --git a/client/tests/kvm/kvm_config.py b/client/tests/kvm/kvm_config.py
index da7988b..405de4b 100755
--- a/client/tests/kvm/kvm_config.py
+++ b/client/tests/kvm/kvm_config.py
@@ -99,33 +99,6 @@ class config:
 return [dict for dict in list if self.match(filter, dict)]
 
 
-# Currently unused, will be removed if it remains unused
-def get_match_block_indices(self, filter, list=None):
-
-Get the indexes of a list that match a given filter.
-
-@param filter: A regular expression that will filter the list.
-@param list: List which we want to know the indexes that match a 
filter.
-
-if list is None:
-list = self.list
-block_list = []
-prev_match = False
-for index in range(len(list)):
-dict = list[index]
-if self.match(filter, dict):
-if not prev_match:
-block_list.append([index])
-prev_match = True
-else:
-if prev_match:
-block_list[-1].append(index)
-prev_match = False
-if prev_match:
-block_list[-1].append(len(list))
-return block_list
-
-
 def split_and_strip(self, str, sep==):
 
 Split str and strip quotes from the resulting parts.
-- 
1.5.4.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/19] KVM test: remove unused function is_sshd_running()

2009-09-09 Thread Michael Goldish
Signed-off-by: Michael Goldish mgold...@redhat.com
---
 client/tests/kvm/kvm_utils.py |   46 -
 client/tests/kvm/kvm_vm.py|   15 -
 2 files changed, 0 insertions(+), 61 deletions(-)

diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py
index f686a53..ac9ede7 100644
--- a/client/tests/kvm/kvm_utils.py
+++ b/client/tests/kvm/kvm_utils.py
@@ -605,52 +605,6 @@ def netcat(host, port, username, password, prompt, 
timeout=10):
 
 # The following are utility functions related to ports.
 
-def is_sshd_running(host, port, timeout=10.0):
-
-Connect to the given host and port and wait for output.
-Return True if the given host and port are responsive.
-
-@param host: Host's hostname
-@param port: Host's port
-@param timeout: Time (seconds) before we giving up on checking the SSH
-daemon.
-
-@return: If output is available, return True. If timeout expires and no
-output was available, return False.
-
-try:
-# Try to connect
-#s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-s = socket.socket()
-s.connect((host, port))
-except socket.error:
-# Can't connect -- return False
-s.close()
-logging.debug(Could not connect)
-return False
-s.setblocking(False)
-# Wait up to 'timeout' seconds
-end_time = time.time() + timeout
-while time.time()  end_time:
-try:
-time.sleep(0.1)
-# Try to receive some text
-str = s.recv(1024)
-if len(str)  0:
-s.shutdown(socket.SHUT_RDWR)
-s.close()
-logging.debug(Success! got string %r % str)
-return True
-except socket.error:
-# No text was available; try again
-pass
-# Timeout elapsed and no text was received
-s.shutdown(socket.SHUT_RDWR)
-s.close()
-logging.debug(Timeout)
-return False
-
-
 def is_port_free(port):
 
 Return True if the given port is available for use.
diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
index 79ca81d..d360d8e 100755
--- a/client/tests/kvm/kvm_vm.py
+++ b/client/tests/kvm/kvm_vm.py
@@ -654,21 +654,6 @@ class VM:
 return self.process.get_pid()
 
 
-def is_sshd_running(self, timeout=10):
-
-Return True iff the guest's remote shell port is responsive.
-
-@param timeout: Time (seconds) before giving up checking the daemon's
-responsiveness.
-
-address = self.get_address()
-port = self.get_port(int(self.params.get(shell_port)))
-if not address or not port:
-logging.debug(IP address or port unavailable)
-return False
-return kvm_utils.is_sshd_running(address, port, timeout=timeout)
-
-
 def remote_login(self, nic_index=0, timeout=10):
 
 Log into the guest via SSH/Telnet/Netcat.
-- 
1.5.4.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 06/19] KVM test: timedrift test: set CPU affinity recursively for all children

2009-09-09 Thread Michael Goldish
In addition to setting the CPU affinity of the given process, set it for all of
its children too.

Signed-off-by: Michael Goldish mgold...@redhat.com
---
 client/tests/kvm/kvm_tests.py |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/client/tests/kvm/kvm_tests.py b/client/tests/kvm/kvm_tests.py
index 1ee7775..deab59e 100644
--- a/client/tests/kvm/kvm_tests.py
+++ b/client/tests/kvm/kvm_tests.py
@@ -578,6 +578,7 @@ def run_timedrift(test, params, env):
 def set_cpu_affinity(pid, mask):
 
 Set the CPU affinity of all threads of the process with PID pid.
+Do this recursively for all child processes as well.
 
 @param pid: The process ID.
 @param mask: The CPU affinity mask.
@@ -589,6 +590,9 @@ def run_timedrift(test, params, env):
 prev_mask = commands.getoutput(taskset -p %s % tid).split()[-1]
 prev_masks[tid] = prev_mask
 commands.getoutput(taskset -p %s %s % (mask, tid))
+children = commands.getoutput(ps --ppid=%s -o pid= % pid).split()
+for child in children:
+prev_masks.update(set_cpu_affinity(child, mask))
 return prev_masks
 
 def restore_cpu_affinity(prev_masks):
@@ -683,13 +687,9 @@ def run_timedrift(test, params, env):
   output_func=logging.debug,
   output_prefix=(host load %d)  % i,
   timeout=0.5))
-# Set the CPU affinity of the shell running the load process
+# Set the CPU affinity of the load process
 pid = host_load_sessions[-1].get_shell_pid()
 set_cpu_affinity(pid, cpu_mask)
-# Try setting the CPU affinity of the load process itself
-pid = host_load_sessions[-1].get_pid()
-if pid:
-set_cpu_affinity(pid, cpu_mask)
 
 # Sleep for a while (during load)
 logging.info(Sleeping for %s seconds... % load_duration)
-- 
1.5.4.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/19] KVM test: boot test: add option to reboot using system_reset

2009-09-09 Thread Michael Goldish
The boot test now behaves as follows:
- Normally it just waits for the guest to go up and logs into it.
- If reboot_method is specified and equals shell, the guest is sent a reboot
  shell command, and the test waits until the guest comes back up.
- If reboot method is specified and equals system_reset, the VM is sent a
  system_reset monitor command, and the test waits until the guest comes back
  up.
  Before sending the system_reset command the test sleeps for a given duration.
  The duration is controlled by the parameter 'sleep_before_reset'.

Signed-off-by: Michael Goldish mgold...@redhat.com
---
 client/tests/kvm/kvm_tests.cfg.sample |8 +++-
 client/tests/kvm/kvm_tests.py |   32 ++--
 2 files changed, 29 insertions(+), 11 deletions(-)

diff --git a/client/tests/kvm/kvm_tests.cfg.sample 
b/client/tests/kvm/kvm_tests.cfg.sample
index 73e929f..0703e64 100644
--- a/client/tests/kvm/kvm_tests.cfg.sample
+++ b/client/tests/kvm/kvm_tests.cfg.sample
@@ -58,7 +58,7 @@ variants:
 
 - reboot:   install setup
 type = boot
-reboot = yes
+reboot_method = shell
 kill_vm_on_error = yes
 
 - migrate:  install setup
@@ -127,6 +127,12 @@ variants:
 - notepad:
 autoit_script = autoit/notepad1.au3
 
+- system_reset: install setup
+type = boot
+reboot_method = system_reset
+sleep_before_reset = 20
+kill_vm_on_error = yes
+
 - shutdown: install setup
 type = shutdown
 kill_vm = yes
diff --git a/client/tests/kvm/kvm_tests.py b/client/tests/kvm/kvm_tests.py
index c2bfb8a..801b84e 100644
--- a/client/tests/kvm/kvm_tests.py
+++ b/client/tests/kvm/kvm_tests.py
@@ -13,9 +13,9 @@ def run_boot(test, params, env):
 
 KVM reboot test:
 1) Log into a guest
-2) Send a reboot command to the guest
-3) Wait until it's up.
-4) Log into the guest to verify it's up again.
+2) Send a reboot command or a system_reset monitor command (optional)
+3) Wait until the guest is up again
+4) Log into the guest to verify it's up again
 
 @param test: kvm test object
 @param params: Dictionary with the test parameters
@@ -33,13 +33,24 @@ def run_boot(test, params, env):
 if not session:
 raise error.TestFail(Could not log into guest)
 
-logging.info(Logged in)
-
-if params.get(reboot) == yes:
-# Send the VM's reboot command
-session.sendline(vm.get_params().get(reboot_command))
-logging.info(Reboot command sent; waiting for guest to go down...)
+try:
+logging.info(Logged in)
 
+if params.get(reboot_method) == shell:
+# Send a reboot command to the guest's shell
+session.sendline(vm.get_params().get(reboot_command))
+logging.info(Reboot command sent; waiting for guest to go 
+ down...)
+elif params.get(reboot_method) == system_reset:
+# Sleep for a while -- give the guest a chance to finish booting
+time.sleep(float(params.get(sleep_before_reset, 10)))
+# Send a system_reset monitor command
+vm.send_monitor_cmd(system_reset)
+logging.info(system_reset monitor command sent; waiting for 
+ guest to go down...)
+else: return
+
+# Wait for the session to become unresponsive
 if not kvm_utils.wait_for(lambda: not session.is_responsive(),
   120, 0, 1):
 raise error.TestFail(Guest refuses to go down)
@@ -54,7 +65,8 @@ def run_boot(test, params, env):
 
 logging.info(Guest is up again)
 
-session.close()
+finally:
+session.close()
 
 
 def run_shutdown(test, params, env):
-- 
1.5.4.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/19] KVM test: shutdown test: allow shutting down using system_powerdown

2009-09-09 Thread Michael Goldish
In addition to using the shutdown command/program, allow using the
system_powerdown monitor command.  The behavior is controlled using the
shutdown_method parameter, which may equal either shell or system_powerdown.

If shutdown_method equals system_powerdown, the test sleeps a given amount of
time (controlled by the parameter sleep_before_powerdown) and then sends the
system_powerdown monitor command.

Signed-off-by: Michael Goldish mgold...@redhat.com
---
 client/tests/kvm/kvm_tests.cfg.sample |8 
 client/tests/kvm/kvm_tests.py |   22 --
 2 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/client/tests/kvm/kvm_tests.cfg.sample 
b/client/tests/kvm/kvm_tests.cfg.sample
index 0703e64..201b0e1 100644
--- a/client/tests/kvm/kvm_tests.cfg.sample
+++ b/client/tests/kvm/kvm_tests.cfg.sample
@@ -133,8 +133,16 @@ variants:
 sleep_before_reset = 20
 kill_vm_on_error = yes
 
+- system_powerdown: install setup
+type = shutdown
+shutdown_method = system_powerdown
+sleep_before_powerdown = 20
+kill_vm = yes
+kill_vm_gracefully = no
+
 - shutdown: install setup
 type = shutdown
+shutdown_method = shell
 kill_vm = yes
 kill_vm_gracefully = no
 
diff --git a/client/tests/kvm/kvm_tests.py b/client/tests/kvm/kvm_tests.py
index 801b84e..863b863 100644
--- a/client/tests/kvm/kvm_tests.py
+++ b/client/tests/kvm/kvm_tests.py
@@ -73,8 +73,9 @@ def run_shutdown(test, params, env):
 
 KVM shutdown test:
 1) Log into a guest
-2) Send a shutdown command to the guest
-3) Wait until it's down
+2) Send a shutdown command to the guest, or issue a system_powerdown
+   monitor command (depending on the value of shutdown_method)
+3) Wait until the guest is down
 
 @param test: kvm test object
 @param params: Dictionary with the test parameters
@@ -95,15 +96,24 @@ def run_shutdown(test, params, env):
 try:
 logging.info(Logged in)
 
-# Send the VM's shutdown command
-session.sendline(vm.get_params().get(shutdown_command))
-
-logging.info(Shutdown command sent; waiting for guest to go down...)
+if params.get(shutdown_method) == shell:
+# Send a shutdown command to the guest's shell
+session.sendline(vm.get_params().get(shutdown_command))
+logging.info(Shutdown command sent; waiting for guest to go 
+ down...)
+elif params.get(shutdown_method) == system_powerdown:
+# Sleep for a while -- give the guest a chance to finish booting
+time.sleep(float(params.get(sleep_before_powerdown, 10)))
+# Send a system_powerdown monitor command
+vm.send_monitor_cmd(system_powerdown)
+logging.info(system_powerdown monitor command sent; waiting for 
+ guest to go down...)
 
 if not kvm_utils.wait_for(vm.is_dead, 240, 0, 1):
 raise error.TestFail(Guest refuses to go down)
 
 logging.info(Guest is down)
+
 finally:
 session.close()
 
-- 
1.5.4.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/19] KVM test: Add new module kvm_test_utils.py

2009-09-09 Thread Michael Goldish
This module is meant to reduce code size by performing common test procedures.
Generally, code here should look like test code.
More specifically:
- Functions in this module should raise exceptions if things go wrong
  (unlike functions in kvm_utils.py and kvm_vm.py which report failure via
  their returned values).
- Functions in this module may use logging.info(), in addition to
  logging.debug() and logging.error(), to log messages the user may be
  interested in (unlike kvm_utils.py and kvm_vm.py which use
  logging.debug() for everything that isn't an error).
- Functions in this module typically use functions and classes from
  lower-level modules (e.g. kvm_utils.py, kvm_vm.py, kvm_subprocess.py).
- Functions in this module should not be used by lower-level modules.
- Functions in this module should be used in the right context.
  For example, a function should not be used where it may display
  misleading or inaccurate info or debug messages.

Signed-off-by: Michael Goldish mgold...@redhat.com
---
 client/tests/kvm/kvm_test_utils.py |   61 
 1 files changed, 61 insertions(+), 0 deletions(-)
 create mode 100644 client/tests/kvm/kvm_test_utils.py

diff --git a/client/tests/kvm/kvm_test_utils.py 
b/client/tests/kvm/kvm_test_utils.py
new file mode 100644
index 000..39e92b9
--- /dev/null
+++ b/client/tests/kvm/kvm_test_utils.py
@@ -0,0 +1,61 @@
+import time, os, logging, re, commands
+from autotest_lib.client.common_lib import utils, error
+import kvm_utils, kvm_vm, kvm_subprocess
+
+
+High-level KVM test utility functions.
+
+This module is meant to reduce code size by performing common test procedures.
+Generally, code here should look like test code.
+More specifically:
+- Functions in this module should raise exceptions if things go wrong
+  (unlike functions in kvm_utils.py and kvm_vm.py which report failure via
+  their returned values).
+- Functions in this module may use logging.info(), in addition to
+  logging.debug() and logging.error(), to log messages the user may be
+  interested in (unlike kvm_utils.py and kvm_vm.py which use
+  logging.debug() for anything that isn't an error).
+- Functions in this module typically use functions and classes from
+  lower-level modules (e.g. kvm_utils.py, kvm_vm.py, kvm_subprocess.py).
+- Functions in this module should not be used by lower-level modules.
+- Functions in this module should be used in the right context.
+  For example, a function should not be used where it may display
+  misleading or inaccurate info or debug messages.
+
+...@copyright: 2008-2009 Red Hat Inc.
+
+
+
+def get_living_vm(env, vm_name):
+
+Get a VM object from the environment and make sure it's alive.
+
+@param env: Dictionary with test environment.
+@param vm_name: Name of the desired VM object.
+@return: A VM object.
+
+vm = kvm_utils.env_get_vm(env, vm_name)
+if not vm:
+raise error.TestError(VM '%s' not found in environment % vm_name)
+if not vm.is_alive():
+raise error.TestError(VM '%s' seems to be dead; test requires a 
+  living VM % vm_name)
+return vm
+
+
+def wait_for_login(vm, nic_index=0, timeout=240):
+
+Try logging into a VM repeatedly.  Stop on success or when timeout expires.
+
+@param vm: VM object.
+@param nic_index: Index of NIC to access in the VM.
+@param timeout: Time to wait before giving up.
+@return: A shell session object.
+
+logging.info(Waiting for guest to be up...)
+session = kvm_utils.wait_for(lambda: vm.remote_login(nic_index=nic_index),
+ timeout, 0, 2)
+if not session:
+raise error.TestFail(Could not log into guest)
+logging.info(Logged in)
+return session
-- 
1.5.4.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 13/19] KVM test: kvm_tests.py: save test code by using utilities in kvm_test_utils.py

2009-09-09 Thread Michael Goldish
Signed-off-by: Michael Goldish mgold...@redhat.com
---
 client/tests/kvm/kvm_tests.py |  148 -
 1 files changed, 27 insertions(+), 121 deletions(-)

diff --git a/client/tests/kvm/kvm_tests.py b/client/tests/kvm/kvm_tests.py
index 863b863..35666cf 100644
--- a/client/tests/kvm/kvm_tests.py
+++ b/client/tests/kvm/kvm_tests.py
@@ -1,6 +1,6 @@
 import time, os, logging, re, commands
 from autotest_lib.client.common_lib import utils, error
-import kvm_utils, kvm_subprocess, ppm_utils, scan_results
+import kvm_utils, kvm_subprocess, ppm_utils, scan_results, kvm_test_utils
 
 
 KVM test definitions.
@@ -21,21 +21,10 @@ def run_boot(test, params, env):
 @param params: Dictionary with the test parameters
 @param env: Dictionary with test environment.
 
-vm = kvm_utils.env_get_vm(env, params.get(main_vm))
-if not vm:
-raise error.TestError(VM object not found in environment)
-if not vm.is_alive():
-raise error.TestError(VM seems to be dead; Test requires a living VM)
-
-logging.info(Waiting for guest to be up...)
-
-session = kvm_utils.wait_for(vm.remote_login, 240, 0, 2)
-if not session:
-raise error.TestFail(Could not log into guest)
+vm = kvm_test_utils.get_living_vm(env, params.get(main_vm))
+session = kvm_test_utils.wait_for_login(vm)
 
 try:
-logging.info(Logged in)
-
 if params.get(reboot_method) == shell:
 # Send a reboot command to the guest's shell
 session.sendline(vm.get_params().get(reboot_command))
@@ -81,21 +70,10 @@ def run_shutdown(test, params, env):
 @param params: Dictionary with the test parameters
 @param env: Dictionary with test environment
 
-vm = kvm_utils.env_get_vm(env, params.get(main_vm))
-if not vm:
-raise error.TestError(VM object not found in environment)
-if not vm.is_alive():
-raise error.TestError(VM seems to be dead; Test requires a living VM)
-
-logging.info(Waiting for guest to be up...)
-
-session = kvm_utils.wait_for(vm.remote_login, 240, 0, 2)
-if not session:
-raise error.TestFail(Could not log into guest)
+vm = kvm_test_utils.get_living_vm(env, params.get(main_vm))
+session = kvm_test_utils.wait_for_login(vm)
 
 try:
-logging.info(Logged in)
-
 if params.get(shutdown_method) == shell:
 # Send a shutdown command to the guest's shell
 session.sendline(vm.get_params().get(shutdown_command))
@@ -134,33 +112,23 @@ def run_migration(test, params, env):
 @param params: Dictionary with test parameters.
 @param env: Dictionary with the test environment.
 
-vm = kvm_utils.env_get_vm(env, params.get(main_vm))
-if not vm:
-raise error.TestError(VM object not found in environment)
-if not vm.is_alive():
-raise error.TestError(VM seems to be dead; Test requires a living VM)
+vm = kvm_test_utils.get_living_vm(env, params.get(main_vm))
 
 # See if migration is supported
 s, o = vm.send_monitor_cmd(help info)
 if not info migrate in o:
 raise error.TestError(Migration is not supported)
 
-dest_vm = vm.clone()
-dest_vm.create(for_migration=True)
-
 # Log into guest and get the output of migration_test_command
-logging.info(Waiting for guest to be up...)
-
-session = kvm_utils.wait_for(vm.remote_login, 240, 0, 2)
-if not session:
-raise error.TestFail(Could not log into guest)
-
-logging.info(Logged in)
-
-reference_output = session.get_command_output(params.get(migration_test_
- command))
+session = kvm_test_utils.wait_for_login(vm)
+migration_test_command = params.get(migration_test_command)
+reference_output = session.get_command_output(migration_test_command)
 session.close()
 
+# Clone the main VM and ask it to wait for incoming migration
+dest_vm = vm.clone()
+dest_vm.create(for_migration=True)
+
 # Define the migration command
 cmd = migrate -d tcp:localhost:%d % dest_vm.migration_port
 logging.debug(Migration command: %s % cmd)
@@ -211,7 +179,7 @@ def run_migration(test, params, env):
 
 logging.info(Logged in after migration)
 
-output = session.get_command_output(params.get(migration_test_command))
+output = session.get_command_output(migration_test_command)
 session.close()
 
 # Compare output to reference output
@@ -225,6 +193,7 @@ def run_migration(test, params, env):
 raise error.TestFail(Command produced different output before and 
  after migration)
 
+# Replace the main VM with the new cloned VM
 kvm_utils.env_register_vm(env, params.get(main_vm), dest_vm)
 
 
@@ -236,19 +205,8 @@ def run_autotest(test, params, env):
 @param params: Dictionary with test parameters.
 @param env: Dictionary with the test environment.
 
-vm = 

[PATCH 14/19] KVM test: kvm_preprocessing.py: don't explicitly print failure messages

2009-09-09 Thread Michael Goldish
This is taken care of elsewhere, so currently when something fails during
pre/post-processing, messages get logged twice.

Signed-off-by: Michael Goldish mgold...@redhat.com
---
 client/tests/kvm/kvm_preprocessing.py |   14 --
 1 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/client/tests/kvm/kvm_preprocessing.py 
b/client/tests/kvm/kvm_preprocessing.py
index 8fa74cf..729e1d4 100644
--- a/client/tests/kvm/kvm_preprocessing.py
+++ b/client/tests/kvm/kvm_preprocessing.py
@@ -31,11 +31,8 @@ def preprocess_image(test, params):
 logging.debug(Creating image...)
 create_image = True
 
-if create_image:
-if not kvm_vm.create_image(params, test.bindir):
-message = Could not create image
-logging.error(message)
-raise error.TestError(message)
+if create_image and not kvm_vm.create_image(params, test.bindir):
+raise error.TestError(Could not create image)
 
 
 def preprocess_vm(test, params, env, name):
@@ -78,11 +75,8 @@ def preprocess_vm(test, params, env, name):
   restarting it...)
 start_vm = True
 
-if start_vm:
-if not vm.create(name, params, test.bindir, for_migration):
-message = Could not start VM
-logging.error(message)
-raise error.TestError(message)
+if start_vm and not vm.create(name, params, test.bindir, for_migration):
+raise error.TestError(Could not start VM)
 
 scrdump_filename = os.path.join(test.debugdir, pre_%s.ppm % name)
 vm.send_monitor_cmd(screendump %s % scrdump_filename)
-- 
1.5.4.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 16/19] KVM test: kvm_subprocess: robustify the test for child process termination

2009-09-09 Thread Michael Goldish
Don't rely on os.read() raising an exception; use waitpid() to check for child
termination:
- every 0.5 seconds, or
- when os.read() raises an exception, or
- when os.read() returns a zero-length string.

Signed-off-by: Michael Goldish mgold...@redhat.com
---
 client/tests/kvm/kvm_subprocess.py |   17 -
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/client/tests/kvm/kvm_subprocess.py 
b/client/tests/kvm/kvm_subprocess.py
index d142ed9..c3c48cd 100755
--- a/client/tests/kvm/kvm_subprocess.py
+++ b/client/tests/kvm/kvm_subprocess.py
@@ -1102,10 +1102,11 @@ def _server_main():
 
 # Read from child and write to files/pipes
 while True:
+check_termination = False
 # Make a list of reader pipes whose buffers are not empty
 fds = [fd for (i, fd) in enumerate(reader_fds) if buffers[i]]
 # Wait until there's something to do
-r, w, x = select.select([shell_fd, inpipe_fd], fds, [])
+r, w, x = select.select([shell_fd, inpipe_fd], fds, [], 0.5)
 # If a reader pipe is ready for writing --
 for (i, fd) in enumerate(reader_fds):
 if fd in w:
@@ -1116,7 +1117,9 @@ def _server_main():
 try:
 data = os.read(shell_fd, 16384)
 except OSError:
-break
+data = 
+if not data:
+check_termination = True
 # Remove carriage returns from the data -- they often cause
 # trouble and are normally not needed
 data = data.replace(\r, )
@@ -1124,14 +1127,18 @@ def _server_main():
 output_file.flush()
 for i in range(len(readers)):
 buffers[i] += data
+# If os.read() raised an exception or there was nothing to read --
+if check_termination or shell_fd not in r:
+pid, status = os.waitpid(shell_pid, os.WNOHANG)
+if pid:
+status = os.WEXITSTATUS(status)
+break
 # If there's data to read from the client --
 if inpipe_fd in r:
 data = os.read(inpipe_fd, 1024)
 os.write(shell_fd, data)
 
-# Wait for the shell process to exit and get its exit status
-status = os.waitpid(shell_pid, 0)[1]
-status = os.WEXITSTATUS(status)
+# Write the exit status to a file
 file = open(status_filename, w)
 file.write(str(status))
 file.close()
-- 
1.5.4.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 15/19] KVM test: Autotest test wrapper cleanup

2009-09-09 Thread Michael Goldish
Make the code shorter and simpler.

Signed-off-by: Michael Goldish mgold...@redhat.com
---
 client/tests/kvm/kvm_tests.py |  153 +++--
 1 files changed, 72 insertions(+), 81 deletions(-)

diff --git a/client/tests/kvm/kvm_tests.py b/client/tests/kvm/kvm_tests.py
index 35666cf..8c785c1 100644
--- a/client/tests/kvm/kvm_tests.py
+++ b/client/tests/kvm/kvm_tests.py
@@ -205,10 +205,44 @@ def run_autotest(test, params, env):
 @param params: Dictionary with test parameters.
 @param env: Dictionary with the test environment.
 
+# Helper functions
+def copy_if_size_differs(vm, local_path, remote_path):
+
+Copy a file to a guest if it doesn't exist or if its size differs.
+
+@param vm: VM object
+@param local_path: Local path
+@param remote_path: Remote path
+
+copy = False
+output = session.get_command_output(ls -l %s % remote_path)
+if (such file in output or
+int(output.split()[4]) != os.path.getsize(local_path)):
+basename = os.path.basename(local_path)
+logging.info(Copying %s to guest (file is missing or has a 
+ different size)... % basename)
+if not vm.copy_files_to(local_path, remote_path):
+raise error.TestFail(Could not copy %s to guest % basename)
+
+def extract(vm, remote_path, dest_dir=.):
+
+Extract a .tar.bz2 file on the guest.
+
+@param vm: VM object
+@param remote_path: Remote file path
+@param dest_dir: Destination dir for the contents
+
+basename = os.path.basename(remote_path)
+logging.info(Extracting %s... % basename)
+status = session.get_command_status(tar xfj %s -C %s %
+(remote_path, dest_dir))
+if status != 0:
+raise error.TestFail(Could not extract %s % basename)
+
 vm = kvm_test_utils.get_living_vm(env, params.get(main_vm))
 session = kvm_test_utils.wait_for_login(vm)
 
-# Collect some info
+# Collect test parameters
 test_name = params.get(test_name)
 test_timeout = int(params.get(test_timeout, 300))
 test_control_file = params.get(test_control_file, control)
@@ -235,104 +269,47 @@ def run_autotest(test, params, env):
   (os.path.join(test.bindir, autotest, tests),
tarred_test_path, test_name), timeout=30)
 
-# Check if we need to copy autotest.tar.bz2
-copy = False
-output = session.get_command_output(ls -l autotest.tar.bz2)
-if such file in output:
-copy = True
-else:
-size = int(output.split()[4])
-if size != os.path.getsize(tarred_autotest_path):
-copy = True
-# Perform the copy
-if copy:
-logging.info(Copying autotest.tar.bz2 to guest
-  (file is missing or has a different size)...)
-if not vm.copy_files_to(tarred_autotest_path, ):
-raise error.TestFail(Could not copy autotest.tar.bz2 to guest)
-
-# Check if we need to copy test_name.tar.bz2
-copy = False
-output = session.get_command_output(ls -l %s.tar.bz2 % test_name)
-if such file in output:
-copy = True
-else:
-size = int(output.split()[4])
-if size != os.path.getsize(tarred_test_path):
-copy = True
-# Perform the copy
-if copy:
-logging.info(Copying %s.tar.bz2 to guest (file is missing or has a
-  different size)... % test_name)
-if not vm.copy_files_to(tarred_test_path, ):
-raise error.TestFail(Could not copy %s.tar.bz2 to guest %
- test_name)
+# Copy autotest.tar.bz2
+copy_if_size_differs(vm, tarred_autotest_path, autotest.tar.bz2)
+
+# Copy test_name.tar.bz2
+copy_if_size_differs(vm, tarred_test_path, test_name + .tar.bz2)
 
 # Extract autotest.tar.bz2
-logging.info(Extracting autotest.tar.bz2...)
-status = session.get_command_status(tar xvfj autotest.tar.bz2)
-if status != 0:
-raise error.TestFail(Could not extract autotest.tar.bz2)
+extract(vm, autotest.tar.bz2)
 
 # mkdir autotest/tests
 session.sendline(mkdir autotest/tests)
 
 # Extract test_name.tar.bz2 into autotest/tests
-logging.info(Extracting %s.tar.bz2... % test_name)
-status = session.get_command_status(tar xvfj %s.tar.bz2 -C 
-autotest/tests % test_name)
-if status != 0:
-raise error.TestFail(Could not extract %s.tar.bz2 % test_name)
+extract(vm, test_name + .tar.bz2, autotest/tests)
 
-# Cleaning up old remaining results
-session.sendline(rm -rf autotest/results/*)
-# Copying the selected control file (located inside
-# test.bindir/autotest_control to the autotest dir
+# Copy the selected control file (located inside
+# 

[PATCH 17/19] KVM test: kvm_vm.py: add macaddr= to command line only if a MAC address is given

2009-09-09 Thread Michael Goldish
(Avoid adding weird things like 'macaddr=None' to the command line.)

Signed-off-by: Michael Goldish mgold...@redhat.com
---
 client/tests/kvm/kvm_vm.py |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
index d360d8e..f728104 100755
--- a/client/tests/kvm/kvm_vm.py
+++ b/client/tests/kvm/kvm_vm.py
@@ -234,7 +234,8 @@ class VM:
 qemu_cmd += ,model=%s % nic_params.get(nic_model)
 if nic_params.has_key(address_index):
 mac, ip = kvm_utils.get_mac_ip_pair_from_dict(nic_params)
-qemu_cmd += ,macaddr=%s % mac
+if mac:
+qemu_cmd += ,macaddr=%s % mac
 # Handle the '-net tap' or '-net user' part
 mode = nic_params.get(nic_mode, user)
 qemu_cmd +=  -net %s,vlan=%d % (mode, vlan)
-- 
1.5.4.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 18/19] KVM test: kvm_tests.cfg.sample: get all Windows test utilities from a single ISO

2009-09-09 Thread Michael Goldish
Instead of rss.iso, vlc.iso and autoit.iso -- look for everything in 
winutils.iso
by default.
This make maintenance a little easier, and eliminates the need to restart VMs
between tests just in order to change the cdrom.
Also, expect vlc.exe in D:\vlc\vlc.exe instead of D:\vlc.exe.

'install' tests still use the usual ISO files.

Signed-off-by: Michael Goldish mgold...@redhat.com
---
 client/tests/kvm/kvm_tests.cfg.sample |   18 +-
 1 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/client/tests/kvm/kvm_tests.cfg.sample 
b/client/tests/kvm/kvm_tests.cfg.sample
index 201b0e1..285a38f 100644
--- a/client/tests/kvm/kvm_tests.cfg.sample
+++ b/client/tests/kvm/kvm_tests.cfg.sample
@@ -119,7 +119,6 @@ variants:
 
 - autoit:   install setup
 type = autoit
-cdrom = windows/autoit.iso
 autoit_binary = D:\AutoIt3.exe
 autoit_script_timeout = 600
 autoit_script_params =
@@ -362,17 +361,19 @@ variants:
 # file_transfer_client = scp
 # file_transfer_port = 22
 
+# This ISO will be used for all tests except install:
+cdrom = windows/winutils.iso
+
 migrate:
 migration_test_command = ver  vol
 stress_boot:
 alive_test_cmd = systeminfo
 timedrift:
-# For this to work, the ISO should contain vlc (vlc.exe) and a 
video (ED_1024.avi)
-cdrom = windows/vlc.iso
 time_command = echo TIME: %date% %time%
 time_filter_re = (?=TIME: \w\w\w ).{19}(?=\.\d\d)
 time_format = %m/%d/%Y %H:%M:%S
-guest_load_command = 'cmd /c d:\vlc -f --loop --no-qt-privacy-ask 
--no-qt-system-tray d:\ED_1024.avi'
+# For this to work, the cdrom at d: should contain vlc 
(d:\vlc\vlc.exe) and a video (d:\ED_1024.avi)
+guest_load_command = 'cmd /c d:\vlc\vlc -f --loop 
--no-qt-privacy-ask --no-qt-system-tray d:\ED_1024.avi'
 # Alternative guest load:
 #guest_load_command = (dir /s  dir /s  dir /s  dir /s)  
nul
 guest_load_stop_command = taskkill /F /IM vlc.exe
@@ -395,7 +396,6 @@ variants:
 user = user
 setup:
 steps = Win2000-32-rss.steps
-cdrom = windows/rss.iso
 
 - WinXP.32:
 image_name = winXP-32
@@ -407,7 +407,6 @@ variants:
 user = user
 setup:
 steps = WinXP-32-rss.steps
-cdrom = windows/rss.iso
 
 - WinXP.64:
 no reboot
@@ -420,7 +419,6 @@ variants:
 user = user
 setup:
 steps = WinXP-64-rss.steps
-cdrom = windows/rss.iso
 
 - Win2003:
 image_size = 20G
@@ -438,7 +436,6 @@ variants:
 user = user
 setup:
 steps = Win2003-32-rss.steps
-cdrom = windows/rss.iso
 
 - 64:
 image_name = win2003-64
@@ -450,7 +447,6 @@ variants:
 user = user
 setup:
 steps = Win2003-64-rss.steps
-cdrom = windows/rss.iso
 
 - WinVista:
 image_name = winvista
@@ -466,7 +462,6 @@ variants:
 md5sum_1m = c724e9695da483bc0fd59e426eaefc72
 setup:
 steps = WinVista-32-rss.steps
-cdrom = windows/rss.iso
 
 - 64:
 image_name += -64
@@ -477,7 +472,6 @@ variants:
 md5sum_1m = 0947bcd5390546139e25f25217d6f165
 setup:
 steps = WinVista-64-rss.steps
-cdrom = windows/rss.iso
 
 - Win2008:
 image_name = win2008
@@ -497,7 +491,6 @@ variants:
 md5sum_1m=07d7f5006393f74dc76e6e2e943e2440
 setup:
 steps = Win2008-32-rss.steps
-cdrom = windows/rss.iso
 
 - 64:
 image_name += -64
@@ -511,7 +504,6 @@ variants:
 passwd = 1q2w3eP
 setup:
 steps = Win2008-64-rss.steps
-cdrom = windows/rss.iso
 
 # Unix/BSD section
 - @Unix:
-- 
1.5.4.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 19/19] KVM test: kvm_preprocessing.py: verify PPM file validity before passing to PIL

2009-09-09 Thread Michael Goldish
Passing PIL an invalid PPM file makes it throw an IOError.

Signed-off-by: Michael Goldish mgold...@redhat.com
---
 client/tests/kvm/kvm_preprocessing.py |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/client/tests/kvm/kvm_preprocessing.py 
b/client/tests/kvm/kvm_preprocessing.py
index 729e1d4..8809f31 100644
--- a/client/tests/kvm/kvm_preprocessing.py
+++ b/client/tests/kvm/kvm_preprocessing.py
@@ -273,9 +273,10 @@ def postprocess(test, params, env):
files to PNG format...)
 try:
 for f in glob.glob(os.path.join(test.debugdir, *.ppm)):
-new_path = f.replace(.ppm, .png)
-image = PIL.Image.open(f)
-image.save(new_path, format = 'PNG')
+if ppm_utils.image_verify_ppm_file(f):
+new_path = f.replace(.ppm, .png)
+image = PIL.Image.open(f)
+image.save(new_path, format='PNG')
 except NameError:
 pass
 
-- 
1.5.4.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Fix --disable-kvm build regression of commit 8c7d4cb

2009-09-09 Thread Daniel Gollub
qemu-kvm --disable-kvm build regression of commit 8c7d4cb spotted by
qemu-kvm buildbot:

http://buildbot.b1-systems.de/qemu-kvm/builders/disable_kvm_i386_debian_5_0/builds/44
http://buildbot.b1-systems.de/qemu-kvm/builders/disable_kvm_x86_64_debian_5_0/builds/42

Signed-off-by: Daniel Gollub gol...@b1-systems.de

 qemu-kvm.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/qemu-kvm.h b/qemu-kvm.h
index 4be6afd..11350f7 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -1157,7 +1157,9 @@ static inline void kvm_arch_get_registers(CPUState *env)
 {
 kvm_arch_save_regs(env);
 kvm_arch_save_mpstate(env);
+#ifdef KVM_CAP_MP_STATE
 env-halted = (env-mp_state == KVM_MP_STATE_HALTED);
+#endif
 }
 
 static inline void kvm_arch_put_registers(CPUState *env)
--

-- 
Daniel GollubGeschaeftsfuehrer: Ralph Dehner
FOSS Developer   Unternehmenssitz:  Vohburg
B1 Systems GmbH  Amtsgericht:   Ingolstadt
Mobil: +49-(0)-160 47 73 970 Handelsregister:   HRB 3537
EMail: gol...@b1-systems.de  http://www.b1-systems.de

Adresse: B1 Systems GmbH, Osterfeldstraße 7, 85088 Vohburg
http://pgpkeys.pca.dfn.de/pks/lookup?op=getsearch=0xED14B95C2F8CA78D
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: New kvm.git branch for linux-next

2009-09-09 Thread Stephen Rothwell
Hi Avi,

On Wed, 09 Sep 2009 20:55:18 +0300 Avi Kivity a...@redhat.com wrote:

 Stephen, please pick up the 'linux-next' branch of kvm.git instead 
 'master' as you do now.  This will better reflect what is actually going 
 to -next, will cause fewer merge errors, and will improve -next 
 bisectability.
 
 (this is actually a symbolic ref to kvm-updates/2.6.32 which will be 
 updated when kvm-updates/2.6.33 is created)

That sounds great.  I have changed over starting from today.

Thanks.

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/


pgpVmzZfGkgSY.pgp
Description: PGP signature


Re: [Autotest] [PATCH 18/19] KVM test: kvm_tests.cfg.sample: get all Windows test utilities from a single ISO

2009-09-09 Thread Lucas Meneghel Rodrigues
On Wed, Sep 9, 2009 at 3:12 PM, Michael Goldish mgold...@redhat.com wrote:
 Instead of rss.iso, vlc.iso and autoit.iso -- look for everything in 
 winutils.iso
 by default.
 This make maintenance a little easier, and eliminates the need to restart VMs
 between tests just in order to change the cdrom.
 Also, expect vlc.exe in D:\vlc\vlc.exe instead of D:\vlc.exe.

Ok, makes a lot of sense. In order to make it easier to people to
build those CDs, I am going to provide a build isos scrpit under the
deps/ folder, that can download the extraneous components from the
internet. I believe this will be a nice touch for people trying the
tests.

 'install' tests still use the usual ISO files.

 Signed-off-by: Michael Goldish mgold...@redhat.com
 ---
  client/tests/kvm/kvm_tests.cfg.sample |   18 +-
  1 files changed, 5 insertions(+), 13 deletions(-)

 diff --git a/client/tests/kvm/kvm_tests.cfg.sample 
 b/client/tests/kvm/kvm_tests.cfg.sample
 index 201b0e1..285a38f 100644
 --- a/client/tests/kvm/kvm_tests.cfg.sample
 +++ b/client/tests/kvm/kvm_tests.cfg.sample
 @@ -119,7 +119,6 @@ variants:

     - autoit:       install setup
         type = autoit
 -        cdrom = windows/autoit.iso
         autoit_binary = D:\AutoIt3.exe
         autoit_script_timeout = 600
         autoit_script_params =
 @@ -362,17 +361,19 @@ variants:
         # file_transfer_client = scp
         # file_transfer_port = 22

 +        # This ISO will be used for all tests except install:
 +        cdrom = windows/winutils.iso
 +
         migrate:
             migration_test_command = ver  vol
         stress_boot:
             alive_test_cmd = systeminfo
         timedrift:
 -            # For this to work, the ISO should contain vlc (vlc.exe) and a 
 video (ED_1024.avi)
 -            cdrom = windows/vlc.iso
             time_command = echo TIME: %date% %time%
             time_filter_re = (?=TIME: \w\w\w ).{19}(?=\.\d\d)
             time_format = %m/%d/%Y %H:%M:%S
 -            guest_load_command = 'cmd /c d:\vlc -f --loop 
 --no-qt-privacy-ask --no-qt-system-tray d:\ED_1024.avi'
 +            # For this to work, the cdrom at d: should contain vlc 
 (d:\vlc\vlc.exe) and a video (d:\ED_1024.avi)
 +            guest_load_command = 'cmd /c d:\vlc\vlc -f --loop 
 --no-qt-privacy-ask --no-qt-system-tray d:\ED_1024.avi'
             # Alternative guest load:
             #guest_load_command = (dir /s  dir /s  dir /s  dir /s)  
 nul
             guest_load_stop_command = taskkill /F /IM vlc.exe
 @@ -395,7 +396,6 @@ variants:
                     user = user
                 setup:
                     steps = Win2000-32-rss.steps
 -                    cdrom = windows/rss.iso

             - WinXP.32:
                 image_name = winXP-32
 @@ -407,7 +407,6 @@ variants:
                     user = user
                 setup:
                     steps = WinXP-32-rss.steps
 -                    cdrom = windows/rss.iso

             - WinXP.64:
                 no reboot
 @@ -420,7 +419,6 @@ variants:
                     user = user
                 setup:
                     steps = WinXP-64-rss.steps
 -                    cdrom = windows/rss.iso

             - Win2003:
                 image_size = 20G
 @@ -438,7 +436,6 @@ variants:
                             user = user
                         setup:
                             steps = Win2003-32-rss.steps
 -                            cdrom = windows/rss.iso

                     - 64:
                         image_name = win2003-64
 @@ -450,7 +447,6 @@ variants:
                             user = user
                         setup:
                             steps = Win2003-64-rss.steps
 -                            cdrom = windows/rss.iso

             - WinVista:
                 image_name = winvista
 @@ -466,7 +462,6 @@ variants:
                             md5sum_1m = c724e9695da483bc0fd59e426eaefc72
                         setup:
                             steps = WinVista-32-rss.steps
 -                            cdrom = windows/rss.iso

                     - 64:
                         image_name += -64
 @@ -477,7 +472,6 @@ variants:
                             md5sum_1m = 0947bcd5390546139e25f25217d6f165
                         setup:
                             steps = WinVista-64-rss.steps
 -                            cdrom = windows/rss.iso

             - Win2008:
                 image_name = win2008
 @@ -497,7 +491,6 @@ variants:
                             md5sum_1m=07d7f5006393f74dc76e6e2e943e2440
                         setup:
                             steps = Win2008-32-rss.steps
 -                            cdrom = windows/rss.iso

                     - 64:
                         image_name += -64
 @@ -511,7 +504,6 @@ variants:
                             passwd = 1q2w3eP
                         setup:
                             steps = Win2008-64-rss.steps
 -                            cdrom = windows/rss.iso

     # 

Re: [Autotest] [PATCH 19/19] KVM test: kvm_preprocessing.py: verify PPM file validity before passing to PIL

2009-09-09 Thread Lucas Meneghel Rodrigues
On Wed, Sep 9, 2009 at 3:12 PM, Michael Goldish mgold...@redhat.com wrote:
 Passing PIL an invalid PPM file makes it throw an IOError.

This one was missing a ppm_utils import. Applied with minimal corrections.

 Signed-off-by: Michael Goldish mgold...@redhat.com
 ---
  client/tests/kvm/kvm_preprocessing.py |    7 ---
  1 files changed, 4 insertions(+), 3 deletions(-)

 diff --git a/client/tests/kvm/kvm_preprocessing.py 
 b/client/tests/kvm/kvm_preprocessing.py
 index 729e1d4..8809f31 100644
 --- a/client/tests/kvm/kvm_preprocessing.py
 +++ b/client/tests/kvm/kvm_preprocessing.py
 @@ -273,9 +273,10 @@ def postprocess(test, params, env):
                        files to PNG format...)
         try:
             for f in glob.glob(os.path.join(test.debugdir, *.ppm)):
 -                new_path = f.replace(.ppm, .png)
 -                image = PIL.Image.open(f)
 -                image.save(new_path, format = 'PNG')
 +                if ppm_utils.image_verify_ppm_file(f):
 +                    new_path = f.replace(.ppm, .png)
 +                    image = PIL.Image.open(f)
 +                    image.save(new_path, format='PNG')
         except NameError:
             pass

 --
 1.5.4.1

 ___
 Autotest mailing list
 autot...@test.kernel.org
 http://test.kernel.org/cgi-bin/mailman/listinfo/autotest




-- 
Lucas
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Autotest] [PATCH 01/19] KVM test: kvm_utils.py: make verify_ip_address_ownership() more robust

2009-09-09 Thread Lucas Meneghel Rodrigues
As the changes were mostly bugfixes and short, I managed to review and
apply them all. Thank you very much Michael!

On Wed, Sep 9, 2009 at 3:11 PM, Michael Goldish mgold...@redhat.com wrote:
 Use arping in addition to querying the arp cache.
 Under certain circumstances a TCP connection may not trigger an ARP request so
 it must be triggered explicitly using arping.

 Signed-off-by: Michael Goldish mgold...@redhat.com
 ---
  client/tests/kvm/kvm_utils.py |   40 ++--
  1 files changed, 18 insertions(+), 22 deletions(-)

 diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py
 index dfca938..f046810 100644
 --- a/client/tests/kvm/kvm_utils.py
 +++ b/client/tests/kvm/kvm_utils.py
 @@ -152,39 +152,35 @@ def get_mac_ip_pair_from_dict(dict):
     return (None, None)


 -def verify_ip_address_ownership(ip, macs, timeout=3.0):
 +def verify_ip_address_ownership(ip, macs, timeout=10.0):
     
 -    Connect to a given IP address and make sure its MAC address equals one of
 -    the given MAC address.
 +    Use arping and the ARP cache to make sure a given IP address belongs to 
 one
 +    of the given MAC addresses.

     @param ip: An IP address.
     @param macs: A list or tuple of MAC addresses.
     @return: True iff ip is assigned to a MAC address in macs.
     
 -    def check_arp_cache(regex):
 -        o = commands.getoutput(/sbin/arp -n)
 -        return bool(re.search(regex, o, re.IGNORECASE))
 -
 +    # Compile a regex that matches the given IP address and any of the given
 +    # MAC addresses
     mac_regex = |.join((%s) % mac for mac in macs)
     regex = re.compile(r\b%s\b.*\b(%s)\b % (ip, mac_regex))

 -    if check_arp_cache(regex):
 +    # Check the ARP cache
 +    o = commands.getoutput(/sbin/arp -n)
 +    if re.search(regex, o, re.IGNORECASE):
         return True

 -    s = socket.socket()
 -    s.setblocking(False)
 -    try:
 -        s.connect((ip, 5))
 -    except socket.error:
 -        pass
 -    end_time = time.time() + timeout
 -    while time.time()  end_time:
 -        time.sleep(0.2)
 -        if check_arp_cache(regex):
 -            s.close()
 -            return True
 -    s.close()
 -    return False
 +    # Get the name of the bridge device for arping
 +    o = commands.getoutput(/sbin/ip route get %s % ip)
 +    dev = re.findall(dev\s+\S+, o, re.IGNORECASE)
 +    if not dev:
 +        return False
 +    dev = dev[0].split()[-1]
 +
 +    # Send an ARP request
 +    o = commands.getoutput(/sbin/arping -f -c 3 -I %s %s % (dev, ip))
 +    return bool(re.search(regex, o, re.IGNORECASE))


  # Functions for working with the environment (a dict-like object)
 --
 1.5.4.1

 ___
 Autotest mailing list
 autot...@test.kernel.org
 http://test.kernel.org/cgi-bin/mailman/listinfo/autotest




-- 
Lucas
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Multiple Port Support for virtio-console

2009-09-09 Thread Amit Shah

Hello all,

Here is a new iteration of the patch series that implements a
transport for guest and host communications.

I've tested for compatibility (old qemu  new kernel, new qemu  old
kernel, new qemu  new kernel) and it all works fine*. Migration works
with the patch Juan just posted.

There are a few items on my todo list but this works well.

New since last send:
- migrate per-port buffers that are queued up
- in-qemu api for open/close/read/write of ports.
  - the read() is a callback that's invoked when complete data
corresponding to one write() request on the guest is available.
- removed comments from virtio_console.c that are no longer relevant.
- address review comments by Juan

TODO:
- Convert all config writes to little endian in qemu / convert from
  little endian to host endian in guest
- Address a few FIXMEs spread in the code
- Introduce a watermark to stop a rogue host process flooding guest
  with data

Conditions:
* Heavy IO on an hvc port and a non-hvc port causes memory corruption
  each time, same place. It could be realted to locking but I doubt
  that. This still has to be sorted out

Please review.
Amit
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] virtio_console: Add support for multiple ports for generic guest and host communication

2009-09-09 Thread Amit Shah
Expose multiple char devices (ports) for simple communication
between the host userspace and guest.

Sample offline usages can be: poking around in a guest to find out
the file systems used, applications installed, etc. Online usages
can be sharing of clipboard data between the guest and the host,
sending information about logged-in users to the host, locking the
screen or session when a vnc session is closed, and so on.

The interface presented to guest userspace is of a simple char
device, so it can be used like this:

fd = open(/dev/vcon2, O_RDWR);
ret = read(fd, buf, 100);
ret = write(fd, string, strlen(string));

Each port is to be assigned a unique function, for example, the
first 4 ports may be reserved for libvirt usage, the next 4 for
generic streaming data and so on. This port-function mapping
isn't finalised yet.

For requirements, use-cases and some history see

http://www.linux-kvm.org/page/VMchannel_Requirements

Signed-off-by: Amit Shah amit.s...@redhat.com
---
 drivers/char/Kconfig   |4 +-
 drivers/char/virtio_console.c  | 1069 +++-
 include/linux/virtio_console.h |   60 +++-
 3 files changed, 994 insertions(+), 139 deletions(-)

diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index b8368e2..cbbb9a1 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -678,7 +678,9 @@ config VIRTIO_CONSOLE
select HVC_DRIVER
help
  Virtio console for use with lguest and other hypervisors.
-
+ Also serves as a general-purpose serial device for data transfer
+ between the guest and host. Character devices at /dev/vconNN will
+ be created when corresponding ports are found.
 
 config HVCS
tristate IBM Hypervisor Virtual Console Server support
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 0d328b5..3f431bc 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -9,10 +9,8 @@
  * functions.
  :*/
 
-/*M:002 The console can be flooded: while the Guest is processing input the
- * Host can send more.  Buffering in the Host could alleviate this, but it is a
- * difficult problem in general. :*/
 /* Copyright (C) 2006, 2007 Rusty Russell, IBM Corporation
+ * Copyright (C) 2009, Amit Shah, Red Hat, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -28,116 +26,424 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+
+#include linux/cdev.h
+#include linux/device.h
 #include linux/err.h
+#include linux/fs.h
 #include linux/init.h
+#include linux/poll.h
+#include linux/spinlock.h
 #include linux/virtio.h
 #include linux/virtio_ids.h
 #include linux/virtio_console.h
+#include linux/workqueue.h
 #include hvc_console.h
 
-/*D:340 These represent our input and output console queues, and the virtio
- * operations for them. */
-static struct virtqueue *in_vq, *out_vq;
-static struct virtio_device *vdev;
+/* This struct stores data that's common to all the ports */
+struct virtio_console_struct {
+   /*
+* Workqueue handlers where we process deferred work after an
+* interrupt
+*/
+   struct work_struct rx_work;
+   struct work_struct tx_work;
+   struct work_struct config_work;
 
-/* This is our input buffer, and how much data is left in it. */
-static unsigned int in_len;
-static char *in, *inbuf;
+   struct list_head port_head;
+   struct list_head unused_read_head;
+   struct list_head unused_write_head;
 
-/* The operations for our console. */
-static struct hv_ops virtio_cons;
+   /* To protect the list of unused write buffers */
+   spinlock_t write_list_lock;
 
-/* The hvc device */
-static struct hvc_struct *hvc;
+   struct virtio_device *vdev;
+   struct class *class;
+   /* The input and the output queues */
+   struct virtqueue *in_vq, *out_vq;
 
-/*D:310 The put_chars() callback is pretty straightforward.
- *
- * We turn the characters into a scatter-gather list, add it to the output
- * queue and then kick the Host.  Then we sit here waiting for it to finish:
- * inefficient in theory, but in practice implementations will do it
- * immediately (lguest's Launcher does). */
-static int put_chars(u32 vtermno, const char *buf, int count)
+   /* The current config space is stored here */
+   struct virtio_console_config *config;
+};
+
+/* This struct holds individual buffers received for each port */
+struct virtio_console_port_buffer {
+   struct list_head next;
+
+   char *buf;
+
+   size_t len; /* length of the buffer */
+   size_t offset; /* offset in the buf from which to consume data */
+};
+
+/* This struct holds the per-port data */
+struct virtio_console_port {
+   /* Next port in the list, head is in the 

[PATCH 1/5] char: Emit 'OPENED' events on char device open

2009-09-09 Thread Amit Shah
Notify users of the char interface whenever the file / connection is
opened.

The existing RESET event is triggered when the qemu char state is reset
as well; which may not be as interesting as char device open events.

Signed-off-by: Amit Shah amit.s...@redhat.com
---
 qemu-char.c |   14 +-
 qemu-char.h |1 +
 2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/qemu-char.c b/qemu-char.c
index c25ed1c..5fe882a 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -474,6 +474,8 @@ static CharDriverState *qemu_chr_open_mux(CharDriverState 
*drv)
 chr-chr_write = mux_chr_write;
 chr-chr_update_read_handler = mux_chr_update_read_handler;
 chr-chr_accept_input = mux_chr_accept_input;
+
+qemu_chr_event(chr, CHR_EVENT_OPENED);
 return chr;
 }
 
@@ -622,6 +624,7 @@ static CharDriverState *qemu_chr_open_fd(int fd_in, int 
fd_out)
 chr-chr_close = fd_chr_close;
 
 qemu_chr_reset(chr);
+qemu_chr_event(chr, CHR_EVENT_OPENED);
 
 return chr;
 }
@@ -913,8 +916,10 @@ static void pty_chr_state(CharDriverState *chr, int 
connected)
  * the virtual device linked to our pty. */
 qemu_mod_timer(s-timer, qemu_get_clock(rt_clock) + 1000);
 } else {
-if (!s-connected)
+if (!s-connected) {
 qemu_chr_reset(chr);
+qemu_chr_event(chr, CHR_EVENT_OPENED);
+}
 s-connected = 1;
 }
 }
@@ -1152,6 +1157,7 @@ static CharDriverState *qemu_chr_open_tty(const char 
*filename)
 }
 chr-chr_ioctl = tty_serial_ioctl;
 qemu_chr_reset(chr);
+qemu_chr_event(chr, CHR_EVENT_OPENED);
 return chr;
 }
 #else  /* ! __linux__  ! __sun__ */
@@ -1297,6 +1303,7 @@ static CharDriverState *qemu_chr_open_pp(const char 
*filename)
 chr-opaque = drv;
 
 qemu_chr_reset(chr);
+qemu_chr_event(chr, CHR_EVENT_OPENED);
 
 return chr;
 }
@@ -1576,6 +1583,7 @@ static CharDriverState *qemu_chr_open_win(const char 
*filename)
 return NULL;
 }
 qemu_chr_reset(chr);
+qemu_chr_event(chr, CHR_EVENT_OPENED);
 return chr;
 }
 
@@ -1675,6 +1683,7 @@ static CharDriverState *qemu_chr_open_win_pipe(const char 
*filename)
 return NULL;
 }
 qemu_chr_reset(chr);
+qemu_chr_event(chr, CHR_EVENT_OPENED);
 return chr;
 }
 
@@ -1689,6 +1698,7 @@ static CharDriverState *qemu_chr_open_win_file(HANDLE 
fd_out)
 chr-opaque = s;
 chr-chr_write = win_chr_write;
 qemu_chr_reset(chr);
+qemu_chr_event(chr, CHR_EVENT_OPENED);
 return chr;
 }
 
@@ -1823,6 +1833,7 @@ static CharDriverState *qemu_chr_open_udp(const char *def)
 chr-chr_write = udp_chr_write;
 chr-chr_update_read_handler = udp_chr_update_read_handler;
 chr-chr_close = udp_chr_close;
+qemu_chr_event(chr, CHR_EVENT_OPENED);
 return chr;
 
 return_err:
@@ -2029,6 +2040,7 @@ static void tcp_chr_connect(void *opaque)
 qemu_set_fd_handler2(s-fd, tcp_chr_read_poll,
  tcp_chr_read, NULL, chr);
 qemu_chr_reset(chr);
+qemu_chr_event(chr, CHR_EVENT_OPENED);
 }
 
 #define IACSET(x,a,b,c) x[0] = a; x[1] = b; x[2] = c;
diff --git a/qemu-char.h b/qemu-char.h
index df620bc..d725d48 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -12,6 +12,7 @@
 #define CHR_EVENT_MUX_IN  3 /* mux-focus was set to this terminal */
 #define CHR_EVENT_MUX_OUT 4 /* mux-focus will move on */
 #define CHR_EVENT_CLOSED  5 /* connection closed */
+#define CHR_EVENT_OPENED  6 /* connection opened */
 
 
 #define CHR_IOCTL_SERIAL_SET_PARAMS   1
-- 
1.6.2.5

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/5] virtio-console: Add support for multiple ports for generic guest-host communication

2009-09-09 Thread Amit Shah
This interface extends the virtio-console device to handle
multiple ports that present a char device from which bits can
be sent and read.

Sample uses for such a device can be obtaining info from the
guest like the file systems used, apps installed, etc. for
offline usage and logged-in users, clipboard copy-paste, etc.
for online usage.

Each port is to be assigned a unique function, for example, the
first 4 ports may be reserved for libvirt usage, the next 4 for
generic streaming data and so on. This port-function mapping
isn't finalised yet.

For requirements, use-cases and some history see

http://www.linux-kvm.org/page/VMchannel_Requirements

Signed-off-by: Amit Shah amit.s...@redhat.com
---
 hw/pc.c |   16 +-
 hw/virtio-console.c |  631 ++
 hw/virtio-console.h |   53 +
 monitor.c   |7 +
 qemu-monitor.hx |   10 +
 qemu-options.hx |2 +-
 sysemu.h|   10 +-
 vl.c|   41 ++--
 8 files changed, 690 insertions(+), 80 deletions(-)

diff --git a/hw/pc.c b/hw/pc.c
index a84b2d3..46751e6 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1459,11 +1459,17 @@ static void pc_init1(ram_addr_t ram_size,
 }
 
 /* Add virtio console devices */
-if (pci_enabled) {
-for(i = 0; i  MAX_VIRTIO_CONSOLES; i++) {
-if (virtcon_hds[i]) {
-pci_create_simple(pci_bus, -1, virtio-console-pci);
-}
+if (pci_enabled  virtcon_nr_ports) {
+void *dev;
+
+dev = pci_create_simple(pci_bus, -1, virtio-console-pci);
+if (!dev) {
+fprintf(stderr, qemu: could not create virtio console pci 
device\n);
+exit(1);
+}
+
+for (i = 0; i  virtcon_nr_ports; i++) {
+virtio_console_new_port(dev, virtcon_idx[i]);
 }
 }
 
diff --git a/hw/virtio-console.c b/hw/virtio-console.c
index 92c953c..135fdbb 100644
--- a/hw/virtio-console.c
+++ b/hw/virtio-console.c
@@ -2,9 +2,11 @@
  * Virtio Console Device
  *
  * Copyright IBM, Corp. 2008
+ * Copyright Red Hat, Inc. 2009
  *
  * Authors:
  *  Christian Ehrhardt ehrha...@linux.vnet.ibm.com
+ *  Amit Shah amit.s...@redhat.com
  *
  * This work is licensed under the terms of the GNU GPL, version 2.  See
  * the COPYING file in the top-level directory.
@@ -12,39 +14,262 @@
  */
 
 #include hw.h
+#include monitor.h
+#include pci.h
+#include sys-queue.h
 #include qemu-char.h
 #include virtio.h
 #include virtio-console.h
 
-
 typedef struct VirtIOConsole
 {
 VirtIODevice vdev;
 VirtQueue *ivq, *ovq;
-CharDriverState *chr;
+struct VirtIOConsolePort *ports;
+struct virtio_console_config *config;
+uint32_t guest_features;
 } VirtIOConsole;
 
-static VirtIOConsole *to_virtio_console(VirtIODevice *vdev)
+/* This struct holds individual buffers received for each port */
+typedef struct VirtIOConsolePortBuffer {
+TAILQ_ENTRY(VirtIOConsolePortBuffer) next;
+
+uint8_t *buf;
+
+size_t len; /* length of the buffer */
+
+/* The size of one write request as issued by the guest. The
+ * buffer could be split in this list but using the size value in
+ * the first buffer for each write we can identify complete
+ * writes
+ */
+size_t size;
+} VirtIOConsolePortBuffer;
+
+struct VirtIOConsolePort {
+VirtIOConsole *vcon;
+CharDriverState *hd;
+
+TAILQ_HEAD(, VirtIOConsolePortBuffer) unflushed_buffer_head;
+
+bool guest_connected;
+bool host_connected;
+};
+
+static VirtIOConsole *virtio_console;
+static struct virtio_console_config virtcon_config;
+static VirtIOConsolePort virtcon_ports[MAX_VIRTIO_CONSOLE_PORTS];
+
+static VirtIOConsolePort *get_port_from_id(uint32_t id)
+{
+if (id  MAX_VIRTIO_CONSOLE_PORTS)
+return NULL;
+
+return virtcon_ports[id];
+}
+
+static int get_id_from_port(VirtIOConsolePort *port)
+{
+uint32_t i;
+
+for (i = 0; i  MAX_VIRTIO_CONSOLE_PORTS; i++) {
+if (port == virtcon_ports[i]) {
+return i;
+}
+}
+return VIRTIO_CONSOLE_BAD_ID;
+}
+
+static bool use_multiport(void)
+{
+return virtio_console-guest_features  (1  VIRTIO_CONSOLE_F_MULTIPORT);
+}
+
+static bool is_internal(uint32_t flags)
 {
-return (VirtIOConsole *)vdev;
+return flags  VIRTIO_CONSOLE_ID_INTERNAL;
 }
 
+static bool is_console(uint32_t port_nr)
+{
+if (port_nr == VIRTIO_CONSOLE_CONSOLE_PORT ||
+port_nr == VIRTIO_CONSOLE_CONSOLE2_PORT)
+return true;
+return false;
+}
+
+void virtio_console_monitor_command(Monitor *mon,
+const char *command, const char *param)
+{
+int ret;
+
+if(!strncmp(command, add_port, 8)) {
+if (!param) {
+monitor_printf(mon, Error: need port id to add new port\n);
+return;
+}
+ret = init_virtio_console_port(virtcon_nr_ports, param);
+if (ret  0) {
+monitor_printf(mon, Error: cannot add new 

[PATCH 3/5] virtio-console: in-qemu api for open/read/write/close ports

2009-09-09 Thread Amit Shah
This is a simple-to-use api for opening a port, registering
a callback for reading stuff, writing to a port and closing
it.

Another api for hot-adding a port can be provided.

Signed-off-by: Amit Shah amit.s...@redhat.com
---
 hw/virtio-console.c |   61 --
 hw/virtio-console.h |5 
 2 files changed, 63 insertions(+), 3 deletions(-)

diff --git a/hw/virtio-console.c b/hw/virtio-console.c
index 135fdbb..9e78a9e 100644
--- a/hw/virtio-console.c
+++ b/hw/virtio-console.c
@@ -52,6 +52,11 @@ struct VirtIOConsolePort {
 
 TAILQ_HEAD(, VirtIOConsolePortBuffer) unflushed_buffer_head;
 
+/* Callback that's invoked when we have a buffer that can be consumed
+ * by an in-qemu user of this port
+ */
+size_t (*read_callback)(const uint8_t *buf, const size_t len);
+
 bool guest_connected;
 bool host_connected;
 };
@@ -150,10 +155,15 @@ static bool has_complete_data(VirtIOConsolePort *port)
 
 static size_t flush_buf(VirtIOConsolePort *port, const uint8_t *buf, size_t 
len)
 {
-if (!port-hd) {
-return 0;
+int ret;
+
+ret = 0;
+if (port-read_callback) {
+ret = port-read_callback(buf, len);
+} else if (port-hd) {
+ret = qemu_chr_write(port-hd, buf, len);
 }
-return qemu_chr_write(port-hd, buf, len);
+return ret;
 }
 
 static void flush_queue(VirtIOConsolePort *port)
@@ -431,6 +441,51 @@ static void vcon_event(void *opaque, int event)
 send_control_event(port, cpkt);
 }
 
+/* Functions for use inside qemu to open and read from/write to ports */
+VirtIOConsolePort *virtio_console_open(uint32_t id,
+   size_t(*read_callback)(const 
uint8_t*buf,
+  const size_t 
len))
+{
+VirtIOConsolePort *port = get_port_from_id(id);
+struct virtio_console_control cpkt;
+
+if (port == NULL) {
+return NULL;
+}
+/* Don't allow opening an already-open port */
+if (port-host_connected) {
+return NULL;
+}
+/* Send port open notification to the guest */
+port-host_connected = true;
+port-read_callback = read_callback;
+cpkt.event = VIRTIO_CONSOLE_PORT_OPEN;
+cpkt.value = 1;
+send_control_event(port, cpkt);
+return port;
+}
+
+void virtio_console_close(VirtIOConsolePort *port)
+{
+struct virtio_console_control cpkt;
+
+if (!port)
+return;
+
+port-read_callback = NULL;
+
+cpkt.event = VIRTIO_CONSOLE_PORT_OPEN;
+cpkt.value = 0;
+send_control_event(port, cpkt);
+}
+
+size_t virtio_console_write(VirtIOConsolePort *port, uint8_t *buf, size_t size)
+{
+if (!port || !port-host_connected) {
+return 0;
+}
+return write_to_port(port, buf, size, false);
+}
 static void virtio_console_set_port_active(uint32_t idx)
 {
 int i;
diff --git a/hw/virtio-console.h b/hw/virtio-console.h
index 56448a9..62d0c4b 100644
--- a/hw/virtio-console.h
+++ b/hw/virtio-console.h
@@ -68,5 +68,10 @@ struct virtio_console_header {
 typedef struct VirtIOConsolePort VirtIOConsolePort;
 void virtio_console_monitor_command(Monitor *mon,
 const char *command, const char *param);
+VirtIOConsolePort *virtio_console_open(uint32_t id,
+   size_t(*read_callback)(const 
uint8_t*buf,
+  const size_t 
len));
+void virtio_console_close(VirtIOConsolePort *port);
+size_t virtio_console_write(VirtIOConsolePort *port, uint8_t *buf, size_t 
size);
 
 #endif
-- 
1.6.2.5

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/5] vnc: add a is_vnc_active() helper

2009-09-09 Thread Amit Shah
This helper is introduced to query the status of vnc.

Signed-off-by: Amit Shah amit.s...@redhat.com
---
 vnc.c |   10 +-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/vnc.c b/vnc.c
index 5eaef6a..ff2d4a8 100644
--- a/vnc.c
+++ b/vnc.c
@@ -178,9 +178,17 @@ static void do_info_vnc_client(Monitor *mon, VncState 
*client)
 #endif
 }
 
-void do_info_vnc(Monitor *mon)
+static int is_vnc_active(void)
 {
 if (vnc_display == NULL || vnc_display-display == NULL) {
+return 0;
+}
+return 1;
+}
+
+void do_info_vnc(Monitor *mon)
+{
+if (!is_vnc_active()) {
 monitor_printf(mon, Server: disabled\n);
 } else {
 char *serverAddr = vnc_socket_local_addr( address: %s:%s\n,
-- 
1.6.2.5

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/5] vnc: Send / receive guest clipboard if virtio-console connected to clipboard port

2009-09-09 Thread Amit Shah
If a connection to the guest clipboard is open, send the host
clipboard to the guest and guest clipboard to the host on any
change

Signed-off-by: Amit Shah amit.s...@redhat.com
---
 hw/virtio-console.h |1 +
 vnc.c   |   33 +
 2 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/hw/virtio-console.h b/hw/virtio-console.h
index 62d0c4b..bd4c5cb 100644
--- a/hw/virtio-console.h
+++ b/hw/virtio-console.h
@@ -28,6 +28,7 @@
 /* Port number to function mapping */
 #define VIRTIO_CONSOLE_CONSOLE_PORT0
 #define VIRTIO_CONSOLE_CONSOLE2_PORT   1
+#define VIRTIO_CONSOLE_CLIPBOARD_PORT  3
 
 /* Features supported */
 #define VIRTIO_CONSOLE_F_MULTIPORT 1
diff --git a/vnc.c b/vnc.c
index ff2d4a8..19a4cca 100644
--- a/vnc.c
+++ b/vnc.c
@@ -29,6 +29,7 @@
 #include qemu_socket.h
 #include qemu-timer.h
 #include acl.h
+#include hw/virtio-console.h
 
 #define VNC_REFRESH_INTERVAL_BASE 30
 #define VNC_REFRESH_INTERVAL_INC  50
@@ -47,6 +48,7 @@
 
 static VncDisplay *vnc_display; /* needed for info vnc */
 static DisplayChangeListener *dcl;
+static VirtIOConsolePort *virtcon_port;
 
 static char *addr_to_string(const char *format,
 struct sockaddr_storage *sa,
@@ -671,6 +673,32 @@ static void vnc_copy(VncState *vs, int src_x, int src_y, 
int dst_x, int dst_y, i
 vnc_flush(vs);
 }
 
+static size_t vnc_clipboard_data_from_guest(const uint8_t *buf, size_t len)
+{
+VncState *vs;
+VncDisplay *vd;
+DisplayState *ds;
+
+if (!is_vnc_active())
+return 0;
+
+ds = vnc_display-ds;
+vd = ds-opaque;
+
+for (vs = vd-clients; vs; vs = vs-next) {
+vnc_write_u8(vs, 3);  /* ServerCutText */
+vnc_write_u8(vs, 0);  /* Padding */
+vnc_write_u8(vs, 0);  /* Padding */
+vnc_write_u8(vs, 0);  /* Padding */
+vnc_write_u32(vs, len);
+while (len--) {
+vnc_write_u8(vs, *(buf++));
+}
+vnc_flush(vs);
+}
+return len;
+}
+
 static void vnc_dpy_copy(DisplayState *ds, int src_x, int src_y, int dst_x, 
int dst_y, int w, int h)
 {
 VncDisplay *vd = ds-opaque;
@@ -1240,6 +1268,7 @@ uint32_t read_u32(uint8_t *data, size_t offset)
 
 static void client_cut_text(VncState *vs, size_t len, uint8_t *text)
 {
+virtio_console_write(virtcon_port, text, len);
 }
 
 static void check_pointer_type_change(VncState *vs, int absolute)
@@ -2265,6 +2294,7 @@ void vnc_display_close(DisplayState *ds)
 vs-subauth = VNC_AUTH_INVALID;
 vs-tls.x509verify = 0;
 #endif
+virtio_console_close(virtcon_port);
 }
 
 int vnc_display_password(DisplayState *ds, const char *password)
@@ -2514,5 +2544,8 @@ int vnc_display_open(DisplayState *ds, const char 
*display)
 vs-display = dpy;
 }
 }
+
+virtcon_port = virtio_console_open(VIRTIO_CONSOLE_CLIPBOARD_PORT,
+   vnc_clipboard_data_from_guest);
 return qemu_set_fd_handler2(vs-lsock, NULL, vnc_listen_read, NULL, vs);
 }
-- 
1.6.2.5

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: KVM: SVM: remove needless mmap_sem acquision from nested_svm_map

2009-09-09 Thread Alexander Graf


On 08.09.2009, at 19:47, Marcelo Tosatti wrote:



nested_svm_map unnecessarily takes mmap_sem around gfn_to_page, since
gfn_to_page / get_user_pages are responsible for it.


Looks good. Sorry I didn't send it out yet.

(not tested, only looked at the code)

Acked-By: Alexander Graf ag...@suse.de

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[ kvm-Bugs-2351676 ] Guests hang periodically on Ubuntu-8.10

2009-09-09 Thread SourceForge.net
Bugs item #2351676, was opened at 2008-11-26 17:59
Message generated for change (Comment added) made by jlokier
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=893831aid=2351676group_id=180599

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Chris Jones (c_jones)
Assigned to: Nobody/Anonymous (nobody)
Summary: Guests hang periodically on Ubuntu-8.10

Initial Comment:
I'm seeing periodic hangs on my guests.  I've been unable so far to find a 
trigger - they always boot fine, but after anywhere from 10 minutes to 24 hours 
they eventually hang completely.

My setup:
  * AMD Athlon X2 4850e (2500 MHz dual core)
  * 4Gig memory
  * Ubuntu 8.10 server, 64-bit
  * KVMs tried:
: kvm-72 (shipped with ubuntu)
: kvm-79 (built myself, --patched-kernel option)
  * Kernels tried:
: 2.6.27.7 (kernel.org, self built)
: 2.6.27-7-server from Ubuntu 8.10 distribution

  In guests
  * Ubuntu 8.10 server, 64-bit (virtual machine install)
  * kernel 2.6.27-7-server from Ubuntu 8.10

I'm running the guests like:
  sudo /usr/local/bin/qemu-system-x86_64\
 -daemonize \
 -no-kvm-irqchip\
 -hda Imgs/ndev_root.img\
 -m 1024\
 -cdrom ISOs/ubuntu-8.10-server-amd64.iso   \
 -vnc :4\
 -net nic,macaddr=DE:AD:BE:EF:04:04,model=e1000 \
 -net tap,ifname=tap4,script=/home/chris/kvm/qemu-ifup.sh 

The problem does not happen if I use -no-kvm.

I've tried some other options that have no effect:
  -no-kvm-pit
  -no-acpi

The disk images are raw format.

When the guests hang, I cannot ping them, and the vnc console us hung.  The 
qemu monitor is still accessible, and the guests recover if I issue a 
system_reset command from the monitor.  However, often, the console will not 
take keyboard after doing so.

When the guest is hung, kvm_stat shows all 0s for the counters:

efer_relo  exits  fpu_reloa  halt_exit  halt_wake  host_stat  hypercall
+insn_emul  insn_emul invlpg   io_exits  irq_exits  irq_windo  largepage
+mmio_exit  mmu_cache  mmu_flood  mmu_pde_z  mmu_pte_u  mmu_pte_w  mmu_recyc
+mmu_shado  nmi_windo   pf_fixed   pf_guest  remote_tl  request_i  signal_ex
+tlb_flush
  0  0  0  0  0  0  0
+0  0  0  0  0  0  0  0
+0  0  0  0  0  0  0  0
+0  0  0  0  0  0

gdb shows two threads - both waiting:

c(gdb) info threads
  2 Thread 0x414f1950 (LWP 422)  0x7f36f07a03e1 in sigtimedwait ()
   from /lib/libc.so.6
  1 Thread 0x7f36f1f306e0 (LWP 414)  0x7f36f084b482 in select ()
   from /lib/libc.so.6
(gdb) thread 1
[Switching to thread 1 (Thread 0x7f36f1f306e0 (LWP 414))]#0  0x7f36f084b482
+in select () from /lib/libc.so.6
(gdb) bt
#0  0x7f36f084b482 in select () from /lib/libc.so.6
#1  0x004094cb in main_loop_wait (timeout=0)
at /home/chris/pkgs/kvm/kvm-79/qemu/vl.c:4719
#2  0x0050a7ea in kvm_main_loop ()
at /home/chris/pkgs/kvm/kvm-79/qemu/qemu-kvm.c:619
#3  0x0040fafc in main (argc=value optimized out,
argv=0x79f41948) at /home/chris/pkgs/kvm/kvm-79/qemu/vl.c:4871
(gdb) thread 2
[Switching to thread 2 (Thread 0x414f1950 (LWP 422))]#0  0x7f36f07a03e1 in
+sigtimedwait () from /lib/libc.so.6
(gdb) bt
#0  0x7f36f07a03e1 in sigtimedwait () from /lib/libc.so.6
#1  0x0050a560 in kvm_main_loop_wait (env=0xc319e0, timeout=0)
at /home/chris/pkgs/kvm/kvm-79/qemu/qemu-kvm.c:284
#2  0x0050aaf7 in ap_main_loop (_env=value optimized out)
at /home/chris/pkgs/kvm/kvm-79/qemu/qemu-kvm.c:425
#3  0x7f36f11ba3ea in start_thread () from /lib/libpthread.so.0
#4  0x7f36f0852c6d in clone () from /lib/libc.so.6
#5  0x in ?? ()


Any clues to help me resolve this would be much appreciated.


--

Comment By: Jamie Lokier (jlokier)
Date: 2009-09-09 10:12

Message:
I'm seeing similar lockups, with kvm-88 on a quad 64-bit Xeon host which is
running Ubuntu Server 9.04, which is Ubuntu's 2.6.27-14-server kernel.

I've been doing some installs into VMs and each time it freezes a few
minutes in.  The console is still visible over VNC (I can disconnect and
reconnect, and get the picture back), but it doesn't respond to keypresses
_except_ it does respond to control-alt-Sysreq in the guest.  X is
similarly non-responsive to keyboard and mouse input.  SSH sessions hang,
but ping is still responsive.

As it's always the same guest kernel in my tests (I have 

[ kvm-Bugs-2351676 ] Guests hang periodically on Ubuntu-8.10

2009-09-09 Thread SourceForge.net
Bugs item #2351676, was opened at 2008-11-26 17:59
Message generated for change (Comment added) made by jlokier
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=893831aid=2351676group_id=180599

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Chris Jones (c_jones)
Assigned to: Nobody/Anonymous (nobody)
Summary: Guests hang periodically on Ubuntu-8.10

Initial Comment:
I'm seeing periodic hangs on my guests.  I've been unable so far to find a 
trigger - they always boot fine, but after anywhere from 10 minutes to 24 hours 
they eventually hang completely.

My setup:
  * AMD Athlon X2 4850e (2500 MHz dual core)
  * 4Gig memory
  * Ubuntu 8.10 server, 64-bit
  * KVMs tried:
: kvm-72 (shipped with ubuntu)
: kvm-79 (built myself, --patched-kernel option)
  * Kernels tried:
: 2.6.27.7 (kernel.org, self built)
: 2.6.27-7-server from Ubuntu 8.10 distribution

  In guests
  * Ubuntu 8.10 server, 64-bit (virtual machine install)
  * kernel 2.6.27-7-server from Ubuntu 8.10

I'm running the guests like:
  sudo /usr/local/bin/qemu-system-x86_64\
 -daemonize \
 -no-kvm-irqchip\
 -hda Imgs/ndev_root.img\
 -m 1024\
 -cdrom ISOs/ubuntu-8.10-server-amd64.iso   \
 -vnc :4\
 -net nic,macaddr=DE:AD:BE:EF:04:04,model=e1000 \
 -net tap,ifname=tap4,script=/home/chris/kvm/qemu-ifup.sh 

The problem does not happen if I use -no-kvm.

I've tried some other options that have no effect:
  -no-kvm-pit
  -no-acpi

The disk images are raw format.

When the guests hang, I cannot ping them, and the vnc console us hung.  The 
qemu monitor is still accessible, and the guests recover if I issue a 
system_reset command from the monitor.  However, often, the console will not 
take keyboard after doing so.

When the guest is hung, kvm_stat shows all 0s for the counters:

efer_relo  exits  fpu_reloa  halt_exit  halt_wake  host_stat  hypercall
+insn_emul  insn_emul invlpg   io_exits  irq_exits  irq_windo  largepage
+mmio_exit  mmu_cache  mmu_flood  mmu_pde_z  mmu_pte_u  mmu_pte_w  mmu_recyc
+mmu_shado  nmi_windo   pf_fixed   pf_guest  remote_tl  request_i  signal_ex
+tlb_flush
  0  0  0  0  0  0  0
+0  0  0  0  0  0  0  0
+0  0  0  0  0  0  0  0
+0  0  0  0  0  0

gdb shows two threads - both waiting:

c(gdb) info threads
  2 Thread 0x414f1950 (LWP 422)  0x7f36f07a03e1 in sigtimedwait ()
   from /lib/libc.so.6
  1 Thread 0x7f36f1f306e0 (LWP 414)  0x7f36f084b482 in select ()
   from /lib/libc.so.6
(gdb) thread 1
[Switching to thread 1 (Thread 0x7f36f1f306e0 (LWP 414))]#0  0x7f36f084b482
+in select () from /lib/libc.so.6
(gdb) bt
#0  0x7f36f084b482 in select () from /lib/libc.so.6
#1  0x004094cb in main_loop_wait (timeout=0)
at /home/chris/pkgs/kvm/kvm-79/qemu/vl.c:4719
#2  0x0050a7ea in kvm_main_loop ()
at /home/chris/pkgs/kvm/kvm-79/qemu/qemu-kvm.c:619
#3  0x0040fafc in main (argc=value optimized out,
argv=0x79f41948) at /home/chris/pkgs/kvm/kvm-79/qemu/vl.c:4871
(gdb) thread 2
[Switching to thread 2 (Thread 0x414f1950 (LWP 422))]#0  0x7f36f07a03e1 in
+sigtimedwait () from /lib/libc.so.6
(gdb) bt
#0  0x7f36f07a03e1 in sigtimedwait () from /lib/libc.so.6
#1  0x0050a560 in kvm_main_loop_wait (env=0xc319e0, timeout=0)
at /home/chris/pkgs/kvm/kvm-79/qemu/qemu-kvm.c:284
#2  0x0050aaf7 in ap_main_loop (_env=value optimized out)
at /home/chris/pkgs/kvm/kvm-79/qemu/qemu-kvm.c:425
#3  0x7f36f11ba3ea in start_thread () from /lib/libpthread.so.0
#4  0x7f36f0852c6d in clone () from /lib/libc.so.6
#5  0x in ?? ()


Any clues to help me resolve this would be much appreciated.


--

Comment By: Jamie Lokier (jlokier)
Date: 2009-09-09 11:05

Message:
Now I tried with the kvm-88 modules too, and it had one of these freezes
within seconds - as soon as I do dd if=/dev/zero of=/dev/vda bs=512
count=1 to a virtio-blk device...  (Root device is IDE).  ps shows the dd
process stuck in sync_page.

SSH, console and X are still working though.  This isn't the same as
lockups using the older modules, but it has an interesting similarity: the
older modules and the current ones both get stuck in sync_page.

I tried the same with an IDE device instead of virtio-blk, and the dd
succeeded, but then an attempt to created a partition on the disk 

[ kvm-Bugs-2351676 ] Guests hang periodically on Ubuntu-8.10

2009-09-09 Thread SourceForge.net
Bugs item #2351676, was opened at 2008-11-26 17:59
Message generated for change (Comment added) made by jlokier
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=893831aid=2351676group_id=180599

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Chris Jones (c_jones)
Assigned to: Nobody/Anonymous (nobody)
Summary: Guests hang periodically on Ubuntu-8.10

Initial Comment:
I'm seeing periodic hangs on my guests.  I've been unable so far to find a 
trigger - they always boot fine, but after anywhere from 10 minutes to 24 hours 
they eventually hang completely.

My setup:
  * AMD Athlon X2 4850e (2500 MHz dual core)
  * 4Gig memory
  * Ubuntu 8.10 server, 64-bit
  * KVMs tried:
: kvm-72 (shipped with ubuntu)
: kvm-79 (built myself, --patched-kernel option)
  * Kernels tried:
: 2.6.27.7 (kernel.org, self built)
: 2.6.27-7-server from Ubuntu 8.10 distribution

  In guests
  * Ubuntu 8.10 server, 64-bit (virtual machine install)
  * kernel 2.6.27-7-server from Ubuntu 8.10

I'm running the guests like:
  sudo /usr/local/bin/qemu-system-x86_64\
 -daemonize \
 -no-kvm-irqchip\
 -hda Imgs/ndev_root.img\
 -m 1024\
 -cdrom ISOs/ubuntu-8.10-server-amd64.iso   \
 -vnc :4\
 -net nic,macaddr=DE:AD:BE:EF:04:04,model=e1000 \
 -net tap,ifname=tap4,script=/home/chris/kvm/qemu-ifup.sh 

The problem does not happen if I use -no-kvm.

I've tried some other options that have no effect:
  -no-kvm-pit
  -no-acpi

The disk images are raw format.

When the guests hang, I cannot ping them, and the vnc console us hung.  The 
qemu monitor is still accessible, and the guests recover if I issue a 
system_reset command from the monitor.  However, often, the console will not 
take keyboard after doing so.

When the guest is hung, kvm_stat shows all 0s for the counters:

efer_relo  exits  fpu_reloa  halt_exit  halt_wake  host_stat  hypercall
+insn_emul  insn_emul invlpg   io_exits  irq_exits  irq_windo  largepage
+mmio_exit  mmu_cache  mmu_flood  mmu_pde_z  mmu_pte_u  mmu_pte_w  mmu_recyc
+mmu_shado  nmi_windo   pf_fixed   pf_guest  remote_tl  request_i  signal_ex
+tlb_flush
  0  0  0  0  0  0  0
+0  0  0  0  0  0  0  0
+0  0  0  0  0  0  0  0
+0  0  0  0  0  0

gdb shows two threads - both waiting:

c(gdb) info threads
  2 Thread 0x414f1950 (LWP 422)  0x7f36f07a03e1 in sigtimedwait ()
   from /lib/libc.so.6
  1 Thread 0x7f36f1f306e0 (LWP 414)  0x7f36f084b482 in select ()
   from /lib/libc.so.6
(gdb) thread 1
[Switching to thread 1 (Thread 0x7f36f1f306e0 (LWP 414))]#0  0x7f36f084b482
+in select () from /lib/libc.so.6
(gdb) bt
#0  0x7f36f084b482 in select () from /lib/libc.so.6
#1  0x004094cb in main_loop_wait (timeout=0)
at /home/chris/pkgs/kvm/kvm-79/qemu/vl.c:4719
#2  0x0050a7ea in kvm_main_loop ()
at /home/chris/pkgs/kvm/kvm-79/qemu/qemu-kvm.c:619
#3  0x0040fafc in main (argc=value optimized out,
argv=0x79f41948) at /home/chris/pkgs/kvm/kvm-79/qemu/vl.c:4871
(gdb) thread 2
[Switching to thread 2 (Thread 0x414f1950 (LWP 422))]#0  0x7f36f07a03e1 in
+sigtimedwait () from /lib/libc.so.6
(gdb) bt
#0  0x7f36f07a03e1 in sigtimedwait () from /lib/libc.so.6
#1  0x0050a560 in kvm_main_loop_wait (env=0xc319e0, timeout=0)
at /home/chris/pkgs/kvm/kvm-79/qemu/qemu-kvm.c:284
#2  0x0050aaf7 in ap_main_loop (_env=value optimized out)
at /home/chris/pkgs/kvm/kvm-79/qemu/qemu-kvm.c:425
#3  0x7f36f11ba3ea in start_thread () from /lib/libpthread.so.0
#4  0x7f36f0852c6d in clone () from /lib/libc.so.6
#5  0x in ?? ()


Any clues to help me resolve this would be much appreciated.


--

Comment By: Jamie Lokier (jlokier)
Date: 2009-09-09 11:09

Message:
I should clarify that last comment, because some text went missing.

When I wrote about lockups within 20 minutes, X non-responsive, SSH
non-responsive etc., that was using kvm-88 userspace, but the kvm modules
which shipped with the distro kernel.

When I was able to unload those modules (which had to wait until other
users weren't using KVM), I tried the out of tree compiled modules which
come with the kvm-88 source tree, and that's when I found I couldn't even
manage a simple bit of writing to one of my disks without SCSI SENSE errors
and I/O errors reaching the application (if using 

Re: Modifying RAM during runtime on guest

2009-09-09 Thread Daniel Bareiro
Hi Brian.

On Tuesday, 08 September 2009 16:18:09 -0500,
Brian Jackson wrote:

  I'm trying to modify the amount of RAM that has some of guests. Host
  has 2.6.30 kernel with KVM-88.
  
  In one of guest I didn't have problems when decreasing the amount of
  memory from 3584 MIB to 1024 MiB. This guest has 2.6.26-2-686 stock
  kernel. Also I was trying to decrease the amount RAM of another guest
  from 3584 MiB to 2048 MiB, but it didn't work. This other guest has
  2.6.24-etchnhalf.1-686-bigmem stock kernel. Does Ballooning in guest
  require 2.6.25 or superior?

 I don't know, if that kernel has a virtio-balloon driver, I'd think that
 was all you need to balloon memory.

Then can be that it is related to kernel that is using the guest:

# uname -a
Linux aprender01 2.6.24-etchnhalf.1-686-bigmem #1 SMP Mon Jul 27 03:56:49 UTC 
2009 i686 GNU/Linux

# cat config-2.6.24-etchnhalf.1-686-bigmem | grep -i virtio
#

  Thinking that it could be an impediment related to the kernel version
  of guest, I tried to increase the memory of another one guest with
  2.6.26-2-686 from 512 MIB to 1024 MIB, but this didn't work either.

 You can only grow memory up to the amount you specified on the command
 line if you've already ballooned down.

Good. Thanks for clarifying to me this detail.

 So if you specify -m 1024M on the command line, then shrink it to 512,
 you could then balloon it back up to a max of 1024.

According to the tests that I was doing in guest with kernel with support
for virtio, shrinking works, but when trying to return to the amount of
initial memory, seems that it fails and I lose connectivity by serial
console and ssh.

In the guest:

# uname -a
Linux central 2.6.26-2-amd64 #1 SMP Sun Jul 26 20:35:48 UTC 2009 x86_64 
GNU/Linux

# cat config-2.6.26-2-amd64 | grep -i virtio
CONFIG_NET_9P_VIRTIO=m
CONFIG_VIRTIO_BLK=m
CONFIG_VIRTIO_NET=m
CONFIG_HW_RANDOM_VIRTIO=m
CONFIG_VIRTIO=m
CONFIG_VIRTIO_RING=m
CONFIG_VIRTIO_PCI=m
CONFIG_VIRTIO_BALLOON=m

In the host:

# telnet localhost 4045
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
QEMU 0.10.50 monitor - type 'help' for more information
(qemu)
(qemu) info balloon
balloon: actual=512
(qemu) balloon 256
(qemu) info balloon
balloon: actual=256
(qemu)
(qemu) balloon 512
(qemu) info balloon
balloon: actual=36

At this moment I'm unable to connect by serial console to the guest and the
ssh sessions are freeze nevertheless kvm process of the guest is running.
Using a VNC client I see several messages of this type in the guest:

Out of memory: kill process  (name) score xx or a child
Killed process  (name)

Finally:

Kernel panic - not syncing - Out of memory and no killable processes...



Thanks for your reply.

Regards,
Daniel
-- 
Fingerprint: BFB3 08D6 B4D1 31B2 72B9  29CE 6696 BF1B 14E6 1D37
Powered by Debian GNU/Linux Squeeze - Linux user #188.598


signature.asc
Description: Digital signature


[PATCH] Use propeer way to compile with HELPER_CFLAGS

2009-09-09 Thread Juan Quintela
This makes the build quiet.

Signed-off-by: Juan Quintela quint...@redhat.com
---
 Makefile.target |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/Makefile.target b/Makefile.target
index 221cc2f..1d0fa11 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -91,9 +91,7 @@ op_helper.o cpu-exec.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
 # cpu_signal_handler() in cpu-exec.c.
 signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS)

-qemu-kvm-helper.o: qemu-kvm-helper.c
-   $(CC) $(HELPER_CFLAGS) $(QEMU_CFLAGS) $(CFLAGS) -c -o $@ $
-
+qemu-kvm-helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)

 #
 # Linux user emulator target
-- 
1.6.2.5

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


qemu-kvm: kqemu - R.I.P.

2009-09-09 Thread Jan Kiszka
Signed-off-by: Jan Kiszka jan.kis...@siemens.com

diff --git a/configure b/configure
index c4231a5..309f8ae 100755
--- a/configure
+++ b/configure
@@ -359,7 +359,6 @@ AIX)
   if [ $cpu = i386 -o $cpu = x86_64 ] ; then
 audio_possible_drivers=$audio_possible_drivers fmod
 kvm=yes
-kqemu=no
   fi
   if [ $cpu = ia64 ] ; then
  kvm=yes

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-commits] [COMMIT ddd9bbd] Support for multiple -monitor devices

2009-09-09 Thread Avi Kivity

On 09/04/2009 05:43 PM, Anthony Liguori wrote:

From: Jan Kiszkajan.kis...@siemens.com

Rebased version of Anthony's patch: Allow to specify more than one
monitor terminal via the -monitor command line switch. This is
particularly useful when libvirt or some other management tool already
occupies the primary monitor but you need another one for debugging.
The current clumsy workaround is to multiplex such additional terminals
over a qemu character device (e.g. -serial mon:device).

   


This (as merged into kvm-next) breaks autotest.  Autotest starts 
qemu-kvm with -monitor unix:/tmp/blah,server,nowait; with this patch it 
no longer opens the socket (as seen with lsof).  I haven't yet found out 
why.


--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html