[Top][All Lists]

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

Re: [Qemu-devel] [PATCH v8 19/23] qmp: isolate responses into io thread

From: Peter Xu
Subject: Re: [Qemu-devel] [PATCH v8 19/23] qmp: isolate responses into io thread
Date: Fri, 23 Mar 2018 13:50:56 +0800
User-agent: Mutt/1.9.1 (2017-09-22)

On Thu, Mar 22, 2018 at 01:00:19PM +0100, Marc-André Lureau wrote:
> Hi
> On Fri, Mar 9, 2018 at 10:00 AM, Peter Xu <address@hidden> wrote:
> > For those monitors who have enabled IO thread, we'll offload the
> > responding procedure into IO thread.  The main reason is that chardev is
> > not thread safe, and we need to do all the read/write IOs in the same
> > thread.  For use_io_thr=true monitors, that thread is the IO thread.
> Actually, the chr write path is suppose to be somewhat thread safe
> (chr_write_lock).
> Secondly, the function responsible to write monitor data has some
> thread-safety, it's called monitor_flush_locked(), because you need
> the mon->out_lock.
> I think that patch is making things more complicated than they need to
> be. You should be able to call monitor_json_emitter/monitor_puts()
> directly from any thread, it will queue the data, start writing, and
> add a watch if necessary in the appropriate context.
> Am I missing something?

Yes there are the locks either in monitor code and chardev code to
protect write operations.  However I don't know enough to be sure of
its safety.  Considering that, having the whole chardev operations
separated into the other IOThread seems to be the only safe approach
to me for now.


Peter Xu

reply via email to

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