All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Alistair Francis <alistair.francis@xilinx.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] MTTCG External Halt
Date: Fri, 02 Feb 2018 20:37:05 +0000	[thread overview]
Message-ID: <87po5nxh5a.fsf@linaro.org> (raw)
In-Reply-To: <CAKmqyKOXV91ex4Ohqy54Df4nLVC5S51EXth9etK1Tudmt6h1vQ@mail.gmail.com>


Alistair Francis <alistair.francis@xilinx.com> writes:

> On Thu, Feb 1, 2018 at 9:13 AM, Alistair Francis
> <alistair.francis@xilinx.com> wrote:
>> On Thu, Feb 1, 2018 at 4:01 AM, Alex Bennée <alex.bennee@linaro.org> wrote:
>>>
>>> Alistair Francis <alistair.francis@xilinx.com> writes:
>>>
>>>> On Wed, Jan 31, 2018 at 12:32 PM, Alex Bennée <alex.bennee@linaro.org> wrote:
>>>>>
>>>>> Alistair Francis <alistair.francis@xilinx.com> writes:
>>>>>
>>>>>> On Tue, Jan 30, 2018 at 8:26 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>>>>>> On 30/01/2018 18:56, Alistair Francis wrote:
>>>>>>>>
>>>>>>>> I don't have a good solution though, as setting CPU_INTERRUPT_RESET
>>>>>>>> doesn't help (that isn't handled while we are halted) and
>>>>>>>> async_run_on_cpu()/run_on_cpu() doesn't reliably reset the CPU when we
>>>>>>>> want.
>>>>>>>>
>>>>>>>> I've ever tried pausing all CPUs before reseting the CPU and them
>>>>>>>> resuming them all but that doesn't seem to to work either.
>>>>>>>
>>>>>>> async_safe_run_on_cpu would be like async_run_on_cpu, except that it
>>>>>>> takes care of stopping all other CPUs while the function runs.
>>>>>>>
>>>>>>>> Is there
>>>>>>>> anything I'm missing? Is there no reliable way to reset a CPU?
>>>>>>>
>>>>>>> What do you mean by reliable?  Executing no instruction after the one
>>>>>>> you were at?
>>>>>>
>>>>>> The reset is called by a GPIO line, so I need the reset to be called
>>>>>> basically as quickly as the GPIO line changes. The async_ and
>>>>>> async_safe_ functions seem to not run quickly enough, even if I run a
>>>>>> process_work_queue() function afterwards.
>>>>>>
>>>>>> Is there a way to kick the CPU to act on the async_*?
>>>>>
>>>>> Define quickly enough? The async_(safe) functions kick the vCPUs so they
>>>>> will all exit the run loop as they enter the next TB (even if they loop
>>>>> to themselves).
>>>>
>>>> We have a special power controller CPU that wakes all the CPUs up and
>>>> at boot the async_* functions don't wake the CPUs up. If I just use
>>>> the cpu_rest() function directly everything starts fine (but then I
>>>> hit issues later).
>>>>
>>>> If I forcefully run process_queued_cpu_work() then I can get the CPUs
>>>> up, but I don't think that is the right solution.
>>>>
>>>>>
>>>>> From an external vCPUs point of view those extra instructions have
>>>>> already executed. If the resetting vCPU needs them to have reset by the
>>>>> time it executes it's next instruction it should either cpu_loop_exit at
>>>>> that point or ensure it is the last instruction in it's TB (which is
>>>>> what we do for the MMU flush cases in ARM, they all end the TB at that
>>>>> point).
>>>>
>>>> cpu_loop_exit() sounds like it would help, but as I'm not in the CPU
>>>> context it just seg faults.
>>>
>>> What context are you in? gdb-stub does have to something like this.
>>
>> gdb-stub just seems to use vm_stop() and vm_start().
>>
>> That fixes all hangs/asserts, but now Linux only brings up 1 CPU (instead of 4).
>
> Hmmm... Interesting if I do this on reset events:
>
>         pause_all_vcpus();
>         cpu_reset(cpu);
>         resume_all_vcpus();
>
> it hangs, while if I do this
>
>         if (runstate_is_running()) {
>             vm_stop(RUN_STATE_PAUSED);
>         }
>         cpu_reset(cpu);
>         if (!runstate_needs_reset()) {
>             vm_start();
>         }
>
> it doesn't hang but CPU bringup doesn't work.

Hmm I'm still confused what context you are in. Is this an externally
triggered reset via the (qemu) prompt or something?

>
> Alistair
>
>>
>> Alistair


--
Alex Bennée

  reply	other threads:[~2018-02-02 20:37 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-03 22:10 [Qemu-devel] MTTCG External Halt Alistair Francis
2018-01-03 22:14 ` Peter Maydell
2018-01-03 22:23   ` Alistair Francis
2018-01-04  1:14     ` Alistair Francis
2018-01-04 11:08 ` Alex Bennée
2018-01-06  2:23   ` Alistair Francis
2018-01-30 23:56     ` Alistair Francis
2018-01-31  4:26       ` Paolo Bonzini
2018-01-31 16:08         ` Alistair Francis
2018-01-31 20:32           ` Alex Bennée
2018-01-31 22:31             ` Alistair Francis
2018-02-01 12:01               ` Alex Bennée
2018-02-01 17:13                 ` Alistair Francis
2018-02-01 21:00                   ` Alistair Francis
2018-02-02 20:37                     ` Alex Bennée [this message]
2018-02-02 21:49                       ` Alistair Francis
2018-02-02 21:59                         ` Alistair Francis
2018-04-22 23:03                           ` Philippe Mathieu-Daudé
2018-01-31 17:13 ` Paolo Bonzini
2018-01-31 18:17   ` Alistair Francis
2018-01-31 18:48     ` Peter Maydell
2018-01-31 18:51       ` Alistair Francis
2018-01-31 18:56         ` Alistair Francis
2018-01-31 18:59         ` Peter Maydell
2018-01-31 19:37           ` Alistair Francis

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=87po5nxh5a.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=alistair.francis@xilinx.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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.