public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>, kvm <kvm@vger.kernel.org>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH v2] KVM: x86: Rework INIT and SIPI handling
Date: Thu, 14 Mar 2013 14:18:42 +0200	[thread overview]
Message-ID: <20130314121842.GA10272@redhat.com> (raw)
In-Reply-To: <5141BFA9.3020108@siemens.com>

On Thu, Mar 14, 2013 at 01:16:41PM +0100, Jan Kiszka wrote:
> On 2013-03-14 13:12, Gleb Natapov wrote:
> > On Thu, Mar 14, 2013 at 12:29:48PM +0100, Jan Kiszka wrote:
> >> On 2013-03-14 11:15, Jan Kiszka wrote:
> >>>>>  
> >>>>> -	if (unlikely(vcpu->arch.mp_state == KVM_MP_STATE_SIPI_RECEIVED)) {
> >>>>> -		pr_debug("vcpu %d received sipi with vector # %x\n",
> >>>>> -			 vcpu->vcpu_id, vcpu->arch.sipi_vector);
> >>>>> -		kvm_lapic_reset(vcpu);
> >>>>> -		kvm_vcpu_reset(vcpu);
> >>>>> -		vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
> >>>>> -	}
> >>>>> -
> >>>>>  	vcpu->srcu_idx = srcu_read_lock(&kvm->srcu);
> >>>>>  	r = vapic_enter(vcpu);
> >>>>
> >>>> vmx_vcpu_reset overwrites vcpu->srcu_idx if ->vcpu_reset is called from
> >>>> within srcu section.
> >>>
> >>> Indeed.
> >>>
> >>> Do you know what the look over vmx_set_cr0 actually protects?
> >>
> >> Found it: It's not actually protecting anything. enter_rmode is called,
> >> and that assumes that lock to be held. If enter_rmode faces an
> >> uninitialized tss, it drops the lock before calling vmx_set_tss_addr.
> >>
> >> Well, I wonder if that is a good place to fix the TSS issue. Why not
> >> make that special case (lacking KVM_SET_TSS_ADDR before first KVM_RUN) a
> >> static jump key and check for it on KVM_RUN?
> >>
> > Or finally break userspace that does not set it before calling kvm_run.
> > I haven't seen people complain about "kvm: KVM_SET_TSS_ADDR need to be
> > called before entering vcpu" warning in dmesg. Or create TSS mem slot at
> > 0xfeffd000 during VM creation and destroy it if userspace overwrites it.
> 
> Whatever is preferred, I'm not able to decide (about ABI "breakage"
> specifically). I just think any of them would be better than pulling
> vcpu_reset out of the inner loop again just to fulfill the locking
> requirements.
> 
I agree. Lets try second approach. Can you write a patch?

--
			Gleb.

  reply	other threads:[~2013-03-14 12:18 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-13 11:42 [PATCH v2] KVM: x86: Rework INIT and SIPI handling Jan Kiszka
2013-03-13 12:27 ` Paolo Bonzini
2013-03-13 12:42   ` Jan Kiszka
2013-03-13 14:08 ` Gleb Natapov
2013-03-14  0:08 ` Marcelo Tosatti
2013-03-14  2:10   ` Marcelo Tosatti
2013-03-14 10:15   ` Jan Kiszka
2013-03-14 11:24     ` Gleb Natapov
2013-03-14 11:29     ` Jan Kiszka
2013-03-14 12:12       ` Gleb Natapov
2013-03-14 12:16         ` Jan Kiszka
2013-03-14 12:18           ` Gleb Natapov [this message]
2013-03-14 12:25             ` Jan Kiszka
2013-03-14 12:28               ` Gleb Natapov
2013-03-14 15:32                 ` Jan Kiszka
2013-03-14 15:46                   ` Gleb Natapov
2013-03-14 14:32     ` Marcelo Tosatti
2013-03-14 14:53       ` Gleb Natapov

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=20130314121842.GA10272@redhat.com \
    --to=gleb@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox