From: "Pavel Dovgalyuk" <dovgaluk@ispras.ru>
To: 'Paolo Bonzini' <pbonzini@redhat.com>,
'Pavel Dovgalyuk' <pavel.dovgaluk@ispras.ru>,
qemu-devel@nongnu.org
Cc: kwolf@redhat.com, peter.maydell@linaro.org, quintela@redhat.com,
jasowang@redhat.com, mst@redhat.com, kraxel@redhat.com
Subject: Re: [Qemu-devel] [PATCH v8 2/9] icount: exit cpu loop on expire
Date: Fri, 27 Jan 2017 09:09:06 +0300 [thread overview]
Message-ID: <000301d27863$de11f560$9a35e020$@ru> (raw)
In-Reply-To: <3634a513-bb63-dc21-3248-d8fc1e8f30e9@redhat.com>
> From: Paolo Bonzini [mailto:pbonzini@redhat.com]
> On 26/01/2017 15:32, Pavel Dovgalyuk wrote:
> >> From: Paolo Bonzini [mailto:pbonzini@redhat.com]
> >> On 26/01/2017 14:37, Pavel Dovgalyuk wrote:
> >>>> Simpler:
> >>>>
> >>>> use_icount &&
> >>>> ((int32_t)cpu->icount_decr.u32 < 0 ||
> >>>> cpu->icount_decr.u16.low + cpu->icount_extra == 0)
> >>> Right.
> >>>
> >>>> But I'm not sure that you need to test u32. After all you're not
> >>> Checking u32 is needed, because sometimes it is less than zero.
> >>
> >> If cpu->icount_decr.u32 is less than zero, the next translation block
> >> would immediately exit with TB_EXIT_ICOUNT_EXPIRED, causing
> >>
> >> cpu->exception_index = EXCP_INTERRUPT;
> >> *last_tb = NULL;
> >> cpu_loop_exit(cpu);
> >>
> >> from cpu_loop_exec_tb's "case TB_EXIT_ICOUNT_EXPIRED".
> >>
> >> And the same is true for cpu->icount_decr.u16.low + cpu->icount_extra ==
> >> 0, so I don't understand why this part of the patch is necessary.
> >
> > I removed that lines because we have to check icount=0 not only when it is expired,
> > but also when all instructions were executed successfully.
> > If there are no instructions to execute, calling tb_find (and translation then)
> > may cause an exception at the wrong moment.
>
> Ok, that makes sense for cpu->icount_decr.u16.low + cpu->icount_extra == 0.
>
> But for decr.u32 < 0, the same reasoning of this comment is also true:
>
> /* Something asked us to stop executing
> * chained TBs; just continue round the main
> * loop. Whatever requested the exit will also
> * have set something else (eg exit_request or
> * interrupt_request) which we will handle
> * next time around the loop. But we need to
> * ensure the tcg_exit_req read in generated code
> * comes before the next read of cpu->exit_request
> * or cpu->interrupt_request.
> */
Right. If the following lines will not be removed (as opposite to my patch) then checking
decr.u32 < 0 will not be needed.
- cpu->exception_index = EXCP_INTERRUPT;
- *last_tb = NULL;
- cpu_loop_exit(cpu);
What is your point about the new version of that patch?
Pavel Dovgalyuk
next prev parent reply other threads:[~2017-01-27 6:09 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-26 12:34 [Qemu-devel] [PATCH v8 0/9] replay additions Pavel Dovgalyuk
2017-01-26 12:34 ` [Qemu-devel] [PATCH v8 1/9] replay: exception replay fix Pavel Dovgalyuk
2017-01-26 12:34 ` [Qemu-devel] [PATCH v8 2/9] icount: exit cpu loop on expire Pavel Dovgalyuk
2017-01-26 13:02 ` Paolo Bonzini
2017-01-26 13:37 ` Pavel Dovgalyuk
2017-01-26 14:28 ` Paolo Bonzini
2017-01-26 14:32 ` Pavel Dovgalyuk
2017-01-26 14:44 ` Paolo Bonzini
2017-01-27 6:09 ` Pavel Dovgalyuk [this message]
2017-01-27 11:02 ` Paolo Bonzini
2017-01-26 12:34 ` [Qemu-devel] [PATCH v8 3/9] apic: save apic_delivered flag Pavel Dovgalyuk
2017-01-26 12:49 ` Paolo Bonzini
2017-01-26 13:03 ` Pavel Dovgalyuk
2017-01-26 13:06 ` Paolo Bonzini
2017-01-26 13:07 ` Pavel Dovgalyuk
2017-01-26 12:34 ` [Qemu-devel] [PATCH v8 4/9] integratorcp: adding vmstate for save/restore Pavel Dovgalyuk
2017-01-26 12:34 ` [Qemu-devel] [PATCH v8 5/9] block: implement bdrv_snapshot_goto for blkreplay Pavel Dovgalyuk
2017-01-26 12:34 ` [Qemu-devel] [PATCH v8 6/9] blkreplay: create temporary overlay for underlaying devices Pavel Dovgalyuk
2017-01-26 12:34 ` [Qemu-devel] [PATCH v8 7/9] replay: disable default snapshot for record/replay Pavel Dovgalyuk
2017-01-26 12:34 ` [Qemu-devel] [PATCH v8 8/9] audio: make audio poll timer deterministic Pavel Dovgalyuk
2017-01-26 12:35 ` [Qemu-devel] [PATCH v8 9/9] replay: add record/replay for audio passthrough Pavel Dovgalyuk
2017-01-26 13:05 ` [Qemu-devel] [PATCH v8 0/9] replay additions 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='000301d27863$de11f560$9a35e020$@ru' \
--to=dovgaluk@ispras.ru \
--cc=jasowang@redhat.com \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=mst@redhat.com \
--cc=pavel.dovgaluk@ispras.ru \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@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).