From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH v5 4/4] KVM: x86: Add support for local interrupt requests from userspace Date: Wed, 29 Jul 2015 12:21:01 +0200 Message-ID: <55B8A90D.3030202@redhat.com> References: <1438039062-3168-1-git-send-email-srutherford@google.com> <1438039062-3168-4-git-send-email-srutherford@google.com> <55B7A6AE.5070001@redhat.com> <20150728190635.GA7460@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Steve Rutherford Return-path: Received: from mail-wi0-f179.google.com ([209.85.212.179]:35173 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751250AbbG2KVE (ORCPT ); Wed, 29 Jul 2015 06:21:04 -0400 Received: by wibxm9 with SMTP id xm9so194166564wib.0 for ; Wed, 29 Jul 2015 03:21:03 -0700 (PDT) In-Reply-To: <20150728190635.GA7460@google.com> Sender: kvm-owner@vger.kernel.org List-ID: On 28/07/2015 21:06, Steve Rutherford wrote: >>> > > +static inline int pic_in_kernel(struct kvm *kvm) >>> > > +{ >>> > > + int ret; >>> > > + >>> > > + ret = (pic_irqchip(kvm) != NULL); >>> > > + smp_rmb(); >> > >> > What does this memory barrier pair with? I don't think it's necessary. > To be honest, it's probably not necessary. I couldn't find why > irqchip_in_kernel (which this function is more or less a copy of) > needed it's memory barrier, so I cargo culted this one in. It's for stuff like injecting an interrupt before any CPU is created, while another thread is doing KVM_CREATE_IRQCHIP. In your case a VCPU has been created so you don't need it (the synchronization point is the mutex_lock(&kvm->lock) in kvm_vm_ioctl_create_vcpu). Paolo