Re: [PATCH 3/3] KVM: PPC: Book3S: Add support for hwrng found on some powernv systems

2013-10-02 Thread Paolo Bonzini
Il 01/10/2013 23:44, Benjamin Herrenschmidt ha scritto: > On Tue, 2013-10-01 at 13:19 +0200, Paolo Bonzini wrote: >> Il 01/10/2013 11:38, Benjamin Herrenschmidt ha scritto: >>> So for the sake of that dogma you are going to make us do something that >>> is about 100 times slower ? (and possibly inv

Re: [PATCH 3/3] KVM: PPC: Book3S: Add support for hwrng found on some powernv systems

2013-10-02 Thread Paolo Bonzini
Il 02/10/2013 07:09, Paul Mackerras ha scritto: > On Tue, Oct 01, 2013 at 01:19:06PM +0200, Paolo Bonzini wrote: > >> Anyhow, I would like to know more about this hwrng and hypercall. >> >> Does the hwrng return random numbers (like rdrand) or real entropy (like >> rdseed that Intel will add in Br

Re: [PATCH 3/3] KVM: PPC: Book3S: Add support for hwrng found on some powernv systems

2013-10-02 Thread Benjamin Herrenschmidt
On Wed, 2013-10-02 at 10:46 +0200, Paolo Bonzini wrote: > > Thanks. Any chance you can give some numbers of a kernel hypercall and > a userspace hypercall on Power, so we have actual data? For example a > hypercall that returns H_PARAMETER as soon as possible. I don't have (yet) numbers at han

Re: [PATCH 3/3] KVM: PPC: Book3S: Add support for hwrng found on some powernv systems

2013-10-02 Thread Alexander Graf
On 02.10.2013, at 11:06, Benjamin Herrenschmidt wrote: > On Wed, 2013-10-02 at 10:46 +0200, Paolo Bonzini wrote: > >> >> Thanks. Any chance you can give some numbers of a kernel hypercall and >> a userspace hypercall on Power, so we have actual data? For example a >> hypercall that returns H_

Re: [PATCH 3/3] KVM: PPC: Book3S: Add support for hwrng found on some powernv systems

2013-10-02 Thread Alexander Graf
On 02.10.2013, at 11:11, Alexander Graf wrote: > > On 02.10.2013, at 11:06, Benjamin Herrenschmidt wrote: > >> On Wed, 2013-10-02 at 10:46 +0200, Paolo Bonzini wrote: >> >>> >>> Thanks. Any chance you can give some numbers of a kernel hypercall and >>> a userspace hypercall on Power, so we h

Re: [PATCH 3/3] KVM: PPC: Book3S: Add support for hwrng found on some powernv systems

2013-10-02 Thread Gleb Natapov
On Wed, Oct 02, 2013 at 11:50:50AM +0200, Alexander Graf wrote: > > On 02.10.2013, at 11:11, Alexander Graf wrote: > > > > > On 02.10.2013, at 11:06, Benjamin Herrenschmidt wrote: > > > >> On Wed, 2013-10-02 at 10:46 +0200, Paolo Bonzini wrote: > >> > >>> > >>> Thanks. Any chance you can giv

Re: [PATCH 3/3] KVM: PPC: Book3S: Add support for hwrng found on some powernv systems

2013-10-02 Thread Michael Ellerman
On Wed, 2013-10-02 at 13:02 +0300, Gleb Natapov wrote: > On Wed, Oct 02, 2013 at 11:50:50AM +0200, Alexander Graf wrote: > > > > On 02.10.2013, at 11:11, Alexander Graf wrote: > > > > So how do you solve live migration between a kernel that has this patch and > > one that doesn't? > > > Yes, I

Re: [PATCH 3/3] KVM: PPC: Book3S: Add support for hwrng found on some powernv systems

2013-10-02 Thread Alexander Graf
On 02.10.2013, at 15:57, Michael Ellerman wrote: > On Wed, 2013-10-02 at 13:02 +0300, Gleb Natapov wrote: >> On Wed, Oct 02, 2013 at 11:50:50AM +0200, Alexander Graf wrote: >>> >>> On 02.10.2013, at 11:11, Alexander Graf wrote: >>> >>> So how do you solve live migration between a kernel that ha

Re: [PATCH 3/3] KVM: PPC: Book3S: Add support for hwrng found on some powernv systems

2013-10-02 Thread Gleb Natapov
On Wed, Oct 02, 2013 at 11:57:55PM +1000, Michael Ellerman wrote: > On Wed, 2013-10-02 at 13:02 +0300, Gleb Natapov wrote: > > On Wed, Oct 02, 2013 at 11:50:50AM +0200, Alexander Graf wrote: > > > > > > On 02.10.2013, at 11:11, Alexander Graf wrote: > > > > > > So how do you solve live migration

Re: [PATCH 1/2] kvm/powerpc: rename kvm_hypercall() to epapr_hypercall()

2013-10-02 Thread Alexander Graf
On 23.09.2013, at 07:23, Bharat Bhushan wrote: > kvm_hypercall() have nothing KVM specific, so renamed to epapr_hypercall(). > Also this in moved to arch/powerpc/include/asm/epapr_hcalls.h > > Signed-off-by: Bharat Bhushan > --- > arch/powerpc/include/asm/epapr_hcalls.h | 36 +

Re: [PATCH 3/3] KVM: PPC: Book3S: Add support for hwrng found on some powernv systems

2013-10-02 Thread Paolo Bonzini
Il 02/10/2013 16:08, Alexander Graf ha scritto: > > The hwrng is accessible by host userspace via /dev/mem. > > A guest should live on the same permission level as a user space > application. If you run QEMU as UID 1000 without access to /dev/mem, why > should the guest suddenly be able to directl

Re: [PATCH 3/3] KVM: PPC: Book3S: Add support for hwrng found on some powernv systems

2013-10-02 Thread Alexander Graf
On 02.10.2013, at 16:33, Paolo Bonzini wrote: > Il 02/10/2013 16:08, Alexander Graf ha scritto: >>> The hwrng is accessible by host userspace via /dev/mem. >> >> A guest should live on the same permission level as a user space >> application. If you run QEMU as UID 1000 without access to /dev/me

Re: [PATCH 3/3] KVM: PPC: Book3S: Add support for hwrng found on some powernv systems

2013-10-02 Thread Gleb Natapov
On Wed, Oct 02, 2013 at 04:33:18PM +0200, Paolo Bonzini wrote: > Il 02/10/2013 16:08, Alexander Graf ha scritto: > > > The hwrng is accessible by host userspace via /dev/mem. > > > > A guest should live on the same permission level as a user space > > application. If you run QEMU as UID 1000 witho

Re: [PATCH 3/3] KVM: PPC: Book3S: Add support for hwrng found on some powernv systems

2013-10-02 Thread Paolo Bonzini
Il 02/10/2013 16:36, Alexander Graf ha scritto: >> > >> > With Michael's earlier patch in this series, the hwrng is accessible by >> > host userspace via /dev/hwrng, no? > Yes, but there's not token from user space that gets passed into the > kernel to check whether access is ok or not. So while Q

[PATCH] kvm: powerpc: book3s: Fix build break for BOOK3S_32

2013-10-02 Thread Aneesh Kumar K.V
From: "Aneesh Kumar K.V" This was introduced by 85a0d845d8bb5df5d2669416212f56cbe1474c6b arch/powerpc/kvm/book3s_pr.c: In function 'kvmppc_core_vcpu_create': arch/powerpc/kvm/book3s_pr.c:1182:30: error: 'struct kvmppc_vcpu_book3s' has no member named 'shadow_vcpu' make[1]: *** [arch/powerpc/kvm

Re: [PATCH 1/2] kvm/powerpc: rename kvm_hypercall() to epapr_hypercall()

2013-10-02 Thread Scott Wood
On Wed, 2013-10-02 at 16:19 +0200, Alexander Graf wrote: > On 23.09.2013, at 07:23, Bharat Bhushan wrote: > > static inline long kvm_hypercall0_1(unsigned int nr, unsigned long *r2) > > @@ -65,7 +54,7 @@ static inline long kvm_hypercall0_1(unsigned int nr, > > unsigned long *r2) > > unsigned l

Re: [PATCH 1/2] kvm/powerpc: rename kvm_hypercall() to epapr_hypercall()

2013-10-02 Thread Alexander Graf
On 02.10.2013, at 18:40, Scott Wood wrote: > On Wed, 2013-10-02 at 16:19 +0200, Alexander Graf wrote: >> On 23.09.2013, at 07:23, Bharat Bhushan wrote: >>> static inline long kvm_hypercall0_1(unsigned int nr, unsigned long *r2) >>> @@ -65,7 +54,7 @@ static inline long kvm_hypercall0_1(unsigned in

Re: [PATCH 1/2] kvm/powerpc: rename kvm_hypercall() to epapr_hypercall()

2013-10-02 Thread Scott Wood
On Wed, 2013-10-02 at 18:53 +0200, Alexander Graf wrote: > On 02.10.2013, at 18:40, Scott Wood wrote: > > > On Wed, 2013-10-02 at 16:19 +0200, Alexander Graf wrote: > >> On 23.09.2013, at 07:23, Bharat Bhushan wrote: > >>> static inline long kvm_hypercall0_1(unsigned int nr, unsigned long *r2) > >

Re: [PATCH 1/2] kvm/powerpc: rename kvm_hypercall() to epapr_hypercall()

2013-10-02 Thread Alexander Graf
On 02.10.2013, at 19:04, Scott Wood wrote: > On Wed, 2013-10-02 at 18:53 +0200, Alexander Graf wrote: >> On 02.10.2013, at 18:40, Scott Wood wrote: >> >>> On Wed, 2013-10-02 at 16:19 +0200, Alexander Graf wrote: On 23.09.2013, at 07:23, Bharat Bhushan wrote: > static inline long kvm_hyp

Re: [PATCH 1/2] kvm/powerpc: rename kvm_hypercall() to epapr_hypercall()

2013-10-02 Thread Scott Wood
On Wed, 2013-10-02 at 19:17 +0200, Alexander Graf wrote: > On 02.10.2013, at 19:04, Scott Wood wrote: > > > On Wed, 2013-10-02 at 18:53 +0200, Alexander Graf wrote: > >> On 02.10.2013, at 18:40, Scott Wood wrote: > >> > >>> On Wed, 2013-10-02 at 16:19 +0200, Alexander Graf wrote: > Won't thi

Re: [PATCH 1/2] kvm/powerpc: rename kvm_hypercall() to epapr_hypercall()

2013-10-02 Thread Alexander Graf
On 02.10.2013, at 19:42, Scott Wood wrote: > On Wed, 2013-10-02 at 19:17 +0200, Alexander Graf wrote: >> On 02.10.2013, at 19:04, Scott Wood wrote: >> >>> On Wed, 2013-10-02 at 18:53 +0200, Alexander Graf wrote: On 02.10.2013, at 18:40, Scott Wood wrote: > On Wed, 2013-10-02 at 16

Re: [PATCH 1/2] kvm/powerpc: rename kvm_hypercall() to epapr_hypercall()

2013-10-02 Thread Scott Wood
On Wed, 2013-10-02 at 19:46 +0200, Alexander Graf wrote: > On 02.10.2013, at 19:42, Scott Wood wrote: > > > On Wed, 2013-10-02 at 19:17 +0200, Alexander Graf wrote: > >> On 02.10.2013, at 19:04, Scott Wood wrote: > >> > >>> On Wed, 2013-10-02 at 18:53 +0200, Alexander Graf wrote: > On 02.10.

Re: [PATCH 1/2] kvm/powerpc: rename kvm_hypercall() to epapr_hypercall()

2013-10-02 Thread Alexander Graf
On 02.10.2013, at 19:49, Scott Wood wrote: > On Wed, 2013-10-02 at 19:46 +0200, Alexander Graf wrote: >> On 02.10.2013, at 19:42, Scott Wood wrote: >> >>> On Wed, 2013-10-02 at 19:17 +0200, Alexander Graf wrote: On 02.10.2013, at 19:04, Scott Wood wrote: > On Wed, 2013-10-02 at 18

Re: [PATCH 1/2] kvm/powerpc: rename kvm_hypercall() to epapr_hypercall()

2013-10-02 Thread Scott Wood
On Wed, 2013-10-02 at 19:54 +0200, Alexander Graf wrote: > On 02.10.2013, at 19:49, Scott Wood wrote: > > > On Wed, 2013-10-02 at 19:46 +0200, Alexander Graf wrote: > >> On 02.10.2013, at 19:42, Scott Wood wrote: > >> > >>> On Wed, 2013-10-02 at 19:17 +0200, Alexander Graf wrote: > On 02.10.

[PATCH 5/6] KVM: ia64: Get rid of KVM_HPAGE defines

2013-10-02 Thread Christoffer Dall
Now when the main kvm code relying on these defines has been moved to the x86 specific part of the world, we can get rid of these. Signed-off-by: Christoffer Dall --- arch/ia64/include/asm/kvm_host.h |4 1 file changed, 4 deletions(-) diff --git a/arch/ia64/include/asm/kvm_host.h b/arc

[PATCH 3/6] KVM: arm64: Get rid of KVM_HPAGE defines

2013-10-02 Thread Christoffer Dall
Now when the main kvm code relying on these defines has been moved to the x86 specific part of the world, we can get rid of these. Signed-off-by: Christoffer Dall --- arch/arm64/include/asm/kvm_host.h |5 - 1 file changed, 5 deletions(-) diff --git a/arch/arm64/include/asm/kvm_host.h b

[PATCH 4/6] KVM: mips: Get rid of KVM_HPAGE defines

2013-10-02 Thread Christoffer Dall
Now when the main kvm code relying on these defines has been moved to the x86 specific part of the world, we can get rid of these. Signed-off-by: Christoffer Dall --- arch/mips/include/asm/kvm_host.h |7 --- 1 file changed, 7 deletions(-) diff --git a/arch/mips/include/asm/kvm_host.h b/

[PATCH 2/6] KVM: ARM: Get rid of KVM_HPAGE defines

2013-10-02 Thread Christoffer Dall
The KVM_HPAGE_DEFINES are a little artificial on ARM, since the huge page size is statically defined at compile time and there is only a single huge page size. Now when the main kvm code relying on these defines has been moved to the x86 specific part of the world, we can get rid of these. Signed

[PATCH 0/6] Get rid of mandatory huge page defines

2013-10-02 Thread Christoffer Dall
The current KVM code relies on a number of definitions to exist for each architecture: KVM_HPAGE_GFN_SHIFT KVM_NR_HPAGE_SIZES KVM_PAGES_PER_HPAGE However, these defines are only used in the gfn_to_index function, which is only used in the x86 code. This series moves the gfn_to_index functio

[PATCH 1/6] KVM: Move gfn_to_index to x86 specific code

2013-10-02 Thread Christoffer Dall
The gfn_to_index function relies on huge page defines which either may not make sense on systems that don't support huge pages or are defined in an unconvenient way for other architectures. Since this is x86-specific, move the function to arch/x86/include/asm/kvm_host.h. Signed-off-by: Christoffe

[PATCH 6/6] KVM: PPC: Get rid of KVM_HPAGE defines

2013-10-02 Thread Christoffer Dall
Now when the main kvm code relying on these defines has been moved to the x86 specific part of the world, we can get rid of these. Signed-off-by: Christoffer Dall --- arch/powerpc/include/asm/kvm_host.h |5 - 1 file changed, 5 deletions(-) diff --git a/arch/powerpc/include/asm/kvm_host.

Re: [PATCH 3/3] KVM: PPC: Book3S: Add support for hwrng found on some powernv systems

2013-10-02 Thread Benjamin Herrenschmidt
On Wed, 2013-10-02 at 11:11 +0200, Alexander Graf wrote: > Right, and the difference for the patch in question is really whether > we handle in in kernel virtual mode or in QEMU, so the bulk of the > overhead (kicking threads out of guest context, switching MMU > context, etc) happens either way.

Re: [PATCH 3/3] KVM: PPC: Book3S: Add support for hwrng found on some powernv systems

2013-10-02 Thread Benjamin Herrenschmidt
On Wed, 2013-10-02 at 13:02 +0300, Gleb Natapov wrote: > Yes, I alluded to it in my email to Paul and Paolo asked also. How this > interface is disabled? Also hwrnd is MMIO in a host why guest needs to > use hypercall instead of emulating the device (in kernel or somewhere > else?). Migration wil

Re: [PATCH 3/3] KVM: PPC: Book3S: Add support for hwrng found on some powernv systems

2013-10-02 Thread Benjamin Herrenschmidt
On Wed, 2013-10-02 at 13:02 +0300, Gleb Natapov wrote: > Yes, I alluded to it in my email to Paul and Paolo asked also. How this > interface is disabled? Also hwrnd is MMIO in a host why guest needs to > use hypercall instead of emulating the device (in kernel or somewhere > else?). Another things

Re: [PATCH 3/3] KVM: PPC: Book3S: Add support for hwrng found on some powernv systems

2013-10-02 Thread Benjamin Herrenschmidt
On Wed, 2013-10-02 at 16:08 +0200, Alexander Graf wrote: > A guest should live on the same permission level as a user space > application. If you run QEMU as UID 1000 without access to /dev/mem, > why should the guest suddenly be able to directly access a memory > location (MMIO) it couldn't access

Re: [PATCH 3/3] KVM: PPC: Book3S: Add support for hwrng found on some powernv systems

2013-10-02 Thread Benjamin Herrenschmidt
On Wed, 2013-10-02 at 17:10 +0300, Gleb Natapov wrote: > > The hwrng is accessible by host userspace via /dev/mem. > > > Regular user has no access to /dev/mem, but he can start kvm guest and > gain access to the device. Seriously. You guys are really trying hard to make our life hell or what ? T

Re: [PATCH 3/3] KVM: PPC: Book3S: Add support for hwrng found on some powernv systems

2013-10-02 Thread Benjamin Herrenschmidt
On Wed, 2013-10-02 at 17:37 +0300, Gleb Natapov wrote: > On Wed, Oct 02, 2013 at 04:33:18PM +0200, Paolo Bonzini wrote: > > Il 02/10/2013 16:08, Alexander Graf ha scritto: > > > > The hwrng is accessible by host userspace via /dev/mem. > > > > > > A guest should live on the same permission level a

Re: [PATCH 3/3] KVM: PPC: Book3S: Add support for hwrng found on some powernv systems

2013-10-02 Thread Paul Mackerras
On Wed, Oct 02, 2013 at 04:36:05PM +0200, Alexander Graf wrote: > > On 02.10.2013, at 16:33, Paolo Bonzini wrote: > > > Il 02/10/2013 16:08, Alexander Graf ha scritto: > >>> The hwrng is accessible by host userspace via /dev/mem. > >> > >> A guest should live on the same permission level as a us

Re: [PATCH] kvm: powerpc: book3s: Fix build break for BOOK3S_32

2013-10-02 Thread Paul Mackerras
On Wed, Oct 02, 2013 at 08:08:44PM +0530, Aneesh Kumar K.V wrote: > From: "Aneesh Kumar K.V" > > This was introduced by 85a0d845d8bb5df5d2669416212f56cbe1474c6b It's a good idea to give the headline of the commit as well as the ID. I also like to trim the ID to 10 characters or so. So it should

Re: [PATCH 3/3] KVM: PPC: Book3S: Add support for hwrng found on some powernv systems

2013-10-02 Thread Gleb Natapov
On Thu, Oct 03, 2013 at 08:02:20AM +1000, Benjamin Herrenschmidt wrote: > On Wed, 2013-10-02 at 13:02 +0300, Gleb Natapov wrote: > > > Yes, I alluded to it in my email to Paul and Paolo asked also. How this > > interface is disabled? Also hwrnd is MMIO in a host why guest needs to > > use hypercal

Re: [PATCH 3/3] KVM: PPC: Book3S: Add support for hwrng found on some powernv systems

2013-10-02 Thread Gleb Natapov
On Thu, Oct 03, 2013 at 08:45:42AM +1000, Paul Mackerras wrote: > On Wed, Oct 02, 2013 at 04:36:05PM +0200, Alexander Graf wrote: > > > > On 02.10.2013, at 16:33, Paolo Bonzini wrote: > > > > > Il 02/10/2013 16:08, Alexander Graf ha scritto: > > >>> The hwrng is accessible by host userspace via /

Re: [PATCH 3/3] KVM: PPC: Book3S: Add support for hwrng found on some powernv systems

2013-10-02 Thread Gleb Natapov
On Thu, Oct 03, 2013 at 08:21:20AM +1000, Benjamin Herrenschmidt wrote: > On Wed, 2013-10-02 at 17:37 +0300, Gleb Natapov wrote: > > On Wed, Oct 02, 2013 at 04:33:18PM +0200, Paolo Bonzini wrote: > > > Il 02/10/2013 16:08, Alexander Graf ha scritto: > > > > > The hwrng is accessible by host userspa

Re: [PATCH 3/3] KVM: PPC: Book3S: Add support for hwrng found on some powernv systems

2013-10-02 Thread Gleb Natapov
On Thu, Oct 03, 2013 at 08:07:22AM +1000, Benjamin Herrenschmidt wrote: > On Wed, 2013-10-02 at 13:02 +0300, Gleb Natapov wrote: > > > Yes, I alluded to it in my email to Paul and Paolo asked also. How this > > interface is disabled? Also hwrnd is MMIO in a host why guest needs to > > use hypercal