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: Paolo Bonzini <pbonzini@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>, kvm <kvm@vger.kernel.org>
Subject: Re: [PATCH] KVM: x86: Convert INIT and SIPI signals into synchronously handled events
Date: Tue, 12 Mar 2013 15:37:39 +0200	[thread overview]
Message-ID: <20130312133739.GD11223@redhat.com> (raw)
In-Reply-To: <513F2D2F.9040103@siemens.com>

On Tue, Mar 12, 2013 at 02:27:11PM +0100, Jan Kiszka wrote:
> On 2013-03-12 14:25, Gleb Natapov wrote:
> > On Tue, Mar 12, 2013 at 02:16:29PM +0100, Jan Kiszka wrote:
> >> On 2013-03-12 14:13, Paolo Bonzini wrote:
> >>> Il 12/03/2013 14:01, Jan Kiszka ha scritto:
> >>>>>>>> For example, should kvm_arch_interrupt_allowed return zero if the VCPU
> >>>>>>>> is in the INIT_RECEIVED state?
> >>>>>>
> >>>>>> Yeah, that probably makes sense beyond async_pf.
> >>>> Wait: If you perform a proper reset on INIT already, we would clear IF
> >>>> thus prevent also async_pf injections. On the other hand,
> >>>> kvm_arch_can_inject_async_page_present returns true if apf.msr_val &
> >>>> KVM_ASYNC_PF_ENABLED is not set - shouldn't that be cleared on reset as
> >>>> well? Hmm...
> >>>
> >>> So if you split the reset (which is done on INIT) from setting up CS on
> >>> SIPI, you kill two birds with a stone, or at least one and a half: you
> >>> clear IF as you wrote above, and INIT on BSP almost works (the only
> >>> missing bit should be setting the mp_state to KVM_MP_STATE_RUNNABLE).
> >>
> >> ...unless the async_pf MSR is cleared on reset as well.
> >>
> > It is:
> > vcpu->arch.apf.msr_val = 0;
> 
> Can you explain the "if !(apf.msr_val & KVM_ASYNC_PF_ENABLED) return
> true;" in kvm_arch_can_inject_async_page_present?
> 
APF works even with non-PV guests. If non PV guest access swapped out
page the page is swapped in asynchronously and vcpu enters apf.halted
state. In this sate it can still receive interrupt. Completion of apf
cause vcpu exit apf.halted state.

On vcpu reset we call kvm_clear_async_pf_completion_queue() so
vcpu->async_pf.done will be empty and kvm_check_async_pf_completion()
will be nop if vcpu is properly reset on INIT.
 
--
			Gleb.

  reply	other threads:[~2013-03-12 13:37 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-12 11:44 [PATCH] KVM: x86: Convert INIT and SIPI signals into synchronously handled events Jan Kiszka
2013-03-12 12:06 ` Paolo Bonzini
2013-03-12 12:29   ` Gleb Natapov
2013-03-12 12:29   ` Paolo Bonzini
2013-03-12 12:46     ` Jan Kiszka
2013-03-12 12:49       ` Gleb Natapov
2013-03-12 12:52         ` Jan Kiszka
2013-03-12 12:53           ` Gleb Natapov
2013-03-12 13:09       ` Paolo Bonzini
2013-03-12 13:13         ` Jan Kiszka
2013-03-12 12:58   ` Jan Kiszka
2013-03-12 13:01     ` Jan Kiszka
2013-03-12 13:13       ` Paolo Bonzini
2013-03-12 13:16         ` Jan Kiszka
2013-03-12 13:25           ` Gleb Natapov
2013-03-12 13:27             ` Jan Kiszka
2013-03-12 13:37               ` Gleb Natapov [this message]
2013-03-13  7:39   ` Jan Kiszka
2013-03-13  9:03     ` Paolo Bonzini
2013-03-13  9:08       ` Jan Kiszka
2013-03-12 13:12 ` Gleb Natapov
2013-03-12 13:21   ` Jan Kiszka
2013-03-12 13:41     ` Gleb Natapov
2013-03-12 13:43       ` Paolo Bonzini
2013-03-12 13:52         ` 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=20130312133739.GD11223@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