[PATCH v16 10/10] KVM: arm/arm64: Enable Dirty Page logging for ARMv8

2015-01-15 Thread Mario Smarduch
This patch enables ARMv8 ditry page logging support. Plugs ARMv8 into generic layer through Kconfig symbol, and drops earlier ARM64 constraints to enable logging at architecture layer. Reviewed-by: Christoffer Dall Signed-off-by: Mario Smarduch --- arch/arm/include/asm/kvm_host.h | 12 ---

[PATCH v16 08/10] KVM: arm64: ARMv8 header changes for page logging

2015-01-15 Thread Mario Smarduch
This patch adds arm64 helpers to write protect pmds/ptes and retrieve permissions while logging dirty pages. Also adds prototype to write protect a memory slot and adds a pmd define to check for read-only pmds. Reviewed-by: Christoffer Dall Signed-off-by: Mario Smarduch --- arch/arm64/include/a

[PATCH v16 09/10] KVM: arm64: Add HYP interface to flush VM Stage 1/2 TLB entries

2015-01-15 Thread Mario Smarduch
This patch adds support for arm64 hyp interface to flush all TLBs associated with VMID. Reviewed-by: Christoffer Dall Signed-off-by: Mario Smarduch --- arch/arm64/kvm/hyp.S | 22 ++ 1 file changed, 22 insertions(+) diff --git a/arch/arm64/kvm/hyp.S b/arch/arm64/kvm/hyp.S

[PATCH v16 07/10] KVM: arm: page logging 2nd stage fault handling

2015-01-15 Thread Mario Smarduch
This patch adds support for 2nd stage page fault handling while dirty page logging. On huge page faults, huge pages are dissolved to normal pages, and rebuilding of 2nd stage huge pages is blocked. In case migration is canceled this restriction is removed and huge pages may be rebuilt again. Signe

[PATCH v16 06/10] KVM: arm: dirty logging write protect support

2015-01-15 Thread Mario Smarduch
Add support to track dirty pages between user space KVM_GET_DIRTY_LOG ioctl calls. We call kvm_get_dirty_log_protect() function to do most of the work. Reviewed-by: Christoffer Dall Reviewed-by: Marc Zyngier Signed-off-by: Mario Smarduch --- arch/arm/kvm/Kconfig |1 + arch/arm/kvm/arm.c

[PATCH v16 05/10] KVM: arm: Add initial dirty page locking support

2015-01-15 Thread Mario Smarduch
Add support for initial write protection of VM memslots. This patch series assumes that huge PUDs will not be used in 2nd stage tables, which is always valid on ARMv7 Acked-by: Christoffer Dall Signed-off-by: Mario Smarduch --- arch/arm/include/asm/kvm_host.h |2 + arch/arm/include/as

[PATCH v16 04/10] KVM: arm: Add ARMv7 API to flush TLBs

2015-01-15 Thread Mario Smarduch
This patch adds ARMv7 architecture TLB Flush function. Acked-by: Marc Zyngier Acked-by: Christoffer Dall Signed-off-by: Mario Smarduch --- arch/arm/include/asm/kvm_asm.h |1 + arch/arm/include/asm/kvm_host.h | 12 arch/arm/kvm/Kconfig|1 + arch/arm/kvm/inter

[PATCH v16 03/10] KVM: x86: switch to kvm_get_dirty_log_protect

2015-01-15 Thread Mario Smarduch
From: Paolo Bonzini We now have a generic function that does most of the work of kvm_vm_ioctl_get_dirty_log, now use it. Acked-by: Christoffer Dall Signed-off-by: Mario Smarduch --- arch/x86/include/asm/kvm_host.h |3 -- arch/x86/kvm/Kconfig|1 + arch/x86/kvm/mmu.c

[PATCH v16 02/10] KVM: Add generic support for dirty page logging

2015-01-15 Thread Mario Smarduch
kvm_get_dirty_log() provides generic handling of dirty bitmap, currently reused by several architectures. Building on that we intrdoduce kvm_get_dirty_log_protect() adding write protection to mark these pages dirty for future write access, before next KVM_GET_DIRTY_LOG ioctl call from user space.

[PATCH v16 01/10] KVM: Add architecture-defined TLB flush support

2015-01-15 Thread Mario Smarduch
Allow architectures to override the generic kvm_flush_remote_tlbs() function via HAVE_KVM_ARCH_TLB_FLUSH_ALL. ARMv7 will need this to provide its own TLB flush interface. Reviewed-by: Christoffer Dall Reviewed-by: Marc Zyngier Reviewed-by: Paolo Bonzini Signed-off-by: Mario Smarduch --- virt/

[PATCH v16 00/10] KVM/arm/arm64/x86: dirty page logging for ARMv7/8 (3.18.0-rc2)

2015-01-15 Thread Mario Smarduch
Patch series adds support for armv7/8 dirty page logging. As we move towards generic dirty page logging interface we move some common code to generic layer shared by x86, armv7 and armv8. armv7/8 Dirty page logging implementation overivew- - initially write protects memory region 2nd stage page ta

Re: [PATCH 1/8] ppc/kvm: Replace ACCESS_ONCE with READ_ONCE

2015-01-15 Thread Michael Ellerman
On Thu, 2015-01-15 at 09:58 +0100, Christian Borntraeger wrote: > ACCESS_ONCE does not work reliably on non-scalar types. For > example gcc 4.6 and 4.7 might remove the volatile tag for such > accesses during the SRA (scalar replacement of aggregates) step > (https://gcc.gnu.org/bugzilla/show_bug.c

Re: [PATCH 4/8] x86/spinlock: Leftover conversion ACCESS_ONCE->READ_ONCE

2015-01-15 Thread Christian Borntraeger
Am 15.01.2015 um 21:01 schrieb Oleg Nesterov: > On 01/15, Christian Borntraeger wrote: >> >> Am 15.01.2015 um 20:38 schrieb Oleg Nesterov: >>> On 01/15, Christian Borntraeger wrote: --- a/arch/x86/include/asm/spinlock.h +++ b/arch/x86/include/asm/spinlock.h @@ -186,7 +186,7 @@ s

Re: [PATCH 4/8] x86/spinlock: Leftover conversion ACCESS_ONCE->READ_ONCE

2015-01-15 Thread Oleg Nesterov
On 01/15, Christian Borntraeger wrote: > > Am 15.01.2015 um 20:38 schrieb Oleg Nesterov: > > On 01/15, Christian Borntraeger wrote: > >> > >> --- a/arch/x86/include/asm/spinlock.h > >> +++ b/arch/x86/include/asm/spinlock.h > >> @@ -186,7 +186,7 @@ static inline void > >> arch_spin_unlock_wait(arch

Re: [PATCH 4/8] x86/spinlock: Leftover conversion ACCESS_ONCE->READ_ONCE

2015-01-15 Thread Christian Borntraeger
Am 15.01.2015 um 20:38 schrieb Oleg Nesterov: > On 01/15, Christian Borntraeger wrote: >> >> --- a/arch/x86/include/asm/spinlock.h >> +++ b/arch/x86/include/asm/spinlock.h >> @@ -186,7 +186,7 @@ static inline void arch_spin_unlock_wait(arch_spinlock_t >> *lock) >> __ticket_t head = ACCESS_ONC

Re: [PATCH 4/8] x86/spinlock: Leftover conversion ACCESS_ONCE->READ_ONCE

2015-01-15 Thread Oleg Nesterov
On 01/15, Christian Borntraeger wrote: > > --- a/arch/x86/include/asm/spinlock.h > +++ b/arch/x86/include/asm/spinlock.h > @@ -186,7 +186,7 @@ static inline void arch_spin_unlock_wait(arch_spinlock_t > *lock) > __ticket_t head = ACCESS_ONCE(lock->tickets.head); > > for (;;) { > -

Re: [Xen-devel] [PATCH 3/8] x86/xen/p2m: Replace ACCESS_ONCE with READ_ONCE

2015-01-15 Thread Christian Borntraeger
Am 15.01.2015 um 11:43 schrieb David Vrabel: > On 15/01/15 08:58, Christian Borntraeger wrote: >> ACCESS_ONCE does not work reliably on non-scalar types. For >> example gcc 4.6 and 4.7 might remove the volatile tag for such >> accesses during the SRA (scalar replacement of aggregates) step >> (http

Re: [Xen-devel] [PATCH 3/8] x86/xen/p2m: Replace ACCESS_ONCE with READ_ONCE

2015-01-15 Thread David Vrabel
On 15/01/15 08:58, Christian Borntraeger wrote: > ACCESS_ONCE does not work reliably on non-scalar types. For > example gcc 4.6 and 4.7 might remove the volatile tag for such > accesses during the SRA (scalar replacement of aggregates) step > (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145) >

Re: [PATCH 3/8] x86/xen/p2m: Replace ACCESS_ONCE with READ_ONCE

2015-01-15 Thread Jürgen Groß
On 01/15/2015 09:58 AM, Christian Borntraeger wrote: ACCESS_ONCE does not work reliably on non-scalar types. For example gcc 4.6 and 4.7 might remove the volatile tag for such accesses during the SRA (scalar replacement of aggregates) step (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145) Cha

[PATCH 4/8] x86/spinlock: Leftover conversion ACCESS_ONCE->READ_ONCE

2015-01-15 Thread Christian Borntraeger
commit 78bff1c8684f ("x86/ticketlock: Fix spin_unlock_wait() livelock") introduced another ACCESS_ONCE case in x86 spinlock.h. Change that as well. Signed-off-by: Christian Borntraeger Cc: Oleg Nesterov --- arch/x86/include/asm/spinlock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

[PATCH 7/8] next: sh: Fix compile error

2015-01-15 Thread Christian Borntraeger
From: Guenter Roeck Commit a91ed664749c ("kernel: tighten rules for ACCESS ONCE") results in a compile failure for sh builds with CONFIG_X2TLB enabled. arch/sh/mm/gup.c: In function 'gup_get_pte': arch/sh/mm/gup.c:20:2: error: invalid initializer make[1]: *** [arch/sh/mm/gup.o] Error 1 Replace

[PATCH 0/8] current ACCESS_ONCE patch queue

2015-01-15 Thread Christian Borntraeger
Folks, fyi, this is my current patch queue for the next merge window. It does contain a patch that will disallow ACCESS_ONCE on non-scalar types. The tree is part of linux-next and can be found at git://git.kernel.org/pub/scm/linux/kernel/git/borntraeger/linux.git linux-next Christian Borntraeg

[PATCH 2/8] ppc/hugetlbfs: Replace ACCESS_ONCE with READ_ONCE

2015-01-15 Thread Christian Borntraeger
ACCESS_ONCE does not work reliably on non-scalar types. For example gcc 4.6 and 4.7 might remove the volatile tag for such accesses during the SRA (scalar replacement of aggregates) step (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145) Change the ppc/hugetlbfs code to replace ACCESS_ONCE with

[PATCH 1/8] ppc/kvm: Replace ACCESS_ONCE with READ_ONCE

2015-01-15 Thread Christian Borntraeger
ACCESS_ONCE does not work reliably on non-scalar types. For example gcc 4.6 and 4.7 might remove the volatile tag for such accesses during the SRA (scalar replacement of aggregates) step (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145) Change the ppc/kvm code to replace ACCESS_ONCE with READ_O

[PATCH 3/8] x86/xen/p2m: Replace ACCESS_ONCE with READ_ONCE

2015-01-15 Thread Christian Borntraeger
ACCESS_ONCE does not work reliably on non-scalar types. For example gcc 4.6 and 4.7 might remove the volatile tag for such accesses during the SRA (scalar replacement of aggregates) step (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145) Change the p2m code to replace ACCESS_ONCE with READ_ONCE.

[PATCH 8/8] kernel: Fix sparse warning for ACCESS_ONCE

2015-01-15 Thread Christian Borntraeger
Commit a91ed664749c ("kernel: tighten rules for ACCESS ONCE") results in sparse warnings like "Using plain integer as NULL pointer" - Let's add a type cast to the dummy assignment. To avoid warnings lik "sparse: warning: cast to restricted __hc32" we also use __force on that cast. Fixes: a91ed6647

[PATCH 5/8] mm/gup: Replace ACCESS_ONCE with READ_ONCE

2015-01-15 Thread Christian Borntraeger
ACCESS_ONCE does not work reliably on non-scalar types. For example gcc 4.6 and 4.7 might remove the volatile tag for such accesses during the SRA (scalar replacement of aggregates) step (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145) Fixup gup_pmd_range. Signed-off-by: Christian Borntraeger

[PATCH 6/8] kernel: tighten rules for ACCESS ONCE

2015-01-15 Thread Christian Borntraeger
Now that all non-scalar users of ACCESS_ONCE have been converted to READ_ONCE or ASSIGN once, lets tighten ACCESS_ONCE to only work on scalar types. This variant was proposed by Alexei Starovoitov. Signed-off-by: Christian Borntraeger Reviewed-by: Paul E. McKenney --- include/linux/compiler.h |