All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>
Subject: Re: [PATCH 1/2] gdbstub: Set current_cpu for memory read write
Date: Thu, 24 Mar 2022 11:10:04 +0800	[thread overview]
Message-ID: <CAEUhbmVXiB+mbbjhy0sT2PhQHNJgdHmehXfcE18g=E3SPffndQ@mail.gmail.com> (raw)
In-Reply-To: <CAFEAcA8RdqQ5fzoZtb5SaYe41FA=oKo21veergqhMgo=eFmB6Q@mail.gmail.com>

On Tue, Mar 22, 2022 at 11:56 PM Peter Maydell <peter.maydell@linaro.org> wrote:
>
> On Tue, 22 Mar 2022 at 15:43, Bin Meng <bmeng.cn@gmail.com> wrote:
> >
> > When accessing the per-CPU register bank of some devices (e.g.: GIC)
> > from the GDB stub context, a segfault occurs. This is due to current_cpu
> > is not set, as the contect is not a guest CPU.
> >
> > Let's set current_cpu before doing the acutal memory read write.
> >
> > Resolves: https://gitlab.com/qemu-project/qemu/-/issues/124
> > Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> > ---
>
> This works, but I worry a bit that it might have unexpected
> side effects, and setting globals (even if thread-local) to
> cause side-effects elsewhere isn't ideal...
>

The functions modified are local to the gdbstub or monitor thread, so
modifying the thread-local variable should have no side-effects.

Regards,
Bin


  parent reply	other threads:[~2022-03-24  3:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-22 15:42 [PATCH 1/2] gdbstub: Set current_cpu for memory read write Bin Meng
2022-03-22 15:42 ` [PATCH 2/2] monitor/misc: Set current_cpu for memory dump Bin Meng
2022-03-22 15:56 ` [PATCH 1/2] gdbstub: Set current_cpu for memory read write Peter Maydell
2022-03-22 18:59   ` Philippe Mathieu-Daudé
2022-03-22 19:32     ` Peter Maydell
2022-03-24  3:10   ` Bin Meng [this message]
2022-03-24 10:27     ` Alex Bennée
2022-03-24 11:52       ` Peter Maydell
2022-03-28  2:10         ` Bin Meng
2022-03-28  9:09           ` Peter Maydell
2022-03-29  4:43             ` Bin Meng
2022-04-02 11:20               ` Bin Meng
2022-04-08  5:58                 ` Bin Meng
2022-04-08  9:00                   ` Alex Bennée
2022-04-12 10:48                   ` 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='CAEUhbmVXiB+mbbjhy0sT2PhQHNJgdHmehXfcE18g=E3SPffndQ@mail.gmail.com' \
    --to=bmeng.cn@gmail.com \
    --cc=alex.bennee@linaro.org \
    --cc=f4bug@amsat.org \
    --cc=peter.maydell@linaro.org \
    --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.