[COMMIT master] Use proper way to compile with HELPER_CFLAGS

2009-09-12 Thread Avi Kivity
From: Juan Quintela quint...@redhat.com

This makes the build quiet.

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

diff --git a/Makefile.target b/Makefile.target
index fc8f8f7..4a24d90 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
--
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] Remove reference to kqemu

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

It is gone.

Signed-off-by: Jan Kiszka jan.kis...@siemens.com
Signed-off-by: Avi Kivity a...@redhat.com

diff --git a/configure b/configure
index 199e269..4e08ca2 100755
--- a/configure
+++ b/configure
@@ -360,7 +360,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-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] Sync halt state into env

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

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

Signed-off-by: Gleb Natapov g...@redhat.com
Signed-off-by: Avi Kivity a...@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)
--
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-12 Thread Avi Kivity
From: Avi Kivity a...@redhat.com

* upstream-merge: (59 commits)
  Fix VMSTATE_PCI_DEVICE version
  qemu-kvm: fix segfault when running kvm without /dev/kvm, falling back to 
non-accelerated mode
  don't call cpu_sychronize_state from reset handlers
  configure: fix Linux AIO detection
  RTC polling mode broken
  Fix compilation warnings when DEBUG_BUFFERED_FILE is defined
  qcow2: Order concurrent AIO requests on the same unallocated cluster
  qcow2: Fix metadata preallocation
  fix VNC SASL detection
  optionrom: make clean should remove raw and .d
  otionrom: Use local CFLAGS no global one
  Remove CFLAGS parameter in cc-option
  Fix for commit 3f9cb1c14dc368f41447db5f78d6248c4f100ad4
  mv from strdup to qemu_strdup in qemu-option.c
  mv strdup to qemu_strdup in vl.c
  fix vl.c compilation if CONFIG_KVM is not defined
  fix PATH_MAX conditional compilation
  eepro100: Clean code which sets the PCI device id
  qemu-io: Improve portability (win32 now supported).
  Fix spelling in comment.
  ...

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] Call kvm_cpu_synchronize_state() on target vcpu

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

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
Signed-off-by: Avi Kivity a...@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
--
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] Revert don't call cpu_sychronize_state from reset handlers

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

This reverts commit 733318ea9 - breaks system_reset.

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

diff --git a/hw/apic.c b/hw/apic.c
index 8cdbf51..68e5de3 100644
--- a/hw/apic.c
+++ b/hw/apic.c
@@ -1066,6 +1066,8 @@ static void apic_reset(void *opaque)
 APICState *s = opaque;
 int bsp;
 
+cpu_synchronize_state(s-cpu_env);
+
 bsp = cpu_is_bsp(s-cpu_env);
 s-apicbase = 0xfee0 |
 (bsp ? MSR_IA32_APICBASE_BSP : 0) | MSR_IA32_APICBASE_ENABLE;
diff --git a/vl.c b/vl.c
index 4d24574..4d186e5 100644
--- a/vl.c
+++ b/vl.c
@@ -3737,12 +3737,10 @@ static void *kvm_cpu_thread_fn(void *arg)
 while (!qemu_system_ready)
 qemu_cond_timedwait(qemu_system_cond, qemu_global_mutex, 100);
 
-cpu_synchronize_state(env);
-
 while (1) {
-qemu_wait_io_event(env);
 if (cpu_can_run(env))
 qemu_cpu_exec(env);
+qemu_wait_io_event(env);
 }
 
 return NULL;
@@ -3767,9 +3765,6 @@ static void *tcg_cpu_thread_fn(void *arg)
 while (!qemu_system_ready)
 qemu_cond_timedwait(qemu_system_cond, qemu_global_mutex, 100);
 
-for (env = first_cpu; env != NULL; env = env-next_cpu) {
-cpu_synchronize_state(env);
-}
 while (1) {
 tcg_cpu_exec();
 qemu_wait_io_event(cur_cpu);
--
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] Fix --disable-kvm build regression due to mp_state

2009-09-12 Thread Avi Kivity
From: Daniel Gollub gol...@b1-systems.de

qemu-kvm --disable-kvm build regression of commit 8c7d4cb spotted by
qemu-kvm buildbot:

/var/lib/buildbot/qemu-kvm/disable_kvm_i386_debian_5_0/build/qemu-kvm.h: In 
function 'kvm_arch_get_registers':
/var/lib/buildbot/qemu-kvm/disable_kvm_i386_debian_5_0/build/qemu-kvm.h:1160: 
error: 'KVM_MP_STATE_HALTED' undeclared (first use in this function)
/var/lib/buildbot/qemu-kvm/disable_kvm_i386_debian_5_0/build/qemu-kvm.h:1160: 
error: (Each undeclared identifier is reported only once
/var/lib/buildbot/qemu-kvm/disable_kvm_i386_debian_5_0/build/qemu-kvm.h:1160: 
error: for each function it appears in.)
make[1]: *** [vl.o] Error 1

Signed-off-by: Daniel Gollub gol...@b1-systems.de
Signed-off-by: Avi Kivity a...@redhat.com

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)
--
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] Fix warnings with USE_KVM_DEVICE_ASSIGNMENT disabled

2009-09-12 Thread Avi Kivity
From: Daniel Gollub gol...@b1-systems.de

/var/lib/buildbot/qemu-kvm/default_x86_64_debian_5_0/build/qemu-kvm-x86.c:1635: 
warning: no previous prototype for 'kvm_arch_do_ioperm'
/var/lib/buildbot/qemu-kvm/default_x86_64_debian_5_0/build/qemu-kvm.c:1832: 
warning: unused variable 'data'
/var/lib/buildbot/qemu-kvm/default_x86_64_debian_5_0/build/qemu-kvm.c:70: 
warning: 'ioperm_head' defined but not used


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

--
 qemu-kvm.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)
Signed-off-by: Avi Kivity a...@redhat.com

diff --git a/qemu-kvm.c b/qemu-kvm.c
index e2f3b91..78eeb6f 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -66,8 +66,10 @@ static CPUState *kvm_debug_cpu_requested;
 
 static uint64_t phys_ram_size;
 
+#ifdef USE_KVM_DEVICE_ASSIGNMENT
 /* The list of ioperm_data */
 static LIST_HEAD(, ioperm_data) ioperm_head;
+#endif
 
 //#define DEBUG_MEMREG
 #ifdef DEBUG_MEMREG
@@ -1829,7 +1831,9 @@ static void *ap_main_loop(void *_env)
 {
 CPUState *env = _env;
 sigset_t signals;
+#ifdef USE_KVM_DEVICE_ASSIGNMENT
 struct ioperm_data *data = NULL;
+#endif
 
 current_env = env;
 env-thread_id = kvm_get_thread_id();
--
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: correct error-handling code

2009-09-12 Thread Avi Kivity
From: Julia Lawall ju...@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

Signed-off-by: Julia Lawall ju...@diku.dk
Signed-off-by: Avi Kivity a...@redhat.com

diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index 95954ad..30f70fd 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -228,7 +228,7 @@ fail:
if (eventfd  !IS_ERR(eventfd))
eventfd_ctx_put(eventfd);
 
-   if (file  !IS_ERR(file))
+   if (!IS_ERR(file))
fput(file);
 
kfree(irqfd);
--
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] MAINTAINERS: update KVM entry

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

Add myself to KVM MAINTAINERS entry.

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

diff --git a/MAINTAINERS b/MAINTAINERS
index 8dca9d8..24f2694 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2928,6 +2928,7 @@ F:include/linux/sunrpc/
 
 KERNEL VIRTUAL MACHINE (KVM)
 M: Avi Kivity a...@redhat.com
+M: Marcelo Tosatti mtosa...@redhat.com
 L: k...@vger.kernel.org
 W: http://kvm.qumranet.com
 S: Supported
--
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: drop duplicate kvm_flush_remote_tlb calls

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

kvm_mmu_slot_remove_write_access already calls it.

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

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 9e3acbd..1d454d9 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2159,7 +2159,6 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
spin_lock(kvm-mmu_lock);
kvm_mmu_slot_remove_write_access(kvm, log-slot);
spin_unlock(kvm-mmu_lock);
-   kvm_flush_remote_tlbs(kvm);
memslot = kvm-memslots[log-slot];
n = ALIGN(memslot-npages, BITS_PER_LONG) / 8;
memset(memslot-dirty_bitmap, 0, n);
@@ -4899,7 +4898,6 @@ int kvm_arch_set_memory_region(struct kvm *kvm,
 
kvm_mmu_slot_remove_write_access(kvm, mem-slot);
spin_unlock(kvm-mmu_lock);
-   kvm_flush_remote_tlbs(kvm);
 
return 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: SVM: remove needless mmap_sem acquision from nested_svm_map

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

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

Signed-off-by: Marcelo Tosatti mtosa...@redhat.com
Acked-by: Alexander Graf ag...@suse.de
Signed-off-by: Avi Kivity a...@redhat.com

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index a5f90c7..a2f2d43 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1394,10 +1394,7 @@ static void *nested_svm_map(struct vcpu_svm *svm, u64 
gpa, enum km_type idx)
 {
struct page *page;
 
-   down_read(current-mm-mmap_sem);
page = gfn_to_page(svm-vcpu.kvm, gpa  PAGE_SHIFT);
-   up_read(current-mm-mmap_sem);
-
if (is_error_page(page))
goto error;
 
--
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: [PATCH 2/3] add SPTE_HOST_WRITEABLE flag to the shadow ptes

2009-09-12 Thread Izik Eidus

Marcelo Tosatti wrote:

On Thu, Sep 10, 2009 at 07:38:57PM +0300, Izik Eidus wrote:
  

this flag notify that the host physical page we are pointing to from
the spte is write protected, and therefore we cant change its access
to be write unless we run get_user_pages(write = 1).

(this is needed for change_pte support in kvm)

Signed-off-by: Izik Eidus iei...@redhat.com
---
 arch/x86/kvm/mmu.c |   15 +++
 arch/x86/kvm/paging_tmpl.h |   18 +++---
 2 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 62d2f86..a7151b8 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -156,6 +156,8 @@ module_param(oos_shadow, bool, 0644);
 #define CREATE_TRACE_POINTS
 #include mmutrace.h
 
+#define SPTE_HOST_WRITEABLE (1ULL  PT_FIRST_AVAIL_BITS_SHIFT)

+
 #define SHADOW_PT_INDEX(addr, level) PT64_INDEX(addr, level)
 
 struct kvm_rmap_desc {

@@ -1754,7 +1756,7 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep,
unsigned pte_access, int user_fault,
int write_fault, int dirty, int level,
gfn_t gfn, pfn_t pfn, bool speculative,
-   bool can_unsync)
+   bool can_unsync, bool reset_host_protection)


 bool host_pte_writeable ?

  


Sure.

--
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: Poor network performance with cable modem assigned to guest

2009-09-12 Thread Jon Fairbairn
Jim Paris j...@jtan.com writes:

 Jon Fairbairn wrote:
 Brian Jackson i...@theiggy.com writes:
 
  On Friday 28 August 2009 01:14:42 pm Jon Fairbairn wrote:
  The setup was done through virt-manager. The network between the host
  and guest is a virtual bridge. What I've been trying to do is to assign
  a USB cable modem to the guest,
 
 
  This is probably your problem here. KVM only emulates a usb1.1
  controller,
 
 that shouldn't be a problem as the cable modem is only a usb 1.1 device.
 
  and from all reports, it doesn't really do that very well.
 
 Not very well? We're talking about a factor of *FIFTY* slow down here.
 If I'd implemented the driver in a 1980s lazy functional language I
 would have only expected a factor of ten :-P ;-).

 I don't have any specific answers, but you might be able to get some
 more info by uncomenting the //#define DEBUG in kvm's usb-linux.c.
 You might also try capturing the USB traffic (e.g. with wireshark)

Thanks for your comments; I was waiting for a time when the network
wasn't in constant use to try some experiminents, but unfortunately my
ISP has replaced the cable modem with a newer version that doesn't have
a USB port, so I have to abandon this approach anyway.

[Assigning a physical PCI device to a kvm guest doesn't work with 
AMD Athlon(tm) 64 X2 Dual Core Processor 4400+
does it?]

-- 
Jón Fairbairn jon.fairba...@cl.cam.ac.uk

--
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 default_x86_64_out_of_tree

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

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

Buildslave for this Build: b1_qemu_kvm_1

Build Reason: 
Build Source Stamp: [branch master] HEAD
Blamelist: Avi Kivity a...@redhat.com,Bernhard Kauer 
ka...@os.inf.tu-dresden.de,Daniel Gollub gol...@b1-systems.de,Dustin 
Kirkland kirkl...@canonical.com,Gerd Hoffmann kra...@redhat.com,Glauber 
Costa glom...@redhat.com,Gleb Natapov g...@redhat.com,Jan Kiszka 
jan.kis...@siemens.com,Jean-Christophe DUBOIS j...@tribudubois.net,Juan 
Quintela quint...@redhat.com,Kevin Wolf kw...@redhat.com,Luiz Capitulino 
lcapitul...@redhat.com,Naphtali Sprei nsp...@redhat.com,Pierre Riteau 
pierre.rit...@irisa.fr,Stefan Weil w...@mail.berlios.de

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


Re: losing mouse location with vnc

2009-09-12 Thread Kenni Lund
2009/9/12 Ross Boylan r...@biostat.ucsf.edu:
 When I try to use a (Linux) VM via vnc there appear to be two mouse
 locations at once.  One is the pointer displayed on the screen; the
 other is the shown as a little box by krdc when I select always show
 local cursor in the krdc menu.  It also appears when I use
 xtightvncviewer.

Try using -usbdevice tablet as an argument to the QEMU/KVM
executable, it will most likely fix your problem.

--
Kenni
--
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


Proxmox VE 1.4beta1 released

2009-09-12 Thread Martin Maurer
Hi all,

We just released Proxmox VE 1.4beta1 - KVM live-migration is working great as 
its now possible to configure NFS, iSCSI, DRBD, LVM with just a view clicks 
(for DRBD, you still need to do the first config on CLI)

All info: http://www.proxmox.com/forum/showthread.php?t=2066

Best Regards,

Martin Maurer

mar...@proxmox.com
http://www.proxmox.com


Proxmox Server Solutions GmbH
Kohlgasse 51/10, 1050 Vienna, Austria
Phone: +43 1 545 4497 11 Fax: +43 1 545 4497 22
Commercial register no.: FN 258879 f
Registration office: Handelsgericht Wien

--
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 3/3] add support for change_pte mmu notifiers

2009-09-12 Thread Marcelo Tosatti
On Sat, Sep 12, 2009 at 09:41:10AM +0300, Izik Eidus wrote:
 Marcelo Tosatti wrote:
 On Thu, Sep 10, 2009 at 07:38:58PM +0300, Izik Eidus wrote:
   
 this is needed for kvm if it want ksm to directly map pages into its
 shadow page tables.

 Signed-off-by: Izik Eidus iei...@redhat.com
 ---
  arch/x86/include/asm/kvm_host.h |1 +
  arch/x86/kvm/mmu.c  |   70 
 ++
  virt/kvm/kvm_main.c |   14 
  3 files changed, 77 insertions(+), 8 deletions(-)

 diff --git a/arch/x86/include/asm/kvm_host.h 
 b/arch/x86/include/asm/kvm_host.h
 index 6046e6f..594d131 100644
 --- a/arch/x86/include/asm/kvm_host.h
 +++ b/arch/x86/include/asm/kvm_host.h
 @@ -797,6 +797,7 @@ asmlinkage void kvm_handle_fault_on_reboot(void);
  #define KVM_ARCH_WANT_MMU_NOTIFIER
  int kvm_unmap_hva(struct kvm *kvm, unsigned long hva);
  int kvm_age_hva(struct kvm *kvm, unsigned long hva);
 +void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
  int cpuid_maxphyaddr(struct kvm_vcpu *vcpu);
  int kvm_cpu_has_interrupt(struct kvm_vcpu *vcpu);
  int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu);
 diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
 index a7151b8..3fd19f2 100644
 --- a/arch/x86/kvm/mmu.c
 +++ b/arch/x86/kvm/mmu.c
 @@ -282,6 +282,11 @@ static pfn_t spte_to_pfn(u64 pte)
 return (pte  PT64_BASE_ADDR_MASK)  PAGE_SHIFT;
  }
  +static pte_t ptep_val(pte_t *ptep)
 +{
 +   return *ptep;
 +}
 +
  static gfn_t pse36_gfn_delta(u32 gpte)
  {
 int shift = 32 - PT32_DIR_PSE36_SHIFT - PAGE_SHIFT;
 @@ -748,7 +753,8 @@ static int rmap_write_protect(struct kvm *kvm, u64 gfn)
 return write_protected;
  }
  -static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp)
 +static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp,
 +  unsigned long data)
  {
 u64 *spte;
 int need_tlb_flush = 0;
 @@ -763,8 +769,48 @@ static int kvm_unmap_rmapp(struct kvm *kvm, unsigned 
 long *rmapp)
 return need_tlb_flush;
  }
  +static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp,
 +unsigned long data)
 +{
 +   int need_flush = 0;
 +   u64 *spte, new_spte;
 +   pte_t *ptep = (pte_t *)data;
 +   pfn_t new_pfn;
 +
 +   new_pfn = pte_pfn(ptep_val(ptep));
 +   spte = rmap_next(kvm, rmapp, NULL);
 +   while (spte) {
 +   BUG_ON(!is_shadow_present_pte(*spte));
 +   rmap_printk(kvm_set_pte_rmapp: spte %p %llx\n, spte, *spte);
 +   need_flush = 1;
 +   if (pte_write(ptep_val(ptep))) {
 +   rmap_remove(kvm, spte);
 +   __set_spte(spte, shadow_trap_nonpresent_pte);
 +   spte = rmap_next(kvm, rmapp, NULL);
 +   } else {
 +   new_spte = *spte ~ (PT64_BASE_ADDR_MASK);
 +   new_spte |= new_pfn  PAGE_SHIFT;
 +
 +   if (!pte_write(ptep_val(ptep))) {
 +   new_spte = ~PT_WRITABLE_MASK;
 +   new_spte = ~SPTE_HOST_WRITEABLE;
 +   if (is_writeble_pte(*spte))
 +   kvm_set_pfn_dirty(spte_to_pfn(*spte));
 +   }
 +   __set_spte(spte, new_spte);
 +   spte = rmap_next(kvm, rmapp, spte);
 +   }
 +   }
 +   if (need_flush)
 +   kvm_flush_remote_tlbs(kvm);
 +
 +   return 0;
 +}
 +
  static int kvm_handle_hva(struct kvm *kvm, unsigned long hva,
 - int (*handler)(struct kvm *kvm, unsigned long *rmapp))
 + unsigned long data,
 + int (*handler)(struct kvm *kvm, unsigned long *rmapp,
 +unsigned long data))
  {
 int i, j;
 int retval = 0;
 @@ -786,13 +832,15 @@ static int kvm_handle_hva(struct kvm *kvm, unsigned 
 long hva,
 if (hva = start  hva  end) {
 gfn_t gfn_offset = (hva - start)  PAGE_SHIFT;
  -  retval |= handler(kvm, memslot-rmap[gfn_offset]);
 +   retval |= handler(kvm, memslot-rmap[gfn_offset],
 + data);
 for (j = 0; j  KVM_NR_PAGE_SIZES - 1; ++j) {
 int idx = gfn_offset;
 idx /= KVM_PAGES_PER_HPAGE(PT_DIRECTORY_LEVEL + 
 j);
 retval |= handler(kvm,
 -   memslot-lpage_info[j][idx].rmap_pde);
 +   memslot-lpage_info[j][idx].rmap_pde,
 +   data);
 

 If change_pte is called to modify a largepage pte, and the shadow has
 that largepage mapped with 4k sptes, you'll set the wrong pfn. That is,
 the patch does not attempt to handle different page sizes properly.

 So either disable change_pte updates to non-4k host vmas (making it
 explictly it does not handle different pagesizes), or handle largepages
 properly, 

Re: [PATCH 3/3] add support for change_pte mmu notifiers

2009-09-12 Thread Izik Eidus

Marcelo Tosatti wrote:

On Sat, Sep 12, 2009 at 09:41:10AM +0300, Izik Eidus wrote:
  

Marcelo Tosatti wrote:


On Thu, Sep 10, 2009 at 07:38:58PM +0300, Izik Eidus wrote:
  
  

this is needed for kvm if it want ksm to directly map pages into its
shadow page tables.

Signed-off-by: Izik Eidus iei...@redhat.com
---
 arch/x86/include/asm/kvm_host.h |1 +
 arch/x86/kvm/mmu.c  |   70 ++
 virt/kvm/kvm_main.c |   14 
 3 files changed, 77 insertions(+), 8 deletions(-)

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 6046e6f..594d131 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -797,6 +797,7 @@ asmlinkage void kvm_handle_fault_on_reboot(void);
 #define KVM_ARCH_WANT_MMU_NOTIFIER
 int kvm_unmap_hva(struct kvm *kvm, unsigned long hva);
 int kvm_age_hva(struct kvm *kvm, unsigned long hva);
+void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
 int cpuid_maxphyaddr(struct kvm_vcpu *vcpu);
 int kvm_cpu_has_interrupt(struct kvm_vcpu *vcpu);
 int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu);
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index a7151b8..3fd19f2 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -282,6 +282,11 @@ static pfn_t spte_to_pfn(u64 pte)
return (pte  PT64_BASE_ADDR_MASK)  PAGE_SHIFT;
 }
 +static pte_t ptep_val(pte_t *ptep)
+{
+   return *ptep;
+}
+
 static gfn_t pse36_gfn_delta(u32 gpte)
 {
int shift = 32 - PT32_DIR_PSE36_SHIFT - PAGE_SHIFT;
@@ -748,7 +753,8 @@ static int rmap_write_protect(struct kvm *kvm, u64 gfn)
return write_protected;
 }
 -static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp)
+static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp,
+  unsigned long data)
 {
u64 *spte;
int need_tlb_flush = 0;
@@ -763,8 +769,48 @@ static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long 
*rmapp)
return need_tlb_flush;
 }
 +static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp,
+unsigned long data)
+{
+   int need_flush = 0;
+   u64 *spte, new_spte;
+   pte_t *ptep = (pte_t *)data;
+   pfn_t new_pfn;
+
+   new_pfn = pte_pfn(ptep_val(ptep));
+   spte = rmap_next(kvm, rmapp, NULL);
+   while (spte) {
+   BUG_ON(!is_shadow_present_pte(*spte));
+   rmap_printk(kvm_set_pte_rmapp: spte %p %llx\n, spte, *spte);
+   need_flush = 1;
+   if (pte_write(ptep_val(ptep))) {
+   rmap_remove(kvm, spte);
+   __set_spte(spte, shadow_trap_nonpresent_pte);
+   spte = rmap_next(kvm, rmapp, NULL);
+   } else {
+   new_spte = *spte ~ (PT64_BASE_ADDR_MASK);
+   new_spte |= new_pfn  PAGE_SHIFT;
+
+   if (!pte_write(ptep_val(ptep))) {
+   new_spte = ~PT_WRITABLE_MASK;
+   new_spte = ~SPTE_HOST_WRITEABLE;
+   if (is_writeble_pte(*spte))
+   kvm_set_pfn_dirty(spte_to_pfn(*spte));
+   }
+   __set_spte(spte, new_spte);
+   spte = rmap_next(kvm, rmapp, spte);
+   }
+   }
+   if (need_flush)
+   kvm_flush_remote_tlbs(kvm);
+
+   return 0;
+}
+
 static int kvm_handle_hva(struct kvm *kvm, unsigned long hva,
- int (*handler)(struct kvm *kvm, unsigned long *rmapp))
+ unsigned long data,
+ int (*handler)(struct kvm *kvm, unsigned long *rmapp,
+unsigned long data))
 {
int i, j;
int retval = 0;
@@ -786,13 +832,15 @@ static int kvm_handle_hva(struct kvm *kvm, unsigned long 
hva,
if (hva = start  hva  end) {
gfn_t gfn_offset = (hva - start)  PAGE_SHIFT;
 -  retval |= handler(kvm, memslot-rmap[gfn_offset]);
+   retval |= handler(kvm, memslot-rmap[gfn_offset],
+ data);
for (j = 0; j  KVM_NR_PAGE_SIZES - 1; ++j) {
int idx = gfn_offset;
idx /= KVM_PAGES_PER_HPAGE(PT_DIRECTORY_LEVEL + 
j);
retval |= handler(kvm,
-   memslot-lpage_info[j][idx].rmap_pde);
+   memslot-lpage_info[j][idx].rmap_pde,
+   data);



If change_pte is called to modify a largepage pte, and the shadow has
that largepage mapped with 4k sptes, you'll set the wrong pfn. That is,
the patch does not attempt to handle different page sizes properly.


Re: [PATCH 3/3] add support for change_pte mmu notifiers

2009-09-12 Thread Marcelo Tosatti
On Sat, Sep 12, 2009 at 08:04:31PM +0300, Izik Eidus wrote:
 If change_pte is called to modify a largepage pte, and the shadow has
 that largepage mapped with 4k sptes, you'll set the wrong pfn. That is,
 the patch does not attempt to handle different page sizes properly.

 So either disable change_pte updates to non-4k host vmas (making it
 explictly it does not handle different pagesizes), or handle largepages
 properly, although i don't see any use for change_pte or largepage
 mappings?
 
 change_pte doesn't get called on 4k pages...
 So adding commet to this function saying it is working just on 4k 
 pages  would be enough ?
 

 It would be better to fail/WARN on non-4k host ptes (can't it?), but if
 that is not possible i think a comment would be enough.

   
 Ok so you want is_large_pte() check on data right? (and WARN() there..)

pte_huge(pte), yeah.


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