[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 1/3] monitor: rename out_lock to mon_lock
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH v2 1/3] monitor: rename out_lock to mon_lock |
Date: |
Mon, 30 Apr 2018 10:56:49 +0100 |
User-agent: |
Mutt/1.9.2 (2017-12-15) |
On Wed, Apr 18, 2018 at 05:02:37PM +0800, Peter Xu wrote:
> The out_lock was only protecting out buffers. In the future the monitor
> code will start to run in multiple threads. We turn it into a bigger
> lock to protect not only the out buffer but also all the rest. We split
> this lock until necessary. So far I don't see a reason to complicate
> lock usage for monitors.
>
> Since at it, arrange the Monitor struct a bit.
>
> Signed-off-by: Peter Xu <address@hidden>
> ---
> monitor.c | 39 ++++++++++++++++++---------------------
> 1 file changed, 18 insertions(+), 21 deletions(-)
>
> diff --git a/monitor.c b/monitor.c
> index 39f8ee17ba..c93aa4e22b 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -202,20 +202,17 @@ typedef struct {
>
> struct Monitor {
> CharBackend chr;
> + /* We can't access guest memory when holding the lock */
> + QemuMutex mon_lock;
Please document which field this lock protects. For example, outbuf and
out_watch need a comment.
> int reset_seen;
> int flags;
> int suspend_cnt; /* Needs to be accessed atomically */
> bool skip_flush;
> bool use_io_thr;
> -
> - /* We can't access guest memory when holding the lock */
> - QemuMutex out_lock;
> QString *outbuf;
> guint out_watch;
signature.asc
Description: PGP signature