All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>,
	Marcelo Tosatti <mtosatti@redhat.com>, kvm <kvm@vger.kernel.org>
Subject: Re: [PATCH] KVM: VMX: Do not overwrite vcpu->srcu_idx in vmx_vcpu_reset
Date: Thu, 14 Mar 2013 16:45:23 +0100	[thread overview]
Message-ID: <5141F093.1020001@redhat.com> (raw)
In-Reply-To: <20130314151106.GA15717@redhat.com>

Il 14/03/2013 16:11, Gleb Natapov ha scritto:
> 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.

There is per-CPU state but it is only used as an optimization.
synchronize_srcu only uses the sum of all values.

In fact, SRCU critical sections are preemptable so there's not even a
guarantee that srcu_read_lock() and srcu_read_unlock() run on the same CPU.

Paolo


  reply	other threads:[~2013-03-14 15:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-14 14:52 [PATCH] KVM: VMX: Do not overwrite vcpu->srcu_idx in vmx_vcpu_reset Jan Kiszka
2013-03-14 15:00 ` Gleb Natapov
2013-03-14 15:03   ` Jan Kiszka
2013-03-14 15:08     ` Paolo Bonzini
2013-03-14 15:11       ` Gleb Natapov
2013-03-14 15:45         ` Paolo Bonzini [this message]
2013-03-14 15:11       ` Jan Kiszka
2013-03-14 19:14   ` Marcelo Tosatti
2013-03-14 19:20     ` Jan Kiszka
2013-03-14 19:39       ` [PATCH v2] " Jan Kiszka
2013-03-15  7:09         ` Jan Kiszka
2013-03-14 20:02       ` [PATCH] " Marcelo Tosatti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5141F093.1020001@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=gleb@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.