qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v16 17/18] plugins: Allow to read registers


From: Akihiko Odaki
Subject: Re: [PATCH v16 17/18] plugins: Allow to read registers
Date: Fri, 3 Nov 2023 00:38:10 +0900
User-agent: Mozilla Thunderbird

On 2023/11/02 20:26, Alex Bennée wrote:
Akihiko Odaki <akihiko.odaki@daynix.com> writes:

It is based on GDB protocol to ensure interface stability.

The timing of the vcpu init hook is also changed so that the hook will
get called after GDB features are initialized.

I guess this was moved into an earlier patch.
  }
+
+int qemu_plugin_find_register_file(unsigned int vcpu_index, const char *name)
+{
+    QEMU_IOTHREAD_LOCK_GUARD();

What is this lock protecting against?

gdb_register_feature doesn't protect cpu->gdb_regs() when registering
features as it is implicitly per-CPU.

If GDB should be locking I would push that down into gdbstub itself (and
not use the global IOTHREAD).

Without lock, gdb_find_feature() may be called while the vCPU is exiting on another thread. The vCPU exit only happens in iothread so taking iothread ensures such race will not happen. Many functions in QEMU expect the iothread lock is taken so I make the same assumption for gdb_find_feature().



reply via email to

[Prev in Thread] Current Thread [Next in Thread]