Received: from eggs.gnu.org ([2001:4830:134:3::10]:50059) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1VaH-0007Vp-4P for qemu-devel@nongnu.org; Wed, 25 Nov 2015 03:37:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a1VaD-0006MN-Rl for qemu-devel@nongnu.org; Wed, 25 Nov 2015 03:37:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:11860) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1VaD-0006MG-MA for qemu-devel@nongnu.org; Wed, 25 Nov 2015 03:37:45 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 704F1C0B7AB5 for ; Wed, 25 Nov 2015 08:37:44 +0000 (UTC) From: Markus Armbruster References: <1448273262-13845-1-git-send-email-peterx@redhat.com> <56533D45.1060108@redhat.com> <20151123175759.GG3606@hawk.localdomain> <5653C422.3040307@redhat.com> <20151124031027.GC26733@ad.usersys.redhat.com> <56544694.3060309@redhat.com> <20151124113723.GA29832@ad.usersys.redhat.com> <56546ADC.5050402@redhat.com> Date: Wed, 25 Nov 2015 09:37:42 +0100 In-Reply-To: <56546ADC.5050402@redhat.com> (Eric Blake's message of "Tue, 24 Nov 2015 06:49:16 -0700") Message-ID: <87r3jeiieh.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH REPOST 0/2] Add basic "detach" support for dump-guest-memory List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Andrew Jones , Fam Zheng , qemu-devel@nongnu.org, Peter Xu , lcapitulino@redhat.com, pbonzini@redhat.com, Laszlo Ersek Eric Blake writes: > On 11/24/2015 04:37 AM, Fam Zheng wrote: > >>> I think the patch should be dropped, and periodic progress reports >>> should be emitted from within the dump loops that do the heavy lifting. >>> >>> For the ELF format dumps, that loop appears to reside in dump_iterate() >>> [dump.c]. >>> >>> For the compressed format dumps, the loop seems to live in >>> write_dump_pages() [dump.c]. >> >> This is a good idea! >> >> What I'm not sure is where to report the progress. Can it be the monitor where >> the dump-guest-memory command was issued? In other words, do we >> support raising >> events before the previous command returns? If yes, can libvirt handle this >> correctly? (But the worst case is using another channel to communicate the >> progress, it is ad-hocery but it must be better than all the risk >> and effort to >> enable multi-threaded dump.) >> >> Eric, Markus, have any idea with the progress reporting? > > I'm fairly certain we support raising events prior to completion of a > synchronous command; what I'm not sure of is whether the event hits the > wire right away or whether it piles up waiting for the next synchronous > command completion. If the latter, then we need to rework it (since the > whole point of this exercise is that we are trying to give progress of a > long-running synchronous command that hasn't completed yet). But we > only have the one monitor connection for libvirt - the only way to pass > events through a second channel is to open a second monitor connection, > but that feels wrong to make libvirt have to track two monitors. Short answer: events can be sent at any time. Delay can come only from taking the necessary lock, or rate limiting. Longer answer: code triggers an event FOO by calling (QAPI-generated) qapi_event_send_FOO(). This marshalls the event's arguments and calls monitor_qapi_event_queue() (you have to peel off some obfuscating abstraction to see that). Assuming no rate limiting, this simply takes the monitor_lock to call monitor_qapi_event_emit(), which immediately sends the event to all QMP monitors.