Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754768AbdDKMEj (ORCPT ); Tue, 11 Apr 2017 08:04:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34566 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751951AbdDKMEg (ORCPT ); Tue, 11 Apr 2017 08:04:36 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A3622C04B941 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=drjones@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A3622C04B941 Date: Tue, 11 Apr 2017 14:04:30 +0200 From: Andrew Jones To: Paolo Bonzini Cc: Radim =?utf-8?B?S3LEjW3DocWZ?= , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Christoffer Dall , Marc Zyngier , Christian Borntraeger , Cornelia Huck , James Hogan , Paul Mackerras Subject: Re: [PATCH 6/6] KVM: perform a wake_up in kvm_make_all_cpus_request Message-ID: <20170411120430.7a7d6a3wzlcxntgq@kamzik.brq.redhat.com> References: <20170406202056.18379-1-rkrcmar@redhat.com> <20170406202056.18379-7-rkrcmar@redhat.com> <20170410111427.uq3neitfcssm6vbn@kamzik.brq.redhat.com> <1478c272-b08a-e2be-626e-b2a372ebb579@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1478c272-b08a-e2be-626e-b2a372ebb579@redhat.com> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 11 Apr 2017 12:04:36 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 738 Lines: 15 On Tue, Apr 11, 2017 at 01:34:49PM +0800, Paolo Bonzini wrote: > kvm_arch_vcpu_should_kick() does cmpxchg, which already includes a > memory barrier when it succeeds, so you need not add smp_mb() there. When the cmpxchg() fails it only guarantees ACQUIRE semantics, meaning the request setting may appear to happen after its completion. This would break our delicate vcpu->requests, vcpu->mode two-variable memory barrier pattern that prohibits a VCPU entering guest mode with a pending request and no IPI. IOW, on ARM we need an explicit smp_mb() before the cmpxchg(), otherwise it's incomplete. I think adding a smp_mb__before_atomic() should cover ARM and any other relaxed memory model arches without impacting x86. Thanks, drew