Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753888AbdDKOUW convert rfc822-to-8bit (ORCPT ); Tue, 11 Apr 2017 10:20:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46610 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753153AbdDKOUR (ORCPT ); Tue, 11 Apr 2017 10:20:17 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5703D3D967 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=pbonzini@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 5703D3D967 Date: Tue, 11 Apr 2017 10:20:16 -0400 (EDT) From: Paolo Bonzini To: Wanpeng Li Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Radim =?utf-8?B?S3LEjW3DocWZ?= , Wanpeng Li Message-ID: <1672616786.12797852.1491920416876.JavaMail.zimbra@redhat.com> In-Reply-To: <1491904161-4099-1-git-send-email-wanpeng.li@hotmail.com> References: <1491904161-4099-1-git-send-email-wanpeng.li@hotmail.com> Subject: Re: [PATCH] x86/kvm: virt_xxx memory barriers instead of mandatory barriers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Originating-IP: [10.4.164.1, 10.4.195.1] Thread-Topic: x86/kvm: virt_xxx memory barriers instead of mandatory barriers Thread-Index: YEngde/gmVpGabdw6jNnAExIT6PJ1w== X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 11 Apr 2017 14:20:17 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1479 Lines: 44 ----- Original Message ----- > From: "Wanpeng Li" > To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org > Cc: "Paolo Bonzini" , "Radim Krčmář" , "Wanpeng Li" > Sent: Tuesday, April 11, 2017 5:49:21 PM > Subject: [PATCH] x86/kvm: virt_xxx memory barriers instead of mandatory barriers > > From: Wanpeng Li > > 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 > Cc: Radim Krčmář > Signed-off-by: Wanpeng Li > --- > 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