mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
monitor: do not use mb_read/mb_set for suspend_cnt
Clean up monitor_event to just use monitor_suspend/monitor_resume, using mon->mux_out to protect against incorrect nesting (especially on startup). The only remaining case of reading suspend_cnt is in the can_read callback, which is just advisory and can use qatomic_read. As an extra benefit, mux_out is now simply protected by mon_lock. Also, moving the prompt to the beginning of the main loop removes it from the output in some error cases where QEMU does not actually start successfully. It is not a full fix and it would be nice to also remove the monitor heading, but this is already a small (though unintentional) improvement. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
4cb96b9742
commit
6ee7c82d0d
5 changed files with 39 additions and 38 deletions
|
@ -569,10 +569,15 @@ static void monitor_accept_input(void *opaque)
|
|||
{
|
||||
Monitor *mon = opaque;
|
||||
|
||||
if (!monitor_is_qmp(mon)) {
|
||||
qemu_mutex_lock(&mon->mon_lock);
|
||||
if (!monitor_is_qmp(mon) && mon->reset_seen) {
|
||||
MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);
|
||||
assert(hmp_mon->rs);
|
||||
readline_restart(hmp_mon->rs);
|
||||
qemu_mutex_unlock(&mon->mon_lock);
|
||||
readline_show_prompt(hmp_mon->rs);
|
||||
} else {
|
||||
qemu_mutex_unlock(&mon->mon_lock);
|
||||
}
|
||||
|
||||
qemu_chr_fe_accept_input(&mon->chr);
|
||||
|
@ -603,7 +608,7 @@ int monitor_can_read(void *opaque)
|
|||
{
|
||||
Monitor *mon = opaque;
|
||||
|
||||
return !qatomic_mb_read(&mon->suspend_cnt);
|
||||
return !qatomic_read(&mon->suspend_cnt);
|
||||
}
|
||||
|
||||
void monitor_list_append(Monitor *mon)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue