From nobody Mon May 13 04:49:14 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1530244014875776.3283323956736; Thu, 28 Jun 2018 20:46:54 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0085D34452A; Fri, 29 Jun 2018 03:46:51 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A7072125305; Fri, 29 Jun 2018 03:46:49 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3433D18037EC; Fri, 29 Jun 2018 03:46:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w5T3kh57022863 for ; Thu, 28 Jun 2018 23:46:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id AA6CB125290; Fri, 29 Jun 2018 03:46:43 +0000 (UTC) Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A1D2B8BE27 for ; Fri, 29 Jun 2018 03:46:40 +0000 (UTC) Received: from mail-pl0-f66.google.com (mail-pl0-f66.google.com [209.85.160.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A0C1D30015E0 for ; Fri, 29 Jun 2018 03:46:29 +0000 (UTC) Received: by mail-pl0-f66.google.com with SMTP id y15-v6so1899684pll.9 for ; Thu, 28 Jun 2018 20:46:29 -0700 (PDT) Received: from kvm-host-22.localdomain ([168.63.150.120]) by smtp.gmail.com with ESMTPSA id 10-v6sm21931724pfs.111.2018.06.28.20.46.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jun 2018 20:46:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=1oFcxsu6IqVTLxKB/OhLlk3tihmXFMijqKs4FQLH3sg=; b=DWV7lbhvCv9bF3vH2S3dY37YuAeOV6brlhuz8rofLCPEWG1F8m9h1gSiC1Yf6Pv0Rc arot4OdqAkD1BKeT3cdMyFD9XAGsPs/TMo+pn6VqPn90IXEjJjZK0sLxaGEDjzVnD2YU j7T7/iIiPEckZZiUAAiBzVCYt24MBpUBfG4TCDxyZOR7Te5ga28b/kn9EhT/3T6GYn0A Bceu3U9ncuCpgMYakyj8mQGziQQuOvTMZQILMkE0U8orU77zscW8Yzb2fCfeuqRrCmk0 rgEMUaOZPCJXOih75guGXOBuHMUIkp1H3kNjvQba5xB031ifnSbHGgxfCrWALJAFPZxn 09uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=1oFcxsu6IqVTLxKB/OhLlk3tihmXFMijqKs4FQLH3sg=; b=N+kqIuoF+psppq74cbmQdfe0lGM5EoNtOSORgH0T6H88/HMAz7yFnImLWh1GlbApZV F+614g2fg5+1zXpTGyPiAc9T4vwuaF2yeRDoQpTW/3mD5d6J8c6yfLztnuYTzEzKrUPc S3apRPafcj09p9lCA7Vu0a+M6pb4Vs0xKoMnnbtoHLNyV7tfjJgZnZ/TOiiVcP1RV0rp qnvDK52TqdAt/IpAr67FOZXKzXqnx0qgdb8kg+75HEg2s1pu/KAGzzxiRKw2D2ZIhxTi rpDLRQt/39oGHu+WBYEsm9MfoBQpIiRaKGtIJgPfxdg5R5dfGzo64IdTkwektCui91Fv fbFA== X-Gm-Message-State: APt69E0nz7pKaSQIGbDI4QFDiTxXaT3YEdQUbhLY/fE086lY+T1czn3X q0ERCs+cu6Gafqs+QQ+p9mPhi233 X-Google-Smtp-Source: ADUXVKKZzRQLloyw6yORIXW7pXHUzQAuWmlRpwNphiWUKIZZ4TunrOyasSM4rhLgDSrSACRUd/c/aA== X-Received: by 2002:a17:902:aa01:: with SMTP id be1-v6mr13103294plb.296.1530243988697; Thu, 28 Jun 2018 20:46:28 -0700 (PDT) From: dujiancheng To: libvir-list@redhat.com Date: Fri, 29 Jun 2018 11:46:15 +0800 Message-Id: <1530243975-23959-2-git-send-email-dujiancheng10@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Fri, 29 Jun 2018 03:46:29 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Fri, 29 Jun 2018 03:46:29 +0000 (UTC) for IP:'209.85.160.66' DOMAIN:'mail-pl0-f66.google.com' HELO:'mail-pl0-f66.google.com' FROM:'dujiancheng10@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.531 * (DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS, T_DKIM_INVALID) 209.85.160.66 mail-pl0-f66.google.com 209.85.160.66 mail-pl0-f66.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.43 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] Add support L2 table cache for qcow2 disk X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 29 Jun 2018 03:46:53 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The patch add support L2 table cache for qcow2 disk. L2 table cache can improve IO read and write performance for qcow2 img. Example: random 4K read requests on a fully populated 100GB image (SSD ba= ckend and vm with directsync cacha mode), IOPS increased by 7 times. =20 --- src/conf/domain_conf.c | 25 +++++++++++++++++++++++++ src/conf/domain_conf.h | 4 ++++ src/qemu/qemu_command.c | 7 +++++++ src/qemu/qemu_domain.c | 4 ++++ 4 files changed, 40 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b8b5345..cb9fb05 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9502,6 +9502,8 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, char *vendor =3D NULL; char *product =3D NULL; char *domain_name =3D NULL; + char *disk_l2_cache_size =3D NULL; + char *disk_cache_clean_interval =3D NULL; =20 if (!(def =3D virDomainDiskDefNew(xmlopt))) return NULL; @@ -9701,6 +9703,27 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlop= t, } } else if (virXMLNodeNameEqual(cur, "boot")) { /* boot is parsed as part of virDomainDeviceInfoParseXML */ + } else if (virXMLNodeNameEqual(cur, "diskCache")) { + disk_l2_cache_size =3D + virXMLPropString(cur, "disk_l2_cache_size"); + if (disk_l2_cache_size && + virStrToLong_ui(disk_l2_cache_size, NULL, 0, + &def->disk_cache.disk_l2_cache_size) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("invalid disk L2 cache size '%s'"), + disk_l2_cache_size); + goto error; + } + disk_cache_clean_interval =3D + virXMLPropString(cur, "disk_cache_clean_interval"); + if (disk_cache_clean_interval && + virStrToLong_ui(disk_cache_clean_interval, NULL, 0, + &def->disk_cache.disk_cache_clean_interval= ) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("invalid disk cache clean interval '%s'"), + disk_cache_clean_interval); + goto error; + } } } =20 @@ -9903,6 +9926,8 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, VIR_FREE(vendor); VIR_FREE(product); VIR_FREE(domain_name); + VIR_FREE(disk_l2_cache_size); + VIR_FREE(disk_cache_clean_interval); =20 ctxt->node =3D save_ctxt; return def; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 71437dc..6396475 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -647,6 +647,10 @@ struct _virDomainDiskDef { unsigned int physical_block_size; } blockio; =20 + struct { + unsigned int disk_l2_cache_size; + unsigned int disk_cache_clean_interval; + } disk_cache; virDomainBlockIoTuneInfo blkdeviotune; =20 char *driverName; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 4fc3176..4bc9412 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1637,6 +1637,13 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk, =20 if (qemuBuildDriveSourceStr(disk, qemuCaps, &opt) < 0) goto error; + =09 + if (disk->disk_cache.disk_l2_cache_size > 0) + virBufferAsprintf(&opt, "l2-cache-size=3D%u,", + disk->disk_cache.disk_l2_cache_size); + if (disk->disk_cache.disk_cache_clean_interval > 0) + virBufferAsprintf(&opt, "cache-clean-interval=3D%u,", + disk->disk_cache.disk_cache_clean_interval); =20 if (qemuDiskBusNeedsDeviceArg(disk->bus)) { char *drivealias =3D qemuAliasDiskDriveFromDisk(disk); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index fee4481..4896bf7 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8627,6 +8627,10 @@ qemuDomainDiskChangeSupported(virDomainDiskDefPtr di= sk, CHECK_EQ(ioeventfd, "ioeventfd", true); CHECK_EQ(event_idx, "event_idx", true); CHECK_EQ(copy_on_read, "copy_on_read", true); + CHECK_EQ(disk_cache.disk_l2_cache_size, + "diskCache disk_l2_cache_size", true); + CHECK_EQ(disk_cache.disk_cache_clean_interval, + "diskCache disk_cache_clean_interval", true); /* "snapshot" is a libvirt internal field and thus can be changed */ /* startupPolicy is allowed to be updated. Therefore not checked here.= */ CHECK_EQ(transient, "transient", true); --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list