qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v6 01/13] monitor: simplify monitor_qmp_setup_ha


From: Peter Xu
Subject: Re: [Qemu-devel] [PATCH v6 01/13] monitor: simplify monitor_qmp_setup_handlers_bh
Date: Wed, 22 Aug 2018 12:38:44 +0800
User-agent: Mutt/1.10.1 (2018-07-13)

On Tue, Aug 21, 2018 at 08:13:59PM +0200, Marc-André Lureau wrote:
> Hi
> 
> On Wed, Aug 15, 2018 at 3:37 PM, Peter Xu <address@hidden> wrote:
> > When we reach monitor_qmp_setup_handlers_bh() we must be using the
> > IOThread then, so no need to check against it any more.  Instead, we
> > assert.
> >
> > Reviewed-by: Markus Armbruster <address@hidden>
> > Signed-off-by: Peter Xu <address@hidden>
> 
> That's a clear simplification that I also found, so ack in principle.
> 
> However, I don't understand the need of a BH in the first place.
> monitor_get_io_context() will return the iothread associated context.
> Could you explain?
> thanks

Please refer to the comment in monitor_init():

        /*
        * We can't call qemu_chr_fe_set_handlers() directly here
        * since chardev might be running in the monitor I/O
        * thread.  Schedule a bottom half.
        */
        aio_bh_schedule_oneshot(monitor_get_aio_context(),
                                monitor_qmp_setup_handlers_bh, mon);

To be more specific: in qemu_chr_fe_set_handlers() after we call
qemu_chr_be_update_read_handlers() then the iothread might already
have started to operate on the chardev, so it can race with
qemu_chr_fe_set_handlers() itself if we call it directly in the main
thread.

Regards,

-- 
Peter Xu



reply via email to

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