From: Richard Henderson <richard.henderson@linaro.org>
To: David Hildenbrand <david@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-s390x@nongnu.org, Cornelia Huck <cohuck@redhat.com>,
Thomas Huth <thuth@redhat.com>
Subject: Re: [PATCH v1] s390x/tcg: MVCL: Exit to main loop if there are pending interrupts
Date: Tue, 1 Oct 2019 12:17:29 -0700 [thread overview]
Message-ID: <720221d3-84a6-9940-812e-b427acfc99ed@linaro.org> (raw)
In-Reply-To: <20191001181655.25948-1-david@redhat.com>
On 10/1/19 11:16 AM, David Hildenbrand wrote:
> +static inline bool should_interrupt_instruction(CPUState *cs)
> +{
> + /*
> + * Something asked us to stop executing chained TBs, e.g.,
> + * cpu_interrupt() or cpu_exit().
> + */
> + if ((int32_t)atomic_read(&cpu_neg(cs)->icount_decr.u32) < 0) {
> + return true;
> + }
> +
> + /* We have a deliverable interrupt pending. */
> + if ((atomic_read(&cs->interrupt_request) & CPU_INTERRUPT_HARD) &&
> + s390_cpu_has_int(S390_CPU(cs))) {
> + return true;
> + }
> + return false;
> +}
The first condition should be true whenever the second condition is true.
In particular, tcg_handle_interrupt sets icount_decr.u16.high = -1 for
qemu_cpu_is_self; otherwise, qemu_cpu_kick calls cpu_exit which does the same
thing.
Think of it this way: we only test icount_decr.u32 at the start of each TB, and
that's the only thing we have that brings us back to the main loop for any
other kind of interrupt.
r~
next prev parent reply other threads:[~2019-10-01 19:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-01 18:16 [PATCH v1] s390x/tcg: MVCL: Exit to main loop if there are pending interrupts David Hildenbrand
2019-10-01 19:17 ` Richard Henderson [this message]
2019-10-01 19:47 ` David Hildenbrand
2019-10-01 21:59 ` Richard Henderson
2019-10-02 7:04 ` David Hildenbrand
2019-10-02 8:19 ` David Hildenbrand
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=720221d3-84a6-9940-812e-b427acfc99ed@linaro.org \
--to=richard.henderson@linaro.org \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=thuth@redhat.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).