From nobody Wed Apr 1 22:20:02 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=1774969484; cv=none; d=zohomail.com; s=zohoarc; b=NtQH+1vkpEhlFIg3hzfqUw3Y0jQbdTkfE6pNU4JzzguorBR4UVcBBHWkA3bg7UmyA6EEXaACuCmNBdhLgHCD4/0QoF1LVWMzEj7+fJWkALdri4js1ziNjh5hiqzlB8o81R1GzmfgIqN4P1wqpXpaI/UdPXk5YH9MoAgK20ghHWY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774969484; h=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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=0w+FkwPEOE9/aTogVmMcduV786B/IV6iPoHRVRGznug=; b=Pp/IkGY/2QUribYawfaN9NE9Dt/QRkdrq5k6LmnbG0tmPlGFMb0RzE/LTN4mbiNLwpOSWlL7SqjixreucACF+kbQogCf5HkrhnAXjLV6/fDIeTr214Ig0lQUxQp+5ffthAhmNed075o3D7aq+140L8J2yOXJx1RVTLEgNJnfUoA= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1774969484945835.8228594472366; Tue, 31 Mar 2026 08:04:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w7adU-0003BC-Er; Tue, 31 Mar 2026 11:04:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w7adT-0003AS-K0 for qemu-devel@nongnu.org; Tue, 31 Mar 2026 11:04: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 1w7adR-0002XK-Cr for qemu-devel@nongnu.org; Tue, 31 Mar 2026 11:04:07 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-380-WqoFMJCsMyG0fIcaYS17fw-1; Tue, 31 Mar 2026 11:04:00 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9C3FC18005AF; Tue, 31 Mar 2026 15:03:59 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.44.50.38]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 192D71954102; Tue, 31 Mar 2026 15:03:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774969443; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0w+FkwPEOE9/aTogVmMcduV786B/IV6iPoHRVRGznug=; b=PQ/QzSowe/+OL/+g7fdcPID2zz1fGxlpGqPBaGmdTgSIKirZrL2hSVScPK8wAsV3n7rh3V Xs4cdR0Fj5sPNVBuV3cOfP7gPtOpo1AlK2MvWIkDSbPg6BMiXjqlAGsE5Tg+4FJCksOmos nSgjSRGtKAU9pjJ9PPsA1EUYc0QnA84= X-MC-Unique: WqoFMJCsMyG0fIcaYS17fw-1 X-Mimecast-MFC-AGG-ID: WqoFMJCsMyG0fIcaYS17fw_1774969439 From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org, peter.maydell@linaro.org Subject: [PULL 1/6] ide: Fix potential assertion failure on VM stop for PIO read error Date: Tue, 31 Mar 2026 17:03:47 +0200 Message-ID: <20260331150352.256332-2-kwolf@redhat.com> In-Reply-To: <20260331150352.256332-1-kwolf@redhat.com> References: <20260331150352.256332-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.54, 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_H2=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=1, RCVD_IN_VALIDITY_RPBL_BLOCKED=1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: 1774969488610154100 Content-Type: text/plain; charset="utf-8" ide_sector_read() as well as its callers neglect to call ide_set_retry() before starting I/O. If the I/O fails, this means that the retry information is stale. In particular, ide_handle_rw_error() has an assertion that s->bus->retry_unit =3D=3D s->unit, which can fail if either there was no previous request or it came from another device on the bus. If the assertion weren't there, a wrong request would be retried after resuming the VM. Fix this by adding a ide_set_retry() call to ide_sector_read(). This affects only reads because ide_transfer_start() does call ide_set_retry(). For writes, the data transfer comes first and the I/O is only started when the data has been read into s->io_buffer, so by that time, ide_set_retry() has been called. For reads, however, the I/O comes first and only then the data is transferred to the guest, so the call in ide_transfer_start() is too late. Buglink: https://redhat.atlassian.net/browse/RHEL-153537 Reported-by: Tingting Mao Signed-off-by: Kevin Wolf Message-ID: <20260326165124.138593-1-kwolf@redhat.com> Signed-off-by: Kevin Wolf --- hw/ide/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/ide/core.c b/hw/ide/core.c index d6719dbf31d..7a15d6cac9b 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -799,6 +799,7 @@ static void ide_sector_read(IDEState *s) s->error =3D 0; /* not needed by IDE spec, but needed by Windows */ sector_num =3D ide_get_sector(s); n =3D s->nsector; + ide_set_retry(s); =20 if (n =3D=3D 0) { ide_transfer_stop(s); --=20 2.53.0 From nobody Wed Apr 1 22:20:02 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=1774969488; cv=none; d=zohomail.com; s=zohoarc; b=bv5HSDZSPBj6WvwP7kRrpJQpXzKjc/fmN98aq/v8IIzhxTqgm4Zrux0VNghVPGkiCS+wibV95UZLAdfJQsPfCjWTobFEHzu//T78fjvwD1uCg/3/R2rY5LjC8ukErckj0UMwRJjK+zTugEANKiynOjMqf1nL/bkk3+ywjB0CfFc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774969488; h=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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=vJPIebSvHta1IUQzeqCUFPwZpsWjYN1JQlABtV3dR5o=; b=IEJ9KfwTrEW848xnmLkXgHS5+6P3q88zBoWku3xKVwMcROEBzBHK8IYwdzEs8epLbkn1/mRPzsDvyZe2RrKcDf5Rfelmx9g/E3ECh3EohtlIS5/ebK+fKhRbxQ1zDEu0hsjc9ehf44wr02ojI/zqNZNik5rKCqyXdYFIU+YdOz4= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1774969488711202.27947544522488; Tue, 31 Mar 2026 08:04:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w7adX-0003G6-RF; Tue, 31 Mar 2026 11:04:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w7adV-0003Bu-D7 for qemu-devel@nongnu.org; Tue, 31 Mar 2026 11:04: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 1w7adT-0002Xt-Jl for qemu-devel@nongnu.org; Tue, 31 Mar 2026 11:04:09 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-594-sTovVP-JP0WenJ1z7xIUlA-1; Tue, 31 Mar 2026 11:04:02 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 890D3195607D; Tue, 31 Mar 2026 15:04:01 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.44.50.38]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 28EBA1954102; Tue, 31 Mar 2026 15:03:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774969446; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vJPIebSvHta1IUQzeqCUFPwZpsWjYN1JQlABtV3dR5o=; b=KjHFuoRdlavu8Jb4BiwLtkcfCED/E7PN5DOpiKkFsXkwjrZddHVKmcmrmMsdrESTUlIhXb J0uJSpmMWiTFQ0msjnEO3hQMD/YwMDtMk+XTYU68In8KOZVkhvIyrgT1nWMDA3Liml7Idn C0w7vNRmLtrZZHs5Bv9UtrLZG2GoMiQ= X-MC-Unique: sTovVP-JP0WenJ1z7xIUlA-1 X-Mimecast-MFC-AGG-ID: sTovVP-JP0WenJ1z7xIUlA_1774969441 From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org, peter.maydell@linaro.org Subject: [PULL 2/6] scsi: Don't consider LOGICAL UNIT NOT SUPPORTED guest recoverable Date: Tue, 31 Mar 2026 17:03:48 +0200 Message-ID: <20260331150352.256332-3-kwolf@redhat.com> In-Reply-To: <20260331150352.256332-1-kwolf@redhat.com> References: <20260331150352.256332-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 27 X-Spam_score: 2.7 X-Spam_bar: ++ X-Spam_report: (2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.54, 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_H2=-0.01, RCVD_IN_SBL_CSS=3.335, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=1, RCVD_IN_VALIDITY_RPBL_BLOCKED=1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: 1774969490132154101 Content-Type: text/plain; charset="utf-8" When commit bdf9613b introduced scsi_sense_buf_is_guest_recoverable(), it included LOGICAL UNIT NOT SUPPORTED in the list of guest recoverable sense codes. It doesn't really explain how the codes to be in the list were selected. As the LUN doesn't come from the guest, but from the block backend (usually the SCSI device on the host that was opened with host_device, but it could also be the iscsi block driver), there is really no way the guest could influence this. It seems that on some storage arrays, LOGICAL UNIT NOT SUPPORTED can happen during failover operations. When combined with multipath, the request should be retried on another path instead of being reported to the guest, which would offline the filesystem in response. Simply returning false in scsi_sense_buf_is_guest_recoverable() will enable the retry logic in file-posix, and will also make sure that if the error persists, the configured error policy is respected so that the VM can be stopped. Buglink: https://redhat.atlassian.net/browse/RHEL-158212 Fixes: bdf9613b7f87 ('scsi: explicitly list guest-recoverable sense codes') Signed-off-by: Kevin Wolf Message-ID: <20260330121635.49205-1-kwolf@redhat.com> Reviewed-by: Paolo Bonzini Reviewed-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- scsi/utils.c | 1 - 1 file changed, 1 deletion(-) diff --git a/scsi/utils.c b/scsi/utils.c index 545956f4f95..daee90ecf0e 100644 --- a/scsi/utils.c +++ b/scsi/utils.c @@ -373,7 +373,6 @@ static bool scsi_sense_is_guest_recoverable(int key, in= t asc, int ascq) case 0x1a00: /* PARAMETER LIST LENGTH ERROR */ case 0x2000: /* INVALID OPERATION CODE */ case 0x2400: /* INVALID FIELD IN CDB */ - case 0x2500: /* LOGICAL UNIT NOT SUPPORTED */ case 0x2600: /* INVALID FIELD IN PARAMETER LIST */ =20 case 0x2104: /* UNALIGNED WRITE COMMAND */ --=20 2.53.0 From nobody Wed Apr 1 22:20:02 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=1774969492; cv=none; d=zohomail.com; s=zohoarc; b=ewe/dbjXnQgy7wrxIl2g3czfmB73GFogNlTCCXVMsrW4fhR6oR7AnH3ViwcLkamXx+lfvf1F/0/gZFYbXKLQn5Yyh3oZCaN+UrYtFVdRDsKqUBC5D16F47UMsNReAFsPmx8vINaNaGrOIzxzu/Aw5k/CoVYM1VVRIFsAuYjHpgs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774969492; h=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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ldb3K5ZW5hyzrTLNC7CI3aGq8mv6oYQ1ZbFmzuc+hVw=; b=ZEHLtIEHkRgZ2cRPZB1agfZqWktNOEcE/V851hn3qKgCMexKj9b3oMmLsvPFNwXAkgvvZtl5tS+dgD5fl65Av/Km9u+ZKakzwB6XKk9+UoEldkqIlvqxyomjBj1TmBrt8rdG65y9trZqmcP4Lshh8wR8VeN4fUGlxwst013CSjg= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1774969492825757.2609809874327; Tue, 31 Mar 2026 08:04:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w7adX-0003G5-Rd; Tue, 31 Mar 2026 11:04:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w7adV-0003Bm-8A for qemu-devel@nongnu.org; Tue, 31 Mar 2026 11:04: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 1w7adT-0002Xu-EL for qemu-devel@nongnu.org; Tue, 31 Mar 2026 11:04:09 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-608-n_e5bf6qOjiwdpsl_v4sPA-1; Tue, 31 Mar 2026 11:04:04 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6CC1D19560B6; Tue, 31 Mar 2026 15:04:03 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.44.50.38]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1399C1954102; Tue, 31 Mar 2026 15:04:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774969445; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ldb3K5ZW5hyzrTLNC7CI3aGq8mv6oYQ1ZbFmzuc+hVw=; b=SUzFldRPERhH7jqe0Nwfc72AvvDwmyLaXucw2jFNRyvbFV2l9nsdxA2kr+Qb+76Z8UkXh8 vs9mSm41W2YTj7QPa2sSYAfgm5Prx4E7MVCwWM8MdGSadS5GVgKbnRPxigBXMyrS/SA7sP vYqH+2NzqLexx+ydVRuZHyT3rTCtEcw= X-MC-Unique: n_e5bf6qOjiwdpsl_v4sPA-1 X-Mimecast-MFC-AGG-ID: n_e5bf6qOjiwdpsl_v4sPA_1774969443 From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org, peter.maydell@linaro.org Subject: [PULL 3/6] block: Fix references in bdrv_bsc_*() function comments Date: Tue, 31 Mar 2026 17:03:49 +0200 Message-ID: <20260331150352.256332-4-kwolf@redhat.com> In-Reply-To: <20260331150352.256332-1-kwolf@redhat.com> References: <20260331150352.256332-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 27 X-Spam_score: 2.7 X-Spam_bar: ++ X-Spam_report: (2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.54, 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_H2=-0.01, RCVD_IN_SBL_CSS=3.335, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=1, RCVD_IN_VALIDITY_RPBL_BLOCKED=1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: 1774969494302158500 Content-Type: text/plain; charset="utf-8" From: Yunjian Long Some functions are defined in block_int-io.h, so the correct annotation is block_int-io.h rather than block_int.h Signed-off-by: Yunjian Long Message-ID: <20260325094204300GFCZYBzAE00cSWaldbDcT@zte.com.cn> Signed-off-by: Kevin Wolf --- block.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/block.c b/block.c index 48a17f393c5..f0a6042e616 100644 --- a/block.c +++ b/block.c @@ -8477,7 +8477,7 @@ static bool bdrv_bsc_range_overlaps_locked(BlockDrive= rState *bs, } =20 /** - * See block_int.h for this function's documentation. + * See block_int-io.h for this function's documentation. */ bool bdrv_bsc_is_data(BlockDriverState *bs, int64_t offset, int64_t *pnum) { @@ -8487,7 +8487,7 @@ bool bdrv_bsc_is_data(BlockDriverState *bs, int64_t o= ffset, int64_t *pnum) } =20 /** - * See block_int.h for this function's documentation. + * See block_int-io.h for this function's documentation. */ void bdrv_bsc_invalidate_range(BlockDriverState *bs, int64_t offset, int64_t bytes) @@ -8501,7 +8501,7 @@ void bdrv_bsc_invalidate_range(BlockDriverState *bs, } =20 /** - * See block_int.h for this function's documentation. + * See block_int-io.h for this function's documentation. */ void bdrv_bsc_fill(BlockDriverState *bs, int64_t offset, int64_t bytes) { --=20 2.53.0 From nobody Wed Apr 1 22:20:02 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=1774969545; cv=none; d=zohomail.com; s=zohoarc; b=DncLO0YT2WttgAGb4H3YAtCoArmQrH7mBypEPyACjQmJ3X1ksCKmpLtpBFeFrRrRevhMJl3QGO3VVlAVyvGhJW6346p71UdxJHROz9IINy8XzSVWYnMV2+OSwmID5fk2SILKDxReaxzGRSEiJAu/tIXozPEsfbp+bXoIHXG5EZY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774969545; h=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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4/EQKTbtcH/MX2YkSmC6DrV9C1Uks/s3kAn+UlSgZnk=; b=OpmDInzR5Dwk4QgwBNTJi1lb0vgJ3V4UfSVL9x0HkoppESYoHLTTUs8yYZyp+d6iUEY6JhoxSdxnzYLcbHe1ddBFYyJ5omo2NJQaw3w0gRE+wLYAw+cO4pMyBE7Gm4ALhlmVa6Rr3qV1RNY6uQuj9zjehUQ8sK8uoAqYRIKPjCY= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1774969545784736.0122929630749; Tue, 31 Mar 2026 08:05:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w7adZ-0003JT-UR; Tue, 31 Mar 2026 11:04:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w7adY-0003Gy-1B for qemu-devel@nongnu.org; Tue, 31 Mar 2026 11:04:12 -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 1w7adW-0002ZF-Im for qemu-devel@nongnu.org; Tue, 31 Mar 2026 11:04:11 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-34-GN0xrhozMYCzet6TcjxOEw-1; Tue, 31 Mar 2026 11:04:06 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 42032195609E; Tue, 31 Mar 2026 15:04:05 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.44.50.38]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DACDE1954102; Tue, 31 Mar 2026 15:04:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774969450; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4/EQKTbtcH/MX2YkSmC6DrV9C1Uks/s3kAn+UlSgZnk=; b=J5PcoOpfEqzTpVBBcpCgGNPy+EBNdBXxldSYQNks2VuZsDjE0r2IkpWQjpgqBKtJ8mv5pk kHWb66ybGHTaFm/6bWhpiccfMSfAAJKifNbXhB6WErecAocbU1TlxWUhR/I55wu2Tz5O5n 0zAPjqFTau/jp3Q+kvHYv0m748VpA5s= X-MC-Unique: GN0xrhozMYCzet6TcjxOEw-1 X-Mimecast-MFC-AGG-ID: GN0xrhozMYCzet6TcjxOEw_1774969445 From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org, peter.maydell@linaro.org Subject: [PULL 4/6] monitor: Fix deadlock in monitor_cleanup Date: Tue, 31 Mar 2026 17:03:50 +0200 Message-ID: <20260331150352.256332-5-kwolf@redhat.com> In-Reply-To: <20260331150352.256332-1-kwolf@redhat.com> References: <20260331150352.256332-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 27 X-Spam_score: 2.7 X-Spam_bar: ++ X-Spam_report: (2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.54, 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_H2=-0.01, RCVD_IN_SBL_CSS=3.335, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=1, RCVD_IN_VALIDITY_RPBL_BLOCKED=1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: 1774969546611158500 Content-Type: text/plain; charset="utf-8" From: hongmianquan During qemu_cleanup, if a non-coroutine QMP command (e.g., query-commands) is concurrently received and processed by the mon_iothread, it can lead to a deadlock in monitor_cleanup. The root cause is a race condition between the main thread's shutdown sequence and the coroutine's dispatching mechanism. When handling a non-coroutine QMP command, qmp_dispatcher_co schedules the actual command execution as a bottom half in iohandler_ctx and then yields. At this suspended point, qmp_dispatcher_co_busy remains true. Subsequently, the main thread in monitor_cleanup(), sets qmp_dispatcher_co_shutdown, and calls qmp_dispatcher_co_wake(). Since qmp_dispatcher_co_busy is already true, the aio_co_wake is skipped. The main thread then enters the AIO_WAIT_WHILE_UNLOCKED loop, it executes the scheduled BH (do_qmp_dispatch_bh) via aio_poll(iohandler_ctx, false), which attempts to wake up the coroutine, aio_co_wake schedules a new wake-up BH in iohandler_ctx. The main thread then blocks indefinitely in aio_poll(qemu_aio_context, true), while the coroutine's wake-up BH is starved in iohandler_ctx, qmp_dispatcher_co never reaches termination, resulting in a deadlock. The execution sequence is illustrated below: IO Thread Main Thread (qemu_aio_context) qmp_dispat= cher_co (iohandler_ctx) | | = | |-- query-commands | = | |-- qmp_dispatcher_co_wake() | = | | (sets busy =3D true) | = | | | <-- Wakes up in iohandler_ctx -->= | | | = |-- qmp_dispatch() | | = |-- Schedules BH (do_qmp_dispatch_bh) | | = |-- qemu_coroutine_yield() | | = [State: Suspended, busy=3Dtrue] | [ quit triggered ] | | |-- monitor_cleanup() | |-- qmp_dispatcher_co_shutdown =3D tr= ue | |-- qmp_dispatcher_co_wake() | | -> Checks busy flag. It's TRUE! | | -> Skips aio_co_wake(). | | | |-- AIO_WAIT_WHILE_UNLOCKED: | | |-- aio_poll(iohandler_ctx, false) | | | -> Executes do_qmp_dispatch_= bh | | | -> Schedules 'co_schedule_bh= ' in iohandler_ctx | | | | | |-- aio_poll(qemu_aio_context, tr= ue) | | | -> Blocks indefinitely! (Dea= dlock) | | | X (Main thread sleeping) = X (Waiting for next iohandler_ctx poll) To fix this, we add an explicit aio_wait_kick() in do_qmp_dispatch_bh() to break the main loop out of its blocking poll, allowing it to evaluate the loop condition and poll iohandler_ctx. Suggested-by: Kevin Wolf Signed-off-by: hongmianquan Signed-off-by: wubo.bob Message-ID: <20260327131024.51947-1-hongmianquan@bytedance.com> Acked-by: Markus Armbruster Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- qapi/qmp-dispatch.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c index 9bb1e6a9f4a..e3897d51977 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -128,6 +128,16 @@ static void do_qmp_dispatch_bh(void *opaque) data->cmd->fn(data->args, data->ret, data->errp); monitor_set_cur(qemu_coroutine_self(), NULL); aio_co_wake(data->co); + + /* + * If the QMP dispatcher coroutine is waiting to be scheduled + * in iohandler_ctx, we must kick the main loop. This ensures + * that AIO_WAIT_WHILE_UNLOCKED() in monitor_cleanup() doesn't + * block indefinitely waiting for an event in qemu_aio_context, + * but actually gets the chance to poll iohandler_ctx and resume + * the coroutine. + */ + aio_wait_kick(); } =20 /* --=20 2.53.0 From nobody Wed Apr 1 22:20:02 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=1774969545; cv=none; d=zohomail.com; s=zohoarc; b=RO8p/23uoX6ZaFNId3qz8kFDE9JeHwA3Z98YWSSkYtnzE53PA+e5bUrZwil+SonPy+czPLXCbIdxF9CHpnA6v6Mz/+AJIbee4pF10yF6JYbcSTk/SPQNE5TwyeNQtaeyW7N+bcZSe4szEOxcdnTW1bycKHZJzZ6yZ9FSpobjbqA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774969545; h=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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=F7l7nol1SzwFYWkkAmybwaQvn6WrYq0DfYyxo8Bu/rc=; b=e7cMekvXW12zY7WsAQMYF3nfYLH//Ut81EWgGC7u8mES02DLlr3SyT3la/5Hm1a04bR8goYN+aNLhICVAeCl0IkDQSExCLrGtSXYRDwC0xre9hOosxFzIb3774lyOqCeTjgWAOH57heo7pV1Inx7MnCiKb+s8wYYVhO0JeOYT+w= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1774969545753928.1103234557077; Tue, 31 Mar 2026 08:05:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w7adZ-0003Iv-7p; Tue, 31 Mar 2026 11:04:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w7adX-0003Fe-Cf for qemu-devel@nongnu.org; Tue, 31 Mar 2026 11:04:11 -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 1w7adW-0002Z9-2T for qemu-devel@nongnu.org; Tue, 31 Mar 2026 11:04:11 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-528-rmiI-oJDNdKshv0HcyWhTA-1; Tue, 31 Mar 2026 11:04:08 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 102B61800624; Tue, 31 Mar 2026 15:04:07 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.44.50.38]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AA86919540C4; Tue, 31 Mar 2026 15:04:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774969449; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F7l7nol1SzwFYWkkAmybwaQvn6WrYq0DfYyxo8Bu/rc=; b=dEDlsmUo35G3VkdAmbUlHit+B4qFc73i4kl0COgIssRZ1VSDTmB7u9KujxciW8emNhL3UC KOkbxSvM/AMaQ9igfijRFzlaWdK7R1zBHa0KlhlDTWW1aaqCYceXCmlxwmoFysX2Zdp89X mu+Xit253CoJc8t0IizakX/MWFVH0Qo= X-MC-Unique: rmiI-oJDNdKshv0HcyWhTA-1 X-Mimecast-MFC-AGG-ID: rmiI-oJDNdKshv0HcyWhTA_1774969447 From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org, peter.maydell@linaro.org Subject: [PULL 5/6] vhost-user-blk-server: fix opt_io_size=1 causing severe Windows I/O degradation Date: Tue, 31 Mar 2026 17:03:51 +0200 Message-ID: <20260331150352.256332-6-kwolf@redhat.com> In-Reply-To: <20260331150352.256332-1-kwolf@redhat.com> References: <20260331150352.256332-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.54, 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_H2=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=1, RCVD_IN_VALIDITY_RPBL_BLOCKED=1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: 1774969549072154100 Content-Type: text/plain; charset="utf-8" From: Max Makarov The QSD vhost-user-blk export sets opt_io_size=3D1 and min_io_size=3D1 in the virtio config. These values are reported to the guest through the VPD Block Limits page as OptimalTransferLength=3D1 block (512 bytes) and OptimalTransferLengthGranularity=3D1 block. Windows respects these hints and splits all I/O into ~512-byte requests, causing ~100x sequential throughput degradation (150 MB/s instead of 15+ GB/s). Linux is unaffected as its block layer ignores these values. Set both to 0 which means "not reported" per the SCSI Block Limits VPD spec, allowing Windows to use its own optimal I/O size defaults. Signed-off-by: Max Makarov Message-ID: <20260330193451.76037-1-maxpain@linux.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- block/export/vhost-user-blk-server.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/export/vhost-user-blk-server.c b/block/export/vhost-user= -blk-server.c index e89422bb85a..67912a3e170 100644 --- a/block/export/vhost-user-blk-server.c +++ b/block/export/vhost-user-blk-server.c @@ -242,8 +242,8 @@ vu_blk_initialize_config(BlockDriverState *bs, config->blk_size =3D cpu_to_le32(blk_size); config->size_max =3D cpu_to_le32(0); config->seg_max =3D cpu_to_le32(128 - 2); - config->min_io_size =3D cpu_to_le16(1); - config->opt_io_size =3D cpu_to_le32(1); + config->min_io_size =3D cpu_to_le16(0); + config->opt_io_size =3D cpu_to_le32(0); config->num_queues =3D cpu_to_le16(num_queues); config->max_discard_sectors =3D cpu_to_le32(VIRTIO_BLK_MAX_DISCARD_SECTORS); --=20 2.53.0 From nobody Wed Apr 1 22:20:02 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=1774969510; cv=none; d=zohomail.com; s=zohoarc; b=aK86WSxv9rY3dMjafCe7VgDIo15qvsGHzA3SbEMHGL1GmGtTBq0K++T4515FZBcoN1KyqxvA63gFGY42wpRHQBBPQMosjnkP1HVmm4QiaRyWx5I+NidJXrXmAPlXjsumR5Z53e76O/2CTBS53dsjW3S66DaCBq0QT19zrjeb3qE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774969510; h=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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=3F5JMu/lV41yfl1mxCaocZma8j3FtqQndeH67Sr02Ms=; b=hUYGn2bY1aAxD6I4J6fsbOh84FKalTQ86oIbRF18aYEq6EiH2I6SbXu3/bp6ON3lOt6mcpeXUcA71LW/50vcfSBcmnhsw5cuMgNVPktIvmUoLt1kGZcin+xjybhFVD2ICAuJsRLkwOPzCtopR150B9zfx5042UzcAq+cZ9dYCzA= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177496951041381.47125064025886; Tue, 31 Mar 2026 08:05:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w7add-0003T4-5G; Tue, 31 Mar 2026 11:04:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w7adb-0003SM-I5 for qemu-devel@nongnu.org; Tue, 31 Mar 2026 11:04:15 -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 1w7ada-0002Zn-4U for qemu-devel@nongnu.org; Tue, 31 Mar 2026 11:04:15 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-645-UIT-HEXEPwq60rURQK4aFg-1; Tue, 31 Mar 2026 11:04:11 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D28EF195604F; Tue, 31 Mar 2026 15:04:08 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.44.50.38]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 782D419540C4; Tue, 31 Mar 2026 15:04:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774969453; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3F5JMu/lV41yfl1mxCaocZma8j3FtqQndeH67Sr02Ms=; b=cpyVmNGHWtkEHpxeAeZ2LGb6e6xEESLwvK1LhVO9jsa9Fv1NYj1xuNOx9PMmdGjNd3LxZi CGxl935CP+qbfj/Xe1t1Lry2wSwV4Iz3uIHKxCOoweIdHKqmTZs1L7OT2Vjc3jhFUTqCmX 0Vwk/OjkcoWhsL2q/Y8xrOrgcVpu3J0= X-MC-Unique: UIT-HEXEPwq60rURQK4aFg-1 X-Mimecast-MFC-AGG-ID: UIT-HEXEPwq60rURQK4aFg_1774969448 From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org, peter.maydell@linaro.org Subject: [PULL 6/6] block: Fix crash after setting latency historygram with single bin Date: Tue, 31 Mar 2026 17:03:52 +0200 Message-ID: <20260331150352.256332-7-kwolf@redhat.com> In-Reply-To: <20260331150352.256332-1-kwolf@redhat.com> References: <20260331150352.256332-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 27 X-Spam_score: 2.7 X-Spam_bar: ++ X-Spam_report: (2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.54, 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_SBL_CSS=3.335, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=1, RCVD_IN_VALIDITY_RPBL_BLOCKED=1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: 1774969512452154100 Content-Type: text/plain; charset="utf-8" Passing an empty list of boundaries to block-latency-histogram-set sets up a state that leads to a NULL pointer dereference when the next request should be accounted for. This is not a useful configuration, so just error out if the user tries to set it. The crash can easily be reproduced with the following script: qmp() { cat < Message-ID: <20260331102608.60882-1-kwolf@redhat.com> Signed-off-by: Kevin Wolf --- block/accounting.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/block/accounting.c b/block/accounting.c index 5cf51f029b1..f00fe997403 100644 --- a/block/accounting.c +++ b/block/accounting.c @@ -185,6 +185,15 @@ int block_latency_histogram_set(BlockAcctStats *stats,= enum BlockAcctType type, prev =3D entry->value; } =20 + /* + * block_latency_histogram_account() assumes that it can always access + * hist->boundaries[0], so require at least one boundary. A histogram = with + * a single bin is useless anyway. + */ + if (new_nbins <=3D 1) { + return -EINVAL; + } + hist->nbins =3D new_nbins; g_free(hist->boundaries); hist->boundaries =3D g_new(uint64_t, hist->nbins - 1); --=20 2.53.0