From nobody Mon Nov 23 04:44:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1792434137; cv=none; d=zohomail.com; s=zohoarc; b=Ch7zdsyEh6ut+RE8/t9PL8fXA+BnXAzpwDeWm0IWDbcseQdi6wCQuui6IGARVatbEcwDJpQQJFMgbOlxKtG2n9scZjdoxpGcPWjpgUmrmTyTiovA3OOLLIUcv/qleilQ20LcXqxlCuhphhZQyTxA+c8SmwW/pOp/VeRvfcCXtm4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792434137; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=tG2xuGtICVidqLJNjh8cG+5m/y22VnsOleBvhosc2g0=; b=TXvcnthKSOGlKuOgSJgHtT8PVdt5zo5IWV8AoRgE+nEFstCZ4LT0nmdUB3HNgW6H9OHO7aMsJQ9hvFFBAcDFqP859OIg0kotES7sHZzwFJ3o7Nvkahro3/ZK6wpPkP6e1hlc6FUo2xJcNHpV2zXCpuisDsYZbeqwQw0DiFz2UDc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792434137901744.7163069256437; Mon, 19 Oct 2026 11:22:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xIryd-0006Oc-8T; Mon, 19 Oct 2026 14:20:51 -0400 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 1xIryY-0006MX-5C for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:20:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xIryW-0005nG-1o for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:20:45 -0400 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-210-OH6KYIxdNK21vvc6mHf4JQ-1; Mon, 19 Oct 2026 18:20:40 +0000 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4a01b112fa2so27867905e9.1 for ; Mon, 19 Oct 2026 11:20:40 -0700 (PDT) Received: from localhost (p200300cfd705ccf50633a9a8543b8b67.dip0.t-ipconnect.de. [2003:cf:d705:ccf5:633:a9a8:543b:8b67]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e1d823ca7sm441048f8f.38.2026.10.19.11.20.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Oct 2026 11:20:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1792434042; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tG2xuGtICVidqLJNjh8cG+5m/y22VnsOleBvhosc2g0=; b=YUCj1SwFT5k244PDJAWBKf6OnArIUcp9soAHgZXftwGFzQDbT6SPkGaJbG84ZGner/g++C LDpoHqPWhUokYCdwjaSTv3gMUg5lol2xF/rUknEtJTGXe434xSTZwlAx6wWykzN7F7sVCF ucr00pQFzcfX94AlY+I1FO8uHkaWheE= X-MC-Unique: OH6KYIxdNK21vvc6mHf4JQ-1 X-Mimecast-MFC-AGG-ID: OH6KYIxdNK21vvc6mHf4JQ_1792434040 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1792434039; x=1793038839; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=tG2xuGtICVidqLJNjh8cG+5m/y22VnsOleBvhosc2g0=; b=kBFeF/R7U2xIVLSHU2A9f8KJpivBs5PmhiaKnyBK50rwi88hJZ3unGCG3Z+sI8DcAT 6ujMBF+WcUYQBfjsirIYlmTERqugfWiaY2CTHjWpxs+yCCt80y+GRdvNU0jIgp5VhDo7 DLrXG50dlN5rvMhCIVAZGMWBf/RwhDyNPxl6MoEyzcw41mg8U2bte526n8T1C08i3S+1 dGQ/qUyUr/HR9v/Mw4qHgwK8xWYQVnUC2G+rOr+WKKNOxuGI5MCsxzd2WWvcKEDuAyxc jY5W/b00AGWK4OUYkf9l1K+F4xSt4hoSfnGkO1YTgaBIK+VE8p7t7xuni1U/bzsHJqlC HUYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792434039; x=1793038839; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=tG2xuGtICVidqLJNjh8cG+5m/y22VnsOleBvhosc2g0=; b=aHyOMCib1aou8AEaxE+J/ALkoBCDtogZjO93AONLN0IWrHaWgILYF+9YNhn2nffE6o nhkrKUDEjo0wnE9BpWlv+UHBWInjRNKcBOZ+F3G6P4jtg0xcERYa6yEQk4u/CNIFsGLV ASdX8HyiKsRzqwSUa+r/UMidXLflzrWm7T7SJr7h1wRCvdo5NaGBXI7DAqMyoC1PeS/p uouETT70tYlCfXpF666Wv5i5/uSS12wP3zYxOTCcX07v5RufhrBhvwe2YXnGkerngFg8 FPtYY7M90mU1mR4PInMDetCjGydN8wERU6iy5hCg4nAbYDJoZcxQa206H5On23IafC2z Jlpw== X-Gm-Message-State: AFq9FYJP9xQw6g/OhtS0xzWI9oOqfE80wx3e4w9/rc+eHCb1Rz5FAjSh +T1nbC1/FSYkz1mSQTJFhTia+3EJBrf+q6lpFRFf6FNfnzuJEHE/tSYBluX69LoaWyzflQk9N/A nZv/HC0+TXXO/PIWBhFGwTzbt8q79fetZU+HrDDCXLyVnQnrOpjyAEs02 X-Gm-Gg: AYBFou1mYcqaaPhvqzrfZE0D/F+lK8VXWWCy++ePlR2IYagOOMSPWsJxZmyNAZ9Qp0N 7tzcqm//NTgAkrzkMfUSji3D8BtGGG6v3bq0192fBTW1e1luRoq9D2sIS8tp6oavv8LU4FskBUg FNbI9Gzh7O7YHOa2d7EBy31S1vKKvPYoe4jZuZoP7ZZrNtW/nAxv/GF3nhxESOMdTvgiYLSYMS+ L1Swsb70x2Nnl3l5nAoloqeJxYlyMppjpZIUe/TqtVJ6HqWG/1mzndmzwb4NoXQlLVcCaxF1ZLH vQ4OUC8TIilrp+MnRmqVn4mcgpgfOJD+xrNn+cs5mGNseD4urZeJJjG27jp2b7o3N9Tu8fH7grZ o16OXRdVmYCt8jUL6saavXXwtA34vhefoDduamW0P7dVtFhBMF6aMjZlSPw== X-Received: by 2002:a05:600c:674f:b0:4a1:8efb:c9ae with SMTP id 5b1f17b1804b1-4a1d760d2fcmr165205535e9.23.1792434039573; Mon, 19 Oct 2026 11:20:39 -0700 (PDT) X-Received: by 2002:a05:600c:674f:b0:4a1:8efb:c9ae with SMTP id 5b1f17b1804b1-4a1d760d2fcmr165205115e9.23.1792434039180; Mon, 19 Oct 2026 11:20:39 -0700 (PDT) From: Hanna Czenczek To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Hanna Czenczek , Kevin Wolf , John Snow , "Denis V . Lunev" , Eric Blake , Markus Armbruster , Stefan Hajnoczi , Paolo Bonzini Subject: [PATCH v2 01/12] qapi/common: Clarify what IoOperationType is for Date: Mon, 19 Oct 2026 20:20:17 +0200 Message-ID: <20261019182028.45305-2-hreitz@redhat.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261019182028.45305-1-hreitz@redhat.com> References: <20261019182028.45305-1-hreitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.329, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1792434139797158500 Content-Type: text/plain; charset="utf-8" The documentation for this type is a bit sparse right now, and specifically does not explain why it is limited to read/write only; "I/O operation type" could well imply this should distinguish a much broader range of operations like flushes, discards, etc., but it does not. Make a note why that is, which is that these types reflect the block device on-error policy settings that we have, which are rerror for read and werror for write. Signed-off-by: Hanna Czenczek --- qapi/common.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qapi/common.json b/qapi/common.json index 1352e664b23..880eb87a9cb 100644 --- a/qapi/common.json +++ b/qapi/common.json @@ -9,7 +9,10 @@ =20 ## # @IoOperationType: -# An enumeration of the I/O operation types +# An enumeration of the I/O operation types, limited to the block +# device on-error policy settings we have (rerror and werror). +# For reference, the corresponding error policy values are set in +# `BlockdevOnError`. # # @read: read operation # --=20 2.55.0 From nobody Mon Nov 23 04:44:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1792434109; cv=none; d=zohomail.com; s=zohoarc; b=J4K3EqMEfZaOMcl6lh6VUM/8Z91wRHFzlyZvqDNawXwQyG0HEX/a/5SvykGOp79nDddUy40X0geK90yyktYQutNRZ8C9CkqTPjNleSUQU16uh1x25Z08JDkXGwh0jm8IZsW7z9d2Kxu8Qu21NNXoPCcIrmBXMkMJUQqXpWomF78= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792434109; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qXcmPxWEX8mMB5MQUG/SCYqTbCTvCSbkZB7dxIrPjTk=; b=hlcZsHrOBLjHMffPQQukPL17e5kzkfqTMMr2e/hXn4Koa+WqeZ+Pq5EmpGoZHXIa7Rdp6noWKsZOzvsSRsi17yyCdJX7ZlUo/31ul2Hv8obfhnt6FPVRTnVdiC1JuC5WyZI4tkBMzTDObDemXVuVvS7+PyUo0B8i6FC9/oAjXGM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792434108981971.1529894797123; Mon, 19 Oct 2026 11:21:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xIryb-0006Nl-NM; Mon, 19 Oct 2026 14:20:49 -0400 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 1xIryZ-0006N0-EN for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:20:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xIryW-0005nM-T0 for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:20:47 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-137-ebTl4x3JN12U7MG6LmchWg-1; Mon, 19 Oct 2026 18:20:42 +0000 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-486f9d150c3so1325318f8f.3 for ; Mon, 19 Oct 2026 11:20:42 -0700 (PDT) Received: from localhost (p200300cfd705ccf50633a9a8543b8b67.dip0.t-ipconnect.de. [2003:cf:d705:ccf5:633:a9a8:543b:8b67]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e1d8214b5sm510834f8f.41.2026.10.19.11.20.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Oct 2026 11:20:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1792434044; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qXcmPxWEX8mMB5MQUG/SCYqTbCTvCSbkZB7dxIrPjTk=; b=AWhhCiqfMzI2gHrfv2349Px6k1twCs8ARk8xiPd6DZla5rje0uczZcZHESEWpGRZXVmime HVkH5YwVPN2ruTEU9L5jYQE68hF2nec723Lj1pNo3I9aNSvV4JysTnfVat6tzVqvMmjKli O+FP4fwqi63va9Vy/w1aNu61D29gyqI= X-MC-Unique: ebTl4x3JN12U7MG6LmchWg-1 X-Mimecast-MFC-AGG-ID: ebTl4x3JN12U7MG6LmchWg_1792434042 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1792434041; x=1793038841; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=qXcmPxWEX8mMB5MQUG/SCYqTbCTvCSbkZB7dxIrPjTk=; b=eq33l1IXgmzpfB8hdmG6dP+u9mqjG3BSdb4xteB+hXwVNSr9GfdXYg6E2fGGVsqZGQ 5Em+Ib9kIiH9dTXxUmItdiyKRpgcp4Q8ZmIrobAR7wA2NVcq7X6ZQ6WHjrq38VJcOx+9 7zUB9gYpFgvfVSJKeMuaffBoeEQNcPZ62VrjusjaU5jgZBe0DxMudj7Q5EKpV4ghK5f3 o0kwp3Gh8x+DGFMB38UkmBHWpMu5oPHTVV6V0W3sjy6geDJ0pE9g9F42oSXGcATQoD3Y qqJhzgc+dxcdR3ytf4weKoOHi1JUVS+Juc+iQ1FJzE4pwr4W5oW3CkO6ccrwR8CbY7Pz QfXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792434041; x=1793038841; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=qXcmPxWEX8mMB5MQUG/SCYqTbCTvCSbkZB7dxIrPjTk=; b=pJwhPgCPfRrAfqz+1jHDAPiBdmQ+NIqK3xZvJNz0+YGgudcCS/M/3w90rwOBBHzlNo TnQaFMxCp/ityVJM7ZpiGVWZRJTqrWYbDlhxoeuErpZWi2TkJlLkQenahtrnkIPPAlTQ SW/5vRhU4DbzJXgIZTO3fCL7C9fIfZuINic+oAFOzsXtSwr0chttIbGfpbHGwEwT7Gxl 6W917GMYwZkQLBMEIN2RfZmicOU5crHmnBqYvaFOXgXq6vl00SXbTDxZFkbI5k2s7C6o dDToe/C6fH2dywZiv2vfsjntNYMlIXRR+Pphj0bBuE2wC7K7ej+7U85qy0klPHehuXn1 g9dw== X-Gm-Message-State: AFq9FYKO5zdCx4/6qjr0jbkCBmctb9n+EONmZHSl/8j1rn3o1EZ/cu34 km+EWo0bsrOmrf45+aA/HJ7EMg3+fk74fcIQ1+W5isp8L6E7AZAipUjvfkivP6g6yXEx3hic/pa 8bzjmU3OGdKQm+RAOMdCnG40HoKoZXQaSYQRHdsQMU2VPSHeMru7XDeHE X-Gm-Gg: AYBFou0Z32xXHesh8xgdnVlm8RSgQz2EHMl9e4NrskBZ141jn+6Vl1wpVDrZvy1mrZf lh1s7OzWqGUcAccOg0FHT2vXD1ebyzZ+LPAuwqWef4PaQ6RgHjkg4su1rPvDyneDidG5v84gesx 3tdzkXmlprJnqrsOT+u+r58cvxGBQVNNFjXxJyw44xmqBsdZlh/4GRIQ32z5iudmvHLV3rxKmuN 74Hj9xVHUL7L9V38G8z5z7Ne4Ky44P/k42c852R9TJHKeGtkzqiCTa+BsNTMO5FEFAri6ZqRmEc 76sk761V56ENldeAOUEbqvI5OarKfFqpLjBSFdkvyhePC9zwHnAXF68K1GsChNm4Wapqo+FLzyW dFxOXpWgjZUOxsIgr+36D2i7XWhKw+XMV7QDOdLL3J86EfwoBlwaYTLX3Ww== X-Received: by 2002:a5d:5f90:0:b0:48e:bf0:30f with SMTP id ffacd0b85a97d-48e0bf00722mr13089902f8f.34.1792434041523; Mon, 19 Oct 2026 11:20:41 -0700 (PDT) X-Received: by 2002:a5d:5f90:0:b0:48e:bf0:30f with SMTP id ffacd0b85a97d-48e0bf00722mr13089862f8f.34.1792434040982; Mon, 19 Oct 2026 11:20:40 -0700 (PDT) From: Hanna Czenczek To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Hanna Czenczek , Kevin Wolf , John Snow , "Denis V . Lunev" , Eric Blake , Markus Armbruster , Stefan Hajnoczi , Paolo Bonzini Subject: [PATCH v2 02/12] qapi/block: Add IoAccountingOperation enum Date: Mon, 19 Oct 2026 20:20:18 +0200 Message-ID: <20261019182028.45305-3-hreitz@redhat.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261019182028.45305-1-hreitz@redhat.com> References: <20261019182028.45305-1-hreitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.329, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-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-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1792434111245158500 Content-Type: text/plain; charset="utf-8" This enum gives more information than IoOperationType (which is used for the rerror/werror distinction) to identify operation types for block accounting. Signed-off-by: Hanna Czenczek --- qapi/block.json | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/qapi/block.json b/qapi/block.json index 0a88d405a26..8f4a71733c1 100644 --- a/qapi/block.json +++ b/qapi/block.json @@ -629,3 +629,23 @@ 'command': 'str' }, 'features': [ 'unstable' ], 'allow-preconfig': true } + +## +# @IoAccountingOperation: +# +# I/O operation types as they are tracked by block accounting. +# +# @read: Reading data +# +# @write: Writing data +# +# @flush: Flushing data to disk +# +# @zone-append: Appending data to a zone of a zoned block device +# +# @unmap: Discarding a block of data +# +# Since: 11.2 +## +{ 'enum': 'IoAccountingOperation', + 'data': [ 'read', 'write', 'flush', 'zone-append', 'unmap' ] } --=20 2.55.0 From nobody Mon Nov 23 04:44:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1792434146; cv=none; d=zohomail.com; s=zohoarc; b=OF0k2nF1H+4CbwgVmY/UEsPWRGQOGeCDOwVX63tZXiHPmTy2G2LUz5NRfvX4uUYa0npks6wnkheilDN0ioF7mdSpx2fe1J8Y03zmFH7clxBOxu43M5ef39duxAkqwJIxpzOhuT5MVY+pRISqyOgPC5pilPjO+/ea3btjx5hemSU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792434146; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=wVRkZNNXfd4DS0qt4PPu5Y8nfyMWE++35Qhr2DdHC/s=; b=EECXdWCSYwmFrKB4P8SIzWjXAW6HWR8fMh35ojUY9NAQRiNIluv2zUkj3sWtfWQX0MW1ih6aKTYlEJUiH6derScVWoYWeRsO2HZ4D7lVBVCaTqCVb0/Md9f8U4gqfe6m0HakIJ+L7ed4ar2Yfji2Po5BlrnSP4f5Vyk/n1SLIAA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792434146224911.3085866788131; Mon, 19 Oct 2026 11:22:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xIryd-0006P6-UP; Mon, 19 Oct 2026 14:20:51 -0400 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 1xIrya-0006NR-F8 for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:20:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xIryY-0005nt-Sa for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:20:48 -0400 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-399-LSDJiSL6M2y6W2sTFpNn7w-1; Mon, 19 Oct 2026 18:20:44 +0000 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-48e1291432aso1112215f8f.2 for ; Mon, 19 Oct 2026 11:20:44 -0700 (PDT) Received: from localhost (p200300cfd705ccf50633a9a8543b8b67.dip0.t-ipconnect.de. [2003:cf:d705:ccf5:633:a9a8:543b:8b67]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e1d6dbbb0sm556694f8f.5.2026.10.19.11.20.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Oct 2026 11:20:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1792434046; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wVRkZNNXfd4DS0qt4PPu5Y8nfyMWE++35Qhr2DdHC/s=; b=ecQDF2l/SDJghKbPLHR3EAUJ/2F4jbqkcu9wfmt3/H2KV6OdoOy6EeWH/0X2UBID4opXcj t3jbdTKAIcXFzvgXXCKfEL8/+qf388/ZP324pDGTdLYrLxkWR6ixOMQHqE3gNdU2vymVMv YVkCh/lODWb81oUENfoNdM4xKXEsjaQ= X-MC-Unique: LSDJiSL6M2y6W2sTFpNn7w-1 X-Mimecast-MFC-AGG-ID: LSDJiSL6M2y6W2sTFpNn7w_1792434043 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1792434043; x=1793038843; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=wVRkZNNXfd4DS0qt4PPu5Y8nfyMWE++35Qhr2DdHC/s=; b=cQdLGzLkaGAOKOk5G53v3DEGSv8Q2vHAXdbwh/8W/5m+ZFkAnlxS6QvZX5HV48TXXx aTqLINgbIzZDbqf/WtQ/8CDcZHWdl2QChbn5b9dZjnN4HmtPLiLKj1hxWX2TpPkYdjb5 djh0IG7HR4v4fMAUjEMrnQMbu2gPhlM/M+RhCQdir7Nna/G2GdTb1yKjiemKQgBWv+SA 81ErHUI8RA83/cd7Y5zgpPohXUEbk0eo5u159TSxynzaG1gNmfLX5vuE81CRMgxbX1Ue TUJ1DBfqC3FDiLlxswTGBG1luxoeZQq7zhLbJEffuXPX7BR761we+NG/SqnFRKuUiA0T jskw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792434043; x=1793038843; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=wVRkZNNXfd4DS0qt4PPu5Y8nfyMWE++35Qhr2DdHC/s=; b=Qx9LxokBLlwwv47lbv+agSUGy5nOVUFYgFNAt60JF3vGuvr0OcngnVH2jyLkSplKdL YttLS5isi1NHY8R6HwMbxtIufZQWvGTHBkLpOo5FVFZgjvQ7jnrRJis3GqXdcPHCjAtN uWT7auvwPqeFqepxhRIsmO2Bw8QAAzmVmk+B6MPZJG9o6kqoHurEE6V0ZsmgbCRMzLm2 SsASGtTQIGkvf5YJq156s6LC4PZ3vimqZIDJKObiUeLo9xqtHeU7RotcrsPk4PuEsJXt PoOAFW2tauM/ANUaIYK7eaDqIsNPZ09V3M5WG0Xjqeo1ibBEmTnA+sQPdRfdzhuunJy+ M1ww== X-Gm-Message-State: AFq9FYJ09W1tD2vQrK6mE8p35ExEjvJjxQSJ3qZVOW8bnXov900KAyp+ tL6B+wLmWC2HwoTT3Om7Fgl/IHj7RMh4dZ2ec/EAjRn6QkO7q615iblJ1f37YsYl9UQHcsH7iFL YAX4FLNOU9cwsJ/c5up/RaGqszybepkk44UTM5rOdFhQvwNfTe3Zra5bf X-Gm-Gg: AYBFou1ohJ298EtYXCpPaNltpTx28z7eH6A5hukar3C5iQ6cdgQ7t7MCVaI5fS0YFxC BW3ViAPIEtaHAd0+z5wKRF7++qxecVBcZWaacV5ASFSZcc8qtxq4+lrcyX6nMypjDdZxIlDKM17 WaDfMwcTpRPVQ/4Un3Syd6BzaGnhmE9+nVM+CFT5iEx0EfCvsg3kWnoLB49qY2GR23dUp82IbgS tDAreJvB3cEPjvGDkajviR/JdNVtuUDsO3kLg9JSB0GSOeFQriWYS4b26Gcezvstwx3TeI4+LB1 YnbYM6uSvNajWB5WMfPXhizxq+02M7/zYCevm8PXr5PZZceKLXuRsyJsgY+CtfVrd1UcnV7wxKu ByhNroB20dTAzGkVJKnCu7b14jCZX8CS3IfTuMMe8UXV88U30OroDAHNyog== X-Received: by 2002:a05:6000:46dc:b0:48d:ee59:3a30 with SMTP id ffacd0b85a97d-48e07f9d2damr12187792f8f.22.1792434043380; Mon, 19 Oct 2026 11:20:43 -0700 (PDT) X-Received: by 2002:a05:6000:46dc:b0:48d:ee59:3a30 with SMTP id ffacd0b85a97d-48e07f9d2damr12187773f8f.22.1792434042988; Mon, 19 Oct 2026 11:20:42 -0700 (PDT) From: Hanna Czenczek To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Hanna Czenczek , Kevin Wolf , John Snow , "Denis V . Lunev" , Eric Blake , Markus Armbruster , Stefan Hajnoczi , Paolo Bonzini Subject: [PATCH v2 03/12] runstate: Allow IO_ERROR/SUSPENDED transitions Date: Mon, 19 Oct 2026 20:20:19 +0200 Message-ID: <20261019182028.45305-4-hreitz@redhat.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261019182028.45305-1-hreitz@redhat.com> References: <20261019182028.45305-1-hreitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.329, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UPPERCASE_50_75=0.008 autolearn=no 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-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1792434147816158500 Content-Type: text/plain; charset="utf-8" I/O errors can occur while the VM is suspended, and we can continue from a stop due to I/O error into suspension. Allow these transitions. Signed-off-by: Hanna Czenczek --- system/runstate.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/system/runstate.c b/system/runstate.c index 56bfc5b07da..7b3233f77f6 100644 --- a/system/runstate.c +++ b/system/runstate.c @@ -106,6 +106,7 @@ static const RunStateTransition runstate_transitions_de= f[] =3D { { RUN_STATE_IO_ERROR, RUN_STATE_RUNNING }, { RUN_STATE_IO_ERROR, RUN_STATE_FINISH_MIGRATE }, { RUN_STATE_IO_ERROR, RUN_STATE_PRELAUNCH }, + { RUN_STATE_IO_ERROR, RUN_STATE_SUSPENDED }, =20 { RUN_STATE_PAUSED, RUN_STATE_RUNNING }, { RUN_STATE_PAUSED, RUN_STATE_FINISH_MIGRATE }, @@ -173,6 +174,7 @@ static const RunStateTransition runstate_transitions_de= f[] =3D { { RUN_STATE_SUSPENDED, RUN_STATE_SAVE_VM }, { RUN_STATE_SUSPENDED, RUN_STATE_RESTORE_VM }, { RUN_STATE_SUSPENDED, RUN_STATE_SHUTDOWN }, + { RUN_STATE_SUSPENDED, RUN_STATE_IO_ERROR }, =20 { RUN_STATE_WATCHDOG, RUN_STATE_RUNNING }, { RUN_STATE_WATCHDOG, RUN_STATE_FINISH_MIGRATE }, --=20 2.55.0 From nobody Mon Nov 23 04:44:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1792434109; cv=none; d=zohomail.com; s=zohoarc; b=jCf183wP2P8+PfEY8K2K4PA6aKcXqQaID6I868G9MZO3gF7RYLbwLarx/FTHnzfoAzgqwC+t0XNaQk7g9tD3vIJZZNfmlaovEwDreGdbkGq/eATnm7coRIonJEANU718+9BmK+P7JEpZQ+c38BBKAcRMaDopEnzLYl5P0+510O0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792434109; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=eJf5WoW+KCYT2WZIsVh8AsXHBLLVzMmsYUbsdGFsmtM=; b=WjQRvZ4tMRXicfrVo3HaHb9maafYvIi1tv79mvqPuk6DHe9EZZV30K3keDEhng1ZfvmrpZOcQiCg7hAQId9OA+7SKqeSEnKMBBwkI8E5T2LO6gP7kkHhKA1XQ2FSvoC006uA/iZuw3PYuFH5AxDtFBPSM+kYnwOq4zRyzTaCyQU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792434109033501.81440963786554; Mon, 19 Oct 2026 11:21:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xIrz1-0006Xd-0n; Mon, 19 Oct 2026 14:21:18 -0400 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 1xIryc-0006OZ-Ig for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:20:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xIrya-0005oi-Jg for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:20:50 -0400 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-658-lX7hR5uiMLOlatHKp_TAvg-1; Mon, 19 Oct 2026 18:20:46 +0000 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4a17741243eso14101595e9.0 for ; Mon, 19 Oct 2026 11:20:46 -0700 (PDT) Received: from localhost (p200300cfd705ccf50633a9a8543b8b67.dip0.t-ipconnect.de. [2003:cf:d705:ccf5:633:a9a8:543b:8b67]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a1f2cb6d82sm9577475e9.5.2026.10.19.11.20.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Oct 2026 11:20:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1792434048; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eJf5WoW+KCYT2WZIsVh8AsXHBLLVzMmsYUbsdGFsmtM=; b=KImn+U0QQy/YhMBSGtGBq+sbI2IC3NJz4+Oq0dJJfNOdKc89b1LQUdm++6EI+7CgiFfdjZ 86776ADMC3dQRwEdzyY8XrsvlSFEWLMBTmIzdW+shU2Ebr44O/CNfs2aUbWDNHl1wrdZFV SKjFzlV7xCXxkoH8IOIQEcahbLzikE4= X-MC-Unique: lX7hR5uiMLOlatHKp_TAvg-1 X-Mimecast-MFC-AGG-ID: lX7hR5uiMLOlatHKp_TAvg_1792434045 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1792434045; x=1793038845; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=eJf5WoW+KCYT2WZIsVh8AsXHBLLVzMmsYUbsdGFsmtM=; b=H0n+HUjlnMOC/zBfYe9Xl4K6JTWvRCNIpKQXsDbUr2WYKMNsnPApcJyeH5NFXbeLa4 OxITojUDM5mxBD8hCo73qVYt/X3+FPKZ2H217hoXVVcTv9mSdNPxt8gRH8nGTsxe77c6 In4PHQqBM0BPHOA5bMnfpzme5jGkPghGjX1aCpDnIp7wTKwDS0HGAfP6O0cMzgzWHnaM iOeYRX8NkHZm4/9OpbpmCk+XQkPuaojR49SAS4imcuo6NLUNM7qRqQO3UNmrQ07m6Vff /RBHvbHAe1D03x+x/xaf1+PMuacyECnoCU1BfrG9PZJQtaLSUn79PzU5hl0ezdkACIK+ vDhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792434045; x=1793038845; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=eJf5WoW+KCYT2WZIsVh8AsXHBLLVzMmsYUbsdGFsmtM=; b=MBhr5BrSclyVxf23vACVPTUuU7ssDiULFK+s8p3IDyBQPnc22u975kAIannuI6JJVT PXMlk4mafYjUVIl99fEbdQOm0rzhWK/j/BpCxkiNCDq9d3cSKuGQDu+UvUcMLkaE7PNX AuGHODFlyceFqQzIvClqA2SB3OA71Z36mQg7lznGf3iEs1a4gD0AbxUgood2MavjnWMI WQ1+oCy3G92Fcn+4V52WR4QBtyzIkeegvsiBeRLT1tahN2HKsvqivxlX8ujneisJOY4l CNWtjADDbhK0nNhAhK6zBdU/Khj7jOs2bBVLVyJuEqYHMhvEo2Hl749sTJpJk3I9VXVS rnmA== X-Gm-Message-State: AFq9FYJ4WFe8Dp5AxgeWU96uSuvXruW0AtEGa/BbFLFbE7jzFUw84Xg/ uhcThqwzqcrzGrWMTI8DxkMAbhMxoptvTO2Hnr+ysYHKPVoaufsqd8PxJaI0VzxyzE7nxM/96iK 3uXzC6imKUUoFKnUCTK+cQlI7n5Pag3miCahZjPKEgxFLJX7P3VYucGTu X-Gm-Gg: AYBFou3QA95pPTx6V1cRe2/7n0LLrmKOK/B5aOfysNlLXG8bOXsJ3rYB4qlFcZFXnqF Oy17CneL0ipq9UdigJ7ruHeQ8a+GHh7+el1rtrUpoTQRmT53uikTzUV0hCKDhHqG3vh3LyhVpdL REPNzYXhuQ1TYaZCYeKhSVPir9LX05P7fmExo9jhCkAmPVasNKvhoh3ZHggxD7kQSECaQk6za1x qI78WsQgcKHn85jFA85WrI4fTVIX9mdCi9GMicQV5Qv/8rryGe905apzlwNEU0Pluka41xOZ/IZ n3hsG8loX1bBTsmxwu0E4JV+zAzga5T9ps5N731D2Py5UiD1FI/rRxGmdJ0d4fPYmot/FDGTziN 36SqhIBG1yu552IVYHTupeGhVYzBtKLOIVboM2BwdErka3oE46fJPIsZc X-Received: by 2002:a05:600c:3d8f:b0:4a1:e31f:e86b with SMTP id 5b1f17b1804b1-4a1e31ff798mr114111855e9.28.1792434045303; Mon, 19 Oct 2026 11:20:45 -0700 (PDT) X-Received: by 2002:a05:600c:3d8f:b0:4a1:e31f:e86b with SMTP id 5b1f17b1804b1-4a1e31ff798mr114111435e9.28.1792434044910; Mon, 19 Oct 2026 11:20:44 -0700 (PDT) From: Hanna Czenczek To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Hanna Czenczek , Kevin Wolf , John Snow , "Denis V . Lunev" , Eric Blake , Markus Armbruster , Stefan Hajnoczi , Paolo Bonzini Subject: [PATCH v2 04/12] iotests: PC-only test for I/O errors during suspend Date: Mon, 19 Oct 2026 20:20:20 +0200 Message-ID: <20261019182028.45305-5-hreitz@redhat.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261019182028.45305-1-hreitz@redhat.com> References: <20261019182028.45305-1-hreitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.329, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1792434111482158500 Content-Type: text/plain; charset="utf-8" Using IDE (PIO) and writing directly to the PIIX4 PM device, we can test what happens when an I/O error occurs while the VM is suspended. The moment we resume the request while the VM is suspended is the moment of the SUSPENDED -> IO_ERROR transition, and the moment we issue `cont` is the reverse IO_ERROR -> SUSPENDED transition. Signed-off-by: Hanna Czenczek --- .../tests/io-error-during-suspend | 155 ++++++++++++++++++ .../tests/io-error-during-suspend.out | 22 +++ 2 files changed, 177 insertions(+) create mode 100755 tests/qemu-iotests/tests/io-error-during-suspend create mode 100644 tests/qemu-iotests/tests/io-error-during-suspend.out diff --git a/tests/qemu-iotests/tests/io-error-during-suspend b/tests/qemu-= iotests/tests/io-error-during-suspend new file mode 100755 index 00000000000..5ef741d96b4 --- /dev/null +++ b/tests/qemu-iotests/tests/io-error-during-suspend @@ -0,0 +1,155 @@ +#!/usr/bin/env python3 +# group: rw +# +# Reproduce an I/O error while the guest is entering suspend +# +# Copyright (C) 2026 Red Hat, Inc. +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Creator/Owner: Hanna Czenczek + +import iotests +from iotests import filter_qmp_event, log + +iotests.script_initialize() + +# PC machine type required for PIIX4 and IDE +if iotests.qemu_default_machine !=3D 'pc': + iotests.notrun('Requires a PC machine') + +def vm_qemu_io(qvm, dev_id, cmd): + log(f'[HMP] qemu-io to {dev_id}: {cmd}') + command_line=3Df'qemu-io -d {dev_id} "{cmd}"' + log(qvm.qmp('human-monitor-command', command_line=3Dcommand_line)) + +def await_event(qvm, match): + evt =3D qvm.event_wait(match, timeout=3D30.0) + assert evt is not None + return evt + +def find_pci(qvm, vendor, device): + """ + Return bus, slot, function of the device matching vendor and device ID. + """ + + for bus in qvm.qmp('query-pci')['return']: + for dev in bus['devices']: + if dev['id']['vendor'] =3D=3D vendor and dev['id']['device'] = =3D=3D device: + return dev['bus'], dev['slot'], dev['function'] + + raise RuntimeError(f'PCI device {vendor:04x}:{device:04x} not found') + +def enter_s3(qvm): + """ + Enter suspend via the PIIX4 PM device + """ + + bus, slot, function =3D find_pci(qvm, 0x8086, 0x7113) + pci_pm_addr =3D 0x80000000 | (bus << 16) | (slot << 11) | (function <<= 8) + + # Config registers: + # - 0x40: Set the power management I/O range base + # - 0x80: Bit 0 enables that range + # I/O range: + # - +4: PM1a_CNT + # - Bits 10..=3D12: SLEEP_TYPE (1 for suspend, see `acpi_pm_cnt_writ= e()`) + # - Bit 13: SLEEP_ENABLE + + arbitrary_pm_io_base =3D 0xb000 + log('Setting up PIIX4 PM I/O range') + # Setting the base address + qvm.qtest(f'outl 0xcf8 {pci_pm_addr + 0x40:#x}') + qvm.qtest(f'outl 0xcfc {arbitrary_pm_io_base:#x}') + # Enabling the range + qvm.qtest(f'outl 0xcf8 {pci_pm_addr + 0x80:#x}') + qvm.qtest('outb 0xcfc 0x1') + + log('Going to sleep') + pm1a_cnt =3D arbitrary_pm_io_base + 4 + pm1a_value =3D (1 << 10) | (1 << 13) + qvm.qtest(f'outw {pm1a_cnt:#x} {pm1a_value:#x}') + +def ide_issue_pio_read(qvm, lba, sectors): + """ + Issue a read request from the master device. + Does not read the data through PIO, though. + """ + + for port, val in ( + (0x1f6, 0xe0 | ((lba >> 24) & 0xf)), # 0x40 selects LBA + (0x1f2, sectors), + (0x1f3, lba & 0xff), + (0x1f4, (lba >> 8) & 0xff), + (0x1f5, (lba >> 16) & 0xff), + (0x1f7, 0x20), # WIN_READ + ): + qvm.qtest(f'outb {port:#x} {val:#x}') + +with iotests.VM() as vm: + # So we have PIIX4 + vm.add_args('-machine', 'pc') + + failing_sector =3D 42 + vm.add_blockdev(vm.qmp_to_opts({ + 'driver': 'raw', + 'node-name': 'test', + 'file': { + 'driver': 'blkdebug', + 'inject-error': [{'event': 'read_aio', 'iotype': 'read', + 'sector': str(failing_sector), 'once': 'on'}= ], + 'image': { + 'driver': 'null-co', + }, + }, + })) + + disk =3D 'ide-disk' + vm.add_device(f'ide-hd,id=3D{disk},drive=3Dtest,bus=3Dide.0,unit=3D0,' + 'rerror=3Dstop,werror=3Dstop') + + vm.launch() + + try: + # Issue a read request from a guest device (to the failing sector)= , and + # have it pause before it returns + vm_qemu_io(vm, disk, 'break read_aio r0') + log('Issuing read') + ide_issue_pio_read(vm, failing_sector, 1) + vm_qemu_io(vm, disk, 'wait_break r0') + + # Read request is paused now, let's suspend the VM + log('Entering suspend') + enter_s3(vm) + log(await_event(vm, 'SUSPEND'), filters=3D[filter_qmp_event]) + + # Should be suspended now + log('[QMP] query-status') + log(vm.qmp('query-status')) + except Exception: + # The VM will not be able to quit without this request finished, w= hich + # (without this block) would make the test hang instead of exit if + # something unexpected goes wrong + vm_qemu_io(vm, disk, 'resume r0') + raise + + # Resume the request, which should run into an error thanks to our blk= debug + # configuration + vm_qemu_io(vm, disk, 'resume r0') + log(await_event(vm, 'BLOCK_IO_ERROR'), filters=3D[filter_qmp_event]) + log(await_event(vm, 'STOP'), filters=3D[filter_qmp_event]) + + # Should be stopped now (not just suspended) + log('[QMP] query-status') + log(vm.qmp('query-status')) + + log('[QMP] cont') + log(vm.qmp('cont')) + + log(await_event(vm, 'RESUME'), filters=3D[filter_qmp_event]) + + # Should be suspended again (error was injected 'once', so should be g= one) + log('[QMP] query-status') + log(vm.qmp('query-status')) + + vm.shutdown() diff --git a/tests/qemu-iotests/tests/io-error-during-suspend.out b/tests/q= emu-iotests/tests/io-error-during-suspend.out new file mode 100644 index 00000000000..353f18250ad --- /dev/null +++ b/tests/qemu-iotests/tests/io-error-during-suspend.out @@ -0,0 +1,22 @@ +[HMP] qemu-io to ide-disk: break read_aio r0 +{"return": ""} +Issuing read +[HMP] qemu-io to ide-disk: wait_break r0 +{"return": ""} +Entering suspend +Setting up PIIX4 PM I/O range +Going to sleep +{"event": "SUSPEND", "timestamp": {"microseconds": "USECS", "seconds": "SE= CS"}} +[QMP] query-status +{"return": {"running": false, "status": "suspended"}} +[HMP] qemu-io to ide-disk: resume r0 +{"return": ""} +{"data": {"action": "stop", "device": "", "node-name": "test", "nospace": = false, "operation": "read", "qom-path": "/machine/peripheral/ide-disk", "re= ason": "Input/output error"}, "event": "BLOCK_IO_ERROR", "timestamp": {"mic= roseconds": "USECS", "seconds": "SECS"}} +{"event": "STOP", "timestamp": {"microseconds": "USECS", "seconds": "SECS"= }} +[QMP] query-status +{"return": {"running": false, "status": "io-error"}} +[QMP] cont +{"return": {}} +{"event": "RESUME", "timestamp": {"microseconds": "USECS", "seconds": "SEC= S"}} +[QMP] query-status +{"return": {"running": false, "status": "suspended"}} --=20 2.55.0 From nobody Mon Nov 23 04:44:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1792434132; cv=none; d=zohomail.com; s=zohoarc; b=UpUICxlAd+/MekMhhnW6A1V0livT8Sg5CUQ2G6XYKlzkf0+DW3Zm3WoNpVxLVjM0OYzqVG6ii8ib3FhU0CxLNx8myTPskkqnjG4Ta7xd9a0yFXXasFMLKg1ytGEoihle6jhN8o3fA4fR4Xk3M6RgHAEBqyY9+wBkMacs8jiaZQ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792434132; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=EmurfuTPfJ0EHYQXXF9xVLYCuMVwZUNsvrJgFo3xhfs=; b=QgOuhZyTzWngaCyio0o6uswQdOLKDr30Xe2KwqMyaR7rUCvgqE2uRU7juxgKiHV0qhqJTABdjO8pgk7Y7CLfdIOXbL0r9/Y2zPbWcL+MRcpH+RlfucKcXTEyD/vx6PPUMe9ppozIbvpbJX0hny+ElVA19F5B+AUHP7XwJFfKwdk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792434132584371.1521930079915; Mon, 19 Oct 2026 11:22:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xIryv-0006VI-AS; Mon, 19 Oct 2026 14:21:11 -0400 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 1xIrye-0006PJ-M5 for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:20:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xIryd-0005p7-0d for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:20:52 -0400 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-369-YYFehmVKOkS0yaQFQg1zsg-1; Mon, 19 Oct 2026 18:20:48 +0000 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4a01d1fb07bso27374365e9.2 for ; Mon, 19 Oct 2026 11:20:48 -0700 (PDT) Received: from localhost (p200300cfd705ccf50633a9a8543b8b67.dip0.t-ipconnect.de. [2003:cf:d705:ccf5:633:a9a8:543b:8b67]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e1d6db78csm594439f8f.2.2026.10.19.11.20.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Oct 2026 11:20:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1792434050; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EmurfuTPfJ0EHYQXXF9xVLYCuMVwZUNsvrJgFo3xhfs=; b=COMGbBBA0cYPOVMyquOd792Ek6bCejncjxhydBj+2/gGwwW7XzauiznGUUFlK08cVA0OvD nHP0e+C54da1q33XFRMqy9GFd0S+RZOEW80MNaK0sKOXxUkrt2GQJCKV0uo7KwfDKPc4lr L6ObgcJ3IdOctBpVTkJqribVcivTGes= X-MC-Unique: YYFehmVKOkS0yaQFQg1zsg-1 X-Mimecast-MFC-AGG-ID: YYFehmVKOkS0yaQFQg1zsg_1792434048 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1792434048; x=1793038848; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=EmurfuTPfJ0EHYQXXF9xVLYCuMVwZUNsvrJgFo3xhfs=; b=fg8CwWNRRLDYxVieHIYhtTmbFQjaHCicD7B06OCnDFmpsnOEzbCD2x3I6Av8RcM8FF VL/f9dOA4V66WP3BaGMlEAJfx1tgrdgjxsPXOGXRj0bAqIFl+GTCRZlcTVr1P3L/xrXu Ld1lEJVcQnxk0sRFJYXJCgmtDEesehsvt+XhiHeaUb+MwERS7moFp0XR2RcByW6Wl4Z6 wdMetew49lUgDHdiz2899F3BI08ds35Jabc3NUwi7GgIw+cgz90u3UuFi22iHNoSueUp 66CDwuSnUbnTScU8bM8/5oRSzmIU1aEY4LlzEBNlpaymcxBZDUPwbDaoIT8v+71KOLcL yrdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792434048; x=1793038848; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=EmurfuTPfJ0EHYQXXF9xVLYCuMVwZUNsvrJgFo3xhfs=; b=SRJjINNsbbdCdoxfbjJRfK2nAwO4jWpUm2Vc3IWcQsEVC4Uoy1NPjfuYMzHgOQ6DTr nznlu0+k53FePlVt0NEjDuh+e+43q9ys2XL1+3qEuv1FAYB0JR/SlqjTU10DC/F0dxdA sRr3wXEQb3JekvZTrZ/+zD2V0EKexyCLeEzlOhHyGhKPEV+iukm23t+IMODm9aiWVDB6 IZ/lUf2IJUQplyKkk+lPL3zTDRZxcbqcrS4iU+rjCRfecHmcdQx1fz0pDajuTZxtrhGD /d6X6h5mdWjP7p1NPZp4/mwVu0GWZL8ZnScqDT/c1JuPMLcC0F7ji1+8Ep42AZMrlISL w0CA== X-Gm-Message-State: AFq9FYIqtILBRdoSLEEvVmrbMqmHHcRV+7bztPDEi/JXR4My/tTzvKtj cy8LJO/k1IRsvkpwmfsNaMaSrY/m6SRtxUMZydQbEjyCXB9BWA+HmlTefwoiFwQJvor+y1h2DT5 GV0SmVUKI1DBPILNgBHi6tB1TNLWtY2N4jwt0s+uhFwqLl3aADp9zCQ2l X-Gm-Gg: AYBFou19c064gIJ+Ek9ml4cgx9iWuGujUxJnabxktjwn59sFlpziURCHM0ic+AQsE5r b1dm5XS9LbXr//yFsat/zPkUubohobiVqcqRbNRZj8pMOe6DSYvZS/69CwfmZZIAXLCTU930zGL rur4DU4LMoRJlnpHYtVnj3QCPpYf+Qpz1qwnF+uxGaOSDjpPBrMOxU4D+dGzN+NSzn+wm1uTvPK jbX3qgV7juFmCw8IabdJLxtsKrqucQgAE3jYQFSFtRDoejjPmFFE0XXSNKMdmETw3OCGTUozZ00 KfhzPjnl91dHpg4JPDo3RqB+3nW+IsM4FTno/DOXh1uSv6EGK54BIBzmtRMDLaD0NCTvtHE+Y8Y ySt/NBt3KOx1eqGOYvKgOT1st5hCurU+Cys/Y2IJMWGn658EdPhS8A52k X-Received: by 2002:a05:600c:4503:b0:4a0:a34:6e7d with SMTP id 5b1f17b1804b1-4a1d7614e56mr196570475e9.18.1792434047367; Mon, 19 Oct 2026 11:20:47 -0700 (PDT) X-Received: by 2002:a05:600c:4503:b0:4a0:a34:6e7d with SMTP id 5b1f17b1804b1-4a1d7614e56mr196569955e9.18.1792434046893; Mon, 19 Oct 2026 11:20:46 -0700 (PDT) From: Hanna Czenczek To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Hanna Czenczek , Kevin Wolf , John Snow , "Denis V . Lunev" , Eric Blake , Markus Armbruster , Stefan Hajnoczi , Paolo Bonzini Subject: [PATCH v2 05/12] qapi/run-state: Add io-hang state Date: Mon, 19 Oct 2026 20:20:21 +0200 Message-ID: <20261019182028.45305-6-hreitz@redhat.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261019182028.45305-1-hreitz@redhat.com> References: <20261019182028.45305-1-hreitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.329, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-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-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1792434135695158500 Content-Type: text/plain; charset="utf-8" This state is similar to io-error, but is not entered on I/O errors but instead when a request takes longer than a user-defined time (set via the delay-stop-ns property on a block device, which is not yet available but will be added by a future patch in this series). In contrast to other stop states, this state does not drain block devices. That is because it is entered only when a request hangs, which means that draining would be counter-productive. Signed-off-by: Hanna Czenczek Acked-by: Markus Armbruster --- qapi/run-state.json | 7 ++++++- system/runstate.c | 25 ++++++++++++++++++------- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/qapi/run-state.json b/qapi/run-state.json index 8bbd9884087..cf3f43579de 100644 --- a/qapi/run-state.json +++ b/qapi/run-state.json @@ -53,12 +53,17 @@ # @colo: guest is paused to save/restore VM state under colo # checkpoint, VM can not get into this state unless colo # capability is enabled for migration. (since 2.8) +# +# @io-hang: An I/O operation has been delayed for too long and the +# device is configured to stop the VM when that happens. In +# contrast to other paused states, the VM's block devices will not +# be drained when entering this run state. (since 11.2) ## { 'enum': 'RunState', 'data': [ 'debug', 'inmigrate', 'internal-error', 'io-error', 'paused', 'postmigrate', 'prelaunch', 'finish-migrate', 'restore-vm', 'running', 'save-vm', 'shutdown', 'suspended', 'watchdog', - 'guest-panicked', 'colo' ] } + 'guest-panicked', 'colo', 'io-hang' ] } =20 ## # @ShutdownCause: diff --git a/system/runstate.c b/system/runstate.c index 7b3233f77f6..c5b56308735 100644 --- a/system/runstate.c +++ b/system/runstate.c @@ -98,6 +98,7 @@ static const RunStateTransition runstate_transitions_def[= ] =3D { { RUN_STATE_INMIGRATE, RUN_STATE_PRELAUNCH }, { RUN_STATE_INMIGRATE, RUN_STATE_POSTMIGRATE }, { RUN_STATE_INMIGRATE, RUN_STATE_COLO }, + { RUN_STATE_INMIGRATE, RUN_STATE_IO_HANG }, =20 { RUN_STATE_INTERNAL_ERROR, RUN_STATE_PAUSED }, { RUN_STATE_INTERNAL_ERROR, RUN_STATE_FINISH_MIGRATE }, @@ -135,6 +136,7 @@ static const RunStateTransition runstate_transitions_de= f[] =3D { { RUN_STATE_FINISH_MIGRATE, RUN_STATE_SUSPENDED }, { RUN_STATE_FINISH_MIGRATE, RUN_STATE_WATCHDOG }, { RUN_STATE_FINISH_MIGRATE, RUN_STATE_GUEST_PANICKED }, + { RUN_STATE_FINISH_MIGRATE, RUN_STATE_IO_HANG }, =20 { RUN_STATE_RESTORE_VM, RUN_STATE_RUNNING }, { RUN_STATE_RESTORE_VM, RUN_STATE_PRELAUNCH }, @@ -155,6 +157,7 @@ static const RunStateTransition runstate_transitions_de= f[] =3D { { RUN_STATE_RUNNING, RUN_STATE_WATCHDOG }, { RUN_STATE_RUNNING, RUN_STATE_GUEST_PANICKED }, { RUN_STATE_RUNNING, RUN_STATE_COLO}, + { RUN_STATE_RUNNING, RUN_STATE_IO_HANG }, =20 { RUN_STATE_SAVE_VM, RUN_STATE_RUNNING }, { RUN_STATE_SAVE_VM, RUN_STATE_SUSPENDED }, @@ -175,6 +178,7 @@ static const RunStateTransition runstate_transitions_de= f[] =3D { { RUN_STATE_SUSPENDED, RUN_STATE_RESTORE_VM }, { RUN_STATE_SUSPENDED, RUN_STATE_SHUTDOWN }, { RUN_STATE_SUSPENDED, RUN_STATE_IO_ERROR }, + { RUN_STATE_SUSPENDED, RUN_STATE_IO_HANG }, =20 { RUN_STATE_WATCHDOG, RUN_STATE_RUNNING }, { RUN_STATE_WATCHDOG, RUN_STATE_FINISH_MIGRATE }, @@ -185,6 +189,11 @@ static const RunStateTransition runstate_transitions_d= ef[] =3D { { RUN_STATE_GUEST_PANICKED, RUN_STATE_FINISH_MIGRATE }, { RUN_STATE_GUEST_PANICKED, RUN_STATE_PRELAUNCH }, =20 + { RUN_STATE_IO_HANG, RUN_STATE_RUNNING }, + { RUN_STATE_IO_HANG, RUN_STATE_FINISH_MIGRATE }, + { RUN_STATE_IO_HANG, RUN_STATE_PRELAUNCH }, + { RUN_STATE_IO_HANG, RUN_STATE_SUSPENDED }, + { RUN_STATE__MAX, RUN_STATE__MAX }, }; =20 @@ -445,13 +454,15 @@ static int do_vm_stop(RunState state, bool send_stop) } } =20 - bdrv_drain_all(); - /* - * Even if vm_state_notify() return failure, - * it would be better to flush as before. - */ - ret |=3D bdrv_flush_all(); - trace_vm_stop_flush_all(ret); + if (state !=3D RUN_STATE_IO_HANG) { + bdrv_drain_all(); + /* + * Even if vm_state_notify() return failure, + * it would be better to flush as before. + */ + ret |=3D bdrv_flush_all(); + trace_vm_stop_flush_all(ret); + } =20 return ret; } --=20 2.55.0 From nobody Mon Nov 23 04:44:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1792434166; cv=none; d=zohomail.com; s=zohoarc; b=VnNSsSk5X8nfbftzuFDII6lBFASBUcPtD5QMoZKHXYBSJOTZXUMhnLEtb59BgERfFcwLVSTELEmHhTZxSOQhQaEsFn1l5v+Zg+6qodsTYdR0RDLloH7kF0Q24Ut9lJR2KN8CjIoNZKCVcqICoN20goi47Ybd81mF13JAOBWfmTw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792434166; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=enixiR+tTsUCI6UXWKu3g61lIiahEj28V+vTeL2j0sU=; b=UovzZPOy17dNOAioPNuC/+R4IkMctZ29VpC9dkLZIP+KU02A2Lwe3rtzoapJ29tKcm5bCX8VLFrSu7VFnzSPPaGT9scuniZG28TfhF/8ua1ieSDv7J0S0Vci0hgtjOVL3a5nMEB8FByv2NWzYqm7EbjgwMBCKorVnXXnJXCUFyM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179243416616433.26950516214458; Mon, 19 Oct 2026 11:22:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xIryn-0006Tl-C5; Mon, 19 Oct 2026 14:21:01 -0400 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 1xIryh-0006Qd-15 for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:20:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xIryf-0005pe-EZ for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:20:54 -0400 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-547-N9Hs-31ZOR2tVE3b_aGdww-1; Mon, 19 Oct 2026 18:20:51 +0000 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4a1e6ae710bso9159455e9.0 for ; Mon, 19 Oct 2026 11:20:50 -0700 (PDT) Received: from localhost (p200300cfd705ccf50633a9a8543b8b67.dip0.t-ipconnect.de. [2003:cf:d705:ccf5:633:a9a8:543b:8b67]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e1d8185ddsm500557f8f.29.2026.10.19.11.20.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Oct 2026 11:20:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1792434052; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=enixiR+tTsUCI6UXWKu3g61lIiahEj28V+vTeL2j0sU=; b=g/cS5MbC/poGTEeFP5iPt/mJoXkf/XLg5CGUL5MTFVLAv+E/YA41wKpqma3+nv3tAgMBM9 8CXNkq1CfgbOlB7myb/KkI5UvSCji9IJCxRH70+hImXvS+DSDI7Nl9GXewamnvLnClkbDd t6vWFW1wAtxB3Cz6PTGWT9Ra2s6cfN0= X-MC-Unique: N9Hs-31ZOR2tVE3b_aGdww-1 X-Mimecast-MFC-AGG-ID: N9Hs-31ZOR2tVE3b_aGdww_1792434050 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1792434050; x=1793038850; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=enixiR+tTsUCI6UXWKu3g61lIiahEj28V+vTeL2j0sU=; b=JSryDfmh7d1wNKwKi6gGOQ0/8bO3nfEF9rcamxdhof7fXfKDDR+cJmFPuA+XRQaZwU XoHnlBdLXBgR+f25ANstrV73vgcTH+zd4Fw5En8C2Rt2nbhOamMOpfcqFL+hPkz2hzXr qqSTVSlmJB3RchYNzQ52BRXGNfyiKxYQydvAE6qBBAgeicm1jfRs2wR4gZSILlIOcMef x4cpm/oJGTqhpPHaU9a7tYJde8oSuLn0MkZ7LYfJ8+i652lEF1ynfkbgwqhzE5rqzMzo kAdY+pEhHK1mnLPZiNB23VjXrkHHUbSt/rSNyrL+6202OBfPvyIWgQhAD2xhC/77UNt6 28pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792434050; x=1793038850; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=enixiR+tTsUCI6UXWKu3g61lIiahEj28V+vTeL2j0sU=; b=vdEZLWP3ot7PIkzWKbT6Ga3HPVBn5+D4TfrlaiCophQo8Y+6eHRs0LjINYNtfn+UqO 9e9d1p9+C2TUMkjVbvQIOrn/aaWeOt4F5Mjax0P2lk7Dt7JWSoVaH1G6eXyHoQC0aTuP 8g7j7GwEMw1s6mCf9KynrJpZjI42Hsas1arSJLi3Pz6dkyPRi7HSpcaLQFb0pLCZq/+g yg9j8Vz5vGvnCV4dF++tZf6U1HWAMCqXYY4IZrz2a2jBYQ2E9ss1wVDc2kWa6hu2WeXJ Z9GtkriQ68DEKiKqKNhnq0lBz8/zNGjFRDV4Cd7c5B/fDFGS458aOn9YkaiYx5fO3MPX a9Bw== X-Gm-Message-State: AFq9FYIt5bM5FJue7GmNoBf2BobN/UIVATUWv5V3353aCTTzdNYS18Gr rukFGPXIDEpJzjwwYsc2FkRYcKrBVwJjI+UvH9FUacpHPSJv4aJzpnwSCN4tHl6BRKAVqWdgGHK 7e5pjmeRFCBJ+wwoU3y6fZOmESKzP2WI9DKZyOOtkSaORo8bWx3+r4ST3 X-Gm-Gg: AYBFou3W7WoqzTE+7Tgd3GUfccwSYdl2hTTTcy/6hVbxAZoeTCN+bylfchFpQdX9D6J BrG1Nd+3y9V5j/hO8TY50Ffn9Wk5HS/CBaV+BdywAt2aVR2FTvhULs+aCj+ua/Ul4Q9MYbQAxVp uDACzpMr5sQWvtL3IPoYN6ApmymtCBkcRqoK9+18FqUWwugnxjZg7XcVpCUtOq3hC2+itGxt76x Re8I+SUJ2hiypwHtVzhbFk799IWlcyH1oSxJ0kRSq8q7ADP5AbGCBACpTTYrZo0GiIrCX0EHdMi YvWrHC26Tv0uLKC9Ccfw+AYdgiDVIQ/VYI6FT5nVFdpn8DmbMaqwI3ZcHJTtrjouqCgtCerdPeq NlZFmJ6YxiEUW204PC4+pBTMIYpNUwm4VrceqiQ2rp3ZEItZCicul6y28yw== X-Received: by 2002:a05:600c:a46:b0:49d:1df6:2592 with SMTP id 5b1f17b1804b1-4a1d7603dd1mr194475315e9.21.1792434049882; Mon, 19 Oct 2026 11:20:49 -0700 (PDT) X-Received: by 2002:a05:600c:a46:b0:49d:1df6:2592 with SMTP id 5b1f17b1804b1-4a1d7603dd1mr194474895e9.21.1792434049558; Mon, 19 Oct 2026 11:20:49 -0700 (PDT) From: Hanna Czenczek To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Hanna Czenczek , Kevin Wolf , John Snow , "Denis V . Lunev" , Eric Blake , Markus Armbruster , Stefan Hajnoczi , Paolo Bonzini Subject: [PATCH v2 06/12] qapi/block: Add BLOCK_IO_DELAY event Date: Mon, 19 Oct 2026 20:20:22 +0200 Message-ID: <20261019182028.45305-7-hreitz@redhat.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261019182028.45305-1-hreitz@redhat.com> References: <20261019182028.45305-1-hreitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.329, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-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-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1792434168156158500 Content-Type: text/plain; charset="utf-8" This event will be emitted when a disk operation takes longer than a pre-defined threshold (as set on the block device). Note that the description refers to the "delay-report-ns" and "delay-stop-ns" block device properties, which are not yet available. A future commit in this series will add them. Signed-off-by: Hanna Czenczek --- qapi/block.json | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/qapi/block.json b/qapi/block.json index 8f4a71733c1..5f9f5c28050 100644 --- a/qapi/block.json +++ b/qapi/block.json @@ -649,3 +649,40 @@ ## { 'enum': 'IoAccountingOperation', 'data': [ 'read', 'write', 'flush', 'zone-append', 'unmap' ] } + +## +# @BLOCK_IO_DELAY: +# +# Emitted when a disk operation takes longer than the pre-defined +# threshold (as set via the "delay-report-ns" / "delay-stop-ns" +# properties on the block device). +# +# Note that delays deliberately incurred by throttling do count +# towards the operation duration. +# +# @qom-path: path to the block device object in the QOM tree +# +# @operation: I/O operation +# +# @latency-ns: Ongoing duration of the operation (in nanoseconds) +# +# @action: Action that has been taken ("report" for "delay-report-ns" +# or "stop" for "delay-stop-ns"). A "stop" action means the VM +# will be stopped with the "io-hang" `RunState`, which does not +# drain the block devices attached to the VM, because draining +# would be counterproductive in case of a hanging I/O request. +# +# @offset: Request offset in the guest disk (in bytes), if available +# +# @bytes: Request length +# +# Since: 11.2 +## +{ 'event': 'BLOCK_IO_DELAY', + 'data': { + 'qom-path': 'str', + 'operation': 'IoAccountingOperation', + 'latency-ns': 'uint64', + 'action': 'BlockErrorAction', + '*offset': 'uint64', + 'bytes': 'uint64' } } --=20 2.55.0 From nobody Mon Nov 23 04:44:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1792434155; cv=none; d=zohomail.com; s=zohoarc; b=ZAo50I6RdYDtrj+1xAVpfALUBRPxQNG7d23ySYp9gppoytVNl+ytiOPlKyvaYzcVyesrEXqMdOQUb5fVtTZzf0XamAO5MYYsfYSUwEMVOSqWXzo8VRdKWIgMymCJxy1OrmAKCfR5PgHM9mDHHChi/m2/MZQDQHT1F8FYlq3AbyE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792434155; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=0DMCIM4SY6M+GNhaHaNHAs2jnIKCW5lF8AzgnG/Gl44=; b=hCxfgTdNmshWzTGcoUj8uLqxzA1VF5O2o3RfUFV4GoRnGLVU1fZKey07tTFz44jvCIdwS7ZhdOQxP/KRVaQ4+rBrdNWGNjNkI3s4CLxU9yKl9AxhYHkxSLHXE3EvwzHPUGLOMwVUFGPT9liFcuKvv+EuQ1SCLJlSCmUaXZ0m04k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792434155533280.49035628050365; Mon, 19 Oct 2026 11:22:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xIryn-0006Th-4z; Mon, 19 Oct 2026 14:21:01 -0400 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 1xIryi-0006RR-PU for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:20:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xIryh-0005q4-DK for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:20:56 -0400 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-358-kiO2A3lzMt6fGcRieRxQUA-1; Mon, 19 Oct 2026 18:20:53 +0000 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4a1d1f26a63so16207265e9.1 for ; Mon, 19 Oct 2026 11:20:52 -0700 (PDT) Received: from localhost (p200300cfd705ccf50633a9a8543b8b67.dip0.t-ipconnect.de. [2003:cf:d705:ccf5:633:a9a8:543b:8b67]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a1f2cc809csm9811365e9.8.2026.10.19.11.20.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Oct 2026 11:20:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1792434054; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0DMCIM4SY6M+GNhaHaNHAs2jnIKCW5lF8AzgnG/Gl44=; b=Q5d451xqs2USq9ymPDD+klWZxC0pWEhiEvY4Q3R0jDnbcpqb1DZYuH/9pelxPNZzJOiMY6 5XLYY9+QfAez++dhjGowqbqSgV7s8+24OgtpamJgsdnhLLxpFH+xswLCecUk+HX5awarZj Fpze+gocfuH70Q9D76xbGRxP62dRlIg= X-MC-Unique: kiO2A3lzMt6fGcRieRxQUA-1 X-Mimecast-MFC-AGG-ID: kiO2A3lzMt6fGcRieRxQUA_1792434052 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1792434052; x=1793038852; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=0DMCIM4SY6M+GNhaHaNHAs2jnIKCW5lF8AzgnG/Gl44=; b=C4c/IB8Uwr3qr2xe7iobj3pjBQO7Q30dWEuPDQa+U3T12y1ZHTvn5lTdaXC5PNev9c x6ZUBls25KgwhPE7nUpUzGZC+ViGfpf5tFqvSFhxZJMCICNqnhc6Rya9IeJbKWRl08gz Zk/DS1QL1CV5He6hDlcE7RfTkMVNsZVgfPcHmUfEy/2RNwslNymivneYfTlcwOiJ1Fhs F/OVg/9VdaBlr94RzAIvmo0LIvQHXo5ZHXM2qINswP0A/DlWA8kW7hng5cF5Ig57iyZG z9dagoORv7yGYqw+f4cY6IokYc6WErPLAsm3Z5uTMHP3MRUmrLumpBiCZfksZZNFTU3f 4gCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792434052; x=1793038852; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=0DMCIM4SY6M+GNhaHaNHAs2jnIKCW5lF8AzgnG/Gl44=; b=YEeg48owzubO04R4MVJ8MISzjgxN9mhC5+Qh0bgikh72kH731kBa6ArYjPQ8hSFZDj X/krtB9gfY1rgYICbGbxcuesxGcw307d3iR3/vDjJ4Pk9iObiS7WSJAYgILV/iA5A119 rtVxwxF0Nn1jOATvnMqfj6IHXmA9lpzJcqEXXxL2tJmKDWfbJeQJZdyY+YIj135+kD80 4EXdzulc8C210loTgu/NkwWlCdGgIx/z/C9Oz5X8hRtTJ0sJcYMRLmdxNPNS8tTSk7Ef STrpdF8becRlwkbqi7QV7aPF1nf9aW5a8MfBkm2iz2w/2XqJQ63c+zhQWdXh+CbfD4ok SLHg== X-Gm-Message-State: AFq9FYK4AyKBCQ7T+n7rvSqD4WTpSYJGGFb4zqdsxBNdjM5TPknA9NxW lzlqtdWQTJT5p3QbKBqv41uCCsY412irP9RLI2Ypqyrq/8Lt5vxCCAmFbk4qmvZxy30avVoQKqt uNV+v/5ZTWtEX08zh+7CfiudWA8691hr/UvvCB2Ra8ju0ljDmlXoG6po1 X-Gm-Gg: AYBFou3civAs5Rwh5m3c57V2CH/xKQj6BVFAOoKTDPX2SZBA29fjrLwvo26QnnWzzTf Dl6J5fBqpm1IPV8GC5VV1xtPFQEYmf+cn2sTqp3fTO798Wlilb+VPqAszCtaCQ70HkH+aJ9yw+E mbVh1zQ/2MhS6isVf024BAkvQJcU3Xy7GKioTyPL8RZm9WMbSE2ar+vrFEHK4VrGHsRo/Qcza33 w/cBRn10tsP+twxqXlN5D9kIku7W5LamnRod2HIice9p79AGvou4npwvbh3R1SqxdwgJw98JM3y eP6YVFrFUVxQLxgOLEi3n7XHhEfl94rssVX17znHjJpXYco4bBvNyiX+eyepQwHCGp/fmQsi5mG 5sRMyNKsh1boUF7TAUYwuCpm4V6IVb5O4V1fhILeLwOJJqIJTfyjWiUzNAw== X-Received: by 2002:a05:600c:1f86:b0:4a1:93fd:8f8 with SMTP id 5b1f17b1804b1-4a1d75ab363mr192611025e9.4.1792434051895; Mon, 19 Oct 2026 11:20:51 -0700 (PDT) X-Received: by 2002:a05:600c:1f86:b0:4a1:93fd:8f8 with SMTP id 5b1f17b1804b1-4a1d75ab363mr192610655e9.4.1792434051559; Mon, 19 Oct 2026 11:20:51 -0700 (PDT) From: Hanna Czenczek To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Hanna Czenczek , Kevin Wolf , John Snow , "Denis V . Lunev" , Eric Blake , Markus Armbruster , Stefan Hajnoczi , Paolo Bonzini Subject: [PATCH v2 07/12] qapi/block: Add BLOCK_IO_DONE event Date: Mon, 19 Oct 2026 20:20:23 +0200 Message-ID: <20261019182028.45305-8-hreitz@redhat.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261019182028.45305-1-hreitz@redhat.com> References: <20261019182028.45305-1-hreitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.329, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1792434155946158500 Content-Type: text/plain; charset="utf-8" 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 @@ -660,6 +660,9 @@ # Note that delays deliberately incurred by throttling do count # towards the operation duration. # +# This event will only be emitted once per request and action. When +# the operation does finish, a `BLOCK_IO_DONE` event is emitted. +# # @qom-path: path to the block device object in the QOM tree # # @operation: I/O operation @@ -686,3 +689,33 @@ 'action': 'BlockErrorAction', '*offset': 'uint64', 'bytes': 'uint64' } } + +## +# @BLOCK_IO_DONE: +# +# Emitted on completion for disk operations that previously emitted a +# `BLOCK_IO_DELAY` event. +# +# @qom-path: path to the block device object in the QOM tree +# +# @operation: I/O operation +# +# @latency-ns: Full duration of the operation (in nanoseconds) +# +# @offset: Request offset in the guest disk (in bytes), if available +# +# @bytes: Request length +# +# @failed: If true, this request failed for any reason. If false, the +# request succeeded. +# +# Since: 11.2 +## +{ 'event': 'BLOCK_IO_DONE', + 'data': { + 'qom-path': 'str', + 'operation': 'IoAccountingOperation', + 'latency-ns': 'uint64', + '*offset': 'uint64', + 'bytes': 'uint64', + 'failed': 'bool' } } --=20 2.55.0 From nobody Mon Nov 23 04:44:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1792434159; cv=none; d=zohomail.com; s=zohoarc; b=HtZ1WO7GEVzPNtPpk8IOb5vECjdEgzeB1Gswi+XVWRRx8IrLr5xpEUW7gno9KKbfz6/rJRizkO1+o8vPZp5s5Ra03uk5Z74eyrOj3ikbta+rStzL3eWfz/4BmY4iXXSoKNh696o5CmK3A6ollY3ZQ5+/jpcDPTURbqwWTbqcYpA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792434159; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=PbyBGO5Y3CUQEX9fhnEcMZ4uFMh7IQB6HCrs7yEWN9c=; b=YjpyTEdSzFTznDI3grHqG3oDobOhi1L21SYVKX5/fBzSRlun3f/iEYiwzVKNXWMtZ0YliUV1InVwty3NtgC9scVcd9IBmVv350b/LO6bAtm15GKt4HzNuSMlab3v9RhaO/qKnpVjs2a5/Td8bPHt4fEzNC+3RebkOhlnGPmmaJU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792434159886613.5933756944071; Mon, 19 Oct 2026 11:22:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xIryo-0006Um-8Z; Mon, 19 Oct 2026 14:21:02 -0400 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 1xIryl-0006Sj-Qy for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:20:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xIryk-0005qb-8A for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:20:59 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-27-t-0HMltcMR-G_1C0penjNA-1; Mon, 19 Oct 2026 14:20:56 -0400 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-48c46582442so1544997f8f.0 for ; Mon, 19 Oct 2026 11:20:55 -0700 (PDT) Received: from localhost (p200300cfd705ccf50633a9a8543b8b67.dip0.t-ipconnect.de. [2003:cf:d705:ccf5:633:a9a8:543b:8b67]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a1f2d85a9bsm9638645e9.15.2026.10.19.11.20.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Oct 2026 11:20:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1792434057; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PbyBGO5Y3CUQEX9fhnEcMZ4uFMh7IQB6HCrs7yEWN9c=; b=BEzre1zTeJailtw16QcZUcmuXR0kHg1RD9CfTBV5OsewPFzZqtkNj4HSBgApvH8ptVBtMa i4jEjew0XjFMR/QJndtDwYuoAyppn/5n2Lfz0g5EgyILvUGgOE4wjRwxQuOnYQtKO34WpX 7iNVqeSSyhsFtOolpG6DvnLrGghp0ys= X-MC-Unique: t-0HMltcMR-G_1C0penjNA-1 X-Mimecast-MFC-AGG-ID: t-0HMltcMR-G_1C0penjNA_1792434055 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1792434055; x=1793038855; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=PbyBGO5Y3CUQEX9fhnEcMZ4uFMh7IQB6HCrs7yEWN9c=; b=pE/f+/eHg7PoXhzKd5AyZ8PB+TjUmNoxOmpXSXTSsAZTQJHJGVVAWQ4TqJbXd4SkhC lEVf07F+iQb1UOmokSZbhHItz3YLb125xVd1YF0CwGNHpQknoyFbGlBideOCFQwyLI7L JCHjG5SXf6V3w+QvhlD6G7+N1ZOch730Hm78wUFnY3vE02CW4gYzta6YkAJVGKiVyFPb 5qF/hYdXln6UfGFAE2d9VngJJ3aMrSkzgqhdxQRj6NFsdtFztvk16jjCgq7ulsKmTIgP LLjTpqy/khx/JLUJPKw/gnVmnZDFItNqFrxLEMpBHOQfiFUTIDFnNXOH8DPrFSGv37Qv +Pww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792434055; x=1793038855; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=PbyBGO5Y3CUQEX9fhnEcMZ4uFMh7IQB6HCrs7yEWN9c=; b=XkoiFyJtAtfXQr/phfhAWSmq6jT4bUFT7FeeyliXCgcV7a9ScjmJHcx8mCsaP9sn6q SpCWOjHT4z/rWKEFIX/RIq8vbg0qFAByjIIrSWBrVHOr4IDEa1PA27lKktfe4N/CSmth 18I1PLPLgX0cuFTOUmaoftac4Nw/Nl7pZBrhMuWTqmUDm9PHueoeEbSQNszsKE+bsb0g xOseWyb48/4GwoEho/OYm7xsKXfdZ9OFPZD+u0SvNC3gKitf0zYBZa2h6nPSucPLhbLS bufnf3lmsfDZgDImpa2vpV8cEo6HHGPq643oiOeYklR/C83mKyZqamBHtO/1OsQHlPt+ b66A== X-Gm-Message-State: AFq9FYLpk1xv/xj9I+pESvpndTCKjOnJnJuuynr3/H3Fkwk0QF/NVwY0 lijRJ9Axk62PAOl0iy8R+U6K0iEDTphpaiwyqlV5lDDZMwLmbaxOu6uZnL9abshvU+rxDGgTDvW G81IbHRY2Keu/lQNYRH2bknzF+D0UuAhGN0siBE0JsWKj9BH9j16xNQAa X-Gm-Gg: AYBFou01h3yzNUZJ8JxZUIW5o1BgCOjnQeIWN4GZdxTqMMzNO20pXAlBSw+kIJ8Og66 nsBRWNp1ZlSd1vHYqm0hEI9tqGo0cLjsAahJ1mTsoCb/yU8Wb81dkfj6jEqNktLM1IjnFxgz36P ex6u7vbVWHkdmO4YHg6rjg7GN3tuAQqk2bvxldXeaCRnc2su7lEHKLi1jUdUmeWhHe5po+ZAz8T yRlrLs4aXGcv0cs06bKWzLm7gfg2t39nIE6XxfcE/bZ+tYiOGhhA90JuriuwOdyr7s02FLgK7Bw W1b9u/f8dypPPfOSPN93fI+0f5lwTCwzcmCF60YSei2W2n2Mafp/9Tts3y4S/+LYYkxL2AvZftw Arnqg8AX0G9MZ9h1l5VIPLsioz+wI/mViT0LTLCofZrDXq2+9IQZo+yVU6g== X-Received: by 2002:a05:600c:548c:b0:49f:dc71:e609 with SMTP id 5b1f17b1804b1-4a1d7610f2dmr184106005e9.20.1792434054738; Mon, 19 Oct 2026 11:20:54 -0700 (PDT) X-Received: by 2002:a05:600c:548c:b0:49f:dc71:e609 with SMTP id 5b1f17b1804b1-4a1d7610f2dmr184104655e9.20.1792434053419; Mon, 19 Oct 2026 11:20:53 -0700 (PDT) From: Hanna Czenczek To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Hanna Czenczek , Kevin Wolf , John Snow , "Denis V . Lunev" , Eric Blake , Markus Armbruster , Stefan Hajnoczi , Paolo Bonzini Subject: [PATCH v2 08/12] block-backend: Public blk_get_attached_dev_path() Date: Mon, 19 Oct 2026 20:20:24 +0200 Message-ID: <20261019182028.45305-9-hreitz@redhat.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261019182028.45305-1-hreitz@redhat.com> References: <20261019182028.45305-1-hreitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.329, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-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-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1792434162121158500 Content-Type: text/plain; charset="utf-8" Make blk_get_attached_dev_path() public so we can use it in the I/O operation delay QMP event to identify the affected guest block device. Signed-off-by: Hanna Czenczek --- include/system/block-backend-io.h | 9 +++++++++ block/block-backend.c | 6 +----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/system/block-backend-io.h b/include/system/block-backe= nd-io.h index fd84723d9d0..63b2dd2e24f 100644 --- a/include/system/block-backend-io.h +++ b/include/system/block-backend-io.h @@ -41,6 +41,15 @@ bool blk_iostatus_is_enabled(const BlockBackend *blk); */ char *blk_get_attached_dev_id(BlockBackend *blk); =20 +/* + * Return the QOM path of the block device attached to the + * BlockBackend. + * + * The caller is responsible for releasing the value returned + * with g_free() after use. + */ +char *blk_get_attached_dev_path(BlockBackend *blk); + BlockAIOCB *blk_aio_pwrite_zeroes(BlockBackend *blk, int64_t offset, int64_t bytes, BdrvRequestFlags flags, BlockCompletionFunc *cb, void *opaque); diff --git a/block/block-backend.c b/block/block-backend.c index ab837fac921..78678986466 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -1054,11 +1054,7 @@ char *blk_get_attached_dev_id(BlockBackend *blk) return blk_get_attached_dev_id_or_path(blk, true); } =20 -/* - * The caller is responsible for releasing the value returned - * with g_free() after use. - */ -static char *blk_get_attached_dev_path(BlockBackend *blk) +char *blk_get_attached_dev_path(BlockBackend *blk) { return blk_get_attached_dev_id_or_path(blk, false); } --=20 2.55.0 From nobody Mon Nov 23 04:44:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1792434149; cv=none; d=zohomail.com; s=zohoarc; b=J3hlINJYuLnVzFziaLrx5I3wcLS8m9duXBh/u7705hH9n5615rvho5BXciB0sfj/LE+oNtS3DPW8GslBoNHjCZ/LNvQhIy4U29O2ef4+r4AIReUH111uX9JL2EcKZ3ILz4hiJTcIL+XV3MMNrKG39V/r257AiLB99w7iKiu7d84= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792434149; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=925o7/vyTRiQuTc9YJYdf05nUSpc4VVdjLEaL/ZmUI0=; b=lFwYzz9ZTyul5g8Mxc8GPfLYnO/LCMi75cQM8ShUURH+weFO6/jbIbd7Cj4aS9TOJMycbKGlwXgFVcR1/PBsao/cDNuudgx6vP4BCNnYm0mZ0EKmHxtoxD9r87cG5hknSmYUfjI/YLXluNFpxFDQvz2jhtwATu0q0LFWihV+vOo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792434149483321.5307321266645; Mon, 19 Oct 2026 11:22:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xIryo-0006V4-Qx; Mon, 19 Oct 2026 14:21:02 -0400 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 1xIryn-0006U2-HZ for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:21:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xIryl-0005qn-Vg for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:21:01 -0400 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-630-CKpQyag6N0O5mpqLhHEnYw-1; Mon, 19 Oct 2026 18:20:57 +0000 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-48af5a07314so1488640f8f.2 for ; Mon, 19 Oct 2026 11:20:57 -0700 (PDT) Received: from localhost (p200300cfd705ccf50633a9a8543b8b67.dip0.t-ipconnect.de. [2003:cf:d705:ccf5:633:a9a8:543b:8b67]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e1d823ca7sm442110f8f.38.2026.10.19.11.20.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Oct 2026 11:20:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1792434059; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=925o7/vyTRiQuTc9YJYdf05nUSpc4VVdjLEaL/ZmUI0=; b=IiPXoaJApB0cSghE/kvrYNys+WldpweFdhp2a1Q1zwjRVY6x6/IdqJHU1Afeadl5lg46Lc 0hXQxG8bYSnPKXwoN73bLV8oZRvd89jcsFWLZEN93teaiQdYbb0MjN31nwie7pPyF5/D3F H5uQ1kXE6vr7RQAOVSKybrZ/WTOfhRg= X-MC-Unique: CKpQyag6N0O5mpqLhHEnYw-1 X-Mimecast-MFC-AGG-ID: CKpQyag6N0O5mpqLhHEnYw_1792434057 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1792434056; x=1793038856; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=925o7/vyTRiQuTc9YJYdf05nUSpc4VVdjLEaL/ZmUI0=; b=SxSVncnaOU4NpWmWPsLV/X26MieMIDHHD5AHb/Jh1hFt32E5JEJtovyyA1FhlCjqCj 6/43R88x/cv8ywBPpD8f0qJrd97MNvLJSD9RuhO3dtJNjVN6IZ7yBdZEMWOAAlz5fKka iA6Nkw+uIflmmQaYK2/ApbUrleAZZgR5NumnSz4EdNQ9WOsA8jo8o6G3vUF2Ub7IkeMp 4LTIhw81qvYh2xYLhk+kSKWkRql0RPE45hwgmkHBjIkkrk91RxkgFIE+e0MeDkMocIFU nCVOzZJ6YmyzjppIbbCdiggwxTJUDNE19ooLf8sWtjcmpJ1axtPYvya0BNI/eredaGEm vZJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792434056; x=1793038856; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=925o7/vyTRiQuTc9YJYdf05nUSpc4VVdjLEaL/ZmUI0=; b=o4JLTnZ+waeGW3iwWsjV3iqat2RzKnAv0H1cC6ni2tajr1AYwOhxY9SzhxMSoZcU9z Ga3K0Uowr+HB8b3k9PeLQqgyf3FQDUlxyfAU5UJENxsUzxQpgzswgViXJIyxHNPHmokB fI1S9sMBNjPD0Mm3/M4kQc5Jb2LqnXKuA+QWy0rbRZ6BPpdPVD2765MXVBxDA487vjSf X2j00swQrRGKxsskru8GKRhcTlh9/VQ7JcqwpUgQoxQPUxCAUnkrULVjzCeHZ5VOgH9S P7aXKHcQZZHVf9YiDK1chk+Why9D11H0vdgb2Uv+ucUdIVt0Y968++DSCu8AekaV7ZDO 5HUg== X-Gm-Message-State: AFq9FYL/nIAXp0akLFrizZ1V74vmlABkIGXl03fhKporoeEe33ibB1GM MMjfGTu1cUZ6j7HvG9kCxYU8gexL1kt6+5hFrRDYWVGdFAwG1J/J2BLvbSOkFLPdO+y0z4yT2QR /DdlQyJn4f0x8ISsMXmle9OL7XMO64HuyFKczbeSOPH6oPtYn6MrUWgZk X-Gm-Gg: AYBFou2pF5Dzoee3HNg2ZNvoPwU5zEVdbz4+19/kLbyaYr0ydxuds2ucFeEElvgfT1w eP8CU6jdonylzdFDBGt/eVEhlGeij+nxakWjYibYw7mdD3vHKWkp7y+z8PMzGevM5HQY7Pi8qdi NDXRg7w7xs9myfoMoCauSii/vjJobGWv7pukY8UIz9jx+XtKB6g1mlLnEM8mMCjEs8jiSVacoWG 0L49Ph1dKhHbA6oUvgHQtY8uDvx0ohUG6lbbVTGRiRcBXONvWn3pCRDDd13YPTOG7PhK90Y+jb5 KqsAliop9D53od0CIb7t8NqJUyUmPGw51WNqnPBh5+OdcrRYIKluoXIDM3iGZlCpvxj/VHF+5hR jG6/yDT2I6526fx0xqH0Sv/I7cGw97H7oSy+PGV896weidw44/Dlxv5CwaA== X-Received: by 2002:a05:6000:490f:b0:48b:9d80:53a5 with SMTP id ffacd0b85a97d-48e07bbe5d5mr17013363f8f.10.1792434056515; Mon, 19 Oct 2026 11:20:56 -0700 (PDT) X-Received: by 2002:a05:6000:490f:b0:48b:9d80:53a5 with SMTP id ffacd0b85a97d-48e07bbe5d5mr17013317f8f.10.1792434056025; Mon, 19 Oct 2026 11:20:56 -0700 (PDT) From: Hanna Czenczek To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Hanna Czenczek , Kevin Wolf , John Snow , "Denis V . Lunev" , Eric Blake , Markus Armbruster , Stefan Hajnoczi , Paolo Bonzini Subject: [PATCH v2 09/12] host-utils: Add u{add,sub}{32,64}_saturate() Date: Mon, 19 Oct 2026 20:20:25 +0200 Message-ID: <20261019182028.45305-10-hreitz@redhat.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261019182028.45305-1-hreitz@redhat.com> References: <20261019182028.45305-1-hreitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.329, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1792434149835158500 Content-Type: text/plain; charset="utf-8" Add saturating addition/subtraction functions for unsigned 32 and 64 bit values. Signed-off-by: Hanna Czenczek --- include/qemu/host-utils.h | 62 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/include/qemu/host-utils.h b/include/qemu/host-utils.h index 1db9dbb138e..848e04c8fb1 100644 --- a/include/qemu/host-utils.h +++ b/include/qemu/host-utils.h @@ -636,6 +636,36 @@ static inline int64_t sadd64_saturate(int64_t x, int64= _t y) return ret; } =20 +/** + * uadd32_saturate - 32-bit unsigned addition with saturation + * @x, @y: addends + * + * Computes @x + @y, and saturates rather than truncating the result. + */ +static inline uint32_t uadd32_saturate(uint32_t x, uint32_t y) +{ + uint32_t ret; + if (uadd32_overflow(x, y, &ret)) { + ret =3D UINT32_MAX; + } + return ret; +} + +/** + * uadd64_saturate - 64-bit unsigned addition with saturation + * @x, @y: addends + * + * Computes @x + @y, and saturates rather than truncating the result. + */ +static inline uint64_t uadd64_saturate(uint64_t x, uint64_t y) +{ + uint64_t ret; + if (uadd64_overflow(x, y, &ret)) { + ret =3D UINT64_MAX; + } + return ret; +} + /** * ssub32_saturate - 32-bit signed subtraction with saturation * @x, @y: addends @@ -666,6 +696,38 @@ static inline int64_t ssub64_saturate(int64_t x, int64= _t y) return ret; } =20 +/** + * usub32_saturate - 32-bit unsigned subtraction with saturation + * @x: Minuend + * @y: Subtrahend + * + * Computes @x - @y, and saturates rather than truncating the result. + */ +static inline uint32_t usub32_saturate(uint32_t x, uint32_t y) +{ + uint32_t ret; + if (usub32_overflow(x, y, &ret)) { + ret =3D 0; + } + return ret; +} + +/** + * usub64_saturate - 64-bit unsigned subtraction with saturation + * @x: Minuend + * @y: Subtrahend + * + * Computes @x - @y, and saturates rather than truncating the result. + */ +static inline uint64_t usub64_saturate(uint64_t x, uint64_t y) +{ + uint64_t ret; + if (usub64_overflow(x, y, &ret)) { + ret =3D 0; + } + return ret; +} + /* * Unsigned 128x64 multiplication. * Returns true if the result got truncated to 128 bits. --=20 2.55.0 From nobody Mon Nov 23 04:44:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1792434140; cv=none; d=zohomail.com; s=zohoarc; b=RouxdQV4x8WlQqz8aCk24cK/UcSsaX8s+zhEx6FXlCDb6IKxoMTzgRxvU9zn+u9qNQluzTCZWw0itRcaTRKUeqvAz+jNEnO5CL1bK62c66iW3Gp2VvSVSATLefQ3hPOT1i760vLyCDJ/tLuBjnhkjHyawSzNd3FBPh5QEV+v89Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792434140; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BaKjM2lbdTuf+noosjvno29uVBbNRTtkTIiuAPgJ+AU=; b=bBnTHj2/5vJ7fS/GfRcaE5WGU/W34E4glMXb7u0+FhiojRMayjZ6eRVUdWmLvgIKzu9ecfN6xvs0aRmeddmNwHD0GgHEaOdwc3sP85SjxI+EGGrQwApD87AXpVomiAqzMOiX/KjyHlv8UXp+bPNfUTaylBKzkfLDkb/3VI/iS2s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179243414071096.70508940333775; Mon, 19 Oct 2026 11:22:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xIrzL-0006hf-RQ; Mon, 19 Oct 2026 14:21:36 -0400 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 1xIrys-0006Vl-0R for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:21:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xIryo-0005rL-Sz for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:21:05 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-220-EddtMTW8NyWykqGmZ1GnVg-1; Mon, 19 Oct 2026 18:21:00 +0000 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-48dff112136so1676013f8f.1 for ; Mon, 19 Oct 2026 11:21:00 -0700 (PDT) Received: from localhost (p200300cfd705ccf50633a9a8543b8b67.dip0.t-ipconnect.de. [2003:cf:d705:ccf5:633:a9a8:543b:8b67]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a1f2d85a9bsm9643485e9.15.2026.10.19.11.20.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Oct 2026 11:20:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1792434062; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BaKjM2lbdTuf+noosjvno29uVBbNRTtkTIiuAPgJ+AU=; b=Z9AXJJaWk9MrC5cM/wuHW5nxywy4pYALvBgydZNGpwX7+WuDGKs59n9KJXfUXow+7rjnaJ U7ukn8JjcIF+KjIbK8T06/RMMeBOPqIMg5umnhE18qf3YCg5vRx1DpcTFXP9rFXt9mpLUO bBMobNPb0yojVhko3As22+ISTrnLqXo= X-MC-Unique: EddtMTW8NyWykqGmZ1GnVg-1 X-Mimecast-MFC-AGG-ID: EddtMTW8NyWykqGmZ1GnVg_1792434059 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1792434059; x=1793038859; darn=nongnu.org; h=content-transfer-encoding:content-type:content-type:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to:content-type; bh=BaKjM2lbdTuf+noosjvno29uVBbNRTtkTIiuAPgJ+AU=; b=p2M6ymtv5HvIFxJIpRs2d6o87K6h8q73GjB8cCVltJcO0X1WYA9xcx6ztLviHhpdOg kotPFfkONROkghB19QDq+z+gGjObOROJeWK4LDpAwqOuoIvmJ3kFeB5VwLAwzMcaHGMA LJ/lCQAxK2azoTgnIJcmeSAsyWjWq65B6QkScp93TIB1DRXYPaAL6UrcDIryWzOE7yFx 9SL1AKchc0PjozyLKSfb8j4BP1kR3cHzl2uZavWQO9nP+hOZJq8nkcfHWWw0gTfgT0VA 1wG7dtxqOB/SobIVV5+hTh1i1B3S3bBOtNWbl9Xe7fuYNnz9HeqNYJYZvqAQfFPkyzYj Gr7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792434059; x=1793038859; h=content-transfer-encoding:content-type:content-type:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=BaKjM2lbdTuf+noosjvno29uVBbNRTtkTIiuAPgJ+AU=; b=sd/oL/bU72A/4Tgeeqj7w0q893FTqBMGSXCa4POCQwcQbseDVS5IKpD7KJDMe156iO ktwvT6v6glS3Bk6Ow7Wch5U86Fvdz6Xl+krTTXMjpms/sRDErKXETyoLwDzbLhNeYw2Q kLRugSNDjDI35xpkXOH0ZrYas+bbQK69KJ+oAmzq9o7ajzdQy4ftcY1GW5LaJLQqB2f/ jyhlNeY/bWkX3ugpTrhO4oxhTsUHmtg6sO0127N9/Qhx36TstxggdQZOrwpQqQtkTgeD fGNsmNhns++MztOxAFx+dxlErpn3fGri68Zdv19uTrkD+ekSbYSOAF5nQmuxlrx+oyp8 gwJA== X-Gm-Message-State: AFq9FYJbmrQ7xofbuvgRx+q6KJ7oZ//qFnr1D4uFyFuzNNXFdMCxVo6F bedhcAD7DEv6fvUWE3rMedPuvkxkW+hYh7i+Y+ER5Y3YCYBNWrq+CotjDcgELLtXnwPALx2PBBt uWmo7q4EJW7nVj3ZabakcRgIODu6/m5syLSSIOecp9MtX4G7ZpjwEj8Dwkw0INbHd X-Gm-Gg: AYBFou0uLmHxO0Sx0OXyVnJqFJBRkLb5k2uX2NEN7VzXLwGqMGruxlrROemiQsYxWWQ CPPCB+jgoIL3y3pjybOJNhReiQ9zbF2yOtaPToFewBrC9f3EwSPkib8qevysgSBLqBJ+itl2+xX O2mctzmUjCKK9k2xi11u3PbU3S9cEx5+Ql1HFvd3GqecNdFt1RIojNbWn4vX58GparjCWJGXIvY 0uAW1XeFeLF+uqMlodiUs0LXxtSRmYIelG2Vg8Ji1wZNkf/eDpWTJNP9WesCx90sgfXkqqJAhS7 oq69vqvJ+8riyPJdpF4VyACCSrYoWUJ/619S4Pl/6dmQXUsNIejncMlmrfsUGqAW6gEh/ZLU3RL HvWyPbI59IIlRdjN7kj2J9XspJyPu24rnlaDHOUtQVmUqyKLZatL8XW5e X-Received: by 2002:a05:600c:8709:b0:49f:ff73:9971 with SMTP id 5b1f17b1804b1-4a1d75f8f28mr170571015e9.18.1792434058738; Mon, 19 Oct 2026 11:20:58 -0700 (PDT) X-Received: by 2002:a05:600c:8709:b0:49f:ff73:9971 with SMTP id 5b1f17b1804b1-4a1d75f8f28mr170570345e9.18.1792434058178; Mon, 19 Oct 2026 11:20:58 -0700 (PDT) From: Hanna Czenczek To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Hanna Czenczek , Kevin Wolf , John Snow , "Denis V . Lunev" , Eric Blake , Markus Armbruster , Stefan Hajnoczi , Paolo Bonzini Subject: [PATCH v2 10/12] block: Per-request delay tracker Date: Mon, 19 Oct 2026 20:20:26 +0200 Message-ID: <20261019182028.45305-11-hreitz@redhat.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261019182028.45305-1-hreitz@redhat.com> References: <20261019182028.45305-1-hreitz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.329, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1792434141746158500 Register I/O requests to BlockBackends with a per-BB timer running in the background (in the main context) that goes through the list of requests to find any that surpass a user-defined[1] threshold and then emit a QMP event calling this out, or stopping the VM altogether so the guest can be shielded of absolutely excessive delay. One example for where stopping may be useful: Windows will cancel requests after a set timeout, but virtio-blk does not support cancelling requests (by design, I understand). So it will cancel again, and again, and then reset the whole driver (which however won=E2=80=99t cancel the req= uest either), and eventually declare the driver faulty and show a BSOD. The only ways around this would be to implement request cancellation (which I think is not generally possible), or, well, pause the VM in case of absolutely excessive I/O request delay, and resume it when the request is done (BLOCK_IO_DONE event), so that Windows will not see that massive delay. [1] Not yet user-defined in this commit, but a future commit will allow users to specify the threshold when to take action, on the guest device. Signed-off-by: Hanna Czenczek --- include/block/block-backend-delay.h | 112 +++++++ include/system/block-backend-global-state.h | 11 + block/block-backend-delay.c | 326 ++++++++++++++++++++ block/block-backend.c | 44 ++- block/meson.build | 1 + 5 files changed, 492 insertions(+), 2 deletions(-) create mode 100644 include/block/block-backend-delay.h create mode 100644 block/block-backend-delay.c diff --git a/include/block/block-backend-delay.h b/include/block/block-back= end-delay.h new file mode 100644 index 00000000000..9af2e6de925 --- /dev/null +++ b/include/block/block-backend-delay.h @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2026 Hanna Czenczek + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef BLOCK_BACKEND_DELAY_H +#define BLOCK_BACKEND_DELAY_H + +#include "qemu/thread.h" +#include "qemu/timer.h" +#include "qapi/qapi-types-block.h" + +/* Enumeration of I/O delay threshold types */ +enum BlockDelayThreshold { + /* Latency threshold at which to report a delay */ + BLOCK_DELAY_REPORT, + /* Latency threshold at which to auto-stop the VM */ + BLOCK_DELAY_STOP, + + /* Number of different thresholds */ + BLOCK_DELAY__MAX, +}; + +typedef struct BlockDelayTracker { + /* Timer to regularly check requests for delay */ + QEMUTimer *timer; + + /* Which clock to use */ + QEMUClockType clock_type; + + /* + * Protects access to all subsequent fields in this struct. Do not tak= e any + * other lock while this lock is taken. + */ + QemuMutex lock; + + /* Thresholds for generating delay report events or stopping the VM */ + uint64_t threshold_ns[BLOCK_DELAY__MAX]; + + /* List of active requests; new requests appended at the end */ + QTAILQ_HEAD(, BlockDelayTrackerRequest) requests; +} BlockDelayTracker; + +typedef struct BlockDelayTrackerRequest { + /* offset < 0 means no valid offset */ + int64_t offset; + /* Request length, or 0 if no valid length */ + uint64_t bytes; + /* When the request was started */ + uint64_t start_time_ns; + /* Operation type */ + IoAccountingOperation op_type; + /* + * Whether any delay threshold has been exceeded. + * If so, we need to emit BLOCK_IO_DONE when the request is done. + */ + bool threshold_exceeded[BLOCK_DELAY__MAX]; + /* + * Set the first time any threshold is exceeded, to cache the device n= ame + * for BLOCK_IO_DONE. + */ + char *device_path; + + /* Entry in the list of all running requests for this BB */ + QTAILQ_ENTRY(BlockDelayTrackerRequest) list; +} BlockDelayTrackerRequest; + +/** + * Set up the request latency delay tracker for this BlockBackend. + * + * The caller must allocate blk->delay_tracker beforehand (because + * block-backend-delay.c cannot access BlockBackend fields directly). + */ +void blk_delay_tracker_init(BlockBackend *blk); + +/** + * Stop and destroy the request latency delay tracker for this BlockBacken= d. + */ +void blk_delay_tracker_destroy(BlockDelayTracker *bdt); + +/** + * Return the latency delay tracker object for the given BlockBackend. + * + * (Implemented in block-backend.c, where the BlockBackend definition resi= des.) + */ +BlockDelayTracker *blk_delay_tracker(BlockBackend *blk); + +/** + * Begin tracking an I/O request on @blk of type @op_type over @bytes star= ting + * from @offset. + * + * @request is initialized by this function. + * + * Use offset=3D-1 for operations that have no valid offset (e.g. flush). + */ +void blk_track_delay_begin(BlockBackend *blk, + BlockDelayTrackerRequest *request, + int64_t offset, + uint64_t bytes, + IoAccountingOperation op_type); +/** + * Finalize I/O request tracking. + * + * @ret indicates the operation's status, with 0 for success and -errno for + * errors. + */ +void blk_track_delay_end(BlockBackend *blk, + BlockDelayTrackerRequest *request, + int ret); + +#endif diff --git a/include/system/block-backend-global-state.h b/include/system/b= lock-backend-global-state.h index c3849640df9..c04fcff81a7 100644 --- a/include/system/block-backend-global-state.h +++ b/include/system/block-backend-global-state.h @@ -102,6 +102,17 @@ void blk_update_root_state(BlockBackend *blk); bool blk_get_detect_zeroes_from_root_state(BlockBackend *blk); int blk_get_open_flags_from_root_state(BlockBackend *blk); =20 +/** + * Set the nanosecond threshold for per-request latency, when to consider = it + * sufficient of a delay to report via BLOCK_IO_DELAY QMP event. + */ +void blk_set_delay_report_threshold(BlockBackend *blk, uint64_t ns); +/** + * Set the nanosecond threshold for per-request latency, when to consider = it + * sufficient of a delay to stop the VM. + */ +void blk_set_delay_stop_threshold(BlockBackend *blk, uint64_t ns); + int blk_save_vmstate(BlockBackend *blk, const uint8_t *buf, int64_t pos, int size); int blk_load_vmstate(BlockBackend *blk, uint8_t *buf, int64_t pos, int siz= e); diff --git a/block/block-backend-delay.c b/block/block-backend-delay.c new file mode 100644 index 00000000000..07891573861 --- /dev/null +++ b/block/block-backend-delay.c @@ -0,0 +1,326 @@ +/* + * Keep track of ongoing BlockBackend requests, notify about excessive + * latency (i.e. delays), and potentially even pause the VM until such a + * request is done. + * + * Copyright (c) 2026 Hanna Czenczek + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "block/block-backend-delay.h" +#include "qapi/qapi-events-block.h" +#include "system/block-backend.h" +#include "system/qtest.h" +#include "system/runstate.h" + +/** + * Information for BLOCK_IO_DELAY/DONE events so that: + * - delay_track_timer() can collect all of the events to emit in a list a= nd + * emit them outside of the BlockDelayTracker lock. + * - blk_track_delay_end() can move the event emission to the main loop for + * ordering + */ +typedef struct DelayEvent DelayEvent; +struct DelayEvent { + char *device_path; + IoAccountingOperation op_type; + uint64_t duration_ns; + union { + BlockErrorAction action; /* for BLOCK_IO_DELAY */ + int ret; /* for BLOCK_IO_DONE */ + }; + bool has_offset; + uint64_t offset; + uint64_t bytes; + QTAILQ_ENTRY(DelayEvent) next; +}; + +static void delay_track_timer(void *opaque); +static void send_done_event(void *opaque); + +void blk_delay_tracker_init(BlockBackend *blk) +{ + BlockDelayTracker *bdt =3D blk_delay_tracker(blk); + + assert(bdt !=3D NULL); + + bdt->clock_type =3D qtest_enabled() ? QEMU_CLOCK_VIRTUAL + : QEMU_CLOCK_REALTIME; + + qemu_mutex_init(&bdt->lock); + QTAILQ_INIT(&bdt->requests); + + bdt->timer =3D aio_timer_new(qemu_get_aio_context(), bdt->clock_type, + SCALE_NS, delay_track_timer, blk); +} + +void blk_delay_tracker_destroy(BlockDelayTracker *bdt) +{ + timer_free(bdt->timer); + qemu_mutex_destroy(&bdt->lock); + assert(QTAILQ_EMPTY(&bdt->requests)); + g_free(bdt); +} + +void blk_set_delay_report_threshold(BlockBackend *blk, uint64_t ns) +{ + BlockDelayTracker *bdt =3D blk_delay_tracker(blk); + + WITH_QEMU_LOCK_GUARD(&bdt->lock) { + bdt->threshold_ns[BLOCK_DELAY_REPORT] =3D ns; + } + + /* Wake the timer immediately to adjust to the new threshold */ + timer_mod(bdt->timer, 0); +} + +void blk_set_delay_stop_threshold(BlockBackend *blk, uint64_t ns) +{ + BlockDelayTracker *bdt =3D blk_delay_tracker(blk); + + WITH_QEMU_LOCK_GUARD(&bdt->lock) { + bdt->threshold_ns[BLOCK_DELAY_STOP] =3D ns; + } + + /* Wake the timer immediately to adjust to the new threshold */ + timer_mod(bdt->timer, 0); +} + +void blk_track_delay_begin(BlockBackend *blk, + BlockDelayTrackerRequest *request, + int64_t offset, + uint64_t bytes, + IoAccountingOperation op_type) +{ + BlockDelayTracker *bdt =3D blk_delay_tracker(blk); + + *request =3D (BlockDelayTrackerRequest) { + .offset =3D offset, + .bytes =3D bytes, + .op_type =3D op_type, + }; + + WITH_QEMU_LOCK_GUARD(&bdt->lock) { + if (!bdt->threshold_ns[BLOCK_DELAY_REPORT] && + !bdt->threshold_ns[BLOCK_DELAY_STOP]) { + /* Must be so by 0-initialization of .list */ + assert(!QTAILQ_IN_USE(request, list)); + return; + } + + /* Set this under the lock so `bdt->requests` is correctly ordered= */ + request->start_time_ns =3D qemu_clock_get_ns(bdt->clock_type); + QTAILQ_INSERT_TAIL(&bdt->requests, request, list); + } + +} + +void blk_track_delay_end(BlockBackend *blk, + BlockDelayTrackerRequest *request, + int ret) +{ + BlockDelayTracker *bdt =3D blk_delay_tracker(blk); + bool need_done_event =3D false; + + if (!QTAILQ_IN_USE(request, list)) { + return; + } + + WITH_QEMU_LOCK_GUARD(&bdt->lock) { + for (int i =3D 0; i < BLOCK_DELAY__MAX; i++) { + need_done_event |=3D request->threshold_exceeded[i]; + } + QTAILQ_REMOVE(&bdt->requests, request, list); + } + + /* `device_path` is set if and only if any `threshold_exceeded` are se= t */ + assert(!!request->device_path =3D=3D need_done_event); + + if (need_done_event) { + DelayEvent *event =3D g_new(DelayEvent, 1); + uint64_t now =3D qemu_clock_get_ns(bdt->clock_type); + + *event =3D (DelayEvent) { + .device_path =3D request->device_path, + .op_type =3D request->op_type, + .duration_ns =3D usub64_saturate(now, request->start_time_ns), + .ret =3D ret, + .has_offset =3D request->offset >=3D 0, + .offset =3D request->offset, + .bytes =3D request->bytes, + }; + + /* + * Emit the event in the main loop, where the timer runs, too, so = we + * always emit BLOCK_IO_DONE after all corresponding BLOCK_IO_DELAY + * events. + */ + aio_bh_schedule_oneshot(qemu_get_aio_context(), send_done_event, e= vent); + } +} + +/** + * Send a BLOCK_IO_DONE event from the `DelayEvent` given via `opaque`. + * + * This event, and the `device_path` in it, are freed via `g_free()`. + */ +static void send_done_event(void *opaque) +{ + DelayEvent *event =3D opaque; + + qapi_event_send_block_io_done(event->device_path, + event->op_type, + event->duration_ns, + event->has_offset, event->offset, + event->bytes, + event->ret < 0); + g_free(event->device_path); + g_free(event); +} + +/** + * Track and periodically check for stalled requests. + * + * @opaque is the `BlockBackend`. + * + * Emits events when requests take longer than the BLOCK_DELAY_REPORT + * threshold, and stops the VM if one takes longer than the BLOCK_DELAY_ST= OP + * threshold. + * + * Handles spurious wakes. + */ +static void delay_track_timer(void *opaque) +{ + BlockBackend *blk =3D opaque; + BlockDelayTracker *bdt =3D blk_delay_tracker(blk); + g_autofree char *dev_path =3D NULL; + bool stop_vm =3D false; + uint64_t now; + /* When to wake up next */ + uint64_t timer_time =3D INT64_MAX; + /* List of events to emit */ + QTAILQ_HEAD(, DelayEvent) delay_events =3D + QTAILQ_HEAD_INITIALIZER(delay_events); + + WITH_QEMU_LOCK_GUARD(&bdt->lock) { + now =3D qemu_clock_get_ns(bdt->clock_type); + + for (int i =3D 0; i < BLOCK_DELAY__MAX; i++) { + BlockDelayTrackerRequest *request; + uint64_t threshold_ns =3D bdt->threshold_ns[i]; + + if (!threshold_ns) { + continue; + } + + /* + * Sleep at most for the duration of this threshold, so that we + * will regularly check new requests as they come in. + */ + timer_time =3D MIN(timer_time, uadd64_saturate(now, threshold_= ns)); + + QTAILQ_FOREACH(request, &bdt->requests, list) { + DelayEvent *evt; + char *req_dev_path; + uint64_t duration_ns; + + /* + * New requests are entered at the end of the list, so it + * is always sorted by start_time_ns (ascending). We can + * stop iterating on the first request that is not yet old= er + * than the delay threshold. + */ + duration_ns =3D usub64_saturate(now, request->start_time_n= s); + if (duration_ns < threshold_ns) { + /* + * Ensure waking when we need to emit a delay event for + * this request, the one closest to the delay threshol= d. + */ + timer_time =3D MIN(timer_time, + uadd64_saturate(request->start_time_n= s, + threshold_ns)); + break; + } + + /* Only emit a delay event once */ + if (request->threshold_exceeded[i]) { + continue; + } + + /* + * Always use the same device path for a single request, s= o use + * the cached path if it exists already. Otherwise, use t= he + * current device path. + */ + req_dev_path =3D request->device_path ?: dev_path; + if (!req_dev_path) { + assert(!request->device_path && !dev_path); + + /* + * Fine to call under `BlockDelayTracker.lock` because= this + * will not take a lock itself. + * The alternative would be to either call it before t= he + * lock (not yet knowing if there will be delayed requ= ests), + * or call it after, at which point `request` may no l= onger + * be alive, which would disallow putting the result i= nto + * `request`. We want to put it into `request`, though= , so + * the `BLOCK_IO_DONE` event will always emit the same= path + * as the `BLOCK_IO_DELAY` event(s) before. + * So, in order to call `blk_get_attached_dev_path()` = only + * when needed and to make `request->device_path` work= as a + * per-request cache, we have to call it under the loc= k. + */ + req_dev_path =3D dev_path =3D blk_get_attached_dev_pat= h(blk); + } + + evt =3D g_new(DelayEvent, 1); + *evt =3D (DelayEvent) { + .device_path =3D g_strdup(req_dev_path), + .op_type =3D request->op_type, + .duration_ns =3D duration_ns, + .action =3D i =3D=3D BLOCK_DELAY_REPORT + ? BLOCK_ERROR_ACTION_REPORT + : BLOCK_ERROR_ACTION_STOP, + .has_offset =3D request->offset >=3D 0, + .offset =3D request->offset, + .bytes =3D request->bytes, + }; + QTAILQ_INSERT_TAIL(&delay_events, evt, next); + + /* For BLOCK_IO_DONE */ + if (!request->device_path) { + request->device_path =3D g_strdup(req_dev_path); + } + request->threshold_exceeded[i] =3D true; + + if (i =3D=3D BLOCK_DELAY_STOP) { + stop_vm =3D true; + } + } + } + } + + if (stop_vm) { + qemu_system_vmstop_request_prepare(); + } + while (!QTAILQ_EMPTY(&delay_events)) { + DelayEvent *evt =3D QTAILQ_FIRST(&delay_events); + QTAILQ_REMOVE(&delay_events, evt, next); + + qapi_event_send_block_io_delay(evt->device_path, evt->op_type, + evt->duration_ns, evt->action, + evt->has_offset, evt->offset, + evt->bytes); + g_free(evt->device_path); + g_free(evt); + } + if (stop_vm) { + qemu_system_vmstop_request(RUN_STATE_IO_HANG); + } + + if (timer_time < INT64_MAX) { + timer_mod_ns(bdt->timer, timer_time); + } +} diff --git a/block/block-backend.c b/block/block-backend.c index 78678986466..badc3986f9e 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -12,6 +12,7 @@ =20 #include "qemu/osdep.h" #include "system/block-backend.h" +#include "block/block-backend-delay.h" #include "block/block_int.h" #include "block/blockjob.h" #include "block/coroutines.h" @@ -93,6 +94,8 @@ struct BlockBackend { * Accessed with atomic ops. */ unsigned int in_flight; + + BlockDelayTracker *delay_tracker; }; =20 typedef struct BlockBackendAIOCB { @@ -377,6 +380,9 @@ BlockBackend *blk_new(AioContext *ctx, uint64_t perm, u= int64_t shared_perm) notifier_list_init(&blk->insert_bs_notifiers); QLIST_INIT(&blk->aio_notifiers); =20 + blk->delay_tracker =3D g_new0(BlockDelayTracker, 1); + blk_delay_tracker_init(blk); + QTAILQ_INSERT_TAIL(&block_backends, blk, link); return blk; } @@ -481,6 +487,9 @@ static void blk_delete(BlockBackend *blk) assert(!blk->refcnt); assert(!blk->name); assert(!blk->dev); + + blk_delay_tracker_destroy(blk->delay_tracker); + if (blk->public.throttle_group_member.throttle_state) { blk_io_limits_disable(blk); } @@ -764,6 +773,12 @@ BlockDriverState *blk_bs(BlockBackend *blk) return blk->root ? blk->root->bs : NULL; } =20 +BlockDelayTracker *blk_delay_tracker(BlockBackend *blk) +{ + IO_OR_GS_CODE(); + return blk->delay_tracker; +} + static BlockBackend * GRAPH_RDLOCK bdrv_first_blk(BlockDriverState *bs) { BdrvChild *child; @@ -1338,6 +1353,7 @@ blk_co_do_preadv_part(BlockBackend *blk, int64_t offs= et, int64_t bytes, ThrottleGroupMember *tgm =3D &blk->public.throttle_group_member; int ret; BlockDriverState *bs; + BlockDelayTrackerRequest request; IO_CODE(); =20 blk_wait_while_drained(blk, flags); @@ -1353,6 +1369,8 @@ blk_co_do_preadv_part(BlockBackend *blk, int64_t offs= et, int64_t bytes, } =20 bdrv_inc_in_flight(bs); + blk_track_delay_begin(blk, &request, offset, bytes, + IO_ACCOUNTING_OPERATION_READ); =20 /* throttling disk I/O */ if (qatomic_load_acquire(&tgm->throttle_state)) { @@ -1361,6 +1379,7 @@ blk_co_do_preadv_part(BlockBackend *blk, int64_t offs= et, int64_t bytes, =20 ret =3D bdrv_co_preadv_part(blk->root, offset, bytes, qiov, qiov_offse= t, flags); + blk_track_delay_end(blk, &request, ret); bdrv_dec_in_flight(bs); return ret; } @@ -1413,6 +1432,7 @@ blk_co_do_pwritev_part(BlockBackend *blk, int64_t off= set, int64_t bytes, ThrottleGroupMember *tgm =3D &blk->public.throttle_group_member; int ret; BlockDriverState *bs; + BlockDelayTrackerRequest request; IO_CODE(); =20 blk_wait_while_drained(blk, flags); @@ -1428,6 +1448,8 @@ blk_co_do_pwritev_part(BlockBackend *blk, int64_t off= set, int64_t bytes, } =20 bdrv_inc_in_flight(bs); + blk_track_delay_begin(blk, &request, offset, bytes, + IO_ACCOUNTING_OPERATION_WRITE); /* throttling disk I/O */ if (qatomic_load_acquire(&tgm->throttle_state)) { throttle_group_co_io_limits_intercept(tgm, bytes, THROTTLE_WRITE); @@ -1439,6 +1461,7 @@ blk_co_do_pwritev_part(BlockBackend *blk, int64_t off= set, int64_t bytes, =20 ret =3D bdrv_co_pwritev_part(blk->root, offset, bytes, qiov, qiov_offs= et, flags); + blk_track_delay_end(blk, &request, ret); bdrv_dec_in_flight(bs); return ret; } @@ -1803,6 +1826,7 @@ static int coroutine_fn blk_co_do_pdiscard(BlockBackend *blk, int64_t offset, int64_t bytes, BdrvRequestFlags flags) { + BlockDelayTrackerRequest request; int ret; IO_CODE(); =20 @@ -1814,7 +1838,12 @@ blk_co_do_pdiscard(BlockBackend *blk, int64_t offset= , int64_t bytes, return ret; } =20 - return bdrv_co_pdiscard(blk->root, offset, bytes); + blk_track_delay_begin(blk, &request, offset, bytes, + IO_ACCOUNTING_OPERATION_UNMAP); + ret =3D bdrv_co_pdiscard(blk->root, offset, bytes); + blk_track_delay_end(blk, &request, ret); + + return ret; } =20 static void coroutine_fn blk_aio_pdiscard_entry(void *opaque) @@ -1851,6 +1880,8 @@ int coroutine_fn blk_co_pdiscard(BlockBackend *blk, i= nt64_t offset, /* To be called between exactly one pair of blk_inc/dec_in_flight() */ static int coroutine_fn blk_co_do_flush(BlockBackend *blk) { + BlockDelayTrackerRequest request; + int ret; IO_CODE(); blk_wait_while_drained(blk, 0); GRAPH_RDLOCK_GUARD(); @@ -1859,7 +1890,12 @@ static int coroutine_fn blk_co_do_flush(BlockBackend= *blk) return -ENOMEDIUM; } =20 - return bdrv_co_flush(blk_bs(blk)); + blk_track_delay_begin(blk, &request, -1, 0, + IO_ACCOUNTING_OPERATION_FLUSH); + ret =3D bdrv_co_flush(blk_bs(blk)); + blk_track_delay_end(blk, &request, ret); + + return ret; } =20 static void coroutine_fn blk_aio_flush_entry(void *opaque) @@ -2072,6 +2108,7 @@ int coroutine_fn blk_co_zone_mgmt(BlockBackend *blk, = BlockZoneOp op, int coroutine_fn blk_co_zone_append(BlockBackend *blk, int64_t *offset, QEMUIOVector *qiov, BdrvRequestFlags flags) { + BlockDelayTrackerRequest request; int ret; IO_CODE(); =20 @@ -2083,7 +2120,10 @@ int coroutine_fn blk_co_zone_append(BlockBackend *bl= k, int64_t *offset, return -ENOMEDIUM; } =20 + blk_track_delay_begin(blk, &request, *offset, qiov->size, + IO_ACCOUNTING_OPERATION_ZONE_APPEND); ret =3D bdrv_co_zone_append(blk_bs(blk), offset, qiov, flags); + blk_track_delay_end(blk, &request, ret); blk_dec_in_flight(blk); return ret; } diff --git a/block/meson.build b/block/meson.build index bc419aebf08..f758c82f3c9 100644 --- a/block/meson.build +++ b/block/meson.build @@ -8,6 +8,7 @@ block_ss.add(files( 'blklogwrites.c', 'blkverify.c', 'block-backend.c', + 'block-backend-delay.c', 'block-copy.c', 'commit.c', 'copy-before-write.c', --=20 2.55.0 From nobody Mon Nov 23 04:44:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1792434151; cv=none; d=zohomail.com; s=zohoarc; b=AL5akxjH76MgM4d+XkhZWXX9W5XQqn85L1Jv9dIIE6cILZCKHSC3Juptgjs2oviA1iKrBMCZN+bt7bqJjpQcDplzAcrq6EP3gFQgSDTJtTkUBzbS/KVExDLLqprHfRAA+rUbh5EkVPLBWcBi89ujYT3f1hHyxdrbSXGVONwN+zw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792434151; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=M19r5WuxN7wvAW9brJF3ugoKQeVERy7dE+Mtvf+bc9c=; b=Y1wcpQLbX1khwoaz5y2GUDZ77lIpbs9yt7ikqXQ1aXmDq0zorqTeWOABxhNn4xRxlI9h4WT32hi+K05xYpaM1giYgBd1eG0V8phX9Z9N7eIlbuVCPcpvFqL+SrIbcdRNbH9n+69XlQf7PYw24mPbDgXLy/3G7gqbBEvnGAhPWJk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792434151128647.1009499746335; Mon, 19 Oct 2026 11:22:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xIrzP-0006ph-L9; Mon, 19 Oct 2026 14:21:40 -0400 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 1xIryu-0006Vy-27 for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:21:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xIryr-0005rh-GG for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:21:07 -0400 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-300-y6aKPdtFPwqIGHRczOIKKQ-1; Mon, 19 Oct 2026 18:21:02 +0000 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-49953abe51fso18872685e9.1 for ; Mon, 19 Oct 2026 11:21:01 -0700 (PDT) Received: from localhost (p200300cfd705ccf50633a9a8543b8b67.dip0.t-ipconnect.de. [2003:cf:d705:ccf5:633:a9a8:543b:8b67]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a1cca30aa5sm12676305e9.2.2026.10.19.11.20.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Oct 2026 11:20:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1792434064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M19r5WuxN7wvAW9brJF3ugoKQeVERy7dE+Mtvf+bc9c=; b=COG+/+hG6b67QVQOCTFLjv1xBXddLKu9pF3R9TXye8oAFihWnhFMeA5RpW6LbPny1idj+h Fr64yFme+tzcODjXuXVrAZFVJKSpsrdNiWvD3r4TpOeLFlMqyoCDZkXfn8LUkEym/fgYiK kZagHo9n07cUTsExTU/Sz24jTcl/Cfo= X-MC-Unique: y6aKPdtFPwqIGHRczOIKKQ-1 X-Mimecast-MFC-AGG-ID: y6aKPdtFPwqIGHRczOIKKQ_1792434061 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1792434061; x=1793038861; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=M19r5WuxN7wvAW9brJF3ugoKQeVERy7dE+Mtvf+bc9c=; b=kjGfMb6gISFb4J+5hmEmRaZeQJZU48YBQwW+mH9/c5U1bFbthhMcyKa4AhykdhiFJS ogIeHXTisQlq8A/T5QtN5n42LZJeoWxDxDH6pZwTVaHaeFLNKSuEBb5L80+bc9KjaBK8 rHR16sTlWpk+8yO8fz/y0loCHZCVkNMcTmwJZwyUnJm6Tj0fviA1wYQFrlYYvby/Rm3O LBCwQUHSR7ISqT8OAIz00F62jOD8E7ZTevQDUKM2RRznsdPV/hM3uUBQYUhWSV8Nq3+r QzHS0hV/h8lBU5T4R7P5cE6RkhKREWvf4Yaafpzz9+3saulRXMoO8ZFGqFNiyItS7lBW v8Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792434061; x=1793038861; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=M19r5WuxN7wvAW9brJF3ugoKQeVERy7dE+Mtvf+bc9c=; b=hn8Th1T6NlBUPsex7BvGPHtv4mN3eoofb9VH/KSbQ1W/SqtPoK40qTkuCdOjjxu2gx pNygKuF6a/2l5MC3SJ/kXMZGDI/4kTycbKtaeYImhW7HYjyfy6cbCFtwpGqOFzkUDppG flwDZXFppB0d5Klgp/V1Tqh44ksVIKdNHm0C+pgKZwy6leXL8dY1bIj5KkJDXMpxE+2X jWKUrnE9TYbjfJbT+7zkFU3xk/cAi3O+Hi4DfRNCcKGFm0KIT1ojdkSQDFqOzl1/Pd/d LeyomSBzXQkDz7q8JnBhnFJjBfVWyJTzb0GdAaYWV99CLpl9HM9YjEYgJ3MCjMfDRQ11 WQnw== X-Gm-Message-State: AFq9FYIMdQwMrvVW+6EOLNb+lphEtXgTdL7UoPb6kGL6OMPp13jHFLLc UNUGfAihZS7ragJVX/cjzqG9X493CZL7XcclhhDglOqC+LrnXlHU9VR4zDthwLKCahU52V3L1kH qjI3ZMmE+l53kE399kBXOsj+0f7HCF9+Yledv1TSLWW1q19mc57cGdCxC X-Gm-Gg: AYBFou318GanL39oBy4w/6zHOPRGMHmd1ClRCLidWncdwtnc6N5qjdmGmNFFkYdsCcr fHQDgeBlXBukJtWhfSVmN0Q8tM+GR8ADaPXt5h+yrBXHppDCpIAZ6qawxnyHgd/vQ4R41VbTdtK OL8XsxBIiNBkDT3GDoAl7Vt7KqPt9LXdUA8gmu9wktebdSKVO/c/kPQWhsZZCIe1OunCbDYHXuG fOw++Eem+dRVFZwEUhpimtYaHoUaw7s1DUddcnqLqgM1boGEwitHT+jZ2frtRWFNHfJBstPzng2 op0g1cVOeGeS2x5EIYarKeKvcsV5pnbYmCDROCxOo7kaDS0gdMod0OCdtk02zh8dUDZ38ufTNAn neWdE3G0Nw1cBy6S6xvsOjqLLuqY3DAwH7rrt3tdqkLpv40No+fEogC5iKg== X-Received: by 2002:a05:600c:8b6f:b0:4a1:cef3:fb3a with SMTP id 5b1f17b1804b1-4a1d75f23e2mr161353435e9.9.1792434060656; Mon, 19 Oct 2026 11:21:00 -0700 (PDT) X-Received: by 2002:a05:600c:8b6f:b0:4a1:cef3:fb3a with SMTP id 5b1f17b1804b1-4a1d75f23e2mr161352935e9.9.1792434060145; Mon, 19 Oct 2026 11:21:00 -0700 (PDT) From: Hanna Czenczek To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Hanna Czenczek , Kevin Wolf , John Snow , "Denis V . Lunev" , Eric Blake , Markus Armbruster , Stefan Hajnoczi , Paolo Bonzini Subject: [PATCH v2 11/12] block: Add delay-report-ns and delay-stop-ns props Date: Mon, 19 Oct 2026 20:20:27 +0200 Message-ID: <20261019182028.45305-12-hreitz@redhat.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261019182028.45305-1-hreitz@redhat.com> References: <20261019182028.45305-1-hreitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.329, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1792434151971158500 Content-Type: text/plain; charset="utf-8" These device properties allow setting up I/O latency thresholds for when to report an I/O operation delay via QMP event (BLOCK_IO_DELAY) or when to stop the VM. Signed-off-by: Hanna Czenczek --- include/hw/block/block.h | 8 +++- blockdev.c | 16 ++++++++ hw/block/block.c | 7 ++++ tests/qemu-iotests/172.out | 76 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 106 insertions(+), 1 deletion(-) diff --git a/include/hw/block/block.h b/include/hw/block/block.h index df941df19f2..3edc33a0339 100644 --- a/include/hw/block/block.h +++ b/include/hw/block/block.h @@ -36,6 +36,8 @@ typedef struct BlockConf { BlockdevOnError werror; uint32_t num_stats_intervals; uint32_t *stats_intervals; + uint64_t delay_report_ns; + uint64_t delay_stop_ns; } BlockConf; =20 static inline unsigned int get_physical_block_exp(BlockConf *conf) @@ -83,7 +85,11 @@ static inline unsigned int get_physical_block_exp(BlockC= onf *conf) _conf.account_failed, ON_OFF_AUTO_AUTO), \ DEFINE_PROP_ARRAY("stats-intervals", _state, \ _conf.num_stats_intervals, _conf.stats_intervals, \ - qdev_prop_uint32, uint32_t) + qdev_prop_uint32, uint32_t), \ + DEFINE_PROP_UINT64("delay-report-ns", _state, _conf.delay_report_ns,\ + 0), \ + DEFINE_PROP_UINT64("delay-stop-ns", _state, _conf.delay_stop_ns, \ + 0) =20 #define DEFINE_BLOCK_PROPERTIES(_state, _conf) \ DEFINE_PROP_DRIVE("drive", _state, _conf.blk), \ diff --git a/blockdev.c b/blockdev.c index 6e86c6262f9..90d94900645 100644 --- a/blockdev.c +++ b/blockdev.c @@ -496,6 +496,7 @@ static BlockBackend *blockdev_init(const char *file, QD= ict *bs_opts, BlockdevDetectZeroesOptions detect_zeroes =3D BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF; const char *throttling_group =3D NULL; + uint64_t delay_report_ns, delay_stop_ns; =20 /* Check common options by copying from bs_opts to opts, all other opt= ions * stay in bs_opts for processing by bdrv_open(). */ @@ -580,6 +581,9 @@ static BlockBackend *blockdev_init(const char *file, QD= ict *bs_opts, =20 read_only =3D qemu_opt_get_bool(opts, BDRV_OPT_READ_ONLY, false); =20 + delay_report_ns =3D qemu_opt_get_number(opts, "delay-report-ns", 0); + delay_stop_ns =3D qemu_opt_get_number(opts, "delay-stop-ns", 0); + /* init */ if ((!file || !*file) && !qdict_size(bs_opts)) { BlockBackendRootState *blk_rs; @@ -615,6 +619,8 @@ static BlockBackend *blockdev_init(const char *file, QD= ict *bs_opts, } bs =3D blk_bs(blk); =20 + blk_set_delay_report_threshold(blk, delay_report_ns); + blk_set_delay_stop_threshold(blk, delay_stop_ns); bs->detect_zeroes =3D detect_zeroes; =20 block_acct_setup(blk_get_stats(blk), account_invalid, account_fail= ed, @@ -3753,6 +3759,16 @@ QemuOptsList qemu_common_drive_opts =3D { .type =3D QEMU_OPT_BOOL, .help =3D "whether to account for failed I/O operations " "in the statistics", + },{ + .name =3D "delay-report-ns", + .type =3D QEMU_OPT_NUMBER, + .help =3D "threshold in ns when to report an I/O operation " + "delay via QMP event", + },{ + .name =3D "delay-stop-ns", + .type =3D QEMU_OPT_NUMBER, + .help =3D "threshold in ns when to pause the VM because " + "of an I/O operation delay", }, { /* end of list */ } }, diff --git a/hw/block/block.c b/hw/block/block.c index f187fa025d0..82d6f2e7980 100644 --- a/hw/block/block.c +++ b/hw/block/block.c @@ -249,6 +249,13 @@ bool blkconf_apply_backend_options(BlockConf *conf, bo= ol readonly, blk_set_enable_write_cache(blk, wce); blk_set_on_error(blk, rerror, werror); =20 + if (conf->delay_report_ns) { + blk_set_delay_report_threshold(blk, conf->delay_report_ns); + } + if (conf->delay_stop_ns) { + blk_set_delay_stop_threshold(blk, conf->delay_stop_ns); + } + if (!block_acct_setup(blk_get_stats(blk), conf->account_invalid, conf->account_failed, conf->stats_intervals, conf->num_stats_intervals, errp)) { diff --git a/tests/qemu-iotests/172.out b/tests/qemu-iotests/172.out index a023cd407de..97ba78a8d53 100644 --- a/tests/qemu-iotests/172.out +++ b/tests/qemu-iotests/172.out @@ -31,6 +31,8 @@ Testing: account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "288" =20 =20 @@ -61,6 +63,8 @@ Testing: -fda TEST_DIR/t.qcow2 account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) Attached to: /machine/unattached/device[N] @@ -98,6 +102,8 @@ Testing: -fdb TEST_DIR/t.qcow2 account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) @@ -113,6 +119,8 @@ Testing: -fdb TEST_DIR/t.qcow2 account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "288" floppy1 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) Attached to: /machine/unattached/device[N] @@ -154,6 +162,8 @@ Testing: -fda TEST_DIR/t.qcow2 -fdb TEST_DIR/t.qcow2.2 account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) @@ -169,6 +179,8 @@ Testing: -fda TEST_DIR/t.qcow2 -fdb TEST_DIR/t.qcow2.2 account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) Attached to: /machine/unattached/device[N] @@ -211,6 +223,8 @@ Testing: -fdb account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "288" dev: floppy, id "" unit =3D 0 (0x0) @@ -226,6 +240,8 @@ Testing: -fdb account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "288" =20 =20 @@ -256,6 +272,8 @@ Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2 account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) Attached to: /machine/unattached/device[N] @@ -293,6 +311,8 @@ Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2,ind= ex=3D1 account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) @@ -308,6 +328,8 @@ Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2,ind= ex=3D1 account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "288" floppy1 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) Attached to: /machine/unattached/device[N] @@ -349,6 +371,8 @@ Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2 -dr= ive if=3Dfloppy,file=3DTEST_DIR/t account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) @@ -364,6 +388,8 @@ Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2 -dr= ive if=3Dfloppy,file=3DTEST_DIR/t account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) Attached to: /machine/unattached/device[N] @@ -409,6 +435,8 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -devi= ce floppy,drive=3Dnone0 account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) Attached to: /machine/peripheral-anon/device[N] @@ -446,6 +474,8 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -devi= ce floppy,drive=3Dnone0,unit=3D1 account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) Attached to: /machine/peripheral-anon/device[N] @@ -483,6 +513,8 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -driv= e if=3Dnone,file=3DTEST_DIR/t.qco account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) @@ -498,6 +530,8 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -driv= e if=3Dnone,file=3DTEST_DIR/t.qco account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) Attached to: /machine/peripheral-anon/device[N] @@ -549,6 +583,8 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file=3D= TEST_DIR/t.qcow2.2 -device fl account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) @@ -564,6 +600,8 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file=3D= TEST_DIR/t.qcow2.2 -device fl account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) Attached to: /machine/unattached/device[N] @@ -606,6 +644,8 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file=3D= TEST_DIR/t.qcow2.2 -device fl account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) @@ -621,6 +661,8 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file=3D= TEST_DIR/t.qcow2.2 -device fl account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) Attached to: /machine/unattached/device[N] @@ -663,6 +705,8 @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=3Dnone,file=3D= TEST_DIR/t.qcow2.2 -device fl account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" dev: floppy, id "" unit =3D 1 (0x1) @@ -678,6 +722,8 @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=3Dnone,file=3D= TEST_DIR/t.qcow2.2 -device fl account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" floppy1 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) Attached to: /machine/unattached/device[N] @@ -720,6 +766,8 @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=3Dnone,file=3D= TEST_DIR/t.qcow2.2 -device fl account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" dev: floppy, id "" unit =3D 1 (0x1) @@ -735,6 +783,8 @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=3Dnone,file=3D= TEST_DIR/t.qcow2.2 -device fl account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" floppy1 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) Attached to: /machine/unattached/device[N] @@ -786,6 +836,8 @@ Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2 -dr= ive if=3Dnone,file=3DTEST_DIR/t.q account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) @@ -801,6 +853,8 @@ Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2 -dr= ive if=3Dnone,file=3DTEST_DIR/t.q account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) Attached to: /machine/unattached/device[N] @@ -843,6 +897,8 @@ Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2 -dr= ive if=3Dnone,file=3DTEST_DIR/t.q account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) @@ -858,6 +914,8 @@ Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2 -dr= ive if=3Dnone,file=3DTEST_DIR/t.q account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) Attached to: /machine/unattached/device[N] @@ -906,6 +964,8 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -glob= al floppy.drive=3Dnone0 -device account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) Attached to: /machine/peripheral-anon/device[N] @@ -973,6 +1033,8 @@ Testing: -device floppy account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "288" =20 Testing: -device floppy,drive-type=3D120 @@ -1000,6 +1062,8 @@ Testing: -device floppy,drive-type=3D120 account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "120" =20 Testing: -device floppy,drive-type=3D144 @@ -1027,6 +1091,8 @@ Testing: -device floppy,drive-type=3D144 account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" =20 Testing: -device floppy,drive-type=3D288 @@ -1054,6 +1120,8 @@ Testing: -device floppy,drive-type=3D288 account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "288" =20 =20 @@ -1084,6 +1152,8 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -de= vice floppy,drive=3Dnone0,drive-t account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "120" none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) Attached to: /machine/peripheral-anon/device[N] @@ -1121,6 +1191,8 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -de= vice floppy,drive=3Dnone0,drive-t account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "288" none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) Attached to: /machine/peripheral-anon/device[N] @@ -1161,6 +1233,8 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -de= vice floppy,drive=3Dnone0,logical account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) Attached to: /machine/peripheral-anon/device[N] @@ -1198,6 +1272,8 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -de= vice floppy,drive=3Dnone0,physica account-invalid =3D "auto" account-failed =3D "auto" stats-intervals =3D + delay-report-ns =3D 0 (0x0) + delay-stop-ns =3D 0 (0x0) drive-type =3D "144" none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) Attached to: /machine/peripheral-anon/device[N] --=20 2.55.0 From nobody Mon Nov 23 04:44:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1792434149; cv=none; d=zohomail.com; s=zohoarc; b=UKWAu9CllqCTSh8xJYWRxt+FMBXjuUZ1jYqQmAwRqoC18DudLDPfqW3x12J4H/2mMaj+/D1G0zIBkrrLKyaTEt4tO+YCsHI18vJGx1rqfAN59ceA3Z/EKDuSEx6YXjv3nvk9mXYviqGt485sYHsk/e14HSupOyomUwn4Ev6hAIE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792434149; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=cA1kYpviYukq6qxxQH3ZLixjfNRZabHCuj4f2iyyXYk=; b=RAeX6Pmsevng/UJrU7yXArdiDnNCQf7mAz1KoPZzs5lNOoJAsyod/pxWo2mQWV+MpPnaZ5gvudef/oqav5FtZSM8eyF2qiUmr33BsDKY0et4P2Jk3F/qxP68RZrEGskG204/YbfBTBQjFe6ZQtqWuTTFSARNBI4vUcON1iDu9dQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792434149202237.56785955670716; Mon, 19 Oct 2026 11:22:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xIrz7-0006co-GD; Mon, 19 Oct 2026 14:21:21 -0400 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 1xIryv-0006WD-0e for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:21:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xIrys-0005ry-PL for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:21:08 -0400 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-281-VfbE-8dBPsOGZVNZP3LVmw-1; Mon, 19 Oct 2026 18:21:04 +0000 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4a1721559b4so25104275e9.1 for ; Mon, 19 Oct 2026 11:21:04 -0700 (PDT) Received: from localhost (p200300cfd705ccf50633a9a8543b8b67.dip0.t-ipconnect.de. [2003:cf:d705:ccf5:633:a9a8:543b:8b67]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a1cdf2f0d1sm173497545e9.2.2026.10.19.11.21.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Oct 2026 11:21:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1792434066; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cA1kYpviYukq6qxxQH3ZLixjfNRZabHCuj4f2iyyXYk=; b=eCSFg3ZRykJVqG2uALn02xQtbxI1fMEgQJ/uyk2GwAPFjOx5hbU5RQSG2zwbHBA3zzPY6B UC16MTu5ipd/IskZFSOHbRi0ZRGzJ03wy41ac4Cxr9p5Lp7flEEfH2QjMr7N/sO2gEw2km iYYJ4UWcCJwiVj5kEwFu6EnUtiF90kw= X-MC-Unique: VfbE-8dBPsOGZVNZP3LVmw-1 X-Mimecast-MFC-AGG-ID: VfbE-8dBPsOGZVNZP3LVmw_1792434063 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1792434063; x=1793038863; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=cA1kYpviYukq6qxxQH3ZLixjfNRZabHCuj4f2iyyXYk=; b=dnzIyHH0oTXHf8Qsxogg10h4naavdRts8to6IRtBALZpNef2f1IEea9E8bfgJ6Igji M7xacXKWGEVLTMpMO/xbVMeYoZwYUlsxPKwipdGoWOQeyvr/bbn6pKXg2Ko88YBwpTOj LTu7+PAYr1NGsngvR3sV23God8stnFoX5Kdd76ui9L7Sl7Q0dpm0WRRZhikFXu/+cP/Z WOnFoAQL2wPZt/Fh3SekVpl9eXXkzy71gnSqGb/C3t3PbaPnsiJCveNMaComz4RUsFjY aKmRwQ94DoZG4kCOxfFLeX8Amt97kg/Uza6mMY9xH0pJ3HihraInXq6BkXBQypKm1ltQ tVzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792434063; x=1793038863; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=cA1kYpviYukq6qxxQH3ZLixjfNRZabHCuj4f2iyyXYk=; b=x8JYhUzskQzJEL2D1p0+MuC6CfJZ+CUoE2zmAJsLZ+MeHUamZoPshEcn+OIgc/IL9r vlIdwt88rp4CNn48zSoeK+648IG+1+SBr6+8m0nJBzbgJRqxImSvxIIwVzZGZ6RTwdqJ pth2ObnL116k/lXAHvRDLN8+xLYbPff3mpC/ftpgAvgJERLg+GYd5l6JIsP8nuKR83sV KnCdfgA5Rf3OHVzAZHwPrd9AgF2SKsiw4SX5v6LgSBMTBJTVDJjsFu1/h2F+wNkIehMN KyUm+gRUxaI0D6DxgFIh0X5WetxLMuQ/a8xB9IpWFmjOic3IlbUIQCyxnGwcSCndKaxW cTzQ== X-Gm-Message-State: AFq9FYJUx+vT0Sqs9MiUmgprBRo8MW0DUFON3BOA48VVVpdL7epTtNI3 cG0BP5QUmJXTxJGFZy0+6Eb0zRV3VcncNOaAghlYhrSIQBObw3eWx1+Tt15txXEaIma3/V4Z+di icNn3okrphaxtuoIENwJXtZ6B+835YVxM2OpWqPx5URdjdnFFi9jXo8Yl X-Gm-Gg: AYBFou2KMsweW2/vL/RSjtfinMfNnHpMJfVK/iHi6NGaT+Ud/HjnAvmOIvyoVSp0Taw aWlc/YZ5x3Kw855qcFqbRn0hKt7gKYY16XIJVFFwURqrkoUSGYulI68rP8RGXm8TCtumAUe0gC3 FYzlfbQasTxI0Vu/cW4E6xILYsoixpDklkdOWcfZRDZ5Kz7YKGVhY9/CKW6fnPk7lpeAtWAjxVQ 2Vc2akO7QBZG5g/b2fUuCOP+1YdxFMP4n62c3U2Dv/Be7rIvKXwMScO7Lcy41LRfg2iU3KXTFZf lvdX4kyobPpX/F2Q9LdC3BkWYrKh+PTkpA455HGg3NfVNcXzVtQA05XCnP8rteaRGo3F8uor3lq ykeZRsjSB3WvxuYnIWSDWGQyK1muznhLw3jszfuH5pmWTMQsRMUQpMUwd X-Received: by 2002:a05:600c:4e8a:b0:49f:ffd0:4039 with SMTP id 5b1f17b1804b1-4a1d763ca4amr170445945e9.32.1792434063121; Mon, 19 Oct 2026 11:21:03 -0700 (PDT) X-Received: by 2002:a05:600c:4e8a:b0:49f:ffd0:4039 with SMTP id 5b1f17b1804b1-4a1d763ca4amr170445455e9.32.1792434062535; Mon, 19 Oct 2026 11:21:02 -0700 (PDT) From: Hanna Czenczek To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Hanna Czenczek , Kevin Wolf , John Snow , "Denis V . Lunev" , Eric Blake , Markus Armbruster , Stefan Hajnoczi , Paolo Bonzini Subject: [PATCH v2 12/12] iotests: Add io-delay-reporting test Date: Mon, 19 Oct 2026 20:20:28 +0200 Message-ID: <20261019182028.45305-13-hreitz@redhat.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261019182028.45305-1-hreitz@redhat.com> References: <20261019182028.45305-1-hreitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.329, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1792434149946158500 Content-Type: text/plain; charset="utf-8" Test delay-report-ns and delay-stop-ns via HMP qemu-io (break, aio_read, resume) on a null node (with blkdebug). Signed-off-by: Hanna Czenczek --- tests/qemu-iotests/tests/io-delay-reporting | 187 ++++++++++++++++++ .../qemu-iotests/tests/io-delay-reporting.out | 90 +++++++++ 2 files changed, 277 insertions(+) create mode 100755 tests/qemu-iotests/tests/io-delay-reporting create mode 100644 tests/qemu-iotests/tests/io-delay-reporting.out diff --git a/tests/qemu-iotests/tests/io-delay-reporting b/tests/qemu-iotes= ts/tests/io-delay-reporting new file mode 100755 index 00000000000..7a51d2c4063 --- /dev/null +++ b/tests/qemu-iotests/tests/io-delay-reporting @@ -0,0 +1,187 @@ +#!/usr/bin/env python3 +# group: rw +# +# Test the I/O delay QMP event. +# +# Copyright (C) 2026 Red Hat, Inc. +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Creator/Owner: Hanna Czenczek + +import asyncio +import iotests +from iotests import filter_qmp_event, log + +DELAY_REPORT_MS =3D 5000 # ms +DELAY_STOP_MS =3D 10000 # ms +EPSILON_MS =3D 50 # ms -- small delta that can safely be added/subtracted +NS_PER_MS =3D 1000 * 1000 +DELAY_REPORT_NS =3D DELAY_REPORT_MS * NS_PER_MS +DELAY_STOP_NS =3D DELAY_STOP_MS * NS_PER_MS + +qtest_clock =3D 0 # ms + +iotests.script_initialize() + +def vm_qemu_io(qvm, virtio_blk_id, cmd): + log(f'[HMP] qemu-io to {virtio_blk_id}: {cmd}') + command_line=3Df'qemu-io -d {virtio_blk_id}/virtio-backend "{cmd}"' + log(qvm.qmp('human-monitor-command', command_line=3Dcommand_line)) + +def advance_clock_to(qvm, clock_ms): + """ + Retain the current absolute clock time so we can step *to* a specific = time + via `clock_step`. + """ + + # pylint does not like global much, but this is a test script, and not + # using global would just make this more complicated. + global qtest_clock # pylint: disable=3Dglobal-statement + msecs =3D clock_ms - qtest_clock + log(f'[qtest] clock_step {msecs}ms to {clock_ms}ms') + qvm.qtest(f'clock_step {msecs * NS_PER_MS}') + qtest_clock +=3D msecs + +def reset_clock(): + """ + Reset the internal qtest clock to 0; use before launching a new VM. + """ + + global qtest_clock # pylint: disable=3Dglobal-statement + qtest_clock =3D 0 + +def await_event(qvm, match): + evt =3D qvm.event_wait(match, timeout=3D30.0) + assert evt is not None + return evt + +def assert_no_event(qvm, event_name): + try: + evt =3D qvm.event_wait(event_name, timeout=3D0.1) + assert evt is None, f'Unexpected {event_name} event: {evt}' + except asyncio.TimeoutError: + pass + log(f'(No {event_name} event)') + +def run(error): + """ + If @error is False, run both requests normally. + If it is True, inject an error into the second one. + """ + + log('') + log(f'=3D=3D=3D Running tests with error=3D{error} =3D=3D=3D') + log('') + + reset_clock() + with iotests.VM() as vm: + # Cannot use null-co.latency-ns, as that uses realtime (not qtest = time) + # Need to use raw to get the read_aio event working + opts =3D { + 'driver': 'raw', + 'node-name': 'test-node', + 'file': { + 'driver': 'blkdebug', + 'image': { + 'driver': 'null-co', + }, + }, + } + if error: + opts['file']['inject-error'] =3D [{ + 'event': 'read_aio', + 'iotype': 'read', + 'sector': str(4096 // 512), + 'once': 'on', + }] + vm.add_blockdev(vm.qmp_to_opts(opts)) + + vm.launch() + + log(f'[QMP] device_add id=3Dvblk delay-report-ns=3D{DELAY_REPORT_N= S} ' + f'delay-stop-ns=3D{DELAY_STOP_NS}') + log(vm.qmp('device_add', { + 'driver': 'virtio-blk', + 'id': 'vblk', + 'drive': 'test-node', + 'delay-report-ns': DELAY_REPORT_NS, + 'delay-stop-ns': DELAY_STOP_NS, + })) + + try: + vm_qemu_io(vm, 'vblk', 'break read_aio read_0') + vm_qemu_io(vm, 'vblk', 'aio_read 0k 4k') + vm_qemu_io(vm, 'vblk', 'wait_break read_0') + + vm_qemu_io(vm, 'vblk', 'break read_aio read_1') + vm_qemu_io(vm, 'vblk', 'aio_read 4k 4k') + vm_qemu_io(vm, 'vblk', 'wait_break read_1') + + advance_clock_to(vm, DELAY_REPORT_MS - EPSILON_MS) + + # Assert there is no event before the step + assert_no_event(vm, 'BLOCK_IO_DELAY') + + advance_clock_to(vm, DELAY_REPORT_MS) + + # But now there should be, right on time + events =3D [await_event(vm, 'BLOCK_IO_DELAY'), + await_event(vm, 'BLOCK_IO_DELAY')] + events.sort(key=3Dlambda event: event['data']['offset']) + for event in events: + log(event, filters=3D[filter_qmp_event]) + + # Have the read_0 request finish -- advance clock to test the + # correct duration + advance_clock_to(vm, DELAY_REPORT_MS + EPSILON_MS) + vm_qemu_io(vm, 'vblk', 'resume read_0') + log(await_event(vm, 'BLOCK_IO_DONE'), filters=3D[filter_qmp_ev= ent]) + + # Let read_1 hang for longer to trigger a STOP + advance_clock_to(vm, DELAY_STOP_MS) + + # Read the pre-STOP notification + log(await_event(vm, 'BLOCK_IO_DELAY'), filters=3D[filter_qmp_e= vent]) + + # Then the actual STOP + log(await_event(vm, 'STOP'), filters=3D[filter_qmp_event]) + log('[QMP] query-status') + log(vm.qmp('query-status')) + + # Have the read_1 request finish + advance_clock_to(vm, DELAY_STOP_MS + EPSILON_MS) + vm_qemu_io(vm, 'vblk', 'resume read_1') + log(await_event(vm, 'BLOCK_IO_DONE'), filters=3D[filter_qmp_ev= ent]) + + log('[QMP] cont') + log(vm.qmp('cont')) + log(await_event(vm, 'RESUME'), filters=3D[filter_qmp_event]) + log('[QMP] query-status') + log(vm.qmp('query-status')) + except Exception: + # The VM will not be able to quit without these requests finis= hed, + # which (without this block) would make the test hang instead = of + # exit if something unexpected goes wrong + vm_qemu_io(vm, 'vblk', 'resume read_0') + vm_qemu_io(vm, 'vblk', 'resume read_1') + raise + + # Test device unplug to verify that stopping the delay tracking ti= mer + # works + log('[QMP] device_del id=3Dvblk') + log(vm.qmp('device_del', id=3D'vblk')) + + # system_reset forces the device unplug to happen + log('[QMP] system_reset') + log(vm.qmp('system_reset')) + + event =3D vm.event_wait('DEVICE_DELETED', 20.0, + {'data': {'device': 'vblk'}}) + assert event is not None + log(event, filters=3D[filter_qmp_event]) + + vm.shutdown() + +run(False) +run(True) diff --git a/tests/qemu-iotests/tests/io-delay-reporting.out b/tests/qemu-i= otests/tests/io-delay-reporting.out new file mode 100644 index 00000000000..99349d2b124 --- /dev/null +++ b/tests/qemu-iotests/tests/io-delay-reporting.out @@ -0,0 +1,90 @@ + +=3D=3D=3D Running tests with error=3DFalse =3D=3D=3D + +[QMP] device_add id=3Dvblk delay-report-ns=3D5000000000 delay-stop-ns=3D10= 000000000 +{"return": {}} +[HMP] qemu-io to vblk: break read_aio read_0 +{"return": ""} +[HMP] qemu-io to vblk: aio_read 0k 4k +{"return": ""} +[HMP] qemu-io to vblk: wait_break read_0 +{"return": ""} +[HMP] qemu-io to vblk: break read_aio read_1 +{"return": ""} +[HMP] qemu-io to vblk: aio_read 4k 4k +{"return": ""} +[HMP] qemu-io to vblk: wait_break read_1 +{"return": ""} +[qtest] clock_step 4950ms to 4950ms +(No BLOCK_IO_DELAY event) +[qtest] clock_step 50ms to 5000ms +{"data": {"action": "report", "bytes": 4096, "latency-ns": 5000000000, "of= fset": 0, "operation": "read", "qom-path": "/machine/peripheral/vblk/virtio= -backend"}, "event": "BLOCK_IO_DELAY", "timestamp": {"microseconds": "USECS= ", "seconds": "SECS"}} +{"data": {"action": "report", "bytes": 4096, "latency-ns": 5000000000, "of= fset": 4096, "operation": "read", "qom-path": "/machine/peripheral/vblk/vir= tio-backend"}, "event": "BLOCK_IO_DELAY", "timestamp": {"microseconds": "US= ECS", "seconds": "SECS"}} +[qtest] clock_step 50ms to 5050ms +[HMP] qemu-io to vblk: resume read_0 +{"return": ""} +{"data": {"bytes": 4096, "failed": false, "latency-ns": 5050000000, "offse= t": 0, "operation": "read", "qom-path": "/machine/peripheral/vblk/virtio-ba= ckend"}, "event": "BLOCK_IO_DONE", "timestamp": {"microseconds": "USECS", "= seconds": "SECS"}} +[qtest] clock_step 4950ms to 10000ms +{"data": {"action": "stop", "bytes": 4096, "latency-ns": 10000000000, "off= set": 4096, "operation": "read", "qom-path": "/machine/peripheral/vblk/virt= io-backend"}, "event": "BLOCK_IO_DELAY", "timestamp": {"microseconds": "USE= CS", "seconds": "SECS"}} +{"event": "STOP", "timestamp": {"microseconds": "USECS", "seconds": "SECS"= }} +[QMP] query-status +{"return": {"running": false, "status": "io-hang"}} +[qtest] clock_step 50ms to 10050ms +[HMP] qemu-io to vblk: resume read_1 +{"return": ""} +{"data": {"bytes": 4096, "failed": false, "latency-ns": 10050000000, "offs= et": 4096, "operation": "read", "qom-path": "/machine/peripheral/vblk/virti= o-backend"}, "event": "BLOCK_IO_DONE", "timestamp": {"microseconds": "USECS= ", "seconds": "SECS"}} +[QMP] cont +{"return": {}} +{"event": "RESUME", "timestamp": {"microseconds": "USECS", "seconds": "SEC= S"}} +[QMP] query-status +{"return": {"running": true, "status": "running"}} +[QMP] device_del id=3Dvblk +{"return": {}} +[QMP] system_reset +{"return": {}} +{"data": {"device": "vblk", "path": "/machine/peripheral/vblk"}, "event": = "DEVICE_DELETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} + +=3D=3D=3D Running tests with error=3DTrue =3D=3D=3D + +[QMP] device_add id=3Dvblk delay-report-ns=3D5000000000 delay-stop-ns=3D10= 000000000 +{"return": {}} +[HMP] qemu-io to vblk: break read_aio read_0 +{"return": ""} +[HMP] qemu-io to vblk: aio_read 0k 4k +{"return": ""} +[HMP] qemu-io to vblk: wait_break read_0 +{"return": ""} +[HMP] qemu-io to vblk: break read_aio read_1 +{"return": ""} +[HMP] qemu-io to vblk: aio_read 4k 4k +{"return": ""} +[HMP] qemu-io to vblk: wait_break read_1 +{"return": ""} +[qtest] clock_step 4950ms to 4950ms +(No BLOCK_IO_DELAY event) +[qtest] clock_step 50ms to 5000ms +{"data": {"action": "report", "bytes": 4096, "latency-ns": 5000000000, "of= fset": 0, "operation": "read", "qom-path": "/machine/peripheral/vblk/virtio= -backend"}, "event": "BLOCK_IO_DELAY", "timestamp": {"microseconds": "USECS= ", "seconds": "SECS"}} +{"data": {"action": "report", "bytes": 4096, "latency-ns": 5000000000, "of= fset": 4096, "operation": "read", "qom-path": "/machine/peripheral/vblk/vir= tio-backend"}, "event": "BLOCK_IO_DELAY", "timestamp": {"microseconds": "US= ECS", "seconds": "SECS"}} +[qtest] clock_step 50ms to 5050ms +[HMP] qemu-io to vblk: resume read_0 +{"return": ""} +{"data": {"bytes": 4096, "failed": false, "latency-ns": 5050000000, "offse= t": 0, "operation": "read", "qom-path": "/machine/peripheral/vblk/virtio-ba= ckend"}, "event": "BLOCK_IO_DONE", "timestamp": {"microseconds": "USECS", "= seconds": "SECS"}} +[qtest] clock_step 4950ms to 10000ms +{"data": {"action": "stop", "bytes": 4096, "latency-ns": 10000000000, "off= set": 4096, "operation": "read", "qom-path": "/machine/peripheral/vblk/virt= io-backend"}, "event": "BLOCK_IO_DELAY", "timestamp": {"microseconds": "USE= CS", "seconds": "SECS"}} +{"event": "STOP", "timestamp": {"microseconds": "USECS", "seconds": "SECS"= }} +[QMP] query-status +{"return": {"running": false, "status": "io-hang"}} +[qtest] clock_step 50ms to 10050ms +[HMP] qemu-io to vblk: resume read_1 +{"return": ""} +{"data": {"bytes": 4096, "failed": true, "latency-ns": 10050000000, "offse= t": 4096, "operation": "read", "qom-path": "/machine/peripheral/vblk/virtio= -backend"}, "event": "BLOCK_IO_DONE", "timestamp": {"microseconds": "USECS"= , "seconds": "SECS"}} +[QMP] cont +{"return": {}} +{"event": "RESUME", "timestamp": {"microseconds": "USECS", "seconds": "SEC= S"}} +[QMP] query-status +{"return": {"running": true, "status": "running"}} +[QMP] device_del id=3Dvblk +{"return": {}} +[QMP] system_reset +{"return": {}} +{"data": {"device": "vblk", "path": "/machine/peripheral/vblk"}, "event": = "DEVICE_DELETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} --=20 2.55.0