Re: [PATCH 2/2] Advertise X2APIC support.

2009-05-23 Thread Gleb Natapov
On Sun, May 24, 2009 at 09:46:44AM +0300, Dor Laor wrote: > Gleb Natapov wrote: >> Signed-off-by: Gleb Natapov >> --- >> target-i386/cpu.h|1 + >> target-i386/helper.c |5 +++-- >> 2 files changed, 4 insertions(+), 2 deletions(-) >> >>

Re: [PATCH 0/1] x2apic implementation for kvm

2009-05-24 Thread Gleb Natapov
On Mon, May 25, 2009 at 02:08:26PM +0800, Sheng Yang wrote: > On Friday 22 May 2009 01:37:53 Gleb Natapov wrote: > > This is implementation of x2apic for KVM that I wrote a while ago. > > Unfortunately there is no guest that can take advantage of it since > > Linux doesn&#

Re: [PATCH 0/1] x2apic implementation for kvm

2009-05-24 Thread Gleb Natapov
On Mon, May 25, 2009 at 02:30:05PM +0800, Sheng Yang wrote: > On Monday 25 May 2009 14:13:23 Gleb Natapov wrote: > > On Mon, May 25, 2009 at 02:08:26PM +0800, Sheng Yang wrote: > > > On Friday 22 May 2009 01:37:53 Gleb Natapov wrote: > > > > This is implementation of

Re: [PATCH 0/1] x2apic implementation for kvm

2009-05-24 Thread Gleb Natapov
On Mon, May 25, 2009 at 02:48:03PM +0800, Sheng Yang wrote: > > > > > Yeah... x2apic is for interrupt remapping, and interrupt remapping is > > > > > for VT-d engine. So if we don't want to virtualize VT-d engine and > > > > > interrupt remapping, x2apic is useless for the guest... And VT-d > > > >

[PATCH RFC v2 3/4] Break dependency between vcpu index in vcpus array and vcpu_id.

2009-05-25 Thread Gleb Natapov
Archs are free to use vcpu_id as they see fit. For x86 it is used as vcpu's apic id. Signed-off-by: Gleb Natapov --- include/linux/kvm_host.h |1 + virt/kvm/kvm_main.c | 45 - 2 files changed, 25 insertions(+), 21 deletions(-) diff --

[PATCH RFC v2 0/4] decouple vcpu index from apic id

2009-05-25 Thread Gleb Natapov
. apic_id is arbitrary 32bit value that is passed to vcpu_create ioctls. vcpu_id is kvm internal thing (that may be totally removed from x86 code). In this version vcpus[] is managed by generic code. The code still assumes that boot cpu is created first. Gleb Natapov (4): Introduce kvm_vcpu_is_bsp

[PATCH RFC v2 1/4] Introduce kvm_vcpu_is_bsp() function.

2009-05-25 Thread Gleb Natapov
Use it instead of open code "vcpu_id zero is BSP" assumption. Signed-off-by: Gleb Natapov --- arch/ia64/kvm/kvm-ia64.c |2 +- arch/ia64/kvm/vcpu.c |2 +- arch/x86/kvm/i8254.c |4 ++-- arch/x86/kvm/i8259.c |6 +++--- arch/x86/kvm/lapic.c |7 ---

[PATCH RFC v2 2/4] Use pointer to vcpu instead of vcpu_id in timer code.

2009-05-25 Thread Gleb Natapov
Signed-off-by: Gleb Natapov --- arch/x86/kvm/i8254.c |2 +- arch/x86/kvm/kvm_timer.h |2 +- arch/x86/kvm/lapic.c |2 +- arch/x86/kvm/timer.c |2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index

[PATCH RFC v2 4/4] Use macro to iterate over vcpus.

2009-05-25 Thread Gleb Natapov
Signed-off-by: Gleb Natapov --- arch/ia64/kvm/kvm-ia64.c | 35 arch/powerpc/kvm/powerpc.c | 16 arch/s390/kvm/kvm-s390.c | 55 ++- arch/x86/kvm/i8254.c |7 + arch/x86/kvm/mmu.c

Re: [PATCH RFC v2 1/4] Introduce kvm_vcpu_is_bsp() function.

2009-05-25 Thread Gleb Natapov
On Mon, May 25, 2009 at 05:46:22PM -0300, Marcelo Tosatti wrote: > On Mon, May 25, 2009 at 06:50:33PM +0300, Gleb Natapov wrote: > > Use it instead of open code "vcpu_id zero is BSP" assumption. > > > > Signed-off-by: Gleb Natapov > > --- > > arch/i

Re: [PATCH RFC v2 4/4] Use macro to iterate over vcpus.

2009-05-26 Thread Gleb Natapov
On Tue, May 26, 2009 at 11:18:11AM +0300, Avi Kivity wrote: > Gleb Natapov wrote: >> void kvm_arch_sync_events(struct kvm *kvm) >> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h >> index 0934df3..34634e0 100644 >> --- a/include/linux/kvm_host.h >&g

Re: [PATCH RFC v2 2/4] Use pointer to vcpu instead of vcpu_id in timer code.

2009-05-26 Thread Gleb Natapov
On Tue, May 26, 2009 at 11:30:21AM +0300, Avi Kivity wrote: > Gleb Natapov wrote: >> Signed-off-by: Gleb Natapov >> --- >> arch/x86/kvm/i8254.c |2 +- >> arch/x86/kvm/kvm_timer.h |2 +- >> arch/x86/kvm/lapic.c |2 +- >> arch/x86/kvm/ti

Re: [PATCH RFC v2 3/4] Break dependency between vcpu index in vcpus array and vcpu_id.

2009-05-26 Thread Gleb Natapov
On Tue, May 26, 2009 at 11:34:01AM +0300, Avi Kivity wrote: > Gleb Natapov wrote: >> Archs are free to use vcpu_id as they see fit. For x86 it is used as >> vcpu's apic id. >> >> > > You need a KVM_CAP to inform userspace that the vcpu id has change

Add qemu_send_raw() to vlan.

2009-05-26 Thread Gleb Natapov
It gets packet without virtio header and adds it if needed. Allows to inject packets to vlan from outside. To send gracious arp for instance. diff --git a/hw/virtio-net.c b/hw/virtio-net.c index 8e9178d..3c77b99 100644 --- a/hw/virtio-net.c +++ b/hw/virtio-net.c @@ -389,7 +389,7 @@ static int iov

Re: Add qemu_send_raw() to vlan.

2009-05-26 Thread Gleb Natapov
On Tue, May 26, 2009 at 01:05:35PM +0300, Avi Kivity wrote: > Gleb Natapov wrote: >> It gets packet without virtio header and adds it if needed. Allows to >> inject packets to vlan from outside. To send gracious arp for instance. >> > > This is for announce_self(), n

Re: Add qemu_send_raw() to vlan.

2009-05-26 Thread Gleb Natapov
On Tue, May 26, 2009 at 02:15:37PM +0300, Avi Kivity wrote: > Mark McLoughlin wrote: >> On Tue, 2009-05-26 at 13:03 +0300, Gleb Natapov wrote: >> >>> It gets packet without virtio header and adds it if needed. Allows to >>> inject packets to vlan from outside.

Re: [PATCH RFC 3/3] Break dependency between vcpu index in vcpus array and vcpu's apic id.

2009-05-27 Thread Gleb Natapov
On Thu, May 28, 2009 at 12:47:32AM -0300, Marcelo Tosatti wrote: > On Fri, May 22, 2009 at 02:41:20PM +0300, Gleb Natapov wrote: > > On Thu, May 21, 2009 at 05:29:57PM -0300, Marcelo Tosatti wrote: > > > On Thu, May 21, 2009 at 11:06:42PM +0300, Gleb Natapov wrote: > >

[PATCH RFC v3 3/4] Break dependency between vcpu index in vcpus array and vcpu_id.

2009-05-28 Thread Gleb Natapov
Archs are free to use vcpu_id as they see fit. For x86 it is used as vcpu's apic id. New ioctl is added to configure boot vcpu id that was assumed to be 0 till now. Signed-off-by: Gleb Natapov --- include/linux/kvm.h |2 + include/linux/kvm_host.h |2 + virt/kvm/kvm_m

[PATCH RFC v3 0/4] decouple vcpu index from apic id

2009-05-28 Thread Gleb Natapov
index. Each architecture may use it how it sees fit. x86 uses it as apic id. v2: In this version vcpus[] is managed by generic code. v3: New ioctl is added to specify vcpu_id of bsp vcpu. To maintain backwards compatibility by default vcpu_id == 0 is bsp. Gleb Natapov (4): Introduce

[PATCH RFC v3 2/4] Use pointer to vcpu instead of vcpu_id in timer code.

2009-05-28 Thread Gleb Natapov
Signed-off-by: Gleb Natapov --- arch/x86/kvm/i8254.c |2 +- arch/x86/kvm/kvm_timer.h |2 +- arch/x86/kvm/lapic.c |2 +- arch/x86/kvm/timer.c |2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index

[PATCH RFC v3 1/4] Introduce kvm_vcpu_is_bsp() function.

2009-05-28 Thread Gleb Natapov
Use it instead of open code "vcpu_id zero is BSP" assumption. Signed-off-by: Gleb Natapov --- arch/ia64/kvm/kvm-ia64.c |2 +- arch/ia64/kvm/vcpu.c |2 +- arch/x86/kvm/i8254.c |4 ++-- arch/x86/kvm/i8259.c |6 +++--- arch/x86/kvm/lapic.c |7 ---

[PATCH RFC v3 4/4] Use macro to iterate over vcpus.

2009-05-28 Thread Gleb Natapov
Signed-off-by: Gleb Natapov --- arch/ia64/kvm/kvm-ia64.c | 33 ++--- arch/powerpc/kvm/powerpc.c | 16 ++-- arch/s390/kvm/kvm-s390.c | 33 - arch/x86/kvm/i8254.c |7 ++- arch/x86/kvm/mmu.c

Re: Lost interrupts with upstream KVM

2009-05-29 Thread Gleb Natapov
On Fri, May 29, 2009 at 10:23:24AM +0200, Jan Kiszka wrote: > Hi Gleb, > > with latest kernel modules, namely beginning with 6bc0a1a235 (Remove > irq_pending bitmap), I'm loosing interrupts with upstream's KVM support. > After some bisecting, hair-pulling and a bit meditation I added a > WARN_ON(k

Re: Lost interrupts with upstream KVM

2009-05-29 Thread Gleb Natapov
On Fri, May 29, 2009 at 10:23:24AM +0200, Jan Kiszka wrote: > Hi Gleb, > > with latest kernel modules, namely beginning with 6bc0a1a235 (Remove > irq_pending bitmap), I'm loosing interrupts with upstream's KVM support. > After some bisecting, hair-pulling and a bit meditation I added a > WARN_ON(k

Re: Lost interrupts with upstream KVM

2009-05-29 Thread Gleb Natapov
On Fri, May 29, 2009 at 04:52:41PM +0200, Jan Kiszka wrote: > Gleb Natapov wrote: > > On Fri, May 29, 2009 at 10:23:24AM +0200, Jan Kiszka wrote: > >> Hi Gleb, > >> > >> with latest kernel modules, namely beginning with 6bc0a1a235 (Remove > >> irq

Re: Lost interrupts with upstream KVM

2009-05-29 Thread Gleb Natapov
On Fri, May 29, 2009 at 06:46:47PM +0200, Jan Kiszka wrote: > Gleb Natapov wrote: > > On Fri, May 29, 2009 at 04:52:41PM +0200, Jan Kiszka wrote: > >> Gleb Natapov wrote: > >>> On Fri, May 29, 2009 at 10:23:24AM +0200, Jan Kiszka wrote: > >>>> Hi G

Re: Lost interrupts with upstream KVM

2009-05-29 Thread Gleb Natapov
On Fri, May 29, 2009 at 07:01:44PM +0200, Jan Kiszka wrote: > Gleb Natapov wrote: > > On Fri, May 29, 2009 at 06:46:47PM +0200, Jan Kiszka wrote: > >> Gleb Natapov wrote: > >>> On Fri, May 29, 2009 at 04:52:41PM +0200, Jan Kiszka wrote: > >>>> Gleb Nata

Re: Lost interrupts with upstream KVM

2009-05-29 Thread Gleb Natapov
On Fri, May 29, 2009 at 07:26:52PM +0200, Jan Kiszka wrote: > with latest kernel modules, namely beginning with 6bc0a1a235 (Remove > irq_pending bitmap), I'm loosing interrupts with upstream's KVM > support. > After some bisecting, hair-pulling and a bit meditat

[PATCH] Read MADT entries from memory in processors _MAT method.

2009-06-01 Thread Gleb Natapov
Also use enable/disable bit from ACPI MADT entries to track CPU hot plug. This removes assumptions about APIC ids from AML code and simplify cup hotplug handling. Signed-off-by: Gleb Natapov diff --git a/kvm/bios/acpi-dsdt.dsl b/kvm/bios/acpi-dsdt.dsl index c756fed..69e1426 100755 --- a/kvm

[PATCH] Fix tpr patching to get cpu index from Windows per cpu area.

2009-06-02 Thread Gleb Natapov
Using cpu_index for this purpose work only by luck. Signed-off-by: Gleb Natapov diff --git a/kvm-tpr-opt.c b/kvm-tpr-opt.c index 246e08d..bdbc742 100644 --- a/kvm-tpr-opt.c +++ b/kvm-tpr-opt.c @@ -220,13 +220,29 @@ static int bios_is_mapped(CPUState *env, uint64_t rip) return 1

Re: [PATCH RFC v3 3/4] Break dependency between vcpu index in vcpus array and vcpu_id.

2009-06-02 Thread Gleb Natapov
On Tue, Jun 02, 2009 at 09:38:08AM -0300, Marcelo Tosatti wrote: > > @@ -2223,6 +2226,10 @@ static long kvm_vm_ioctl(struct file *filp, > > r = kvm_irqfd(kvm, data.fd, data.gsi, data.flags); > > break; > > } > > + case KVM_SET_BOOT_CPU_ID: > > + kvm->bsp_vcpu

[PATCH RFC] Do not use cpu_index in interface between libkvm and qemu

2009-06-02 Thread Gleb Natapov
On vcpu creation cookie is returned which is used in future communication. Signed-off-by: Gleb Natapov diff --git a/cpu-defs.h b/cpu-defs.h index 1e071e7..5f541e0 100644 --- a/cpu-defs.h +++ b/cpu-defs.h @@ -147,6 +147,7 @@ struct KVMCPUState { int stop; int stopped; int created

Re: [PATCH 1/4] always halt non-bsp cpu.

2009-06-03 Thread Gleb Natapov
On Tue, Jun 02, 2009 at 03:37:47PM -0400, Glauber Costa wrote: > This is not kvm specific, and should do fine in plain qemu > > Signed-off-by: Glauber Costa > --- > hw/apic.c |3 +-- > 1 files changed, 1 insertions(+), 2 deletions(-) > > diff --git a/hw/apic.c b/hw/apic.c > index 86aa6b6..2

Re: [PATCH 1/4] always halt non-bsp cpu.

2009-06-03 Thread Gleb Natapov
On Wed, Jun 03, 2009 at 01:01:29PM +0200, Jan Kiszka wrote: > Glauber Costa wrote: > > On Wed, Jun 03, 2009 at 12:32:04AM +0200, Jan Kiszka wrote: > >> Glauber Costa wrote: > >>> On Wed, Jun 03, 2009 at 12:01:00AM +0200, Jan Kiszka wrote: > Glauber Costa wrote: > > On Tue, Jun 02, 2009 at

[PATCH] revert part of 3db8b916e merge

2009-06-03 Thread Gleb Natapov
kvm_*_mpstate() cannot be called from kvm_arch_*_registers() since kvm_arch_*_registers() sometimes called from io thread, but kvm_*_mpstate() can be called only by cpu thread. Signed-off-by: Gleb Natapov diff --git a/qemu-kvm.c b/qemu-kvm.c index 68d3b92..7ed1e06 100644 --- a/qemu-kvm.c +++ b

Re: [PATCH] revert part of 3db8b916e merge

2009-06-03 Thread Gleb Natapov
On Wed, Jun 03, 2009 at 03:16:46PM +0300, Avi Kivity wrote: > Gleb Natapov wrote: >> kvm_*_mpstate() cannot be called from kvm_arch_*_registers() >> since kvm_arch_*_registers() sometimes called from io thread, but >> kvm_*_mpstate() can be called only by cpu thread. >>

Re: [PATCH 1/4] avoid halted state for in kernel irqchip

2009-06-03 Thread Gleb Natapov
On Wed, Jun 03, 2009 at 02:25:41PM -0400, Glauber Costa wrote: > This patch is part of a series that tries to provide > a kvm-free apic implementation. In the last interation, > Jan pointed out that halted state management with in kernel > irqchip gets quite messy. I don't disagree. > > It broke t

Re: [PATCH 2/4] sipi and init: move common code

2009-06-03 Thread Gleb Natapov
On Wed, Jun 03, 2009 at 02:25:42PM -0400, Glauber Costa wrote: > @@ -407,12 +393,12 @@ static int kvm_main_loop_cpu(CPUState *env) > if (env->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI)) > env->halted = 0; > if (!kvm_irqchip_in_kernel(kvm_context)) { > -

[PATCH] cleanup acpi table creation

2009-06-04 Thread Gleb Natapov
Current code is a mess. And addition of acpi tables is broken. Signed-off-by: Gleb Natapov diff --git a/kvm/bios/rombios32.c b/kvm/bios/rombios32.c index 369cbef..fda4894 100755 --- a/kvm/bios/rombios32.c +++ b/kvm/bios/rombios32.c @@ -1293,15 +1293,13 @@ struct rsdp_descriptor /* Root

Re: [PATCH 0/4] apic/ioapic kvm free implementation

2009-06-04 Thread Gleb Natapov
On Wed, Jun 03, 2009 at 05:19:26PM -0400, Glauber Costa wrote: > Same thing, > > addressing comments from gleb. > > Jan, can you run your test on this one? It differs from previous one in halt handling. -- Gleb. -- To unsubscribe from this list: send the line "unsubscrib

Re: [PATCH] use KVMState, as upstream do

2009-06-04 Thread Gleb Natapov
On Thu, Jun 04, 2009 at 04:33:19PM -0300, Glauber Costa wrote: > On Thu, Jun 04, 2009 at 10:23:29PM +0300, Gleb Natapov wrote: > > On Thu, Jun 04, 2009 at 02:23:03PM -0400, Glauber Costa wrote: > > > This is a pretty mechanical change. To make code look > > > closer to

Re: [PATCH 0/4] apic/ioapic kvm free implementation

2009-06-04 Thread Gleb Natapov
On Thu, Jun 04, 2009 at 09:46:23PM +0200, Jan Kiszka wrote: > Gleb Natapov wrote: > > On Wed, Jun 03, 2009 at 05:19:26PM -0400, Glauber Costa wrote: > >> Same thing, > >> > >> addressing comments from gleb. > >> > >> > > Jan, can yo

Re: [PATCH] use KVMState, as upstream do

2009-06-04 Thread Gleb Natapov
On Thu, Jun 04, 2009 at 05:10:51PM -0300, Glauber Costa wrote: > On Thu, Jun 04, 2009 at 11:00:46PM +0300, Gleb Natapov wrote: > > On Thu, Jun 04, 2009 at 04:33:19PM -0300, Glauber Costa wrote: > > > On Thu, Jun 04, 2009 at 10:23:29PM +0300, Gleb Natapov wrote: > > > &

Re: [PATCH] use KVMState, as upstream do

2009-06-04 Thread Gleb Natapov
On Thu, Jun 04, 2009 at 05:18:06PM -0300, Glauber Costa wrote: > > > this first phase has nothing to do with functionality. To begin with, > > > KVMState is qemu style, kvm_context_t is not, like it or not (I don't). > > > > > I am not against this mechanical change at all, don't get me wrong. I >

[PATCH 2/4] Use pointer to vcpu instead of vcpu_id in timer code.

2009-06-08 Thread Gleb Natapov
Signed-off-by: Gleb Natapov --- arch/x86/kvm/i8254.c |2 +- arch/x86/kvm/kvm_timer.h |2 +- arch/x86/kvm/lapic.c |2 +- arch/x86/kvm/timer.c |2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index

[PATCH 0/4] decouple vcpu index from apic id

2009-06-08 Thread Gleb Natapov
index. Each architecture may use it how it sees fit. x86 uses it as apic id. Gleb Natapov (4): Introduce kvm_vcpu_is_bsp() function. Use pointer to vcpu instead of vcpu_id in timer code. Break dependency between vcpu index in vcpus array and vcpu_id. Use macro to iterate over vcpus. arch

[PATCH 1/4] Introduce kvm_vcpu_is_bsp() function.

2009-06-08 Thread Gleb Natapov
Use it instead of open code "vcpu_id zero is BSP" assumption. Signed-off-by: Gleb Natapov --- arch/ia64/kvm/kvm-ia64.c |2 +- arch/ia64/kvm/vcpu.c |2 +- arch/x86/kvm/i8254.c |4 ++-- arch/x86/kvm/i8259.c |6 +++--- arch/x86/kvm/lapic.c |7 ---

[PATCH 3/4] Break dependency between vcpu index in vcpus array and vcpu_id.

2009-06-08 Thread Gleb Natapov
Archs are free to use vcpu_id as they see fit. For x86 it is used as vcpu's apic id. New ioctl is added to configure boot vcpu id that was assumed to be 0 till now. Signed-off-by: Gleb Natapov --- include/linux/kvm.h |2 + include/linux/kvm_host.h |2 + virt/kvm/kvm_m

[PATCH 4/4] Use macro to iterate over vcpus.

2009-06-08 Thread Gleb Natapov
Signed-off-by: Gleb Natapov --- arch/ia64/kvm/kvm-ia64.c | 33 ++--- arch/powerpc/kvm/powerpc.c | 16 ++-- arch/s390/kvm/kvm-s390.c | 33 - arch/x86/kvm/i8254.c |7 ++- arch/x86/kvm/mmu.c

Re: [PATCH] cleanup acpi table creation

2009-06-08 Thread Gleb Natapov
On Mon, Jun 08, 2009 at 02:29:16PM +0300, Avi Kivity wrote: > Gleb Natapov wrote: >> Current code is a mess. And addition of acpi tables is broken. >> > > Sorry, this patch is impossible to review. Please send the shortest > possible fix, even if it remains hacky. We

Re: [PATCH 0/4] decouple vcpu index from apic id

2009-06-08 Thread Gleb Natapov
On Tue, Jun 09, 2009 at 10:30:01AM +0800, Zhang, Xiantao wrote: > Avi Kivity wrote: > > Gleb Natapov wrote: > >> Currently vcpu_id is used as an index into vcpus array and as apic id > >> on x86. This is incorrect since apic ids not have to be continuous > >>

[PATCHv2 2/4] Use pointer to vcpu instead of vcpu_id in timer code.

2009-06-09 Thread Gleb Natapov
Signed-off-by: Gleb Natapov --- arch/x86/kvm/i8254.c |2 +- arch/x86/kvm/kvm_timer.h |2 +- arch/x86/kvm/lapic.c |2 +- arch/x86/kvm/timer.c |2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index

[PATCHv2 0/4] decouple vcpu index from apic id

2009-06-09 Thread Gleb Natapov
index. Each architecture may use it how it sees fit. x86 uses it as apic id. v2: remove online_vcpus from ia64 in patch 3/4 introduce KVM_APIC_ARCHITECTURE config option Gleb Natapov (4): Introduce kvm_vcpu_is_bsp() function. Use pointer to vcpu instead of vcpu_id in timer code. Break

[PATCHv2 4/4] Use macro to iterate over vcpus.

2009-06-09 Thread Gleb Natapov
Signed-off-by: Gleb Natapov --- arch/ia64/kvm/kvm-ia64.c | 29 ++--- arch/powerpc/kvm/powerpc.c | 16 ++-- arch/s390/kvm/kvm-s390.c | 33 - arch/x86/kvm/i8254.c |7 ++- arch/x86/kvm/mmu.c |6

[PATCHv2 3/4] Break dependency between vcpu index in vcpus array and vcpu_id.

2009-06-09 Thread Gleb Natapov
Archs are free to use vcpu_id as they see fit. For x86 it is used as vcpu's apic id. New ioctl is added to configure boot vcpu id that was assumed to be 0 till now. Signed-off-by: Gleb Natapov --- arch/ia64/include/asm/kvm_host.h |1 - arch/ia64/kvm/Kconfig|1 + arch

[PATCHv2 1/4] Introduce kvm_vcpu_is_bsp() function.

2009-06-09 Thread Gleb Natapov
Use it instead of open code "vcpu_id zero is BSP" assumption. Signed-off-by: Gleb Natapov --- arch/ia64/kvm/kvm-ia64.c |2 +- arch/ia64/kvm/vcpu.c |2 +- arch/x86/kvm/i8254.c |4 ++-- arch/x86/kvm/i8259.c |6 +++--- arch/x86/kvm/lapic.c |7 ---

Re: [patch] qemu-kvm BIOS move _PR to SSDT

2009-06-10 Thread Gleb Natapov
On Wed, Jun 10, 2009 at 05:01:18PM +0200, Jes Sorensen wrote: > Index: qemu-kvm/kvm/bios/acpi-ssdt.dsl > === > --- /dev/null > +++ qemu-kvm/kvm/bios/acpi-ssdt.dsl > @@ -0,0 +1,140 @@ > +/* > + * Bochs/QEMU ACPI SSDT ASL definition > +

Re: [patch] qemu-kvm BIOS move _PR to SSDT

2009-06-10 Thread Gleb Natapov
On Wed, Jun 10, 2009 at 05:30:40PM +0200, Jes Sorensen wrote: > On 06/10/2009 05:13 PM, Gleb Natapov wrote: >>> + * Bochs/QEMU ACPI SSDT ASL definition >>> + * >>> + * Copyright (c) 2006 Fabrice Bellard >> I am not sure that there is even one bit of code below

[PATCHv2] [APIC] Optimize searching for highest IRR

2009-06-11 Thread Gleb Natapov
possible race and how it is solved. The race is not created by the patch BTW. Signed-off-by: Gleb Natapov diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 44f20cd..38a7fa0 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -165,29 +165,45 @@ static int find_highest_vector

[PATCH] Replace pending exception by PF if it happens serially.

2009-06-11 Thread Gleb Natapov
Replace previous exception with a new one in a hope that instruction re-execution will regenerate lost exception. Signed-off-by: Gleb Natapov diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 272e2e8..3150d06 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -181,16 +181,21

[PATCH 5/6] Rename kvm_(load|save)_mpstate to kvm_arch_(load|save)_mpstate

2009-06-14 Thread Gleb Natapov
To be consistent with other function naming. Signed-off-by: Gleb Natapov --- qemu-kvm-ia64.c |4 ++-- qemu-kvm-x86.c|4 ++-- qemu-kvm.h|2 ++ target-i386/machine.c |6 +++--- target-ia64/machine.c |4 ++-- 5 files changed, 11 insertions(+), 9

[PATCH 1/6] env->kvm_cpu_state.init is always zero here.

2009-06-14 Thread Gleb Natapov
Signed-off-by: Gleb Natapov --- qemu-kvm.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/qemu-kvm.c b/qemu-kvm.c index 2aeb17c..ec911ef 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -412,7 +412,7 @@ static int kvm_main_loop_cpu(CPUState *env) if (env

[PATCH 3/6] Call kvm_arch_load_regs() instead of kvm_load_registers()

2009-06-14 Thread Gleb Natapov
The call is done from vcpu thread. Signed-off-by: Gleb Natapov --- qemu-kvm.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/qemu-kvm.c b/qemu-kvm.c index 7676e02..5fa7154 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -399,7 +399,7 @@ static int kvm_main_loop_cpu

[PATCH 2/6] Do not use env->halted to decide where halted state should be handled.

2009-06-14 Thread Gleb Natapov
Use kvm_irqchip_in_kernel() for that. If irq chip is not handled by userspace kernel should be entered even when CPU is halted. Signed-off-by: Gleb Natapov --- hw/apic.c |3 +-- qemu-kvm.c |6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/apic.c b/hw/apic.c

[PATCH 4/6] Handle vcpu init/sipi by calling a function on vcpu

2009-06-14 Thread Gleb Natapov
Instead of having special case in vcpu event loop. Signed-off-by: Gleb Natapov --- cpu-defs.h |2 -- qemu-kvm.c | 51 +-- 2 files changed, 17 insertions(+), 36 deletions(-) diff --git a/cpu-defs.h b/cpu-defs.h index e17209a..7570096 100644

[PATCH 6/6] Retrieve mp state info in cpu_synchronize_state()

2009-06-14 Thread Gleb Natapov
And set env->halted based on the value to show accurate vcpu state in QEMU monitor. Signed-off-by: Gleb Natapov --- qemu-kvm.c | 27 +++ qemu-kvm.h |2 ++ 2 files changed, 29 insertions(+), 0 deletions(-) diff --git a/qemu-kvm.c b/qemu-kvm.c index af3fd91..41dc

Re: [PATCH 1/6] env->kvm_cpu_state.init is always zero here.

2009-06-15 Thread Gleb Natapov
On Mon, Jun 15, 2009 at 12:55:27PM +0300, Avi Kivity wrote: > On 06/14/2009 01:52 PM, Gleb Natapov wrote: >> Signed-off-by: Gleb Natapov >> --- >> qemu-kvm.c |2 +- >> 1 files changed, 1 insertions(+), 1 deletions(-) >> >> diff --git a/qemu-kvm.c

Re: [PATCH 4/6] Handle vcpu init/sipi by calling a function on vcpu

2009-06-15 Thread Gleb Natapov
On Mon, Jun 15, 2009 at 01:03:39PM +0300, Avi Kivity wrote: > On 06/14/2009 01:52 PM, Gleb Natapov wrote: >> Instead of having special case in vcpu event loop. >> >> > > I'm a little worried about two vcpus INITing each other simultaneously > and deadlockin

Re: [PATCH 4/6] Handle vcpu init/sipi by calling a function on vcpu

2009-06-15 Thread Gleb Natapov
On Mon, Jun 15, 2009 at 01:14:21PM +0300, Avi Kivity wrote: > On 06/15/2009 01:11 PM, Gleb Natapov wrote: >> On Mon, Jun 15, 2009 at 01:03:39PM +0300, Avi Kivity wrote: >> >>> On 06/14/2009 01:52 PM, Gleb Natapov wrote: >>> >>>> Inst

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

2009-06-15 Thread Gleb Natapov
On Mon, Jun 15, 2009 at 01:32:49PM +0300, Michael S. Tsirkin wrote: > > You do need to export available slot numbers from qemu. > > Why would a slot be unavailable? > Because it does not exist? -- Gleb. -- To unsubscribe from this list: send the line "unsubscribe kvm" in

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

2009-06-15 Thread Gleb Natapov
On Mon, Jun 15, 2009 at 01:46:53PM +0300, Michael S. Tsirkin wrote: > On Mon, Jun 15, 2009 at 01:44:56PM +0300, Gleb Natapov wrote: > > On Mon, Jun 15, 2009 at 01:32:49PM +0300, Michael S. Tsirkin wrote: > > > > You do need to export available slot numbers from qemu. > >

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

2009-06-15 Thread Gleb Natapov
On Mon, Jun 15, 2009 at 02:07:53PM +0300, Michael S. Tsirkin wrote: > On Mon, Jun 15, 2009 at 01:52:13PM +0300, Gleb Natapov wrote: > > On Mon, Jun 15, 2009 at 01:46:53PM +0300, Michael S. Tsirkin wrote: > > > On Mon, Jun 15, 2009 at 01:44:56PM +0300, Gleb Natapov wrote: >

Re: [PATCH 4/4] Nested SVM: Improve interrupt injection v2

2009-06-15 Thread Gleb Natapov
On Mon, Jun 15, 2009 at 01:47:08PM +0200, Alexander Graf wrote: > > On 19.05.2009, at 15:22, Gleb Natapov wrote: > >> On Tue, May 19, 2009 at 12:54:03PM +0200, Alexander Graf wrote: >>> While trying to get Hyper-V running, I realized that the interrupt >>> inj

[PATCH 2/8] Do not use env->halted to decide where halted state should be handled.

2009-06-15 Thread Gleb Natapov
Use kvm_irqchip_in_kernel() for that. If irq chip is not handled by userspace kernel should be entered even when CPU is halted. Signed-off-by: Gleb Natapov --- hw/apic.c |3 +-- qemu-kvm.c |6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/apic.c b/hw/apic.c

[PATCH 0/8] Small cpu loop cleanups

2009-06-15 Thread Gleb Natapov
Also fix "info cpus" to show correct halt status with in kernel irq chip. I removed patch that uses on_vcpu() for init/sipi handling for now. Gleb Natapov (8): env->kvm_cpu_state.init is always zero here. Do not use env->halted to decide where halted state should be

[PATCH 4/8] Rename kvm_(load|save)_mpstate to kvm_arch_(load|save)_mpstate

2009-06-15 Thread Gleb Natapov
To be consistent with other function naming. Signed-off-by: Gleb Natapov --- qemu-kvm-ia64.c |4 ++-- qemu-kvm-x86.c|4 ++-- qemu-kvm.h|2 ++ target-i386/machine.c |6 +++--- target-ia64/machine.c |4 ++-- 5 files changed, 11 insertions(+), 9

[PATCH 3/8] Call kvm_arch_load_regs() instead of kvm_load_registers()

2009-06-15 Thread Gleb Natapov
The call is done from vcpu thread. Signed-off-by: Gleb Natapov --- qemu-kvm.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/qemu-kvm.c b/qemu-kvm.c index 7676e02..5fa7154 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -399,7 +399,7 @@ static int kvm_main_loop_cpu

[PATCH 1/8] env->kvm_cpu_state.init is always zero here.

2009-06-15 Thread Gleb Natapov
Signed-off-by: Gleb Natapov --- qemu-kvm.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/qemu-kvm.c b/qemu-kvm.c index 2aeb17c..ec911ef 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -412,7 +412,7 @@ static int kvm_main_loop_cpu(CPUState *env) if (env

[PATCH 8/8] env->exit_request is not used by kvm.

2009-06-15 Thread Gleb Natapov
Remove its use from kvm code. Signed-off-by: Gleb Natapov --- qemu-kvm-x86.c |3 +-- qemu-kvm.c |3 --- vl.c |1 - 3 files changed, 1 insertions(+), 6 deletions(-) diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c index 6865385..5460136 100644 --- a/qemu-kvm-x86.c +++ b

[PATCH 5/8] Retrieve mp state info in cpu_synchronize_state()

2009-06-15 Thread Gleb Natapov
And set env->halted based on the value to show accurate vcpu state in QEMU monitor. Signed-off-by: Gleb Natapov --- qemu-kvm.c | 27 +++ qemu-kvm.h |2 ++ 2 files changed, 29 insertions(+), 0 deletions(-) diff --git a/qemu-kvm.c b/qemu-kvm.c index 5fa7154..3ae4

[PATCH 6/8] env->exception_index is not used by kvm code.

2009-06-15 Thread Gleb Natapov
Signed-off-by: Gleb Natapov --- qemu-kvm-ia64.c |2 -- qemu-kvm-x86.c |2 -- qemu-kvm.c |1 - 3 files changed, 0 insertions(+), 5 deletions(-) diff --git a/qemu-kvm-ia64.c b/qemu-kvm-ia64.c index 234602c..477d24c 100644 --- a/qemu-kvm-ia64.c +++ b/qemu-kvm-ia64.c @@ -35,7

[PATCH 7/8] s->cpu_env cannot be zero here.

2009-06-15 Thread Gleb Natapov
Remove redundant check. Signed-off-by: Gleb Natapov --- hw/apic.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/hw/apic.c b/hw/apic.c index f186202..eac54fd 100644 --- a/hw/apic.c +++ b/hw/apic.c @@ -471,8 +471,7 @@ static void apic_init_ipi(APICState *s) s

Re: [patch] move _PR to SSDT v2

2009-06-16 Thread Gleb Natapov
On Fri, Jun 12, 2009 at 03:56:04PM +0200, Jes Sorensen wrote: > Hi, > > I figured out why Windows wasn't booting with the previous version > of the patch. It seems it didn't like the forward declaration of the > _PR.PRSC method. > > Instead I found that it does seem to work if I add the calling met

Re: KVM: init bsp_vcpu before kvm_arch_vcpu_init

2009-06-17 Thread Gleb Natapov
On Tue, Jun 16, 2009 at 11:33:16AM -0300, Marcelo Tosatti wrote: > > On x86 mp_state is initialized by kvm_arch_vcpu_init. Right > now kvm_vcpu_is_bsp returns false because kvm->bsp_vcpu has > not been initialized, so vcpu_id == 0 ends up with mp_state == > KVM_MP_STATE_UNINITIALIZED. > > Gleb do

Re: KVM: init bsp_vcpu before kvm_arch_vcpu_init

2009-06-17 Thread Gleb Natapov
On Wed, Jun 17, 2009 at 10:07:59AM -0300, Marcelo Tosatti wrote: > On Wed, Jun 17, 2009 at 03:29:05PM +0300, Gleb Natapov wrote: > > On Tue, Jun 16, 2009 at 11:33:16AM -0300, Marcelo Tosatti wrote: > > > > > > On x86 mp_state is initialized by kvm_arch_vcpu_init. Righ

Re: w2k8 - reboots unexpected

2009-06-18 Thread Gleb Natapov
On Thu, Jun 18, 2009 at 01:27:25PM +0200, Andreas Jud wrote: > Hi > > We are running kvm-84 on debian x64 Linux. > > We have serveral guest running on this host. > > One guest witch is running windows 2008 server and used as a terminal > server, reboots sometimes unexpected. > > All what I fou

[PATCH] Cleanup cpu loop

2009-06-18 Thread Gleb Natapov
Rearrange cpu loop to be (hopefully) more readable. Put difference between kernel/userspace irqchip in one place. Signed-off-by: Gleb Natapov diff --git a/qemu-kvm.c b/qemu-kvm.c index 4129fe2..72a081d 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -1746,15 +1746,9 @@ int kvm_cpu_exec(CPUState *env

Re: w2k8 - reboots unexpected

2009-06-18 Thread Gleb Natapov
On Thu, Jun 18, 2009 at 03:55:32PM +0200, Andreas Jud wrote: > Hi Gleb > > Thank you, for fast reply. > > On Thu, 18 Jun 2009 14:37:47 +0300, Gleb Natapov wrote > > You host cpu does not support NMI injection in VMX (your Intel processor > > is too old). I can'

Re: [PATCH] KVM: SVM: Pass through the host kernel's IO delay port

2009-06-22 Thread Gleb Natapov
On Mon, Jun 22, 2009 at 12:11:59PM +0200, Paolo Bonzini wrote: > Avi Kivity wrote: >> On 06/19/2009 01:15 PM, Paolo Bonzini wrote: >>> From: Paolo Bonzini >>> >>> KVM's optimization of guest port 80 accesses was removed last May 11 >>> in commit 99f85a. However, this probably has speed penalties.

Re: [PATCH] Cleanup cpu loop

2009-06-22 Thread Gleb Natapov
On Mon, Jun 22, 2009 at 04:30:51PM +0300, Avi Kivity wrote: > On 06/18/2009 03:22 PM, Gleb Natapov wrote: >> Rearrange cpu loop to be (hopefully) more readable. Put difference >> between kernel/userspace irqchip in one place. >> >> >> static void flush_queued_

[PATCH v2] Cleanup cpu loop

2009-06-22 Thread Gleb Natapov
Rearrange cpu loop to be (hopefully) more readable. Put difference between kernel/userspace irqchip in one place. Signed-off-by: Gleb Natapov diff --git a/qemu-kvm.c b/qemu-kvm.c index 3105753..2d0015c 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -1751,15 +1751,9 @@ int kvm_cpu_exec(CPUState *env

Re: [Qemu-devel] Re: [PATCH 1/2] allow hypervisor CPUID bit to be overriden

2009-06-24 Thread Gleb Natapov
On Wed, Jun 24, 2009 at 10:20:41PM +0100, Jamie Lokier wrote: > Avi Kivity wrote: > > On 06/23/2009 02:31 PM, Paul Brook wrote: > > >On Tuesday 23 June 2009, Avi Kivity wrote: > > > > > >>On 06/23/2009 12:47 AM, Andre Przywara wrote: > > >> > > >>>KVM defaults to the hypervisor CPUID bit to

[PATCH] Add kvm_set_boot_cpu_id() API.

2009-06-25 Thread Gleb Natapov
Signed-off-by: Gleb Natapov --- hw/pc.c|3 ++- qemu-kvm.c | 17 + qemu-kvm.h |1 + 3 files changed, 20 insertions(+), 1 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index cb5b4d0..9ef245d 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -901,7 +901,8 @@ static void pc_init1

[PATCH] Use cpu_is_bsp() to check for bsp cpu.

2009-06-25 Thread Gleb Natapov
Signed-off-by: Gleb Natapov --- qemu-kvm-x86.c |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c index 568df53..a78073e 100644 --- a/qemu-kvm-x86.c +++ b/qemu-kvm-x86.c @@ -23,6 +23,7 @@ #include #include "kvm.h" +#includ

[PATCH] Move x86 specific code from qemu-kvm.c to qemu-kvm-x86.c

2009-06-25 Thread Gleb Natapov
Signed-off-by: Gleb Natapov --- qemu-kvm-ia64.c |4 qemu-kvm-x86.c | 43 +++ qemu-kvm.c | 44 +--- qemu-kvm.h |1 + 4 files changed, 49 insertions(+), 43 deletions(-) diff --git a/qemu

Re: [PATCH] Add kvm_set_boot_cpu_id() API.

2009-06-28 Thread Gleb Natapov
On Sun, Jun 28, 2009 at 12:29:26PM +0300, Avi Kivity wrote: > On 06/25/2009 03:21 PM, Gleb Natapov wrote: >> Signed-off-by: Gleb Natapov >> > > Why is it needed? (good changelog material). > OK. >> } >> - >> + >> +kvm_set_boot_cpu_

[PATCH 3/3 v2] Add x2APIC support to qemu-kvm.

2009-06-28 Thread Gleb Natapov
Add "x2apic" string to extended features name array to be recognizable by -cpu cputype,+x2apic command line option. If kvm kernel module does not support x2APIC the option will be trimmed from cpuid. Signed-off-by: Gleb Natapov --- target-i386/helper.c |2 +- 1 files changed, 1

[PATCH 0/3 v2] x2APIC emulation for kvm

2009-06-28 Thread Gleb Natapov
This patch series implements x2APIC emulation for kvm. x2APIC is an MSR interface to a local apic with performance/scalability enhancements. It brings 32 bit apic ids (ids > 255 cannot be used without interrupt remapping since MSR/IOAPIC still support 8 bit destination IDs), 64bit ICR access, readi

[PATCH 1/3 v2] Add Directed EOI support to APIC emulation

2009-06-28 Thread Gleb Natapov
Directed EOI is specified by x2APIC, but is available even when lapic is in xAPIC mode. Signed-off-by: Gleb Natapov --- arch/x86/include/asm/apicdef.h |2 ++ arch/x86/kvm/lapic.c | 13 - 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/arch/x86/include

[PATCH 2/3 v2] x2APIC interface to local apic

2009-06-28 Thread Gleb Natapov
This patch implements MSR interface to a local apic as defines by x2APIC Intel specification. Signed-off-by: Gleb Natapov --- arch/x86/kvm/lapic.c | 193 ++ arch/x86/kvm/lapic.h |2 + arch/x86/kvm/x86.c |7 ++- 3 files changed, 154

  1   2   3   4   5   6   7   8   9   10   >