From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4BFA0606A327 for ; Wed, 2 Dec 2026 09:25:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=pond.sub.org header.i=@pond.sub.org header.a=rsa-sha256 header.s=mail header.b=P7/DaFY9 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xYgZv-0000pD-BP; Wed, 02 Dec 2026 04:24:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xYgZn-0000gp-IP; Wed, 02 Dec 2026 04:24:37 -0500 Received: from oxygen.pond.sub.org ([2a01:4f8:13b:3ad0:1::3]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xYgZh-0004Sj-HI; Wed, 02 Dec 2026 04:24:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=pond.sub.org; s=mail; t=1796203454; bh=XKz2QSkNGUGStJ1d0qS86cltzDFDkXa1NrvMT7BhJW4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=P7/DaFY9zudrdHmtCEqkm4d+5Kvl30VEKs5+FT6hY/NOhvlKmXCIeehnH6a5akiYf px0wa/rRmACEk0ieqAFWmEOj0FfOnlyjUvZCMmMG660yessEmkO3KNw6bQ+SqPyu/R 1vnp2rQ/mL7UAzIETcPzXUKzpq+FzgNO6Jaq4B04= Received: from blackfin.pond.sub.org (p200300d36f05b900e5f885c0cd39d8e9.dip0.t-ipconnect.de [IPv6:2003:d3:6f05:b900:e5f8:85c0:cd39:d8e9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by oxygen.pond.sub.org (Postfix) with ESMTPSA id EDBD720FBA; Wed, 02 Dec 2026 10:24:13 +0100 (CET) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 9411C21E6A04; Wed, 02 Dec 2026 10:24:24 +0100 (CET) From: Markus Armbruster To: Hanna Czenczek Cc: Markus Armbruster , qemu-block@nongnu.org, qemu-devel@nongnu.org, Kevin Wolf , John Snow , "Denis V . Lunev" , Eric Blake , Stefan Hajnoczi , Paolo Bonzini Subject: Re: [PATCH v2 07/12] qapi/block: Add BLOCK_IO_DONE event In-Reply-To: <5464dd6a-d7fe-4b1e-a284-9f18c263ba3a@redhat.com> (Hanna Czenczek's message of "Tue, 1 Dec 2026 15:19:45 +0100") References: <20261019182028.45305-1-hreitz@redhat.com> <20261019182028.45305-8-hreitz@redhat.com> <871p9ksvx5.fsf@pond.sub.org> <87ld7pgcsy.fsf@pond.sub.org> <87ecdd6k38.fsf@pond.sub.org> <5464dd6a-d7fe-4b1e-a284-9f18c263ba3a@redhat.com> Date: Wed, 02 Dec 2026 10:24:24 +0100 Message-ID: <87ik1cdohj.fsf@pond.sub.org> User-Agent: Gnus/5.13 (Gnus v5.13) X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a01:4f8:13b:3ad0:1::3; envelope-from=armbru@pond.sub.org; helo=oxygen.pond.sub.org X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org X-Spam-Status: No, score=-17.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Hanna Czenczek writes: > On 26.10.26 07:40, Markus Armbruster wrote: >> Hanna Czenczek writes: >> >>> On 23.10.26 08:18, Markus Armbruster wrote: >>>> Hanna Czenczek writes: >>>> >>>>> On 20.10.26 08:55, Markus Armbruster wrote: >>>>>> Hanna Czenczek writes: >>>>>> >>>>>>> This event is emitted when an operation completes, for which a >>>>>>> BLOCK_IO_DELAY event has previously been emitted. >>>>>>> >>>>>>> Signed-off-by: Hanna Czenczek >>>>>>> --- >>>>>>> qapi/block.json | 33 +++++++++++++++++++++++++++++++++ >>>>>>> 1 file changed, 33 insertions(+) >>>>>>> >>>>>>> diff --git a/qapi/block.json b/qapi/block.json >>>>>>> index 5f9f5c28050..38f293dd32d 100644 >>>>>>> --- a/qapi/block.json >>>>>>> +++ b/qapi/block.json >> [...] >> >>>>>>> @@ -686,3 +689,33 @@ >>>>>>> 'action': 'BlockErrorAction', >>>>>>> '*offset': 'uint64', >>>>>>> 'bytes': 'uint64' } } >>>>>>> + >>>>>>> +## >>>>>>> +# @BLOCK_IO_DONE: >>>>>>> +# >>>>>>> +# Emitted on completion for disk operations that previously emitte= d a >>>>>>> +# `BLOCK_IO_DELAY` event. >>>>>> >>>>>> Can we have multiple operations in flight that previously emitted >>>>>> BLOCK_IO_DELAY? >>>>>> >>>>>> If yes, might a management application need to connect the BLOCK_IO_= DONE >>>>>> back to the BLOCK_IO_DELAY? >>>>>> >>>>>> If yes, how could it do that? >>>>> >>>>> Well, the combination of device, operation, offset, bytes. >>>>> >>>>> Do you think there should be an ID like a u64 counter per >>>>> BlockBackend? >>>> >>>> I'm not overly particular on how exactly the connection can be made. = If >>>> the quadruple you suggested always suffices, that's good enough for me. >>>> Documentation should point it out, though. >>>> >>>> Can multiple operations with the same (device, operation, offset, byte= s) >>>> be in flight? >>> >>> Technically, sure. >>> >>> Adding an ID is quite ugly, I feel like, which is why I would need your= input in how it would be least intrusive in QAPI. >> >> First step is to get a clearer idea on what exactly management >> applications need here. > > I see two use cases: > 1. To find when it is OK to resume the VM after auto-stop. That, I assume= d, would require correlating DELAY action=3Dstop events with their DONE eve= nts. Let's see whether I understand. Certain guests handle very slow I/O in undesirable ways. We want to let management applications hide such I/O from them, as follows. The management application uses block device model property "delay-stop-ns" [PATCH 11] to stop the VM when an I/O operation takes too long for this guest. When this happens, event BLOCK_IO_DELAY is emitted, and the VM stops if it isn't stopped already. The I/O operation eventually completes, and event BLOCK_IO_DONE is emitted. The management application wants to resume the VM only when all outstanding slow I/O operations completed, i.e. when it received a BLOCK_IO_DONE for each prior BLOCK_IO_DELAY. Correct? If yes, counting the events might suffice here. > 2. Accounting, in general. One hard case: See what delayed requests are i= n flight, mark them off. But counting is useless here. > The first we could instead just solve by adding an `action` field to DONE= events that shows `report` when the request was only reported at `action= =3Dreport` level; and `stop` when, at any point, it was reported at `action= =3Dstop` level (i.e. causing the VM to stop if not already stopped). Then t= he client can count how many `action=3Dstop` DELAY events happened, against= the resolving `action=3Dstop` DONE events, and resume the VM when the coun= ts are equal. Yes, you need a way to tell whether a BLOCK_IO_DONE matches a BLOCK_IO_DELAY with action "stop" to make the counting work. > (This would go well with requiring that `delay-stop-ns > delay-report-ns`= , so that this will also always be the same `action` value as in the last D= ELAY event.) If property "delay-report-ns" is set in addition to "delay-stop-ns": 1. Neither threshold is passed: no events. 2. Only delay-stop-ns is passed: BLOCK_IO_DELAY with action "report", BLOCK_IO_DONE. 3. delay-report-ns is passed, and then delay-stop-ns, too: BLOCK_IO_DELAY with action "report", BLOCK_IO_DELAY with action "stop", BLOCK_IO_DONE. 4. Two BLOCK_IO_DELAY events in the other order is not supposed to happen. > The second, just reporting delays (which is the use case requested), we d= on=E2=80=99t need correlation. But if we want to allow a list of what delay= ed requests are actually in flight, including their start time (can be deri= ved from the DELAY event time minus the reported duration), then that would= require an ID so between two requests that look the same (e.g. two flushes= ), you can still scratch off the right one. But, first of all, if someone e= ver does need that, we could add this ID then in a compatible manner, and, = second, we probably just should not require clients to keep this state, bec= ause: > > I am not sure whether such =E2=80=9Cstateful=E2=80=9D events are even a g= ood idea, on their own, or whether we need a query command that can list al= l delayed and not-yet-done requests. For example, when you reconnect a clie= nt, the counting up of events laid out above will not work, as it is unclea= r how many in-flight requests there are that hit `action=3Dstop` DELAY. And= this could also supersede the ID requirement for =E2=80=9Csee what delayed= requests are in flight=E2=80=9D, and also give an alternative to counting = up the DELAY vs. DONE events to consider resuming. Management applications can miss events, say because the QMP connection temporarily drops. They commonly want a way to recover from missing events. That's why events commonly come with a matching query command. > (Small problem: If a request finishes simultaneously to querying, it coul= d be missing from the list, but the DONE event only comes later. That would= lead to undercounting for the =E2=80=9Ccount DELAY - DONE=E2=80=9D strateg= y. So that strategy really can only be used for counting up *events*, not t= he result from that list.) > > So I would lean towards (for now): > 1. Adding `action` field to DONE (and document that counting up `action= =3Dstop` DELAY vs. DONE *events* may be used to ensure there are no more re= quests in flight that have been delayed to the `action=3Dstop` point), > 2. Requiring `delay-stop-ns > delay-report-ns` (If both are given. Either= would remain optional.), > 3. Probably also makes sense to document that DELAY and DONE are not rate= -limited, to ensure they will not be, > 4. Adding a query command to list all in-flight requests that reported de= lay. Feels reasonable. I think we want some guidance for management applications on how to use this feature. Not necessarily in QAPI schema doc comments. [...]