All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Alexander Graf <agraf@suse.de>,
	kvm@vger.kernel.org, Paul Mackerras <paulus@au1.ibm.com>,
	kvm-ppc@vger.kernel.org
Subject: Re: Reset problem vs. MMIO emulation, hypercalls, etc...
Date: Sun, 05 Aug 2012 08:55:56 +0000	[thread overview]
Message-ID: <501E351C.8080603@redhat.com> (raw)
In-Reply-To: <1343939348.6911.15.camel@pasglop>

On 08/02/2012 11:29 PM, Benjamin Herrenschmidt wrote:
> On Thu, 2012-08-02 at 16:05 +0300, Avi Kivity wrote:
>> > Yeah, we stumbled over this chunk as well. So you're saying we
>> should delay the reset by invoking a self-signal if we're in such an
>> operation?
>> 
>> Yes.  Qemu of course already supports this for migration, so it should
>> be easy to add.
> 
> Adding a self signal for the CPU initiating the reset is not enough,
> other VCPUs might also be in an hcall or MMIO emulation when that
> happens.

That happens naturally if you update (or read) registers through a
run_on_cpu() call.  run_on_cpu() should never happen within an mmio
sequence.

> 
> It must be done for all VCPUs, so best is to look at the migration
> situation.
> 
> For reset, there are two code path at play:
> 
>  - The VCPU initiating the request: It calls qemu_system_reset_request()
> which calls cpu_stop_current() directly after signaling the main loop
> 
>  - The other VCPUs are then marked with the "stop" flag by the maintloop
> which will then wait for them to set "stopped" to 1, which is done by
> qemu_wait_io_event_common() when it sees "stop".
> 
> Now, it seems like suspend also uses that same technique. I don't
> totally grasp where migration fits in that picture and where it does the
> KVM_RUN with a signal pending trick to complete pending operations, any
> chance you can enlighten me ?

I'm afraid I no longer know the details so closely, the code has changed
quite a lot.  But the self-signal happens in kvm_cpu_exec(), see also
env->exit_request.


-- 
error compiling committee.c: too many arguments to function

WARNING: multiple messages have this Message-ID (diff)
From: Avi Kivity <avi@redhat.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Alexander Graf <agraf@suse.de>,
	kvm@vger.kernel.org, Paul Mackerras <paulus@au1.ibm.com>,
	kvm-ppc@vger.kernel.org
Subject: Re: Reset problem vs. MMIO emulation, hypercalls, etc...
Date: Sun, 05 Aug 2012 11:55:56 +0300	[thread overview]
Message-ID: <501E351C.8080603@redhat.com> (raw)
In-Reply-To: <1343939348.6911.15.camel@pasglop>

On 08/02/2012 11:29 PM, Benjamin Herrenschmidt wrote:
> On Thu, 2012-08-02 at 16:05 +0300, Avi Kivity wrote:
>> > Yeah, we stumbled over this chunk as well. So you're saying we
>> should delay the reset by invoking a self-signal if we're in such an
>> operation?
>> 
>> Yes.  Qemu of course already supports this for migration, so it should
>> be easy to add.
> 
> Adding a self signal for the CPU initiating the reset is not enough,
> other VCPUs might also be in an hcall or MMIO emulation when that
> happens.

That happens naturally if you update (or read) registers through a
run_on_cpu() call.  run_on_cpu() should never happen within an mmio
sequence.

> 
> It must be done for all VCPUs, so best is to look at the migration
> situation.
> 
> For reset, there are two code path at play:
> 
>  - The VCPU initiating the request: It calls qemu_system_reset_request()
> which calls cpu_stop_current() directly after signaling the main loop
> 
>  - The other VCPUs are then marked with the "stop" flag by the maintloop
> which will then wait for them to set "stopped" to 1, which is done by
> qemu_wait_io_event_common() when it sees "stop".
> 
> Now, it seems like suspend also uses that same technique. I don't
> totally grasp where migration fits in that picture and where it does the
> KVM_RUN with a signal pending trick to complete pending operations, any
> chance you can enlighten me ?

I'm afraid I no longer know the details so closely, the code has changed
quite a lot.  But the self-signal happens in kvm_cpu_exec(), see also
env->exit_request.


-- 
error compiling committee.c: too many arguments to function

  reply	other threads:[~2012-08-05  8:55 UTC|newest]

Thread overview: 62+ 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-01  3:17 ` Benjamin Herrenschmidt
2012-08-02 10:46 ` Alexander Graf
2012-08-02 10:46   ` Alexander Graf
2012-08-02 12:22   ` Benjamin Herrenschmidt
2012-08-02 12:22     ` Benjamin Herrenschmidt
2012-08-02 12:35 ` Avi Kivity
2012-08-02 12:35   ` Avi Kivity
2012-08-02 12:59   ` Alexander Graf
2012-08-02 12:59     ` Alexander Graf
2012-08-02 13:05     ` Avi Kivity
2012-08-02 13:05       ` Avi Kivity
2012-08-02 20:29       ` Benjamin Herrenschmidt
2012-08-02 20:29         ` Benjamin Herrenschmidt
2012-08-05  8:55         ` Avi Kivity [this message]
2012-08-05  8:55           ` Avi Kivity
2012-08-05 20:45           ` Benjamin Herrenschmidt
2012-08-05 20:45             ` Benjamin Herrenschmidt
2012-08-02 20:20   ` Benjamin Herrenschmidt
2012-08-02 20:20     ` Benjamin Herrenschmidt
2012-08-03 17:41     ` Marcelo Tosatti
2012-08-03 17:41       ` Marcelo Tosatti
2012-08-03 18:05       ` Marcelo Tosatti
2012-08-03 18:05         ` Marcelo Tosatti
2012-08-03 22:32         ` Benjamin Herrenschmidt
2012-08-03 22:32           ` Benjamin Herrenschmidt
2012-08-05  9:00           ` Avi Kivity
2012-08-05  9:00             ` Avi Kivity
2012-08-06 20:25             ` Scott Wood
2012-08-06 20:25               ` Scott Wood
2012-08-07  8:44               ` Avi Kivity
2012-08-07  8:44                 ` Avi Kivity
2012-08-06 20:54             ` Benjamin Herrenschmidt
2012-08-06 20:54               ` Benjamin Herrenschmidt
2012-08-03 22:30       ` Benjamin Herrenschmidt
2012-08-03 22:30         ` Benjamin Herrenschmidt
2012-08-06  3:13         ` David Gibson
2012-08-06  3:13           ` David Gibson
2012-08-06 20:57           ` Benjamin Herrenschmidt
2012-08-06 20:57             ` Benjamin Herrenschmidt
2012-08-07  1:32             ` David Gibson
2012-08-07  1:32               ` David Gibson
2012-08-07  8:46               ` Avi Kivity
2012-08-07  8:46                 ` Avi Kivity
2012-08-07 12:14                 ` David Gibson
2012-08-07 12:14                   ` David Gibson
2012-08-07 13:13                   ` Avi Kivity
2012-08-07 13:13                     ` Avi Kivity
2012-08-07 21:09                     ` Benjamin Herrenschmidt
2012-08-07 21:09                       ` Benjamin Herrenschmidt
2012-08-08  8:52                       ` Avi Kivity
2012-08-08  8:52                         ` Avi Kivity
2012-08-08  9:27                         ` Benjamin Herrenschmidt
2012-08-08  9:27                           ` Benjamin Herrenschmidt
2012-08-08  0:49                     ` David Gibson
2012-08-08  0:49                       ` David Gibson
2012-08-08  8:58                       ` Avi Kivity
2012-08-08  8:58                         ` Avi Kivity
2012-08-08 11:59                         ` David Gibson
2012-08-08 11:59                           ` David Gibson
2012-08-08 12:42                           ` Avi Kivity
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=501E351C.8080603@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=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 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.