[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v7 13/23] monitor: let suspend/resume work even
From: |
Peter Xu |
Subject: |
Re: [Qemu-devel] [PATCH v7 13/23] monitor: let suspend/resume work even with QMPs |
Date: |
Thu, 22 Feb 2018 18:49:01 +0800 |
User-agent: |
Mutt/1.9.1 (2017-09-22) |
On Wed, Feb 21, 2018 at 04:50:58PM +0000, Stefan Hajnoczi wrote:
> On Wed, Jan 24, 2018 at 01:39:47PM +0800, Peter Xu wrote:
> > diff --git a/monitor.c b/monitor.c
> > index 60bcf67b3a..76137ba2a4 100644
> > --- a/monitor.c
> > +++ b/monitor.c
> > @@ -246,6 +246,21 @@ static inline bool monitor_is_qmp(const Monitor *mon)
> > return (mon->flags & MONITOR_USE_CONTROL);
> > }
> >
> > +/**
> > + * Whether @mon is using readline? Note: not all HMP monitors can are
> > + * using readline, e.g., gdbserver has non-interactive HMP monitor, so
>
> s/can are using/use/
>
> s/has non-interactive HMP monitor/has a non-interactive HMP monitor/
>
> > @@ -3994,19 +4009,43 @@ static void monitor_command_cb(void *opaque, const
> > char *cmdline,
> >
> > int monitor_suspend(Monitor *mon)
> > {
> > - if (!mon->rs)
> > + if (monitor_is_hmp_non_interactive(mon)) {
> > return -ENOTTY;
> > + }
> > +
> > + if (monitor_is_qmp(mon)) {
> > + /*
> > + * Kick iothread to make sure this takes effect. It'll be
> > + * evaluated again in prepare() of the watch object.
> > + */
> > + aio_notify(iothread_get_aio_context(mon_global.mon_iothread));
>
> This must be done after incrementing suspend_cnt to avoid the race
> condition between the iothread and our thread.
Fixed both places. Thanks,
--
Peter Xu