Re: [PATCH] KVM: x86: Avoid NULL dereference in kvm_apic_accept_pic_intr()

2012-02-08 Thread Michael Ellerman
On Tue, 2012-02-07 at 17:38 -0200, Marcelo Tosatti wrote: > On Tue, Feb 07, 2012 at 05:32:07PM +1100, Michael Ellerman wrote: > > A test case which does the following: > > > > ioctl(vmfd, KVM_CREATE_VCPU, 0); > > ioctl(vmfd, KVM_CREATE_IRQCHIP); > > ioctl(cpufd, KVM_RUN); > > > > Can oops in k

qemu-kvm monitor command cpu_set query.

2012-02-08 Thread Onkar N Mahajan
I am doing kernel compilation on a guest with 16 VCPUs. like this : make -j16 bzImage modules Meanwhile on qemu monitor CLI, I do this : (qemu) info cpus * CPU #0: pc=0x2b001abec3a4 thread_id=15395 CPU #1: pc=0x2b2b25b49da2 thread_id=15396 CPU #2: pc=0x810f65e8 thread_id=153

Re: x86: kvmclock: abstract save/restore sched_clock_state

2012-02-08 Thread Igor Mammedov
On 02/07/2012 10:05 PM, Marcelo Tosatti wrote: Upon resume from hibernation, CPU 0's hvclock area contains the old values for system_time and tsc_timestamp. It is necessary for the hypervisor to update these values with uptodate ones before the CPU uses them. Abstract TSC's save/restore sched_c

Re: [PATCH] KVM: x86: Avoid NULL dereference in kvm_apic_accept_pic_intr()

2012-02-08 Thread Michael Ellerman
On Wed, 2012-02-08 at 21:41 +1100, Michael Ellerman wrote: > On Tue, 2012-02-07 at 17:38 -0200, Marcelo Tosatti wrote: > > On Tue, Feb 07, 2012 at 05:32:07PM +1100, Michael Ellerman wrote: > > > A test case which does the following: > > > > > > ioctl(vmfd, KVM_CREATE_VCPU, 0); > > > ioctl(vmfd,

[PATCH v4 1/4] KVM: x86 emulator: Fix task switch privilege checks

2012-02-08 Thread Kevin Wolf
Currently, all task switches check privileges against the DPL of the TSS. This is only correct for jmp/call to a TSS. If a task gate is used, the DPL of this take gate is used for the check instead. Exceptions, external interrupts and iret shouldn't perform any check. Signed-off-by: Kevin Wolf --

[PATCH v4 2/4] KVM: x86 emulator: VM86 segments must have DPL 3

2012-02-08 Thread Kevin Wolf
Setting the segment DPL to 0 for at least the VM86 code segment makes the VM entry fail on VMX. Signed-off-by: Kevin Wolf --- arch/x86/kvm/emulate.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 7097ca9..144a203 10

[PATCH v4 3/4] KVM: SVM: Fix CPL updates

2012-02-08 Thread Kevin Wolf
Keep CPL at 0 in real mode and at 3 in VM86. In protected/long mode, use RPL rather than DPL of the code segment. Signed-off-by: Kevin Wolf --- arch/x86/kvm/svm.c | 19 --- 1 files changed, 16 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c i

[PATCH v4 0/4] Fix task switches into/out of VM86

2012-02-08 Thread Kevin Wolf
Kevin Wolf (4): KVM: x86 emulator: Fix task switch privilege checks KVM: x86 emulator: VM86 segments must have DPL 3 KVM: SVM: Fix CPL updates KVM: x86 emulator: Allow PM/VM86 switch during task switch arch/x86/include/asm/kvm_emulate.h |3 +- arch/x86/include/asm/kvm_host.h|4

[PATCH v4 4/4] KVM: x86 emulator: Allow PM/VM86 switch during task switch

2012-02-08 Thread Kevin Wolf
Task switches can switch between Protected Mode and VM86. The current mode must be updated during the task switch emulation so that the new segment selectors are interpreted correctly. In order to let privilege checks succeed, rflags needs to be updated in the vcpu struct as this causes a CPL upda

Re: Pe: [PATCH v5 1/3] virtio-scsi: first version

2012-02-08 Thread Christian Hoff
Paolo Bonzini wrote: > Christian Hoff wrote: > > Instead the format has some disadvantages: > > - It uses up 8 bytes where 3 bytes would be sufficient in order to store > > both the target ID and LUN number information > > - The format limits us to 255 target IDs. I agree that the LUN limit is >

Re: [PATCH v3 3/3] KVM: perf: kvm events analysis tool

2012-02-08 Thread David Ahern
On 02/07/2012 11:14 PM, Xiao Guangrong wrote: > On 02/08/2012 01:55 AM, David Ahern wrote: > >> On 02/07/2012 06:08 AM, Xiao Guangrong wrote: >>> Add 'perf kvm-events' support to analyze kvm vmexit/mmio/ioport smartly >> >> example output? >> > > > You can find a example output at this website

Re: [patch 1/8] Infrastructure for software and hardware based TSC rate scaling

2012-02-08 Thread Joerg Roedel
On Fri, Feb 03, 2012 at 03:43:50PM -0200, Marcelo Tosatti wrote: > + if (user_tsc_khz > tsc_khz) { > + vcpu->arch.tsc_catchup = 1; > + vcpu->arch.tsc_always_catchup = 1; > + } else > + WARN(1, "user requested TSC ra

[PATCH 1/4 V13] Add flag to indicate that a vm was stopped by the host

2012-02-08 Thread Eric B Munson
This flag will be used to check if the vm was stopped by the host when a soft lockup was detected. The host will set the flag when it stops the guest. On resume, the guest will check this flag if a soft lockup is detected and skip issuing the warning. Signed-off-by: Eric B Munson Cc: mi...@redh

[PATCH 0/4 V13] Avoid soft lockup message when KVM is stopped by host

2012-02-08 Thread Eric B Munson
Changes from V12: Re-add missing kvm.c code after rebase Rename CAP to KVM_CAP_KVMCLOCK_CTRL Rename ioctl to KVM_KVMCLOCK_CTRL Changes from V11: Re-add asm-generic stub Correct api.txt typo add kvm_make_request() call after setting PVCLOCK_GUEST_STOPPED Changes from V10: Return ioctl to per vcpu

[PATCH 2/4 V13] Add functions to check if the host has stopped the vm

2012-02-08 Thread Eric B Munson
When a host stops or suspends a VM it will set a flag to show this. The watchdog will use these functions to determine if a softlockup is real, or the result of a suspended VM. Signed-off-by: Eric B Munson asm-generic changes Acked-by: Arnd Bergmann Cc: mi...@redhat.com Cc: h...@zytor.com Cc: r

[PATCH 4/4 V13] Add check for suspended vm in softlockup detector

2012-02-08 Thread Eric B Munson
A suspended VM can cause spurious soft lockup warnings. To avoid these, the watchdog now checks if the kernel knows it was stopped by the host and skips the warning if so. When the watchdog is reset successfully, clear the guest paused flag. Signed-off-by: Eric B Munson Cc: mi...@redhat.com Cc:

[PATCH 3/4 V13] Add ioctl for KVM_KVMCLOCK_CTRL

2012-02-08 Thread Eric B Munson
Now that we have a flag that will tell the guest it was suspended, create an interface for that communication using a KVM ioctl. Signed-off-by: Eric B Munson Cc: mi...@redhat.com Cc: h...@zytor.com Cc: ry...@linux.vnet.ibm.com Cc: aligu...@us.ibm.com Cc: mtosa...@redhat.com Cc: kvm@vger.kernel.o

Re: [patch 7/8] Dont mark TSC unstable due to S4 suspend

2012-02-08 Thread Joerg Roedel
On Fri, Feb 03, 2012 at 03:43:56PM -0200, Marcelo Tosatti wrote: > + if (backwards_tsc) { > + u64 delta_cyc = max_tsc - local_tsc; > + list_for_each_entry(kvm, &vm_list, vm_list) { > + kvm_for_each_vcpu(i, vcpu, kvm) { > +

Re: [PATCH 1/3] Device isolation group infrastructure (v3)

2012-02-08 Thread Joerg Roedel
On Wed, Feb 01, 2012 at 03:46:52PM +1100, David Gibson wrote: > In order to safely drive a device with a userspace driver, or to pass > it through to a guest system, we must first make sure that the device > is isolated in such a way that it cannot interfere with other devices > on the system. Thi

[RFC] need to improve slot creation/destruction? -- Re: [RFC][PATCH] srcu: Implement call_srcu()

2012-02-08 Thread Takuya Yoshikawa
[Dropped non-kvm members from cc] Marcelo Tosatti wrote: > VGABIOS mode constantly destroys and creates 0xa slot, so > performance is required for KVM_SET_MEM too (it can probably be fixed in > qemu, but older qemu's must be supported). Apart from srcu, I see some problems concerning slot c

Re: [patch 7/8] Dont mark TSC unstable due to S4 suspend

2012-02-08 Thread Marcelo Tosatti
On Wed, Feb 08, 2012 at 04:18:48PM +0100, Joerg Roedel wrote: > On Fri, Feb 03, 2012 at 03:43:56PM -0200, Marcelo Tosatti wrote: > > + if (backwards_tsc) { > > + u64 delta_cyc = max_tsc - local_tsc; > > + list_for_each_entry(kvm, &vm_list, vm_list) { > > + kv

Re: [PATCH for 3.3] KVM: Fix write protection race during dirty logging

2012-02-08 Thread Marcelo Tosatti
On Sun, Feb 05, 2012 at 08:42:41PM +0900, Takuya Yoshikawa wrote: > From: Takuya Yoshikawa > > This patch fixes a race introduced by: > > commit 95d4c16ce78cb6b7549a09159c409d52ddd18dae > KVM: Optimize dirty logging by rmap_write_protect() > > During protecting pages for dirty logging, othe

Re: [PATCH uq/master] apic: Fix legacy vmstate loading for KVM

2012-02-08 Thread Marcelo Tosatti
On Sun, Feb 05, 2012 at 12:45:20PM +0100, Jan Kiszka wrote: > From: Jan Kiszka > > Also in case of loading pre-vmstate machines, we also need to open-code > the reading of the timer expires value and instead call the post_load > callback to apply it (or not). This fixes loading of legacy states i

Re: [PATCH v2] KVM: Factor out kvm_vcpu_kick to arch-generic code

2012-02-08 Thread Alexander Graf
On 06.02.2012, at 19:25, Marcelo Tosatti wrote: > On Tue, Jan 24, 2012 at 11:27:39PM -0500, Christoffer Dall wrote: >> The kvm_vcpu_kick function performs roughly the same funcitonality on >> most all architectures, so we shouldn't have separate copies. >> >> PowerPC keeps a pointer to interchan

Re: [Qemu-devel] [RFC] Next gen kvm api

2012-02-08 Thread Scott Wood
On 02/07/2012 06:28 AM, Anthony Liguori wrote: > On 02/06/2012 01:46 PM, Scott Wood wrote: >> On 02/03/2012 04:52 PM, Anthony Liguori wrote: >>> On 02/03/2012 12:07 PM, Eric Northup wrote: How would the ability to use sys_kvm_* be regulated? >>> >>> Why should it be regulated? >>> >>> It's not

Re: [Qemu-devel] [RFC] Next gen kvm api

2012-02-08 Thread Alan Cox
> If the fd overhead really is a problem, perhaps the fd could be retained > for setup operations, and omitted only on calls that require a vcpu to > have been already set up on the current thread? Quite frankly I'd like to have an fd because it means you've got a meaningful way of ensuring that i

Re: [Qemu-devel] [RFC] Next gen kvm api

2012-02-08 Thread Alan Cox
> >register_pio_hook_ptr_r(PIO_IDE, SIZE_BYTE,&s->cmd[0]); > >for (i = 1; i< 7; i++) { > > register_pio_hook_ptr_r(PIO_IDE + i, SIZE_BYTE,&s->cmd[i]); > > register_pio_hook_ptr_w(PIO_IDE + i, SIZE_BYTE,&s->cmd[i]); > >} > > You can't easily serialize updates to that address

Re: [PATCH] qemu-kvm: Drop broken --no-cpu-emulation

2012-02-08 Thread Marcelo Tosatti
On Mon, Feb 06, 2012 at 03:21:41PM +0100, Jan Kiszka wrote: > Doesn't build for quite a while now, let's remove the rotting bits. > > Signed-off-by: Jan Kiszka > --- > Makefile.target |6 +--- > configure | 10 - > exec.c |2 - > target-i3

Re: [PATCH 0/6] Fixes for kvm on s390

2012-02-08 Thread Marcelo Tosatti
On Mon, Feb 06, 2012 at 10:59:01AM +0100, Christian Borntraeger wrote: > Avi, Marcelo, > > here are some fixes for kvm on s390. > Patch 1 (Sanitize fpc registers for KVM_SET_FPU) fixes a kernel bug that > can be triggered by a user, this should go into 3.3. > Patch 2 (do store status after handlin

Re: [PATCH 0/4] uq/master: Introduce KVM PIT support

2012-02-08 Thread Marcelo Tosatti
On Sun, Feb 05, 2012 at 11:46:26AM +0100, Jan Kiszka wrote: > This adds another piece of qemu-kvm to upstream: The accelerated > in-kernel model of the i8254. It does this in the same fashion as the > interrupt controllers were already introduced. And it even has one bug > less than qemu-kvm: PC sp

Re: [RFC] need to improve slot creation/destruction? -- Re: [RFC][PATCH] srcu: Implement call_srcu()

2012-02-08 Thread Marcelo Tosatti
On Thu, Feb 09, 2012 at 12:43:20AM +0900, Takuya Yoshikawa wrote: > [Dropped non-kvm members from cc] > > Marcelo Tosatti wrote: > > > VGABIOS mode constantly destroys and creates 0xa slot, so > > performance is required for KVM_SET_MEM too (it can probably be fixed in > > qemu, but older qe

Re: [PATCH 0/4 v4] KVM: Introduce kvm_memory_slot::arch

2012-02-08 Thread Marcelo Tosatti
On Wed, Feb 08, 2012 at 12:58:02PM +0900, Takuya Yoshikawa wrote: > Rebased the whole series (against the next branch of kvm.git). > > No manual edit. > If something is still wrong, please let me know. > > > Thanks, > Takuya Applied, thanks. -- To unsubscribe from this list: send the lin

[PATCH 3/3] apic: Fix legacy vmstate loading for KVM

2012-02-08 Thread Marcelo Tosatti
From: Jan Kiszka Also in case of loading pre-vmstate machines, we also need to open-code the reading of the timer expires value and instead call the post_load callback to apply it (or not). This fixes loading of legacy states into the KVM APIC. Reported-by: Paolo Bonzini Signed-off-by: Jan Kisz

[PATCH 2/3] kvm: Implement kvm_irqchip_in_kernel like kvm_enabled

2012-02-08 Thread Marcelo Tosatti
From: Jan Kiszka To both avoid that kvm_irqchip_in_kernel always has to be paired with kvm_enabled and that the former ends up in a function call, implement it like the latter. This means keeping the state in a global variable and defining kvm_irqchip_in_kernel as a preprocessor macro. Signed-of

[PATCH 0/3] [PULL] qemu-kvm.git uq/master queue

2012-02-08 Thread Marcelo Tosatti
The following changes since commit cf4dc461a4cfc3e056ee24edb26154f4d34a6278: Restore consistent formatting (2012-02-07 22:11:04 +0400) are available in the git repository at: git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git uq/master Jan Kiszka (3): kvm: Allow to set shadow MMU size

[PATCH 1/3] kvm: Allow to set shadow MMU size

2012-02-08 Thread Marcelo Tosatti
From: Jan Kiszka Introduce the KVM-specific machine option kvm_shadow_mem. It allows to set a custom shadow MMU size for the virtual machine. This is useful for stress testing e.g. Only x86 supports this for now, but it is in principle a generic concept for all targets with shadow MMUs. Signed-

Re: [PATCH v2] KVM: Factor out kvm_vcpu_kick to arch-generic code

2012-02-08 Thread Christoffer Dall
I'll give it one more shot at fixing it up. On Wed, Feb 8, 2012 at 8:52 AM, Alexander Graf wrote: > > On 06.02.2012, at 19:25, Marcelo Tosatti wrote: > >> On Tue, Jan 24, 2012 at 11:27:39PM -0500, Christoffer Dall wrote: >>> The kvm_vcpu_kick function performs roughly the same funcitonality on >>

Re: [PATCH 1/3] Device isolation group infrastructure (v3)

2012-02-08 Thread Benjamin Herrenschmidt
On Wed, 2012-02-08 at 16:27 +0100, Joerg Roedel wrote: > Again, device grouping is done by the IOMMU drivers, so this all > belongs > into the generic iommu-code rather than the driver core. Except that there isn't really a "generic iommu code"... discovery, initialization & matching of iommu vs.

Re: [PATCH 1/3] Device isolation group infrastructure (v3)

2012-02-08 Thread Benjamin Herrenschmidt
On Wed, 2012-02-08 at 16:27 +0100, Joerg Roedel wrote: > Again, device grouping is done by the IOMMU drivers, so this all > belongs > into the generic iommu-code rather than the driver core. > > I think it makes sense to introduce a device->iommu pointer which > depends on CONFIG_IOMMU_API and put

WARNING: at arch/x86/kernel/smp.c:119 native_smp_send_reschedule+0x25/0x43()

2012-02-08 Thread Sasha Levin
Hi all, I got the following warning when shutting down a KVM guest with a whole bunch of cores (254 in this case). It's actually pretty easy to reproduce it, it happens every once in 2-3 shutdowns. [ 32.448626] [ cut here ] [ 32.449160] WARNING: at arch/x86/kernel/s

Re: WARNING: at arch/x86/kernel/smp.c:119 native_smp_send_reschedule+0x25/0x43()

2012-02-08 Thread Josh Boyer
On Wed, Feb 8, 2012 at 8:31 PM, Sasha Levin wrote: > Hi all, > > I got the following warning when shutting down a KVM guest with a whole bunch > of cores (254 in this case). > > It's actually pretty easy to reproduce it, it happens every once in 2-3 > shutdowns. > > [   32.448626] [

Re: [Android-virt] [PATCH v5 05/13] ARM: KVM: Inject IRQs and FIQs from userspace

2012-02-08 Thread Peter Maydell
On 12 December 2011 17:40, Avi Kivity wrote: > On 12/12/2011 06:31 PM, Peter Maydell wrote: >> I think with an in-kernel GIC model you'd only need to be able to set >> one of the (256 including internal-to-the-CPU inputs) GIC input lines; >> the GIC itself then connects directly to the vcpu IRQ an

Re: [net-next-2.6 PATCH 0/6 v4] macvlan: MAC Address filtering support for passthru mode

2012-02-08 Thread John Fastabend
On 2/5/2012 8:54 AM, Roopa Prabhu wrote: > > > > On 2/3/12 7:32 AM, "Roopa Prabhu" wrote: > >> >> >> >> On 2/2/12 10:58 AM, "John Fastabend" wrote: > .. > >>> Are you sure they will be good to have? I'm not so sure you want to be >>> able to manipulate the uc and mc tables from user space.

Re: [PATCH v3 3/3] KVM: perf: kvm events analysis tool

2012-02-08 Thread Xiao Guangrong
On 02/08/2012 10:26 PM, David Ahern wrote: +static int kvm_events_report(int vcpu) +{ + init_kvm_event_record(); + init_kvm_tid_to_pid(); + verify_vcpu(vcpu); + select_key(); + register_kvm_events_ops(); + setup_pager(); >>> >>> I believe setup_pager

[RFC PATCH v0 1/2] net: bridge: propagate FDB table into hardware

2012-02-08 Thread John Fastabend
Propagate software FDB table into hardware uc, mc lists when the NETIF_F_HW_FDB is set. This resolves the case below where an embedded switch is used in hardware to do inter-VF or VF-PF switching. This patch pushes the FDB entry (specifically the MAC address) into the embedded switch with dev_add_

[RFC PATCH v0 2/2] ixgbe: add NETIF_F_HW_FDB to supported flags

2012-02-08 Thread John Fastabend
Add support for NETIF_F_HW_FDB flag when SR-IOV is enabled. This allows the bridge to push fdb entries into the hardware so the VF can communicate with virtual devices attached to the bridge. veth0 veth2 | | | bridge0 | < softwar

Re: [PATCH 1/3] Device isolation group infrastructure (v3)

2012-02-08 Thread David Gibson
On Wed, Feb 08, 2012 at 04:27:48PM +0100, Joerg Roedel wrote: > On Wed, Feb 01, 2012 at 03:46:52PM +1100, David Gibson wrote: > > In order to safely drive a device with a userspace driver, or to pass > > it through to a guest system, we must first make sure that the device > > is isolated in such a

Re: [PATCH v3 3/3] KVM: perf: kvm events analysis tool

2012-02-08 Thread David Ahern
On 02/08/2012 08:07 PM, Xiao Guangrong wrote: > Thanks for your review and explanation! > > The code of commit_pager_choice(): > static void commit_pager_choice(void) > { > switch (use_pager) { > case 0: > setenv("PERF_PAGER", "cat", 1); > break; > ca

Re: [RFC PATCH v0 1/2] net: bridge: propagate FDB table into hardware

2012-02-08 Thread Stephen Hemminger
On Wed, 08 Feb 2012 19:22:06 -0800 John Fastabend wrote: > Propagate software FDB table into hardware uc, mc lists when > the NETIF_F_HW_FDB is set. > > This resolves the case below where an embedded switch is used > in hardware to do inter-VF or VF-PF switching. This patch > pushes the FDB entr

[PATCH] kvm tool: rewrite kvm__init

2012-02-08 Thread Yang Bai
Since the different issues have been handled in the internal of kvm__init, it can only return NULL if error happened. Signed-off-by: Yang Bai --- tools/kvm/builtin-run.c |4 ++-- tools/kvm/kvm.c | 20 +++- 2 files changed, 9 insertions(+), 15 deletions(-) diff --gi

[KVM-autotest] virt.kvm_vm: Add virtio-scsi support

2012-02-08 Thread Lukas Doktor
This patch adds support for virtio-scsi devices. Added block variants: * virtio_scsi (default) * virtio_scsi_disk (legacy scsi) * virtio_scsi_block (only raw /dev/sd* files) * virtio_scsi_generic (only raw /dev/sg* files) Please keep in mind that virtio-scsi is not yet upstream. To test this patc

[PATCH] [KVM-autotest] virt.kvm_vm: Add virtio-scsi support

2012-02-08 Thread Lukas Doktor
This patch adds support for virtio-scsi devices. Tested targets are scsi-hd, scsi-cd, scsi-disk, scsi-block and scsi-generic where scsi-hd and scsi-cd are default virtio-scsi variant. It's possible to use other targets in specific tests by forcing drive_format_$DISKNAME = "scsi-generic". NOTE: s