mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 16:53:55 -06:00
cpu: expose qemu_cpu_list_lock for lock-guard use
Expose qemu_cpu_list_lock globally so that we can use WITH_QEMU_LOCK_GUARD and QEMU_LOCK_GUARD to simplify a few code paths now and in future. Signed-off-by: Jamie Iles <quic_jiles@quicinc.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230427020925.51003-2-quic_jiles@quicinc.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
eb0153efa6
commit
370ed60029
5 changed files with 26 additions and 25 deletions
|
@ -17,6 +17,7 @@
|
|||
#include "qemu/guest-random.h"
|
||||
#include "qemu/units.h"
|
||||
#include "qemu/selfmap.h"
|
||||
#include "qemu/lockable.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "target_signal.h"
|
||||
|
@ -4238,14 +4239,14 @@ static int fill_note_info(struct elf_note_info *info,
|
|||
info->notes_size += note_size(&info->notes[i]);
|
||||
|
||||
/* read and fill status of all threads */
|
||||
cpu_list_lock();
|
||||
CPU_FOREACH(cpu) {
|
||||
if (cpu == thread_cpu) {
|
||||
continue;
|
||||
WITH_QEMU_LOCK_GUARD(&qemu_cpu_list_lock) {
|
||||
CPU_FOREACH(cpu) {
|
||||
if (cpu == thread_cpu) {
|
||||
continue;
|
||||
}
|
||||
fill_thread_info(info, cpu->env_ptr);
|
||||
}
|
||||
fill_thread_info(info, cpu->env_ptr);
|
||||
}
|
||||
cpu_list_unlock();
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue