From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH] KVM: VMX: Do not overwrite vcpu->srcu_idx in vmx_vcpu_reset Date: Thu, 14 Mar 2013 17:11:06 +0200 Message-ID: <20130314151106.GA15717@redhat.com> References: <5141E41B.8080804@siemens.com> <20130314150004.GX11223@redhat.com> <5141E6BA.2060404@siemens.com> <5141E7FA.8060003@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Jan Kiszka , Marcelo Tosatti , kvm To: Paolo Bonzini Return-path: Received: from mx1.redhat.com ([209.132.183.28]:40059 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756635Ab3CNPLK (ORCPT ); Thu, 14 Mar 2013 11:11:10 -0400 Content-Disposition: inline In-Reply-To: <5141E7FA.8060003@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Mar 14, 2013 at 04:08:42PM +0100, Paolo Bonzini wrote: > Il 14/03/2013 16:03, Jan Kiszka ha scritto: > >> > vcpu->srcu_idx = srcu_read_lock() > >> > idx = srcu_read_lock(&vcpu->kvm->srcu); > >> > srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx); > >> > vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu); > >> > srcu_read_unlock(&vcpu->kvm->srcu, idx); > >> > srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx); > >> > > >> > Not sure this is valid. > > Grmbl, likely not. > > It might be. > > Isn't it the same as two different CPUs doing > > CPU 1 CPU 2 > ------------------------------------------------------------------------------------------------ > > vcpu->srcu_idx = srcu_read_lock() > idx = srcu_read_lock(&vcpu->kvm->srcu); > srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx); > vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu); > srcu_read_unlock(&vcpu->kvm->srcu, idx); > srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx); > > ? > Srcu may have per cpu state. We can always ask Paul. -- Gleb.