qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Pavel Dovgalyuk <pavel.dovgalyuk@ispras.ru>, qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, alex.bennee@linaro.org, peterx@redhat.com,
	david@redhat.com
Subject: Re: [PATCH 4/4] icount: preserve cflags when custom tb is about to execute
Date: Thu, 28 Oct 2021 12:26:19 -0700	[thread overview]
Message-ID: <f6e2ae69-e838-5475-035e-b19a510b18b0@linaro.org> (raw)
In-Reply-To: <163542170287.2127597.18369415404458239885.stgit@pasha-ThinkPad-X280>

On 10/28/21 4:48 AM, Pavel Dovgalyuk wrote:
> +        if (cpu->cflags_next_tb == -1
> +            && (!use_icount || !(tb->cflags & CF_USE_ICOUNT)
> +                || cpu_neg(cpu)->icount_decr.u16.low >= tb->icount)) {
> +            /*
> +             * icount is disabled or there are enough instructions
> +             * in the budget, do not retranslate this block with
> +             * different parameters.
> +             */
> +            cpu->cflags_next_tb = tb->cflags;
> +        }

I can't see that this will work.

We've been asked to exit to the main loop; probably for an interrupt.  The next thing 
that's likely to happen is that cpu_cc->do_interrupt will adjust cpu state to continue in 
the guest interrupt handler.  The cflags_next_tb flag that you're setting up is not 
relevant to that context.

This seems related to Phil's reported problem

   https://gitlab.com/qemu-project/qemu/-/issues/245

in which an interrupt arrives before we finish processing the watchpoint.

I *think* we need to make cflags_next_tb != -1 be treated like any other interrupt disable 
bit, and delay delivery of the interrupt.  Which also means that we should not check for 
exit_tb at the beginning of any TB we generate for the watchpoint step.

I simply haven't taken the time to investigate this properly.


r~


  reply	other threads:[~2021-10-28 19:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-28 11:47 [PATCH 0/4] Some watchpoint-related patches Pavel Dovgalyuk
2021-10-28 11:48 ` [PATCH 1/4] softmmu: fix watchpoint processing in icount mode Pavel Dovgalyuk
2021-10-28 19:09   ` Richard Henderson
2021-10-28 11:48 ` [PATCH 2/4] softmmu: remove useless condition in watchpoint check Pavel Dovgalyuk
2021-10-28 19:10   ` Richard Henderson
2021-10-28 11:48 ` [PATCH 3/4] softmmu: fix for "after access" watchpoints Pavel Dovgalyuk
2021-10-28 19:13   ` Richard Henderson
2021-10-28 11:48 ` [PATCH 4/4] icount: preserve cflags when custom tb is about to execute Pavel Dovgalyuk
2021-10-28 19:26   ` Richard Henderson [this message]
2021-11-03  8:44     ` Pavel Dovgalyuk
2021-11-11  9:56     ` Pavel Dovgalyuk
2021-10-28 19:29 ` [PATCH 0/4] Some watchpoint-related patches Richard Henderson

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=f6e2ae69-e838-5475-035e-b19a510b18b0@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=david@redhat.com \
    --cc=pavel.dovgalyuk@ispras.ru \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).