kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <dwg@au1.ibm.com>
To: Avi Kivity <avi@redhat.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	kvm@vger.kernel.org, Alexander Graf <agraf@suse.de>,
	Paul Mackerras <paulus@au1.ibm.com>,
	kvm-ppc@vger.kernel.org
Subject: Re: Reset problem vs. MMIO emulation, hypercalls, etc...
Date: Wed, 8 Aug 2012 21:59:43 +1000	[thread overview]
Message-ID: <20120808115943.GU16664@truffala.fritz.box> (raw)
In-Reply-To: <50222A52.6010201@redhat.com>

On Wed, Aug 08, 2012 at 11:58:58AM +0300, Avi Kivity wrote:
> On 08/08/2012 03:49 AM, David Gibson wrote:
> >> > We never have irqchip in kernel (because we haven't written that yet)
> >> > but we still sleep in-kernel for CEDE.  I haven't spotted any problem
> >> > with that, but now I'm wondering if there is one, since x86 don't do
> >> > it in what seems like the analogous situation.
> >> > 
> >> > It's possible this works because our decrementer (timer) interrupts
> >> > are different at the core level from external interrupts coming from
> >> > the PIC, and *are* handled in kernel, but I haven't actually followed
> >> > the logic to work out if this is the case.
> >> > 
> >> >>  Meaning the normal state of things is to sleep in
> >> >> the kernel (whether or not you have an emulated interrupt controller in
> >> >> the kernel -- the term irqchip in kernel is overloaded for x86).
> >> > 
> >> > Uh.. overloaded in what way.
> >> 
> >> On x86, irqchip-in-kernel means that the local APICs, the IOAPIC, and
> >> the two PICs are emulated in the kernel.  Now the IOAPIC and the PICs
> >> correspond to non-x86 interrupt controllers, but the local APIC is more
> >> tightly coupled to the core.  Interrupt acceptance by the core is an
> >> operation that involved synchronous communication with the local APIC:
> >> the APIC presents the interrupt, the core accepts it based on the value
> >> of the interrupt enable flag and possible a register (CR8), then the
> >> APIC updates the ISR and IRR.
> >> 
> >> The upshot is that if the local APIC is in userspace, interrupts must be
> >> synchronous with vcpu exection, so that KVM_INTERRUPT is a vcpu ioctl
> >> and HLT is emulated in userspace (so that local APIC emulation can check
> >> if an interrupt wakes it up or not).
> > 
> > Sorry, still not 100% getting it.  When the vcpu is actually running
> > code, that synchronous communication must still be accomplished via
> > the KVM_INTERRUPT ioctl, yes?  So what makes HLT different, that the
> > communication can't be accomplished in that case.
> 
> No, you're correct.  HLT could have been emulated in userspace, it just
> wasn't.  The correct statement is that HLT was arbitrarily chosen to be
> emulated in userspace with the synchronous model, but the asynchronous
> model forced it into the kernel.

Aha!  Ok, understood.  Uh, assuming you meant kernelspace, not
userspace in the first line there, anyway.  Ok, so I am now reassured
that our current handling of CEDE in kernelspace does not cause
problems.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

  reply	other threads:[~2012-08-08 11:59 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-01  3:17 Reset problem vs. MMIO emulation, hypercalls, etc Benjamin Herrenschmidt
2012-08-02 10:46 ` Alexander Graf
2012-08-02 12:22   ` Benjamin Herrenschmidt
2012-08-02 12:35 ` Avi Kivity
2012-08-02 12:59   ` Alexander Graf
2012-08-02 13:05     ` Avi Kivity
2012-08-02 20:29       ` Benjamin Herrenschmidt
2012-08-05  8:55         ` Avi Kivity
2012-08-05 20:45           ` Benjamin Herrenschmidt
2012-08-02 20:20   ` Benjamin Herrenschmidt
2012-08-03 17:41     ` Marcelo Tosatti
2012-08-03 18:05       ` Marcelo Tosatti
2012-08-03 22:32         ` Benjamin Herrenschmidt
2012-08-05  9:00           ` Avi Kivity
2012-08-06 20:25             ` Scott Wood
2012-08-07  8:44               ` Avi Kivity
2012-08-06 20:54             ` Benjamin Herrenschmidt
2012-08-03 22:30       ` Benjamin Herrenschmidt
2012-08-06  3:13         ` David Gibson
2012-08-06 20:57           ` Benjamin Herrenschmidt
2012-08-07  1:32             ` David Gibson
2012-08-07  8:46               ` Avi Kivity
2012-08-07 12:14                 ` David Gibson
2012-08-07 13:13                   ` Avi Kivity
2012-08-07 21:09                     ` Benjamin Herrenschmidt
2012-08-08  8:52                       ` Avi Kivity
2012-08-08  9:27                         ` Benjamin Herrenschmidt
2012-08-08  0:49                     ` David Gibson
2012-08-08  8:58                       ` Avi Kivity
2012-08-08 11:59                         ` David Gibson [this message]
2012-08-08 12:42                           ` Avi Kivity

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=20120808115943.GU16664@truffala.fritz.box \
    --to=dwg@au1.ibm.com \
    --cc=agraf@suse.de \
    --cc=avi@redhat.com \
    --cc=benh@kernel.crashing.org \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=paulus@au1.ibm.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;
as well as URLs for NNTP newsgroup(s).