Re: [PATCH v2 4/6] hw_random: fix unregister race.

2014-10-31 Thread Herbert Xu
On Fri, Oct 31, 2014 at 10:28:00AM +1030, Rusty Russell wrote: > Herbert Xu writes: > > On Thu, Sep 18, 2014 at 08:37:45PM +0800, Amos Kong wrote: > >> From: Rusty Russell > >> > >> The previous patch added one potential problem: we can still be > >> reading from a hwrng when it's unregistered.

Re: [PATCH 00/17] RFC: userfault v2

2014-10-31 Thread zhanghailiang
On 2014/10/31 13:17, Andres Lagar-Cavilla wrote: On Thu, Oct 30, 2014 at 9:38 PM, zhanghailiang wrote: On 2014/10/31 11:29, zhanghailiang wrote: On 2014/10/31 10:23, Peter Feiner wrote: On Thu, Oct 30, 2014 at 07:31:48PM +0800, zhanghailiang wrote: On 2014/10/30 1:46, Andrea Arcangeli wro

Re: [PATCH] KVM: x86: fix access memslots w/o hold srcu read lock

2014-10-31 Thread Paolo Bonzini
On 31/10/2014 06:30, Chen, Tiejun wrote: > > @@ -4442,6 +4442,7 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu) > { > struct vcpu_vmx *vmx = to_vmx(vcpu); > struct msr_data apic_base_msr; > + int idx; > > vmx->rmode.vm86_active = 0; > > @@ -4509,7 +4510,9 @@

Re: [PATCH] KVM: x86: fix access memslots w/o hold srcu read lock

2014-10-31 Thread Wanpeng Li
Hi Paolo, On 14/10/31 下午6:36, Paolo Bonzini wrote: On 31/10/2014 06:30, Chen, Tiejun wrote: @@ -4442,6 +4442,7 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx = to_vmx(vcpu); struct msr_data apic_base_msr; + int idx; vmx->rmode.vm8

Re: [kvm-unit-tests PATCH 0/6] arm: enable MMU

2014-10-31 Thread Paolo Bonzini
On 30/10/2014 16:56, Andrew Jones wrote: > This first patch of this series fixes a bug caused by attempting > to use spinlocks without enabling the MMU. The next three do some > prep for the fifth, and also fix arm's PAGE_ALIGN. The fifth is > prep for the sixth, which finally turns the MMU on fo

Re: [PATCH v2 03/15] arm/arm64: KVM: refactor vgic_handle_mmio() function

2014-10-31 Thread Andre Przywara
Hi Christoffer, On 15/10/14 17:25, Christoffer Dall wrote: > On Thu, Aug 21, 2014 at 02:06:44PM +0100, Andre Przywara wrote: >> Currently we only need to deal with one MMIO region for the GIC >> emulation, but we soon need to extend this. Refactor the existing >> code to allow easier addition of d

Re: [PATCH v2 04/15] arm/arm64: KVM: wrap 64 bit MMIO accesses with two 32 bit ones

2014-10-31 Thread Andre Przywara
Hi Christoffer, On 15/10/14 17:26, Christoffer Dall wrote: > On Thu, Aug 21, 2014 at 02:06:45PM +0100, Andre Przywara wrote: >> Some GICv3 registers can and will be accessed as 64 bit registers. >> Currently the register handling code can only deal with 32 bit >> accesses, so we do two consecutive

Re: [PATCH v2 05/15] arm/arm64: KVM: introduce per-VM ops

2014-10-31 Thread Andre Przywara
Hi Christoffer, On 15/10/14 17:27, Christoffer Dall wrote: > On Thu, Aug 21, 2014 at 02:06:46PM +0100, Andre Przywara wrote: >> Currently we only have one virtual GIC model supported, so all guests >> use the same emulation code. With the addition of another model we >> end up with different guest

Re: [PATCH v2 01/15] arm/arm64: KVM: rework MPIDR assignment and add accessors

2014-10-31 Thread Andre Przywara
Hi Christoffer, On 15/10/14 17:25, Christoffer Dall wrote: > On Thu, Aug 21, 2014 at 02:06:42PM +0100, Andre Przywara wrote: >> The virtual MPIDR registers (containing topology information) for the >> guest are currently mapped linearily to the vcpu_id. Improve this >> mapping for arm64 by using t

Re: [PATCH v2 06/15] arm/arm64: KVM: make the maximum number of vCPUs a per-VM value

2014-10-31 Thread Andre Przywara
On 15/10/14 17:27, Christoffer Dall wrote: > On Thu, Aug 21, 2014 at 02:06:47PM +0100, Andre Przywara wrote: >> Currently the maximum number of vCPUs supported is a global value >> limited by the used GIC model. GICv3 will lift this limit, but we >> still need to observe it for guests using GICv2.

Re: [PATCH 0/3] kvm: APICv register write workaround

2014-10-31 Thread Paolo Bonzini
On 30/10/2014 15:06, Radim Krčmář wrote: > APICv traps register writes, so we can't retrieve previous value, but > our code depends on detecting changes. Applied, thanks. Paolo > Apart from disabling APIC register virtualization, we can detect the > change by using extra memory. One value his

Re: [PATCH 6/6] kvm_stat: Add powerpc support

2014-10-31 Thread Paolo Bonzini
Thanks, applied the series at last. Paolo On 17/06/2014 09:54, Michael Ellerman wrote: > Add support for powerpc platforms. We use uname -m, which allows us to > detect ppc, ppc64 and ppc64le/el. > > Signed-off-by: Michael Ellerman > --- > scripts/kvm/kvm_stat | 18 -- > 1 file

Re: [PATCH 2/6] kvm_stat: Fix the non-x86 exit reasons

2014-10-31 Thread Paolo Bonzini
On 17/06/2014 09:54, Michael Ellerman wrote: > In kvm_stat we have a dictionary of exit reasons for s390. Firstly these > are not s390 specific, they are the generic exit reasons. So rename the > dictionary to reflect that. > > Secondly, the values are defined using hex, but in the kernel header

Re: [PATCH v9 14/19] vfio: move eventfd support code for VFIO_PCI to a separate file

2014-10-31 Thread Antonios Motakis
On Mon, Oct 27, 2014 at 8:16 PM, Bjorn Helgaas wrote: > Hi Antonios, > > On Mon, Oct 27, 2014 at 12:07 PM, Antonios Motakis > wrote: >> The virqfd functionality that is used by VFIO_PCI to implement interrupt >> masking and unmasking via an eventfd, is generic enough and can be reused >> by anoth

[PATCH V1 1/4] KVM: x86/vPMU: Define kvm_pmu_ops to support vPMU function dispatch

2014-10-31 Thread Wei Huang
This patch defines a new function pointer struct (kvm_pmu_ops) to support vPMU for both Intel and AMD. The functions of this new struct are well self-explaned by their names. In the meanwhile the struct that maps from event_sel bits to PERF_TYPE_HARDWARE events is moved from Intel specific code to

[PATCH V1 0/4] KVM vPMU support for x86

2014-10-31 Thread Wei Huang
Currently KVM only supports vPMU for Intel platforms. This patch set enable vPMU support for AMD platform by creating a common PMU interface for x86. The PMU calls from guest VMs are dispatched to corresponding functions defined in arch specific files. V1: * Adopt the file layout suggested by R

[PATCH V1 3/4] KVM: x86/vPMU: Implement AMD PMU support for KVM

2014-10-31 Thread Wei Huang
This patch implemented vPMU for AMD platform. The design piggybacks on the existing Intel structs (kvm_pmu and kvm_pmc), but only uses the parts of generic counters. The kvm_pmu_ops interface is also initialized in this patch. Signed-off-by: Wei Huang --- arch/x86/kvm/pmu_amd.c | 332 +++

[PATCH V1 2/4] KVM: x86/vPMU: Convert pmu.c code into Intel specific code

2014-10-31 Thread Wei Huang
This patch converts existing pmu.c into Intel specific code and hooks up with the PMU interface using the following steps: - Convert pmu.c to pmu_intel.c; All public PMU functions are renamed and hooked up with the newly defined intel_pmu_ops. - Create a corresponding pmu_amd.c file with empty f

[PATCH V1 4/4] KVM: x86/vPMU: Enable PMU handling for AMD PERFCTRn and EVNTSELn MSRs

2014-10-31 Thread Wei Huang
This patch enables PMU handling (read/write) for AMD performance counters, whic include PERFCTR[0..3] and EVNTSEL[0..3]. Signed-off-by: Wei Huang --- arch/x86/kvm/x86.c | 34 ++ 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/arch/x86/kvm/x86.c b/a

Re: [PATCH v9 17/19] vfio: virqfd: add vfio_ prefix to virqfd_enable and virqfd_disable

2014-10-31 Thread Antonios Motakis
On Mon, Oct 27, 2014 at 9:12 PM, Bjorn Helgaas wrote: > On Mon, Oct 27, 2014 at 12:08 PM, Antonios Motakis > wrote: >> The virqfd_enable and virqfd_disable functions are now global. Add the >> vfio_ prefix to those functions. > > Wouldn't it be better to change the name *before* making them globa

Re: [PATCH] kvm: kvmclock: use get_cpu() and put_cpu()

2014-10-31 Thread Paolo Bonzini
On 26/09/2014 08:00, Tiejun Chen wrote: > We can use get_cpu() and put_cpu() to replace > preempt_disable()/cpu = smp_processor_id() and > preempt_enable() for slightly better code. > > Signed-off-by: Tiejun Chen > --- > arch/x86/kernel/kvmclock.c | 19 --- > 1 file changed, 8 in

Re: [PATCH v2 0/8] CR4 handling improvements

2014-10-31 Thread Andy Lutomirski
On Fri, Oct 31, 2014 at 8:09 AM, Peter Zijlstra wrote: > > > This looks ok I suppose, although the x86 people should pass verdict on > the first few patches. Adding some KVM people, too. Patches 2 and 3 affect KVM, and that code has been buggy in the recent past. They should mostly fix the perf

Re: [PATCH v9 04/19] vfio: amba: VFIO support for AMBA devices

2014-10-31 Thread Alex Williamson
On Mon, 2014-10-27 at 19:07 +0100, Antonios Motakis wrote: > Add support for discovering AMBA devices with VFIO and handle them > similarly to Linux platform devices. > > Signed-off-by: Antonios Motakis > --- > drivers/vfio/platform/vfio_amba.c | 116 > ++ >

Re: [PATCH v9 07/19] vfio/platform: return info for device memory mapped IO regions

2014-10-31 Thread Alex Williamson
On Mon, 2014-10-27 at 19:07 +0100, Antonios Motakis wrote: > This patch enables the IOCTLs VFIO_DEVICE_GET_REGION_INFO ioctl call, > which allows the user to learn about the available MMIO resources of > a device. > > Signed-off-by: Antonios Motakis > --- > drivers/vfio/platform/vfio_platform_co

Re: [PATCH v9 12/19] vfio/platform: trigger an interrupt via eventfd

2014-10-31 Thread Alex Williamson
On Mon, 2014-10-27 at 19:07 +0100, Antonios Motakis wrote: > This patch allows to set an eventfd for a patform device's interrupt, > and also to trigger the interrupt eventfd from userspace for testing. > Level sensitive interrupts are marked as maskable and are handled in > a later patch. Edge tri

Re: [PATCH v9 13/19] vfio/platform: support for level sensitive interrupts

2014-10-31 Thread Alex Williamson
On Mon, 2014-10-27 at 19:07 +0100, Antonios Motakis wrote: > Level sensitive interrupts are exposed as maskable and automasked > interrupts and are masked and disabled automatically when they fire. > > Signed-off-by: Antonios Motakis > --- > drivers/vfio/platform/vfio_platform_irq.c | 102 >

Re: [PATCH 00/17] RFC: userfault v2

2014-10-31 Thread Peter Feiner
On Fri, Oct 31, 2014 at 11:29:49AM +0800, zhanghailiang wrote: > Agreed, but for doing live memory snapshot (VM is running when do snapsphot), > we have to do this (block the write action), because we have to save the page > before it > is dirtied by writing action. This is the difference, compare

Re: [PATCH v9 15/19] vfio: add local lock in virqfd instead of depending on VFIO PCI

2014-10-31 Thread Alex Williamson
On Mon, 2014-10-27 at 19:08 +0100, Antonios Motakis wrote: > Virqfd just needs to keep accesses to any struct *virqfd safe, but this > comes into play only when creating or destroying eventfds, so sharing > the same spinlock with the VFIO bus driver is not necessary. > > Signed-off-by: Antonios Mo

Re: [PATCH v9 10/19] vfio/platform: return IRQ info

2014-10-31 Thread Alex Williamson
On Mon, 2014-10-27 at 19:07 +0100, Antonios Motakis wrote: > Return information for the interrupts exposed by the device. > This patch extends VFIO_DEVICE_GET_INFO with the number of IRQs > and enables VFIO_DEVICE_GET_IRQ_INFO. > > Signed-off-by: Antonios Motakis > --- > drivers/vfio/platform/Ma

Re: [PATCH v2 1/6] vfio: implement iommu driver capabilities with an enum

2014-10-31 Thread Alex Williamson
On Mon, 2014-10-27 at 19:05 +0100, Antonios Motakis wrote: > Currently a VFIO driver's IOMMU capabilities are encoded as a series of > numerical defines. Replace this with an enum for future maintainability. > > Signed-off-by: Antonios Motakis > --- > include/uapi/linux/vfio.h | 21 ++---

[PATCH v3] KVM: x86: fix access memslots w/o hold srcu read lock

2014-10-31 Thread Wanpeng Li
The srcu read lock must be held while accessing memslots (e.g. when using gfn_to_* functions), however, commit c24ae0dcd3e8 ("kvm: x86: Unpin and remove kvm_arch->apic_access_page") call gfn_to_page() in kvm_vcpu_reload_apic_access_page() w/o hold it in vmx_vcpu_reset() path which leads to suspici

Re: [PATCH] KVM: x86: fix access memslots w/o hold srcu read lock

2014-10-31 Thread Wanpeng Li
Hi Paolo, On 14/10/31 下午6:36, Paolo Bonzini wrote: On 31/10/2014 06:30, Chen, Tiejun wrote: @@ -4442,6 +4442,7 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx = to_vmx(vcpu); struct msr_data apic_base_msr; + int idx; vmx->rmode.vm8