qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: pbonzini@redhat.com, Pavel Dovgalyuk <pavel.dovgalyuk@ispras.ru>,
	qemu-devel@nongnu.org, peterx@redhat.com, david@redhat.com
Subject: Re: [PATCH v2 1/3] icount: preserve cflags when custom tb is about to execute
Date: Wed, 17 Nov 2021 10:29:37 +0000	[thread overview]
Message-ID: <87czmzvzuz.fsf@linaro.org> (raw)
In-Reply-To: <207105cf-bb82-55c5-ff30-e29517c970f5@linaro.org>


Richard Henderson <richard.henderson@linaro.org> writes:

> On 11/17/21 10:47 AM, Alex Bennée wrote:
>> -    gen_set_label(tcg_ctx->exitreq_label);
>> +    if (tcg_ctx->exitreq_label) {
>> +        gen_set_label(tcg_ctx->exitreq_label);
>> +    }
>>       tcg_gen_exit_tb(tb, TB_EXIT_REQUESTED);
>
> The exit_tb is also not reachable, and should go in with the label.

ok

>
>>   }
>>   modified   accel/tcg/cpu-exec.c
>> @@ -954,11 +954,16 @@ int cpu_exec(CPUState *cpu)
>>                * after-access watchpoints.  Since this request should never
>>                * have CF_INVALID set, -1 is a convenient invalid value that
>>                * does not require tcg headers for cpu_common_reset.
>> +             *
>> +             * As we don't want this special TB being interrupted by
>> +             * some sort of asynchronous event we apply CF_NOIRQ to
>> +             * disable the usual event checking.
>>                */
>>               cflags = cpu->cflags_next_tb;
>>               if (cflags == -1) {
>>                   cflags = curr_cflags(cpu);
>>               } else {
>> +                cflags |= CF_NOIRQ;
>>                   cpu->cflags_next_tb = -1;
>>               }
>
> Still missing something to avoid cpu_handle_interrupt firing?

Something as simple as:

--8<---------------cut here---------------start------------->8---
modified   accel/tcg/cpu-exec.c
@@ -721,6 +721,15 @@ static inline bool need_replay_interrupt(int interrupt_request)
 static inline bool cpu_handle_interrupt(CPUState *cpu,
                                         TranslationBlock **last_tb)
 {
+    /*
+     * If we have special cflags lets not get distracted with IRQs. We
+     * shall exit the loop as soon as the next TB completes what it
+     * needs to do.
+     */
+    if (cpu->cflags_next_tb != -1) {
+        return false;
+    }
+
     /* Clear the interrupt flag now since we're processing
      * cpu->interrupt_request and cpu->exit_request.
--8<---------------cut here---------------end--------------->8---

?

>
>
> r~


-- 
Alex Bennée


  reply	other threads:[~2021-11-17 10:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-11  9:55 [PATCH v2 0/3] Some watchpoint-related patches Pavel Dovgalyuk
2021-11-11  9:55 ` [PATCH v2 1/3] icount: preserve cflags when custom tb is about to execute Pavel Dovgalyuk
2021-11-11 12:20   ` Alex Bennée
2021-11-16  7:40     ` Pavel Dovgalyuk
2021-11-16 10:57       ` Alex Bennée
2021-11-17  9:47   ` Alex Bennée
2021-11-17 10:03     ` Richard Henderson
2021-11-17 10:29       ` Alex Bennée [this message]
2021-11-17 11:29         ` Richard Henderson
2021-11-18 11:05     ` Pavel Dovgalyuk
2021-11-11  9:55 ` [PATCH v2 2/3] softmmu: fix watchpoint-interrupt races Pavel Dovgalyuk
2021-11-11 13:15   ` Alex Bennée
2021-11-12 10:10   ` David Hildenbrand
2021-11-11  9:55 ` [PATCH v2 3/3] softmmu: fix watchpoints on memory used by vCPU internals Pavel Dovgalyuk
2021-11-11 10:48 ` [PATCH v2 0/3] Some watchpoint-related patches David Hildenbrand
2021-11-11 10:50   ` Pavel Dovgalyuk

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=87czmzvzuz.fsf@linaro.org \
    --to=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 \
    --cc=richard.henderson@linaro.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).