All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
	qemu-devel@nongnu.org, "Maxim Levitsky" <mlevitsk@redhat.com>
Cc: cohuck@redhat.com, alex.bennee@linaro.org, mst@redhat.com
Subject: Re: [PATCH 3/5] gdbstub: reject unsupported flags in handle_set_qemu_sstep
Date: Thu, 11 Nov 2021 18:16:19 +0100	[thread overview]
Message-ID: <8ee9adb7-791e-a4fa-6770-662af9747f06@redhat.com> (raw)
In-Reply-To: <0063585f-e3e2-dc62-5d85-3864e992c953@redhat.com>

On 11/11/21 12:38, Philippe Mathieu-Daudé wrote:
> Simpler:
> 
>   gdbserver_state.supported_sstep_flags = SSTEP_ENABLE;
> 
>> +    /*
>> +     * In replay mode all events written into the log should be replayed.
>> +     * That is why NOIRQ flag is removed in this mode.
>> +     */
>   if (replay_mode == REPLAY_MODE_NONE) {
>     gdbserver_state.supported_sstep_flags |= SSTEP_NOIRQ | SSTEP_NOTIMER;
>   }
> 

This variant may be simpler now, but not with the next patch.  This is
because something like this is nasty (see the "=" vs "|=" difference):

      gdbserver_state.supported_sstep_flags = SSTEP_ENABLE;
      if (kvm_enabled()) {
         gdbserver_state.supported_sstep_flags = kvm_get_supported_sstep_flags();
      } else {
          gdbserver_state.supported_sstep_flags |=
              SSTEP_NOIRQ | SSTEP_NOTIMER;
      }

and something like this is technically incorrect, because a hypothetical
non-TCG record/replay would have the same limitation in the sstep_flags:

      gdbserver_state.supported_sstep_flags = SSTEP_ENABLE;
      if (kvm_enabled()) {
         gdbserver_state.supported_sstep_flags = kvm_get_supported_sstep_flags();
      } else {
          gdbserver_state.supported_sstep_flags = SSTEP_ENABLE;
          if (replay_mode != REPLAY_MODE_NONE) {
              gdbserver_state.supported_sstep_flags |=
                  SSTEP_NOIRQ | SSTEP_NOTIMER;
      }

>>
>> +
>> +    if (new_sstep_flags  & ~gdbserver_state.supported_sstep_flags) {
>> +        put_packet("E22");
>> +        return;
>> +    }
> 
> Please does this change in a separate patch, after moving
> to GDBState.

Honestly it seems overkill.  The point of this patch is to add _this_
check, everything else is just a means to this end.  Before, there was
no concept of supported flags, so there was only one variable.  Now that
there are two variables, it makes sense to move them to GDBState.  Also,
with no concept of supported flags it would not be possible to avoid the
get_sstep_flags() function.

If I had to split the patch further, I'd first move sstep_flags to
gdbserver_state.sstep_flags, and then do everything else, but IMO this
patch is already small enough and easy enough to review.

Paolo



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

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-11 11:05 [PATCH 0/5] Update linux-headers + NOIRQ support for KVM gdbstub Paolo Bonzini
2021-11-11 11:06 ` [PATCH 1/5] virtio-gpu: do not byteswap padding Paolo Bonzini
2021-11-11 11:28   ` Cornelia Huck
2021-11-11 11:32   ` Philippe Mathieu-Daudé
2021-11-11 16:58   ` Michael S. Tsirkin
2021-11-11 17:06   ` Alex Bennée
2021-11-11 11:06 ` [PATCH 2/5] linux-headers: update to 5.16-rc1 Paolo Bonzini
2021-11-11 11:29   ` Cornelia Huck
2021-11-11 17:07   ` Alex Bennée
2021-11-11 11:06 ` [PATCH 3/5] gdbstub: reject unsupported flags in handle_set_qemu_sstep Paolo Bonzini
2021-11-11 11:38   ` Philippe Mathieu-Daudé
2021-11-11 17:16     ` Paolo Bonzini [this message]
2021-11-11 17:08   ` Alex Bennée
2021-11-11 19:29     ` Paolo Bonzini
2021-11-11 11:06 ` [PATCH 4/5] gdbstub, kvm: let KVM report supported singlestep flags Paolo Bonzini
2021-11-11 17:14   ` Alex Bennée
2021-11-11 11:06 ` [PATCH 5/5] kvm: add support for KVM_GUESTDBG_BLOCKIRQ Paolo Bonzini
2021-11-11 16:31   ` Philippe Mathieu-Daudé
2021-11-11 17:17   ` Alex Bennée

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=8ee9adb7-791e-a4fa-6770-662af9747f06@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=cohuck@redhat.com \
    --cc=mlevitsk@redhat.com \
    --cc=mst@redhat.com \
    --cc=philmd@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 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.