Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932905AbcJNSvK (ORCPT ); Fri, 14 Oct 2016 14:51:10 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:34149 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751453AbcJNSvH (ORCPT ); Fri, 14 Oct 2016 14:51:07 -0400 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.0 \(3226\)) Subject: Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry From: Nadav Amit In-Reply-To: <1476469291-5039-2-git-send-email-pbonzini@redhat.com> Date: Fri, 14 Oct 2016 11:50:54 -0700 Cc: LKML , KVM , =?utf-8?B?UmFkaW0gS3LEjW3DocWZ?= , Yang Zhang , feng.wu@intel.com, mst@redhat.com Content-Transfer-Encoding: 7bit Message-Id: <4B0C832B-BB75-40BD-85A9-9DC84DEB44E2@gmail.com> References: <1476469291-5039-1-git-send-email-pbonzini@redhat.com> <1476469291-5039-2-git-send-email-pbonzini@redhat.com> To: Paolo Bonzini X-Mailer: Apple Mail (2.3226) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 425 Lines: 14 > > diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c > index 23b99f305382..63a442aefc12 100644 > --- a/arch/x86/kvm/lapic.c > +++ b/arch/x86/kvm/lapic.c > @@ -342,9 +342,11 @@ void __kvm_apic_update_irr(u32 *pir, void *regs) > u32 i, pir_val; > > for (i = 0; i <= 7; i++) { > - pir_val = xchg(&pir[i], 0); > - if (pir_val) > + pir_val = READ_ONCE(pir[i]); Out of curiosity, do you really need this READ_ONCE?