Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1621095 > unrolled thread

[PATCH] x86/kvm: virt_xxx memory barriers instead of mandatory barriers

Started byWanpeng Li <kernellwp@gmail.com>
First post2017-04-11 11:50 +0200
Last post2017-04-12 21:10 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] x86/kvm: virt_xxx memory barriers instead of mandatory barriers Wanpeng Li <kernellwp@gmail.com> - 2017-04-11 11:50 +0200
    Re: [PATCH] x86/kvm: virt_xxx memory barriers instead of mandatory  barriers Paolo Bonzini <pbonzini@redhat.com> - 2017-04-11 16:30 +0200
    Re: [PATCH] x86/kvm: virt_xxx memory barriers instead of mandatory  barriers Radim Krčmář <rkrcmar@redhat.com> - 2017-04-12 21:10 +0200

#1621095 — [PATCH] x86/kvm: virt_xxx memory barriers instead of mandatory barriers

FromWanpeng Li <kernellwp@gmail.com>
Date2017-04-11 11:50 +0200
Subject[PATCH] x86/kvm: virt_xxx memory barriers instead of mandatory barriers
Message-ID<tv0AV-5dh-7@gated-at.bofh.it>
From: Wanpeng Li <wanpeng.li@hotmail.com>

virt_xxx memory barriers are implemented trivially using the low-level 
__smp_xxx macros, __smp_xxx is equal to a compiler barrier for strong 
TSO memory model, however, mandatory barriers will unconditional add 
memory barriers, this patch replaces the rmb() in kvm_steal_clock() by 
virt_rmb().

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
---
 arch/x86/kernel/kvm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index 14f65a5..da5c097 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -396,9 +396,9 @@ static u64 kvm_steal_clock(int cpu)
 	src = &per_cpu(steal_time, cpu);
 	do {
 		version = src->version;
-		rmb();
+		virt_rmb();
 		steal = src->steal;
-		rmb();
+		virt_rmb();
 	} while ((version & 1) || (version != src->version));
 
 	return steal;
-- 
2.7.4

[toc] | [next] | [standalone]


#1621360 — Re: [PATCH] x86/kvm: virt_xxx memory barriers instead of mandatory barriers

FromPaolo Bonzini <pbonzini@redhat.com>
Date2017-04-11 16:30 +0200
SubjectRe: [PATCH] x86/kvm: virt_xxx memory barriers instead of mandatory barriers
Message-ID<tv4XV-8aE-45@gated-at.bofh.it>
In reply to#1621095

----- Original Message -----
> From: "Wanpeng Li" <kernellwp@gmail.com>
> To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
> Cc: "Paolo Bonzini" <pbonzini@redhat.com>, "Radim Krčmář" <rkrcmar@redhat.com>, "Wanpeng Li" <wanpeng.li@hotmail.com>
> Sent: Tuesday, April 11, 2017 5:49:21 PM
> Subject: [PATCH] x86/kvm: virt_xxx memory barriers instead of mandatory barriers
> 
> From: Wanpeng Li <wanpeng.li@hotmail.com>
> 
> virt_xxx memory barriers are implemented trivially using the low-level
> __smp_xxx macros, __smp_xxx is equal to a compiler barrier for strong
> TSO memory model, however, mandatory barriers will unconditional add
> memory barriers, this patch replaces the rmb() in kvm_steal_clock() by
> virt_rmb().
> 
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Radim Krčmář <rkrcmar@redhat.com>
> Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
> ---
>  arch/x86/kernel/kvm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
> index 14f65a5..da5c097 100644
> --- a/arch/x86/kernel/kvm.c
> +++ b/arch/x86/kernel/kvm.c
> @@ -396,9 +396,9 @@ static u64 kvm_steal_clock(int cpu)
>  	src = &per_cpu(steal_time, cpu);
>  	do {
>  		version = src->version;
> -		rmb();
> +		virt_rmb();
>  		steal = src->steal;
> -		rmb();
> +		virt_rmb();
>  	} while ((version & 1) || (version != src->version));
>  
>  	return steal;
> --
> 2.7.4

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

[toc] | [prev] | [next] | [standalone]


#1622487 — Re: [PATCH] x86/kvm: virt_xxx memory barriers instead of mandatory barriers

FromRadim Krčmář <rkrcmar@redhat.com>
Date2017-04-12 21:10 +0200
SubjectRe: [PATCH] x86/kvm: virt_xxx memory barriers instead of mandatory barriers
Message-ID<tvvOq-8oz-19@gated-at.bofh.it>
In reply to#1621095
2017-04-11 02:49-0700, Wanpeng Li:
> From: Wanpeng Li <wanpeng.li@hotmail.com>
> 
> virt_xxx memory barriers are implemented trivially using the low-level 
> __smp_xxx macros, __smp_xxx is equal to a compiler barrier for strong 
> TSO memory model, however, mandatory barriers will unconditional add 
> memory barriers, this patch replaces the rmb() in kvm_steal_clock() by 
> virt_rmb().
> 
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Radim Krčmář <rkrcmar@redhat.com>
> Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
> ---

Applied to kvm/queue, thanks.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web