From: "Pavel Dovgalyuk" <dovgaluk@ispras.ru>
To: 'Paolo Bonzini' <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: serge.fdrv@gmail.com, peter.maydell@linaro.org, pavel.dovgaluk@ispras.ru
Subject: Re: [Qemu-devel] [RFC/RFT PATCH 0/7] cpu-exec: simplify cpu_exec and remove some icount special cases
Date: Tue, 31 Jan 2017 12:05:08 +0300 [thread overview]
Message-ID: <000601d27ba1$1f009a50$5d01cef0$@ru> (raw)
In-Reply-To: <20170129210910.6333-1-pbonzini@redhat.com>
Hi, Paolo!
Thanks for refactoring.
I tested these patches with icount record/replay on i386 machine.
It works, but the following changes should be applied.
I also removed call to replay_has_interrupt, because now it is not needed here.
It seems, that this call is an artifact of an older record/replay revision.
diff --git a/cpu-exec.c b/cpu-exec.c
index 3838eb8..5cef8bc 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -519,7 +519,8 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
}
/* Finally, check if we need to exit to the main loop. */
- if (unlikely(atomic_read(&cpu->exit_request) || replay_has_interrupt())) {
+ if (unlikely(atomic_read(&cpu->exit_request)
+ || (use_icount && cpu->icount_decr.u16.low + cpu->icount_extra == 0))) {
atomic_set(&cpu->exit_request, 0);
cpu->exception_index = EXCP_INTERRUPT;
return true;
Pavel Dovgalyuk
> -----Original Message-----
> From: Paolo Bonzini [mailto:paolo.bonzini@gmail.com] On Behalf Of Paolo Bonzini
> Sent: Monday, January 30, 2017 12:09 AM
> To: qemu-devel@nongnu.org
> Cc: serge.fdrv@gmail.com; peter.maydell@linaro.org; pavel.dovgaluk@ispras.ru
> Subject: [RFC/RFT PATCH 0/7] cpu-exec: simplify cpu_exec and remove some icount special cases
>
> The series includes three parts:
>
> 1-2: fix two bugs, the first one pretty bad, the second seems
> to be theoretical only.
>
> 3-5: simplify cpu_exec. This builds on Sergey's conversion
> of cpu_exec to a simple top-down logic, making the phases
> clearer and saving on the cost of siglongjmp in the meanwhile.
>
> 6-7: these are intended to be a base for Pavel's record/replay
> fixes. The main thing I noticed while reviewing is that icount
> is redoing (with u16.high) a lot of things that tcg_exit_req is
> doing too. This is because, at the time icount was introduced,
> tcg_exit_req didn't exist and QEMU instead unwound chained TBs
> through POSIX signals. But now we have essentially two ways to
> do the same thing with subtly different invariants or downright
> bugs (such as the one fixed by patch 1). Patch 6 therefore
> unifies tcg_exit_req and the icount interrupt flag. It saves a
> handful of instructions per TB in icount mode and generally
> makes icount mode "less special", which is a good thing since
> no one seems to understand it well. Patch 7 then removes another
> EXCP_INTERRUPT/cpu_loop_exit pair; by exiting to main loop simply
> through cpu->exit_request, hopefully it fixes one of the issues that
> Pavel was seeing.
>
> For now I've tested this only on an aarch64 Linux image (with
> and without -icount). Thanks,
>
> Paolo
>
> Paolo Bonzini (7):
> cpu-exec: fix jmp_first out-of-bounds access with icount
> cpu-exec: tighten barrier on TCG_EXIT_REQUESTED
> cpu-exec: avoid cpu_loop_exit in cpu_handle_interrupt
> cpu-exec: avoid repeated sigsetjmp on interrupts
> cpu-exec: remove outermost infinite loop
> cpu-exec: unify icount_decr and tcg_exit_req
> cpu-exec: centralize exiting to the main loop
>
> cpu-exec.c | 153 +++++++++++++++++++++-------------------------
> include/exec/exec-all.h | 1 +
> include/exec/gen-icount.h | 53 ++++++++--------
> include/qom/cpu.h | 15 +++--
> qom/cpu.c | 2 +-
> tcg/tcg.h | 1 -
> translate-all.c | 2 +-
> translate-common.c | 13 ++--
> 8 files changed, 109 insertions(+), 131 deletions(-)
>
> --
> 2.9.3
next prev parent reply other threads:[~2017-01-31 9:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-29 21:09 [Qemu-devel] [RFC/RFT PATCH 0/7] cpu-exec: simplify cpu_exec and remove some icount special cases Paolo Bonzini
2017-01-29 21:09 ` [Qemu-devel] [PATCH 1/7] cpu-exec: fix jmp_first out-of-bounds access with icount Paolo Bonzini
2017-01-29 21:09 ` [Qemu-devel] [PATCH 2/7] cpu-exec: tighten barrier on TCG_EXIT_REQUESTED Paolo Bonzini
2017-01-29 21:09 ` [Qemu-devel] [PATCH 3/7] cpu-exec: avoid cpu_loop_exit in cpu_handle_interrupt Paolo Bonzini
2017-01-29 21:09 ` [Qemu-devel] [PATCH 4/7] cpu-exec: avoid repeated sigsetjmp on interrupts Paolo Bonzini
2017-01-29 21:09 ` [Qemu-devel] [PATCH 5/7] cpu-exec: remove outermost infinite loop Paolo Bonzini
2017-01-29 21:09 ` [Qemu-devel] [PATCH 6/7] cpu-exec: unify icount_decr and tcg_exit_req Paolo Bonzini
2017-01-29 21:09 ` [Qemu-devel] [PATCH 7/7] cpu-exec: centralize exiting to the main loop Paolo Bonzini
2017-01-29 21:18 ` [Qemu-devel] [RFC/RFT PATCH 0/7] cpu-exec: simplify cpu_exec and remove some icount special cases no-reply
2017-01-31 9:05 ` Pavel Dovgalyuk [this message]
2017-02-01 20:54 ` Paolo Bonzini
2017-02-03 7:07 ` Pavel Dovgalyuk
2017-02-03 15:07 ` Paolo Bonzini
2017-02-15 12:42 ` Paolo Bonzini
2017-02-15 12:45 ` Pavel Dovgalyuk
2017-02-15 12:57 ` Paolo Bonzini
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='000601d27ba1$1f009a50$5d01cef0$@ru' \
--to=dovgaluk@ispras.ru \
--cc=pavel.dovgaluk@ispras.ru \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=serge.fdrv@gmail.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.