From: "Alex Bennée" <alex.bennee@linaro.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: keithp@keithp.com, qemu-devel@nongnu.org,
Richard Henderson <rth@twiddle.net>
Subject: Re: [RFC PATCH] semihosting: suspend recieving CPU when blocked (HACK, WIP)
Date: Wed, 18 Dec 2019 17:36:42 +0000 [thread overview]
Message-ID: <877e2tfsd1.fsf@linaro.org> (raw)
In-Reply-To: <5c6068cb-f8bf-fe4b-391b-7ced97f14221@redhat.com>
Paolo Bonzini <pbonzini@redhat.com> writes:
> On 17/12/19 15:18, Alex Bennée wrote:
>>
>> Paolo Bonzini <pbonzini@redhat.com> writes:
>>
>>> On 17/12/19 14:42, Alex Bennée wrote:
>>>>> Why do you need to set exception_index to something other than -1 (using
>>>>> cpu_loop_exit_noexc for example)?
>>>> If there is no exception to process we won't exit the main loop which we
>>>> need to do if we want to wait until there is data to read.
>>>
>>> Okay.
>>>
>>>>> Using ->stop here is a bit weird, since ->stop is usually related to
>>>>> pause_all_vcpus.
>>>>
>>>> Arguably we could come up with a better API to cpu.c but this allows us
>>>> to use cpu_resume(c->sleeping_cpu) when waking up rather than hand
>>>> rolling our own wake-up mechanism.
>>>
>>> But we already have the right wake-up mechanism, which is
>>> cpu->halted/cpu_has_work.
>>
>> cpu_has_work is a guest function though and semihosting_console is a
>> common hw module. It can't peek into the guests internal state.
>
> semihosting_console only needs to something like
> cpu_interrupt(cpu->stopped_cpu, CPU_INTERRUPT_SEMIHOST).
As an exception is being delivered we just end up re-executing the
EXCP_SEMIHOST. I still don't see why using cpu_interrupt is an
improvement seeing as it is secondary to exception processing.
> (By the way,
> the stopped_cpu should probably be a list to mimic the condition
> variable---for example a GSList).
ok
>
>> This all
>> comes back to cpu_thread_is_idle anyway in making our decision about if
>> we do or do not sleep on the halt_cond.
>>
>>> That also makes it possible to just use
>>> EXCP_HALTED instead of adding a new EXCP_BLOCKED.
>>
>> We can certainly use EXCP_HALTED but maybe come up with a common way of
>> entering the state? There seems to be a combination of messing around
>> with special interrupts and direct poking of cs->halted = 1 while
>> setting the exception. Maybe this could finally clear up the #if
>> defined(TARGET_I386) hacking in cpus.c?
>
> If you're talking accel/tcg/cpu-exec.c, that's different; the issue
> there is that x86 has a kind of warm reset pin that is not equivalent to
> cpu_reset. Removing that would only entail adding a new member function
> to CPUClass.
>
> Paolo
--
Alex Bennée
next prev parent reply other threads:[~2019-12-18 17:40 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-23 19:26 [PATCH] Semihost SYS_READC implementation (v3) Keith Packard
2019-10-23 19:26 ` Keith Packard
2019-10-24 17:33 ` no-reply
2019-10-24 17:33 ` no-reply
2019-10-24 18:54 ` Paolo Bonzini
2019-10-24 18:54 ` Paolo Bonzini
2019-10-24 22:46 ` [PATCH] Semihost SYS_READC implementation (v4) Keith Packard
2019-10-25 9:51 ` Alex Bennée
2019-10-25 16:36 ` Keith Packard
2019-10-25 16:49 ` Peter Maydell
2019-10-25 19:15 ` Keith Packard
2019-10-25 20:53 ` Peter Maydell
2019-10-25 23:18 ` Keith Packard
2019-11-04 20:42 ` [PATCH] Semihost SYS_READC implementation (v6) Keith Packard
2019-11-04 20:42 ` Keith Packard
2019-12-17 8:38 ` Alex Bennée
2019-12-17 8:38 ` Alex Bennée
2019-12-17 9:08 ` Paolo Bonzini
2019-12-17 9:08 ` Paolo Bonzini
2019-12-17 9:51 ` Alex Bennée
2019-12-17 9:51 ` Alex Bennée
2019-12-17 10:04 ` Paolo Bonzini
2019-12-17 10:04 ` Paolo Bonzini
2019-12-17 12:14 ` [RFC PATCH] semihosting: suspend recieving CPU when blocked (HACK, WIP) Alex Bennée
2019-12-17 12:22 ` Paolo Bonzini
2019-12-17 13:42 ` Alex Bennée
2019-12-17 13:48 ` Paolo Bonzini
2019-12-17 14:18 ` Alex Bennée
2019-12-17 14:39 ` Paolo Bonzini
2019-12-17 14:39 ` Paolo Bonzini
2019-12-18 17:36 ` Alex Bennée [this message]
2019-12-18 21:23 ` Paolo Bonzini
2019-11-05 5:10 ` [PATCH] Semihost SYS_READC implementation (v4) Keith Packard
2019-11-11 14:51 ` Peter Maydell
2019-11-14 15:46 ` Alistair Francis
2019-11-14 17:43 ` Keith Packard
2019-11-14 17:39 ` Keith Packard
2019-11-14 17:47 ` Peter Maydell
2019-11-14 19:20 ` Peter Maydell
2019-11-14 16:14 ` Peter Maydell
2019-11-14 18:05 ` Keith Packard
2019-11-14 18:18 ` Peter Maydell
2019-11-14 19:18 ` Richard Henderson
2019-11-14 19:29 ` Peter Maydell
2019-11-14 20:52 ` Richard Henderson
2019-11-14 21:04 ` Peter Maydell
2019-11-14 22:26 ` Keith Packard
2019-11-15 10:54 ` Peter Maydell
2019-11-15 23:40 ` Keith Packard
2019-10-25 17:02 ` Alex Bennée
2019-10-25 18:17 ` no-reply
2019-10-25 18:20 ` no-reply
2019-10-24 17:43 ` [PATCH] Semihost SYS_READC implementation (v3) no-reply
2019-10-24 17:43 ` no-reply
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=877e2tfsd1.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=keithp@keithp.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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.