From nobody Mon Dec 15 23:01:47 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1658846380; cv=none; d=zohomail.com; s=zohoarc; b=RdyskCldfrXAGkS7WZhhPwd1A3/y6Gi2rvr1QUctqgJCsDKZqOW0cS2JvuScPgfZXcLkDYRmD6KDP/USgV9Q3NMlYDRZkainlM6/V9/VRWGhldCjGcPMzfOpF0SA54cjY7UAp0dtfzudHXYvMquMc+pdudjIvPW4QkLmJ4HqJpk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658846380; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gn0lqkfRZv9iFdJSASPiqp3ooqla169L5ZNDEbmbbpg=; b=cTnmW7+z6ZQRi1r6VbCaG8yK0lqhzr+0ZUGYagJSKktIFDJmPESumL4ENw7vJMAFAypJVWlWe+EBgE38GVuzGORiGTzrtQJdlC1nMYroHTuQHnVhXngMNwoXmc74rOrXhZ2ccJKiQYxIgGn3v/9iS0UuLk9/eKDaOI25qInw8k0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1658846380947314.72080841656236; Tue, 26 Jul 2022 07:39:40 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-602-v4YLXZ_hPf-UCbAhR5KUeA-1; Tue, 26 Jul 2022 10:39:35 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2F01D29AB405; Tue, 26 Jul 2022 14:39:21 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15AAF141513A; Tue, 26 Jul 2022 14:39:21 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id AE120194035A; Tue, 26 Jul 2022 14:39:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id EA8501940374 for ; Tue, 26 Jul 2022 14:39:16 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id C7719400DFD7; Tue, 26 Jul 2022 14:39:16 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 492D040CF8EE for ; Tue, 26 Jul 2022 14:39:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658846379; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=gn0lqkfRZv9iFdJSASPiqp3ooqla169L5ZNDEbmbbpg=; b=YqcwzUPrbzWY83l9wd94+Rf04UNURpboGaDESXS62ZLniw3r3Bz4laN/gBump3QOYfS35Z CzGFcY7PRtsyx09+LP/a+eTQ5N4ahhkYt3P9E2nJClAM56TefuhbsUQQ9zE4G56j4KKm0q EZZWI5GMaZFMlU9b12cuR0bRSaRUCDo= X-MC-Unique: v4YLXZ_hPf-UCbAhR5KUeA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 76/80] qemu: Setup disk throttling for SD cards via monitor Date: Tue, 26 Jul 2022 16:37:54 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1658846382450100004 Content-Type: text/plain; charset="utf-8" Set it same way we set throttling for other disks in qemuProcessSetupDiskThrottling. Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/qemu/qemu_command.c | 42 ----------------------------------------- src/qemu/qemu_process.c | 20 +++++++++++--------- 2 files changed, 11 insertions(+), 51 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index afdf79ff55..6b93c5f579 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1676,46 +1676,6 @@ qemuBuildDriveSourceStr(virDomainDiskDef *disk, } -static void -qemuBuildDiskThrottling(virDomainDiskDef *disk, - virBuffer *buf) -{ -#define IOTUNE_ADD(_field, _label) \ - if (disk->blkdeviotune._field) { \ - virBufferAsprintf(buf, ",throttling." _label "=3D%llu", \ - disk->blkdeviotune._field); \ - } - - IOTUNE_ADD(total_bytes_sec, "bps-total"); - IOTUNE_ADD(read_bytes_sec, "bps-read"); - IOTUNE_ADD(write_bytes_sec, "bps-write"); - IOTUNE_ADD(total_iops_sec, "iops-total"); - IOTUNE_ADD(read_iops_sec, "iops-read"); - IOTUNE_ADD(write_iops_sec, "iops-write"); - - IOTUNE_ADD(total_bytes_sec_max, "bps-total-max"); - IOTUNE_ADD(read_bytes_sec_max, "bps-read-max"); - IOTUNE_ADD(write_bytes_sec_max, "bps-write-max"); - IOTUNE_ADD(total_iops_sec_max, "iops-total-max"); - IOTUNE_ADD(read_iops_sec_max, "iops-read-max"); - IOTUNE_ADD(write_iops_sec_max, "iops-write-max"); - - IOTUNE_ADD(size_iops_sec, "iops-size"); - if (disk->blkdeviotune.group_name) { - virBufferAddLit(buf, ",throttling.group=3D"); - virQEMUBuildBufferEscapeComma(buf, disk->blkdeviotune.group_name); - } - - IOTUNE_ADD(total_bytes_sec_max_length, "bps-total-max-length"); - IOTUNE_ADD(read_bytes_sec_max_length, "bps-read-max-length"); - IOTUNE_ADD(write_bytes_sec_max_length, "bps-write-max-length"); - IOTUNE_ADD(total_iops_sec_max_length, "iops-total-max-length"); - IOTUNE_ADD(read_iops_sec_max_length, "iops-read-max-length"); - IOTUNE_ADD(write_iops_sec_max_length, "iops-write-max-length"); -#undef IOTUNE_ADD -} - - static void qemuBuildDiskGetErrorPolicy(virDomainDiskDef *disk, const char **wpolicy, @@ -1790,8 +1750,6 @@ qemuBuildDriveStr(virDomainDiskDef *disk) } } - qemuBuildDiskThrottling(disk, &opt); - return virBufferContentAndReset(&opt); } diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index ac463571bb..f15222e932 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7220,7 +7220,7 @@ qemuProcessGenID(virDomainObj *vm, /** - * qemuProcessSetupDiskThrottlingBlockdev: + * qemuProcessSetupDiskThrottling: * * Sets up disk trottling for -blockdev via block_set_io_throttle monitor * command. This hack should be replaced by proper use of the 'throttle' @@ -7228,9 +7228,9 @@ qemuProcessGenID(virDomainObj *vm, * Same hack is done in qemuDomainAttachDiskGeneric. */ static int -qemuProcessSetupDiskThrottlingBlockdev(virQEMUDriver *driver, - virDomainObj *vm, - virDomainAsyncJob asyncJob) +qemuProcessSetupDiskThrottling(virQEMUDriver *driver, + virDomainObj *vm, + virDomainAsyncJob asyncJob) { size_t i; int ret =3D -1; @@ -7243,10 +7243,12 @@ qemuProcessSetupDiskThrottlingBlockdev(virQEMUDrive= r *driver, for (i =3D 0; i < vm->def->ndisks; i++) { virDomainDiskDef *disk =3D vm->def->disks[i]; qemuDomainDiskPrivate *diskPriv =3D QEMU_DOMAIN_DISK_PRIVATE(disk); + g_autofree char *drivealias =3D NULL; - /* sd-cards are instantiated via -drive */ - if (qemuDiskBusIsSD(disk->bus)) - continue; + if (!QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) { + if (!(drivealias =3D qemuAliasDiskDriveFromDisk(disk))) + goto cleanup; + } /* Setting throttling for empty drives fails */ if (virStorageSourceIsEmpty(disk->src)) @@ -7255,7 +7257,7 @@ qemuProcessSetupDiskThrottlingBlockdev(virQEMUDriver = *driver, if (!qemuDiskConfigBlkdeviotuneEnabled(disk)) continue; - if (qemuMonitorSetBlockIoThrottle(qemuDomainGetMonitor(vm), NULL, + if (qemuMonitorSetBlockIoThrottle(qemuDomainGetMonitor(vm), drivea= lias, diskPriv->qomName, &disk->blkdev= iotune) < 0) goto cleanup; } @@ -7768,7 +7770,7 @@ qemuProcessLaunch(virConnectPtr conn, if (qemuProcessSetupBalloon(driver, vm, asyncJob) < 0) goto cleanup; - if (qemuProcessSetupDiskThrottlingBlockdev(driver, vm, asyncJob) < 0) + if (qemuProcessSetupDiskThrottling(driver, vm, asyncJob) < 0) goto cleanup; /* Since CPUs were not started yet, the balloon could not return the m= emory --=20 2.36.1