From: "Pavel Dovgalyuk" <dovgaluk@ispras.ru>
To: 'Paolo Bonzini' <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: serge.fdrv@gmail.com, pavel.dovgaluk@ispras.ru, peter.maydell@linaro.org
Subject: Re: [Qemu-devel] [RFC/RFT PATCH 0/7] cpu-exec: simplify cpu_exec and remove some icount special cases
Date: Fri, 3 Feb 2017 10:07:12 +0300 [thread overview]
Message-ID: <000301d27dec$2488e1b0$6d9aa510$@ru> (raw)
In-Reply-To: <cf88e926-78b5-7d74-a1eb-4f13b3955496@redhat.com>
> From: Paolo Bonzini [mailto:paolo.bonzini@gmail.com] On Behalf Of Paolo Bonzini
> On 31/01/2017 01:05, Pavel Dovgalyuk wrote:
> > 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;
>
> So is this needed to avoid exceptions in tb_find? Please add a comment
> about this
This code comes from my last patch, that was not applied.
Here is the comment:
It adds check to break cpu loop when icount expires without
setting the TB_EXIT_ICOUNT_EXPIRED flag. It happens when there is no
available translated blocks and all instructions were executed.
In icount replay mode unnecessary tb_find will be called (which may
cause an exception) and execution will be non-deterministic.
> and check if you can also replace:
>
> atomic_set(&cpu->exit_request, 1);
>
> in cpu_loop_exec_tb with
>
> cpu->icount_decr.u16.low = 0;
>
> ?
>
This line is not needed at all, because the following code decrements
icount automatically.
if (insns_left > 0) {
cpu_exec_nocache(cpu, insns_left, tb, false);
}
Pavel Dovgalyuk
next prev parent reply other threads:[~2017-02-03 7:07 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
2017-02-01 20:54 ` Paolo Bonzini
2017-02-03 7:07 ` Pavel Dovgalyuk [this message]
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='000301d27dec$2488e1b0$6d9aa510$@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 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).