From nobody Fri Dec 12 14:07:43 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1763733940; cv=none; d=zohomail.com; s=zohoarc; b=Td/8uwa6EVeGgJNdGGF1sLy+00J78+d5XMa40tevSCCGmLvHTYwK5ioVoDWeTxre2FXKR98UXVQrzQUzedoTDMikrnztaegZHubsPcY3aaytH8bbJ0pY7E7pMwqNhqW+JXWHb30k/1wOHpUmB62YejyIOzRMleRulUOoEi2qmqc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1763733940; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=VgMbWxK8DEG1C5D3oCy8VA7/q5MVOTnRIimc4irmCr4=; b=iAun9XRM4GVo8shJH4R3aHt/03Q7vu603PtoTZgDBj5PZo/gTUX9adiY8ZZE6228/eWtV8bdDEfLM37EJ8mfz59AeHjSCXPIkQxLmaTgj0DGfyVtatH+rMJfyLkfcBoPA0KQ14qy0IMP9HiIhHaBsxJb4LZn5mYYaxf28pqdIvo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1763733940566710.2853778915153; Fri, 21 Nov 2025 06:05:40 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 252EC44157; Fri, 21 Nov 2025 09:05:36 -0500 (EST) Received: from [172.19.199.56] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 96D56443D4; Fri, 21 Nov 2025 09:01:49 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 68E5241902; Fri, 21 Nov 2025 09:01:26 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id E09D63F350 for ; Fri, 21 Nov 2025 09:01:23 -0500 (EST) 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-527-2GCrXwzcMSyUCc8rNTYXQg-1; Fri, 21 Nov 2025 09:01:21 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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 00AA01977523 for ; Fri, 21 Nov 2025 14:01:19 +0000 (UTC) Received: from speedmetal.openshiftapps.com (unknown [10.45.242.12]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4CDB71800451 for ; Fri, 21 Nov 2025 14:01:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763733683; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VgMbWxK8DEG1C5D3oCy8VA7/q5MVOTnRIimc4irmCr4=; b=i/GB4T4AcHTkLqMn+5pWNB67yWA77r2FPDHIf2a3sOYauABQr1csUEkm432Kes3+QT22RP fUGfvd11FdndrrhL9eH7mSKNQfkn3aa5vkKic/8H1I+MCCp1ruXStSAmrO/m+nTcfWd8Tc Ao3OZJPYvw5MJ194evCJji0gM94xA3g= X-MC-Unique: 2GCrXwzcMSyUCc8rNTYXQg-1 X-Mimecast-MFC-AGG-ID: 2GCrXwzcMSyUCc8rNTYXQg_1763733681 To: devel@lists.libvirt.org Subject: [PATCH 2/2] Add support for 'dpofua' setting for SCSI disks Date: Fri, 21 Nov 2025 15:01:14 +0100 Message-ID: <9ec6beee1f13f03fd67d2ecacdb0ec8bba48e40b.1763733595.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: wG6NhpUhUX445Snph52zWCtufST18OGYlX82JfMJYiU_1763733681 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: AFG5LZQB37YVWQ2YE3MJGRQUBJQKM2XX X-Message-ID-Hash: AFG5LZQB37YVWQ2YE3MJGRQUBJQKM2XX X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1763733942030018900 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Add the 'dpofua' setting in the XML and for the qemu driver. DPO - Disable Page Out and FUA - Force Unit Access are two features implemented by SCSI disks (either both together or neither of them) which influence how caching is handled. QEMU provides a good default but in certain specific occasions changing the default may have performance benefits. Add support for setting them via the XML. Signed-off-by: Peter Krempa --- docs/formatdomain.rst | 5 +++++ src/conf/domain_conf.c | 15 +++++++++++++++ src/conf/domain_conf.h | 1 + src/conf/domain_validate.c | 7 +++++++ src/conf/schemas/domaincommon.rng | 5 +++++ src/qemu/qemu_command.c | 1 + .../qemuxmlconfdata/disk-scsi.x86_64-latest.args | 4 ++-- tests/qemuxmlconfdata/disk-scsi.x86_64-latest.xml | 4 ++-- tests/qemuxmlconfdata/disk-scsi.xml | 4 ++-- 9 files changed, 40 insertions(+), 6 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index c6d0b183d0..1197369481 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -3378,6 +3378,11 @@ paravirtualized driver is specified via the ``disk``= element. :since:`since after 0.4.4`; "sata" attribute value :since:`since 0.9.7`; "removable" attribute value :since:`since 1.1.3`; "rotation_rate" attribute value :since:`since 7.3.0` + The optional attribute ``dpofua`` (:since:`Since 11.10.0, only QEMU dri= ver`) + controls the support of DPO(Disable Page Out) and FUA(Force Unit Access) + properties of a SCSI disk cache access (both must be present or absent). + If the value is omitted hypervisor default is applied (which may depend= on + the machine type version) and is the suggested setting. ``throttlefilters`` The optional ``throttlefilters`` element provides the ability to provid= e additional per-device throttle chain :since:`Since 11.2.0` diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 15d5cd9d80..f6c6c70374 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8593,6 +8593,10 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt, if (virXMLPropUInt(targetNode, "rotation_rate", 10, VIR_XML_PROP_N= ONE, &def->rotation_rate) < 0) return NULL; + + if (virXMLPropTristateSwitch(targetNode, "dpofua", VIR_XML_PROP_NO= NE, + &def->dpofua) < 0) + return NULL; } if ((geometryNode =3D virXPathNode("./geometry", ctxt))) { @@ -20853,6 +20857,14 @@ virDomainDiskDefCheckABIStability(virDomainDiskDef= *src, return false; } + if (src->dpofua !=3D dst->dpofua) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target disk 'dpofua' property %1$s does not matc= h source %2$s"), + virTristateSwitchTypeToString(dst->dpofua), + virTristateSwitchTypeToString(src->dpofua)); + return false; + } + if (src->queues !=3D dst->queues) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Target disk queue count %1$u does not match sour= ce %2$u"), @@ -24120,6 +24132,9 @@ virDomainDiskDefFormat(virBuffer *buf, } if (def->rotation_rate) virBufferAsprintf(&childBuf, " rotation_rate=3D'%u'", def->rotatio= n_rate); + if (def->dpofua !=3D VIR_TRISTATE_SWITCH_ABSENT) + virBufferAsprintf(&childBuf, " dpofua=3D'%s'", + virTristateSwitchTypeToString(def->dpofua)); virBufferAddLit(&childBuf, "/>\n"); virDomainDiskDefFormatIotune(&childBuf, def); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 11eb46ae53..ccd89e42a6 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -601,6 +601,7 @@ struct _virDomainDiskDef { unsigned int queue_size; virDomainDiskModel model; virDomainVirtioOptions *virtio; + virTristateSwitch dpofua; /* only SCSI disks; control of the DPO/FUA c= ache setting */ bool diskElementAuth; bool diskElementEnc; diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 8085d782c5..90add3e185 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -1024,6 +1024,13 @@ virDomainDiskDefValidate(const virDomainDef *def, } } + if (disk->dpofua !=3D VIR_TRISTATE_SWITCH_ABSENT && + disk->bus !=3D VIR_DOMAIN_DISK_BUS_SCSI) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("'dpofua' option is available only for SCSI disks= ")); + return -1; + } + return 0; } diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincom= mon.rng index 75b5124c33..4f690837ce 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -2615,6 +2615,11 @@ + + + + + diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c56c321a6e..d0f8d5c5a7 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1936,6 +1936,7 @@ qemuBuildDiskDeviceProps(const virDomainDef *def, "S:werror", wpolicy, "S:rerror", rpolicy, "A:stats-intervals", &statistics, + "T:dpofua", disk->dpofua, /* SCSI-only, ensu= red by validation */ NULL) < 0) return NULL; diff --git a/tests/qemuxmlconfdata/disk-scsi.x86_64-latest.args b/tests/qem= uxmlconfdata/disk-scsi.x86_64-latest.args index cd07cd2d22..ae0a1ffe0c 100644 --- a/tests/qemuxmlconfdata/disk-scsi.x86_64-latest.args +++ b/tests/qemuxmlconfdata/disk-scsi.x86_64-latest.args @@ -41,9 +41,9 @@ XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGue= st1/.config \ -blockdev '{"driver":"file","filename":"/tmp/scsidisk3.img","node-name":"l= ibvirt-3-storage","read-only":false}' \ -device '{"driver":"scsi-hd","bus":"scsi2.0","channel":0,"scsi-id":0,"lun"= :0,"device_id":"drive-scsi2-0-0-0","drive":"libvirt-3-storage","id":"scsi2-= 0-0-0","wwn":5764824127192592812}' \ -blockdev '{"driver":"file","filename":"/tmp/scsidisk4.img","node-name":"l= ibvirt-2-storage","read-only":false}' \ --device '{"driver":"scsi-hd","bus":"scsi3.0","channel":0,"scsi-id":0,"lun"= :0,"device_id":"drive-scsi3-0-0-0","drive":"libvirt-2-storage","id":"scsi3-= 0-0-0"}' \ +-device '{"driver":"scsi-hd","bus":"scsi3.0","channel":0,"scsi-id":0,"lun"= :0,"device_id":"drive-scsi3-0-0-0","drive":"libvirt-2-storage","id":"scsi3-= 0-0-0","dpofua":true}' \ -blockdev '{"driver":"file","filename":"/tmp/scsidisk5.img","node-name":"l= ibvirt-1-storage","read-only":false}' \ --device '{"driver":"scsi-hd","bus":"scsi4.0","channel":0,"scsi-id":0,"lun"= :0,"device_id":"drive-scsi4-0-0-0","drive":"libvirt-1-storage","id":"scsi4-= 0-0-0","removable":true}' \ +-device '{"driver":"scsi-hd","bus":"scsi4.0","channel":0,"scsi-id":0,"lun"= :0,"device_id":"drive-scsi4-0-0-0","drive":"libvirt-1-storage","id":"scsi4-= 0-0-0","removable":true,"dpofua":false}' \ -audiodev '{"id":"audio1","driver":"none"}' \ -device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","add= r":"0x6"}' \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ diff --git a/tests/qemuxmlconfdata/disk-scsi.x86_64-latest.xml b/tests/qemu= xmlconfdata/disk-scsi.x86_64-latest.xml index 3e645ea343..33de2a6595 100644 --- a/tests/qemuxmlconfdata/disk-scsi.x86_64-latest.xml +++ b/tests/qemuxmlconfdata/disk-scsi.x86_64-latest.xml @@ -46,13 +46,13 @@ - +
- +
diff --git a/tests/qemuxmlconfdata/disk-scsi.xml b/tests/qemuxmlconfdata/di= sk-scsi.xml index 755c856b98..7e20c70dfe 100644 --- a/tests/qemuxmlconfdata/disk-scsi.xml +++ b/tests/qemuxmlconfdata/disk-scsi.xml @@ -38,12 +38,12 @@ - +
- +
--=20 2.51.1