RE: [Patch v3] Enable CPU SMEP feature for KVM

2011-05-29 Thread Li, Xin
> > > > > > > + else > > > > + best->ebx&= ~(bit(X86_FEATURE_SMEP)); > > > > > > Not needed - x86.c already masks unsupported features. > > > > Should KVM still support guest SMEP when host disables it thru nosmep? > > No. We treat nosmep as "no smep for the k

Re: [PATCH 4/6] kvm tools: Add rwlock wrapper

2011-05-29 Thread Ingo Molnar
* Avi Kivity wrote: > Yes, this is equivalent to the kernel's stop_machine_run(). It's a > heavyweight method but it should work just fine. Yeah. It is fine for reconfiguration/configuration-only kind of write paths - i.e. the mmio lookup path should be ok. There's only one thing i'd like t

Re: [Patch v3] Enable CPU SMEP feature for KVM

2011-05-29 Thread Avi Kivity
On 05/29/2011 10:15 AM, Li, Xin wrote: > > > > > > > + else > > > > + best->ebx&= ~(bit(X86_FEATURE_SMEP)); > > > > > > Not needed - x86.c already masks unsupported features. > > > > Should KVM still support guest SMEP when host disables it t

Re: [PATCH 4/6] kvm tools: Add rwlock wrapper

2011-05-29 Thread Ingo Molnar
* Avi Kivity wrote: > On 05/28/2011 09:32 PM, Ingo Molnar wrote: > >* Avi Kivity wrote: > > > >> > So if you set a notification signal via fcntl(F_SETOWN) on the > >> > scheduler context switch event fd, the user-space RCU code will > >> > get a signal on every context switch. > >> > >>

Re: [PATCH 4/6] kvm tools: Add rwlock wrapper

2011-05-29 Thread Avi Kivity
On 05/29/2011 10:35 AM, Ingo Molnar wrote: * Avi Kivity wrote: > On 05/28/2011 09:32 PM, Ingo Molnar wrote: > >* Avi Kivity wrote: > > > >> > So if you set a notification signal via fcntl(F_SETOWN) on the > >> > scheduler context switch event fd, the user-space RCU code will > >

Re: KVM: x86: use proper port value when checking io instruction permission (v3)

2011-05-29 Thread Avi Kivity
On 05/26/2011 02:56 PM, Marcelo Tosatti wrote: Commit fa4491a6b667304 moved the permission check for io instructions to the ->check_perm callback. It failed to copy the port value from RDX register for string and "in,out ax,dx" instructions. Fix it by reading RDX register at decode stage when ap

[Patch v4 0/4] Enable SMEP feature support for kvm

2011-05-29 Thread Yang, Wei Y
This patchset enables a new CPU feature SMEP (Supervisor Mode Execution Protection) in KVM. SMEP prevents kernel from executing code in application. Updated Intel SDM describes this CPU feature. The document will be published soon. This patchset is based on Fenghua's SMEP patch series, as referre

[Patch v4 1/4] Add SMEP bit to CR4_RESERVED_BITS

2011-05-29 Thread Yang, Wei Y
This patch adds SMEP bit to CR4_RESERVED_BITS. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/include/asm/kvm_host.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm

[Patch v4 3/4] Mask function7 ebx against host capability word9

2011-05-29 Thread Yang, Wei Y
This patch masks CPUID leaf 7 ebx against host capability word9. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/kvm/x86.c |7 ++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index

[Patch v4 2/4] Add SMEP handling when setting CR4

2011-05-29 Thread Yang, Wei Y
This patch adds SMEP handling when setting CR4. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/kvm/x86.c | 15 +-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 77c9d86.

[PATCH v4] Enable CPU SMEP feature support for QEMU-KVM

2011-05-29 Thread Yang, Wei Y
This patchset enables a new CPU feature SMEP (Supervisor Mode Execution Protection) in QEMU-KVM. SMEP prevents kernel from executing code in application. Updated Intel SDM describes this CPU feature. The document will be published soon. SMEP is identified by CPUID leaf 7 EBX[7], which is 0 befo

[Patch v4 4/4] Add instruction fetch checking when walking guest page table

2011-05-29 Thread Yang, Wei Y
This patch adds instruction fetch checking when walking guest page table. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/kvm/paging_tmpl.h |9 - 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/paging_tmpl.h b

Re: [PATCH v2 1/4] kvm tools: Add ioeventfd support

2011-05-29 Thread Pekka Enberg
On Fri, 2011-05-27 at 18:52 +0200, Ingo Molnar wrote: > In such cases it would *really* be useful, in addition of dumping > 80-100 raw numbers to summarize results and compare them for the > reader, as i suspect you've done already? Please don't keep it a > secret and don't force the reader to c

Re: [PATCH 4/6] kvm tools: Add rwlock wrapper

2011-05-29 Thread Ingo Molnar
* Avi Kivity wrote: > On 05/29/2011 10:35 AM, Ingo Molnar wrote: > >* Avi Kivity wrote: > > > >> On 05/28/2011 09:32 PM, Ingo Molnar wrote: > >> >* Avi Kivity wrote: > >> > > >> >> > So if you set a notification signal via fcntl(F_SETOWN) on the > >> >> > scheduler context switch

Re: [PATCH 4/6] kvm tools: Add rwlock wrapper

2011-05-29 Thread Avi Kivity
On 05/29/2011 03:37 PM, Ingo Molnar wrote: > > > > It's not transparent at all if you index RCU data structures by > > the current CPU index, which the kernel implementation does. > > But that's completely broken for userspace. The "current cpu > index" doesn't even exist, since you can't

Re: [PATCH v2 3/4] kvm tools: Use ioeventfd in virtio-net

2011-05-29 Thread Ingo Molnar
* Sasha Levin wrote: > Use ioeventfds to receive notifications of IO events in virtio-net. > Doing so prevents an exit every time we receive/send a packet. > > Signed-off-by: Sasha Levin > --- > tools/kvm/virtio/net.c | 22 ++ > 1 files changed, 22 insertions(+), 0 delet

[PATCH 00/10] KVM: x86 emulator: Some cleanups and conversion to opcode::execute

2011-05-29 Thread Takuya Yoshikawa
The patch set does not change anything functionally. Once the code becomes a bit tidier, I will try more performance related changes. Takuya -- 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://vge

[PATCH 01/10] KVM: x86 emulator: Use the pointers ctxt and c consistently

2011-05-29 Thread Takuya Yoshikawa
From: Takuya Yoshikawa We should use the local variables ctxt and c when the emulate_ctxt and decode appears many times. At least, we need to be consistent about how we use these in a function. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c |6 ++-- arch/x86/kvm/x86.c |

[PATCH 02/10] KVM: x86 emulator: Rename emulate_xxx() to em_xxx()

2011-05-29 Thread Takuya Yoshikawa
From: Takuya Yoshikawa The next patch will change these to be called by opcode::execute. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 20 ++-- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c inde

[PATCH 03/10] KVM: x86 emulator: Use opcode::execute for some instructions

2011-05-29 Thread Takuya Yoshikawa
From: Takuya Yoshikawa Move the following functions to the opcode tables: RET (Far return) : CB IRET : CF JMP (Jump far) : EA SYSCALL : 0F 05 CLTS : 0F 06 SYSENTER : 0F 34 SYSEXIT : 0F 35 Signed-off-by: Takuya Yoshikawa --- ar

[PATCH] testdev: adjust for ISA irq changes

2011-05-29 Thread Avi Kivity
Recent changes killed the ioapic_irq_hack hack, use the isa_get_irq() API instead. Signed-off-by: Avi Kivity --- hw/isa-bus.c |2 +- hw/testdev.c |4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/isa-bus.c b/hw/isa-bus.c index 2765543..7e06efc 100644 --- a/hw/isa

[PATCH 04/10] KVM: x86 emulator: Use opcode::execute for TEST(84/85, A8/A9)

2011-05-29 Thread Takuya Yoshikawa
From: Takuya Yoshikawa Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 19 +++ 1 files changed, 11 insertions(+), 8 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 9134965..2e2e87f 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86

[PATCH 05/10] KVM: x86 emulator: Use opcode::execute for XCHG(86/87)

2011-05-29 Thread Takuya Yoshikawa
From: Takuya Yoshikawa In addition, replace one "goto xchg" with an em_xchg() call. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 31 +-- 1 files changed, 17 insertions(+), 14 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.

[PATCH 06/10] KVM: x86 emulator: Use opcode::execute for RET(C3)

2011-05-29 Thread Takuya Yoshikawa
From: Takuya Yoshikawa Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 18 +++--- 1 files changed, 11 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 16c7507..759ec7c 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/

[PATCH 07/10] KVM: x86 emulator: Use opcode::execute for MOV(8C/8E)

2011-05-29 Thread Takuya Yoshikawa
From: Takuya Yoshikawa Different functions for those which take segment register operands. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 59 +-- 1 files changed, 31 insertions(+), 28 deletions(-) diff --git a/arch/x86/kvm/emulate.c

[PATCH 08/10] KVM: x86 emulator: Clean up INT n/INTO/INT 3(CC/CD/CE)

2011-05-29 Thread Takuya Yoshikawa
From: Takuya Yoshikawa Call emulate_int() directly to avoid spaghetti goto's. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 15 +-- 1 files changed, 5 insertions(+), 10 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 7a06fb2..a5d067

[PATCH 09/10] KVM: x86 emulator: Use opcode::execute for LOOP/JCXZ

2011-05-29 Thread Takuya Yoshikawa
From: Takuya Yoshikawa LOOP/LOOPcc : E0-E2 JCXZ/JECXZ/JRCXZ : E3 Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 35 --- 1 files changed, 24 insertions(+), 11 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c inde

[PATCH 10/10] KVM: x86 emulator: Use opcode::execute for CLI/STI(FA/FB)

2011-05-29 Thread Takuya Yoshikawa
From: Takuya Yoshikawa Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 38 +- 1 files changed, 21 insertions(+), 17 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 2bf3415..e0c83a7 100644 --- a/arch/x86/kvm/emul

[PATCH] kvm: reinstate TPR access reporting support

2011-05-29 Thread Avi Kivity
Recent refactoring for commonality with upstream dropped support for this. Signed-off-by: Avi Kivity --- target-i386/kvm.c |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/target-i386/kvm.c b/target-i386/kvm.c index bccd87c..316057a 100644 --- a/target-i386/kvm.c +++

Re: [Patch v4 4/4] Add instruction fetch checking when walking guest page table

2011-05-29 Thread Avi Kivity
On 05/29/2011 02:42 PM, Yang, Wei Y wrote: This patch adds instruction fetch checking when walking guest page table. + /* check if the kernel is fetching from user page */ + if (unlikely((pte_access& PT_USER_MASK)&& +

Re: [Patch v4 1/4] Add SMEP bit to CR4_RESERVED_BITS

2011-05-29 Thread Avi Kivity
On 05/29/2011 02:41 PM, Yang, Wei Y wrote: This patch adds SMEP bit to CR4_RESERVED_BITS. Actually, it removes SMEP from CR4_RESERVED_BITS. -- error compiling committee.c: too many arguments to function -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a messag

Re: [PATCH 4/6] kvm tools: Add rwlock wrapper

2011-05-29 Thread Ingo Molnar
* Avi Kivity wrote: > I don't understand how you expect per_cpu to work in userspace. As > soon as you calculate the per-cpu address, it can be invalidated. > It doesn't help that you get a signal; you've already calculated > the address. I was thinking of some sort of transactional mechani

Re: [PATCH 4/6] kvm tools: Add rwlock wrapper

2011-05-29 Thread Avi Kivity
On 05/29/2011 05:27 PM, Ingo Molnar wrote: * Avi Kivity wrote: > I don't understand how you expect per_cpu to work in userspace. As > soon as you calculate the per-cpu address, it can be invalidated. > It doesn't help that you get a signal; you've already calculated > the address. I was t

Re: [PATCH] testdev: adjust for ISA irq changes

2011-05-29 Thread Jan Kiszka
On 2011-05-29 14:57, Avi Kivity wrote: > Recent changes killed the ioapic_irq_hack hack, use the isa_get_irq() API > instead. > > Signed-off-by: Avi Kivity > --- > hw/isa-bus.c |2 +- > hw/testdev.c |4 +--- > 2 files changed, 2 insertions(+), 4 deletions(-) > > diff --git a/hw/isa-bus.

Re: [PATCH] testdev: adjust for ISA irq changes

2011-05-29 Thread Avi Kivity
On 05/29/2011 06:05 PM, Jan Kiszka wrote: On 2011-05-29 14:57, Avi Kivity wrote: > Recent changes killed the ioapic_irq_hack hack, use the isa_get_irq() API > instead. > > Signed-off-by: Avi Kivity > --- > hw/isa-bus.c |2 +- > hw/testdev.c |4 +--- > 2 files changed, 2 insertions

Re: [PATCH] testdev: adjust for ISA irq changes

2011-05-29 Thread Jan Kiszka
On 2011-05-29 17:10, Avi Kivity wrote: > On 05/29/2011 06:05 PM, Jan Kiszka wrote: >> On 2011-05-29 14:57, Avi Kivity wrote: >> > Recent changes killed the ioapic_irq_hack hack, use the >> isa_get_irq() API >> > instead. >> > >> > Signed-off-by: Avi Kivity >> > --- >> > hw/isa-bus.c |2 +-

Re: Graphics card pass-through working with two pass pci-initialization

2011-05-29 Thread Jan Kiszka
On 2010-05-28 20:49, André Weidemann wrote: > Hi, > > On 28.05.2011 10:18, Jan Kiszka wrote: >> On 2011-05-26 23:19, André Weidemann wrote: >>> On 27.05.2011 21:50, André Weidemann wrote: On 27.05.2011 21:40, André Weidemann wrote: > If I am not mistaken then the graphics card needs

Re: [PATCH] testdev: adjust for ISA irq changes

2011-05-29 Thread Avi Kivity
On 05/29/2011 06:21 PM, Jan Kiszka wrote: > Suppose our motherboard wired > the PCI links to GSI16-19 (or GSI16-23, as we once wanted before we had > MSI-X)? We'd need an API to access non-ISA interrupt lines. > > So what's the clean fix here? gsi_get_irq()? Maybe. Depends on the requireme

Re: [PATCH 4/6] kvm tools: Add rwlock wrapper

2011-05-29 Thread Paul E. McKenney
On Sun, May 29, 2011 at 09:19:48AM +0200, Ingo Molnar wrote: > > * Avi Kivity wrote: > > > Yes, this is equivalent to the kernel's stop_machine_run(). It's a > > heavyweight method but it should work just fine. > > Yeah. It is fine for reconfiguration/configuration-only kind of write > paths

Re: Graphics card pass-through working with two pass pci-initialization

2011-05-29 Thread Avi Kivity
On 05/29/2011 06:22 PM, Jan Kiszka wrote: Yeah, you definitely run out of PCI memory. Plus you may suffer from the PAM/SMRAM bug I wrote about in the wiki. Try if this hack improves the situation: http://git.kiszka.org/?p=qemu-kvm.git;a=commitdiff;h=96e600f43275310364c0310519d6ab6540bb7d25 H

Re: [PATCH] testdev: adjust for ISA irq changes

2011-05-29 Thread Jan Kiszka
On 2011-05-29 17:26, Avi Kivity wrote: > On 05/29/2011 06:21 PM, Jan Kiszka wrote: >> > Suppose our motherboard wired >> > the PCI links to GSI16-19 (or GSI16-23, as we once wanted before we >> had >> > MSI-X)? We'd need an API to access non-ISA interrupt lines. >> > >> > So what's the clean f

Re: [PATCH 4/6] kvm tools: Add rwlock wrapper

2011-05-29 Thread Paul E. McKenney
On Sun, May 29, 2011 at 06:00:00PM +0300, Avi Kivity wrote: > On 05/29/2011 05:27 PM, Ingo Molnar wrote: > >* Avi Kivity wrote: > > > >> I don't understand how you expect per_cpu to work in userspace. As > >> soon as you calculate the per-cpu address, it can be invalidated. > >> It doesn't hel

Re: [PATCH 4/6] kvm tools: Add rwlock wrapper

2011-05-29 Thread Paul E. McKenney
On Sun, May 29, 2011 at 08:31:30AM -0700, Paul E. McKenney wrote: > On Sun, May 29, 2011 at 09:19:48AM +0200, Ingo Molnar wrote: > > > > * Avi Kivity wrote: > > > > > Yes, this is equivalent to the kernel's stop_machine_run(). It's a > > > heavyweight method but it should work just fine. > >

Re: [PATCH 07/20] qemu-kvm: Clean up kvm_update_interrupt_request

2011-05-29 Thread Avi Kivity
On 05/27/2011 03:19 PM, Jan Kiszka wrote: Most tests in kvm_update_interrupt_request are unneeded today: - env argument is always non-NULL (caller references it as well) - current_env must have been created when we get here - env->thread can't be zero (initialized early during cpu creation)

Re: [PATCH 08/20] qemu-kvm: Replace kvm_update_interrupt_request with qemu_cpu_kick

2011-05-29 Thread Avi Kivity
On 05/27/2011 03:19 PM, Jan Kiszka wrote: Activate the iothread version of qemu_cpu_kick. We just need to initialize the yet unused CPUState::halt_cond for it. This finally obsoletes kvm_update_interrupt_request, so drop it. void qemu_cpu_kick(void *_env) { CPUState *env = _env; qemu

Re: [PATCH 4/6] kvm tools: Add rwlock wrapper

2011-05-29 Thread Sasha Levin
On Sun, 2011-05-29 at 08:31 -0700, Paul E. McKenney wrote: > This is very important even if no write path ever becomes more than > just occasional. If you don't mark the read paths like Ingo suggests, > your one-year-from-now self will be very annoyed at you, as the code > will be quite difficult

Re: [PATCH 00/20] qemu-kvm: Cleanup and switch to upstream - The Season Final

2011-05-29 Thread Avi Kivity
On 05/27/2011 03:19 PM, Jan Kiszka wrote: With this series applied, we are finally at a level of almost zero redundancy between QEMU upstream and the qemu-kvm tree. The last major duplication to be removed is the original io-thread implementation and everything related to it: - locking - vcpu

Re: [PATCH 07/20] qemu-kvm: Clean up kvm_update_interrupt_request

2011-05-29 Thread Jan Kiszka
On 2011-05-29 18:16, Avi Kivity wrote: > On 05/27/2011 03:19 PM, Jan Kiszka wrote: >> Most tests in kvm_update_interrupt_request are unneeded today: >> - env argument is always non-NULL (caller references it as well) >> - current_env must have been created when we get here >> - env->thread ca

Re: [PATCH 07/20] qemu-kvm: Clean up kvm_update_interrupt_request

2011-05-29 Thread Avi Kivity
On 05/29/2011 07:37 PM, Jan Kiszka wrote: On 2011-05-29 18:16, Avi Kivity wrote: > On 05/27/2011 03:19 PM, Jan Kiszka wrote: >> Most tests in kvm_update_interrupt_request are unneeded today: >>- env argument is always non-NULL (caller references it as well) >>- current_env must have bee

Re: [PATCH 08/20] qemu-kvm: Replace kvm_update_interrupt_request with qemu_cpu_kick

2011-05-29 Thread Jan Kiszka
On 2011-05-29 18:19, Avi Kivity wrote: > On 05/27/2011 03:19 PM, Jan Kiszka wrote: >> Activate the iothread version of qemu_cpu_kick. We just need to >> initialize the yet unused CPUState::halt_cond for it. >> >> This finally obsoletes kvm_update_interrupt_request, so drop it. >> > > void qemu_cpu

Re: [PATCH 08/20] qemu-kvm: Replace kvm_update_interrupt_request with qemu_cpu_kick

2011-05-29 Thread Avi Kivity
On 05/29/2011 07:41 PM, Jan Kiszka wrote: > > void qemu_cpu_kick(void *_env) > { > CPUState *env = _env; > > qemu_cond_broadcast(env->halt_cond); > if (!env->thread_kicked) { > qemu_cpu_kick_thread(env); > env->thread_kicked = true; > } > } > > Seems to h

RCU red-black tree (was: Re: [PATCH 4/6] kvm tools: Add rwlock wrapper)

2011-05-29 Thread Mathieu Desnoyers
* Mathieu Desnoyers (mathieu.desnoy...@efficios.com) wrote: > * Sasha Levin (levinsasha...@gmail.com) wrote: [...] > > Hi Mathieu! > > > > In tools/kvm/ we use a rb-tree (same one used by the kernel) with the > > augmentation feature to support an interval rb-tree - which means that > > every upda

[PATCH 1/4] kvm tools: Use correct value for user signal base

2011-05-29 Thread Sasha Levin
Signed-off-by: Sasha Levin --- tools/kvm/include/kvm/kvm.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tools/kvm/include/kvm/kvm.h b/tools/kvm/include/kvm/kvm.h index f951f2d..6a17362 100644 --- a/tools/kvm/include/kvm/kvm.h +++ b/tools/kvm/include/kvm/kvm.h @@ -11,7

[PATCH 2/4] kvm tools: Allow pausing guests

2011-05-29 Thread Sasha Levin
Allow pausing and unpausing guests running on the host. Pausing a guest means that none of the VCPU threads are running KVM_RUN until they are unpaused. Signed-off-by: Sasha Levin --- tools/kvm/include/kvm/kvm-cpu.h |1 + tools/kvm/include/kvm/kvm.h |4 +++ tools/kvm/kvm-cpu.c

[PATCH 3/4] kvm tools: Add a brlock

2011-05-29 Thread Sasha Levin
brlock is a lock which is very cheap for reads, but very expensive for writes. This lock will be used when updates are very rare and reads are common. This lock is currently implemented by stopping the guest while performing the updates. We assume that the only threads which read from the locked da

[PATCH 4/4] kvm tools: Use brlock in MMIO and IOPORT

2011-05-29 Thread Sasha Levin
Use brlock to protect mmio and ioport modules and make them update-safe. Signed-off-by: Sasha Levin --- tools/kvm/ioport.c | 10 +- tools/kvm/mmio.c | 17 +++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/tools/kvm/ioport.c b/tools/kvm/ioport.c index

Re: RCU red-black tree (was: Re: [PATCH 4/6] kvm tools: Add rwlock wrapper)

2011-05-29 Thread Sasha Levin
On Sun, 2011-05-29 at 13:01 -0400, Mathieu Desnoyers wrote: > * Mathieu Desnoyers (mathieu.desnoy...@efficios.com) wrote: > > * Sasha Levin (levinsasha...@gmail.com) wrote: > [...] > > > Hi Mathieu! > > > > > > In tools/kvm/ we use a rb-tree (same one used by the kernel) with the > > > augmentatio

Re: [PATCH 08/20] qemu-kvm: Replace kvm_update_interrupt_request with qemu_cpu_kick

2011-05-29 Thread Jan Kiszka
On 2011-05-29 18:44, Avi Kivity wrote: > On 05/29/2011 07:41 PM, Jan Kiszka wrote: >> > >> > void qemu_cpu_kick(void *_env) >> > { >> > CPUState *env = _env; >> > >> > qemu_cond_broadcast(env->halt_cond); >> > if (!env->thread_kicked) { >> > qemu_cpu_kick_thread(env); >> >

Re: [PATCH 2/4] kvm tools: Allow pausing guests

2011-05-29 Thread Sasha Levin
I mixed up files, this patch misses: /* See if the guest is running */ if (!kvm_cpus[i] || kvm_cpus[i]->thread == 0) return; In the beginning of kvm__pause() and kvm__continue(). I'll send an updated patch. On Sun, 2011-05-29 at 20:32 +0300, Sasha Levin wrote: > A

Re: [PATCH 3/4] kvm tools: Add a brlock

2011-05-29 Thread Ingo Molnar
* Sasha Levin wrote: > +++ b/tools/kvm/include/kvm/brlock.h > @@ -0,0 +1,12 @@ > +#ifndef KVM__BRLOCK_H > +#define KVM__BRLOCK_H > + > +#include "kvm/kvm.h" > +#include "kvm/barrier.h" > + > +#define br_read_lock() mb() > +#define br_read_unlock() mb() These only need to be co

Re: [PATCH 3/4] kvm tools: Add a brlock

2011-05-29 Thread Sasha Levin
On Sun, 2011-05-29 at 20:47 +0200, Ingo Molnar wrote: > * Sasha Levin wrote: > > > +++ b/tools/kvm/include/kvm/brlock.h > > @@ -0,0 +1,12 @@ > > +#ifndef KVM__BRLOCK_H > > +#define KVM__BRLOCK_H > > + > > +#include "kvm/kvm.h" > > +#include "kvm/barrier.h" > > + > > +#define br_read_lock()

Re: Graphics card pass-through working with two pass pci-initialization

2011-05-29 Thread André Weidemann
Hi, On 29.05.2011 17:22, Jan Kiszka wrote: On 2010-05-28 20:49, André Weidemann wrote: Hi, On 28.05.2011 10:18, Jan Kiszka wrote: On 2011-05-26 23:19, André Weidemann wrote: On 27.05.2011 21:50, André Weidemann wrote: On 27.05.2011 21:40, André Weidemann wrote: If I am not mistaken then t

Re: [PATCH 4/6] kvm tools: Add rwlock wrapper

2011-05-29 Thread Ingo Molnar
* Paul E. McKenney wrote: > On Sun, May 29, 2011 at 06:00:00PM +0300, Avi Kivity wrote: > > On 05/29/2011 05:27 PM, Ingo Molnar wrote: > > >* Avi Kivity wrote: > > > > > >> I don't understand how you expect per_cpu to work in userspace. As > > >> soon as you calculate the per-cpu address, it

Re: [PATCH 3/4] kvm tools: Add a brlock

2011-05-29 Thread Ingo Molnar
* Sasha Levin wrote: > On Sun, 2011-05-29 at 20:47 +0200, Ingo Molnar wrote: > > * Sasha Levin wrote: > > > > > +++ b/tools/kvm/include/kvm/brlock.h > > > @@ -0,0 +1,12 @@ > > > +#ifndef KVM__BRLOCK_H > > > +#define KVM__BRLOCK_H > > > + > > > +#include "kvm/kvm.h" > > > +#include "kvm/barrier

Re: [PATCH 4/6] kvm tools: Add rwlock wrapper

2011-05-29 Thread Ingo Molnar
* Paul E. McKenney wrote: > And the other reason that you want to mark the readers is for debug > purposes. Murphy being who he is, you will some day need to check > for someone calling the "OK to update" function while they are > acting as a reader. Correct. In one of the previous mails i

Re: Graphics card pass-through working with two pass pci-initialization

2011-05-29 Thread Jan Kiszka
On 2011-05-29 21:30, André Weidemann wrote: > Hi, > > On 29.05.2011 17:22, Jan Kiszka wrote: >> On 2010-05-28 20:49, André Weidemann wrote: >>> Hi, >>> >>> On 28.05.2011 10:18, Jan Kiszka wrote: On 2011-05-26 23:19, André Weidemann wrote: > On 27.05.2011 21:50, André Weidemann wrote:

Re: RCU red-black tree (was: Re: [PATCH 4/6] kvm tools: Add rwlock wrapper)

2011-05-29 Thread Mathieu Desnoyers
* Sasha Levin (levinsasha...@gmail.com) wrote: > On Sun, 2011-05-29 at 13:01 -0400, Mathieu Desnoyers wrote: > > * Mathieu Desnoyers (mathieu.desnoy...@efficios.com) wrote: > > > * Sasha Levin (levinsasha...@gmail.com) wrote: > > [...] > > > > Hi Mathieu! > > > > > > > > In tools/kvm/ we use a rb-

[Patch v5 0/4] Enable SMEP feature support for kvm

2011-05-29 Thread Yang, Wei Y
This patchset enables a new CPU feature SMEP (Supervisor Mode Execution Protection) in KVM. SMEP prevents kernel from executing code in application. Updated Intel SDM describes this CPU feature. The document will be published soon. This patchset is based on Fenghua's SMEP patch series, as referr

[Patch v5 1/4] Remove SMEP bit from CR4_RESERVED_BITS

2011-05-29 Thread Yang, Wei Y
This patch removes SMEP bit from CR4_RESERVED_BITS. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/include/asm/kvm_host.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/a

[Patch v5 2/4] Add SMEP handling when setting CR4

2011-05-29 Thread Yang, Wei Y
This patch adds SMEP handling when setting CR4. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/kvm/x86.c | 15 +-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 77c9d86

[Patch v5 3/4] Mask function7 ebx against host capability word9

2011-05-29 Thread Yang, Wei Y
This patch masks CPUID leaf 7 ebx against host capability word9. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/kvm/x86.c |7 ++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index

[Patch v5 4/4] Add instruction fetch checking when walking guest page table

2011-05-29 Thread Yang, Wei Y
This patch adds instruction fetch checking when walking guest page table. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/kvm/paging_tmpl.h |9 - 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/paging_tmpl.h

[PATCH v5] Enable CPU SMEP feature support for QEMU-KVM

2011-05-29 Thread Yang, Wei Y
This patchset enables a new CPU feature SMEP (Supervisor Mode Execution Protection) in QEMU-KVM. SMEP prevents kernel from executing code in application. Updated Intel SDM describes this CPU feature. The document will be published soon. SMEP is identified by CPUID leaf 7 EBX[7], which is 0 befo

Re: [PATCH 4/6] kvm tools: Add rwlock wrapper

2011-05-29 Thread Paul E. McKenney
On Sun, May 29, 2011 at 09:33:27PM +0200, Ingo Molnar wrote: > > * Paul E. McKenney wrote: > > > On Sun, May 29, 2011 at 06:00:00PM +0300, Avi Kivity wrote: > > > On 05/29/2011 05:27 PM, Ingo Molnar wrote: > > > >* Avi Kivity wrote: > > > > > > > >> I don't understand how you expect per_cpu to

Re: [PATCH 4/6] kvm tools: Add rwlock wrapper

2011-05-29 Thread Paul E. McKenney
On Sun, May 29, 2011 at 09:54:50PM +0200, Ingo Molnar wrote: > > * Paul E. McKenney wrote: > > > And the other reason that you want to mark the readers is for debug > > purposes. Murphy being who he is, you will some day need to check > > for someone calling the "OK to update" function while

Re: RCU red-black tree (was: Re: [PATCH 4/6] kvm tools: Add rwlock wrapper)

2011-05-29 Thread Paul E. McKenney
On Sun, May 29, 2011 at 01:01:04PM -0400, Mathieu Desnoyers wrote: > * Mathieu Desnoyers (mathieu.desnoy...@efficios.com) wrote: > > * Sasha Levin (levinsasha...@gmail.com) wrote: > [...] > > > Hi Mathieu! > > > > > > In tools/kvm/ we use a rb-tree (same one used by the kernel) with the > > > augm

RE: [PATCH uq/master V2] kvm: Add CPUID support for VIA CPU

2011-05-29 Thread BrillyWu
Hi, Jan > > > @@ -855,6 +870,8 @@ int cpu_x86_register (CPUX86State *env, > > env->cpuid_xlevel = def->xlevel; > > env->cpuid_kvm_features = def->kvm_features; > > env->cpuid_svm_features = def->svm_features; > > +env->cpuid_ext4_features = def->ext4_features; > > +env->cpui

[Qemu-devel][RFC]QEMU disk I/O limits

2011-05-29 Thread Zhi Yong Wu
Hello, all, I have prepared to work on a feature called "Disk I/O limits" for qemu-kvm projeect. This feature will enable the user to cap disk I/O amount performed by a VM.It is important for some storage resources to be shared among multi-VMs. As you've known, if some of VMs are doing

Re: RCU red-black tree (was: Re: [PATCH 4/6] kvm tools: Add rwlock wrapper)

2011-05-29 Thread Sasha Levin
On Sun, 2011-05-29 at 22:54 -0400, Mathieu Desnoyers wrote: > Please note that what I currently have is a normal rbtree, not an > interval rbtree. Can you elaborate on your use-case so I can try to > figure out how we could augment it to support the interval rbtree you > need ? We don't need anyth

Re: [PATCHv2 10/14] virtio_net: limit xmit polling

2011-05-29 Thread Rusty Russell
On Sat, 28 May 2011 23:02:04 +0300, "Michael S. Tsirkin" wrote: > On Thu, May 26, 2011 at 12:58:23PM +0930, Rusty Russell wrote: > > ie. free two packets for every one we're about to add. For steady state > > that would work really well. > > Sure, with indirect buffers, but if we > don't use in

kvm-tool seems to be stuck

2011-05-29 Thread Francis Moreau
Hello, I just wanted to give kvm-tool a try and it unfortunately seems to be stuck somewhere: $ ./kvm run --disk linux-0.2.img --kernel ../../../linux-2.6/arch/x86/boot/bzImage  # kvm run -k ../../../linux-2.6/arch/x86/boot/bzImage -m 448 -c 4  Warning: Unable to open /dev/net/tun PPrroobbiinngg