From: Avi Kivity <avi@redhat.com>
To: Scott Wood <scottwood@freescale.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: Tue, 07 Aug 2012 11:44:07 +0300 [thread overview]
Message-ID: <5020D557.4070703@redhat.com> (raw)
In-Reply-To: <50202845.2050605@freescale.com>
On 08/06/2012 11:25 PM, Scott Wood wrote:
> On 08/05/2012 04:00 AM, Avi Kivity wrote:
>> On 08/04/2012 01:32 AM, Benjamin Herrenschmidt wrote:
>>> On Fri, 2012-08-03 at 15:05 -0300, Marcelo Tosatti wrote:
>>>
>>>> See kvm_arch_process_async_events() call to qemu_system_reset_request()
>>>> in target-i386/kvm.c.
>>>>
>>>> The whole thing is fragile, though: we rely on the order events
>>>> are processed inside KVM_RUN, in x86:
>>>>
>>>> 1) If there is pending MMIO, process it.
>>>> 2) If not, return with -EINTR (and KVM_EXIT_INTR) in case
>>>> there is a signal pending.
>>>>
>>>> That way, the vcpu will not process the stop event from the main loop
>>>> (ie not exit from the kvm_cpu_exec() loop), until MMIO is finished.
>>>
>>> Right, it is fragile, thankfully we appear to adhere to the same
>>> ordering on powerpc so far :-)
>>>
>>> So we'll need to test but it looks like we might be able to fix our
>>> problem without a kernel or API change, just by changing qemu to
>>> do the same exit_request trick for our reboot hypercall.
>>>
>>> Long run however, I wonder whether we should consider an explicit ioctl
>>> to complete those pending operations instead...
>>
>> It's pointless. We have to support the old method forever.
>
> Not in new architectures (even PPC has yet to start using this) or new
> userspaces -- and forever is a long time. People down the road may very
> well decide that it's time to clean out the deprecated stuff that hasn't
> been used in over a decade. IMHO this shouldn't be a reason to
> not improve the API, as long as compatibility is possible for as long as
> it is deemed worthwhile.
For qemu this is in common code (kvm-all.c); some architectures might
need wiring up, but the code is there.
For the kernel we need to handle signals, and we need to check for
signals in the atomic guest entry path. That leads naturally to the
completion-before-signal order.
In fact there's no other way to do it. If we check for signals before
handling completions, there's no way for userspace to know whether the
completion was completely handled, and whether more completions are
necessary (mmio completions are limited to 8 bytes but some x86
instructions generate many more accesses).
>
>> There's no
>> material different between sigqueue() + KVM_RUN and KVM_COMPLETE, or a
>> KVM_RUN with a flag that tells it to exit immediately.
>
> The latter is less fragile and easier to use.
if (need_exit)
queue signal
vs
run->need_exit = need_exit
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2012-08-07 8:44 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 [this message]
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
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=5020D557.4070703@redhat.com \
--to=avi@redhat.com \
--cc=agraf@suse.de \
--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 \
--cc=scottwood@freescale.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).