From nobody Tue Jan 21 07:43:28 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1736365864913189.13050259726333; Wed, 8 Jan 2025 11:51:04 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 03B6112E5; Wed, 8 Jan 2025 14:51:03 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id E0979149E; Wed, 8 Jan 2025 14:44:01 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 626BC13EE; Wed, 8 Jan 2025 14:43:50 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id BF4B912B7 for ; Wed, 8 Jan 2025 14:43:22 -0500 (EST) 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-637-hOmcozccNu-hk-dC2RTsLg-1; Wed, 08 Jan 2025 14:43:20 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 2C9A9195608F for ; Wed, 8 Jan 2025 19:43:20 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.103]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 50086300018D; Wed, 8 Jan 2025 19:43:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736365402; 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=1sfuHaCr2eVnRMkt75nl8hRyLUZS1ax3PJXrywIwmz8=; b=LmCaNwPgiQFZ3inigX0B3h/yhP1sPAD1fu+XNmboqur+0HoYze2ZPJTw9jyOzUUQnxP3gF NbaQ13hmeEmFMDEfjhBUNqhPV8unMyfWn1nRHJjY7Q+VcLtLLqco0dGGc0Bjgk9GTDTXL8 Q0SRqlMTC5YTlbrhS9MQg11CXHKyZ/k= X-MC-Unique: hOmcozccNu-hk-dC2RTsLg-1 X-Mimecast-MFC-AGG-ID: hOmcozccNu-hk-dC2RTsLg From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: devel@lists.libvirt.org Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 15/26] qemu: add config parameter to control auto-save bypass cache Date: Wed, 8 Jan 2025 19:42:48 +0000 Message-ID: <20250108194259.1171990-16-berrange@redhat.com> In-Reply-To: <20250108194259.1171990-1-berrange@redhat.com> References: <20250108194259.1171990-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: AdNeTFUawFhOc7c_Dt5MGkpMOewU9__BNw84yKGP2Uw_1736365400 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: O6YKE5D74JEOEP5VG2HHC4NH3USUZOKV X-Message-ID-Hash: O6YKE5D74JEOEP5VG2HHC4NH3USUZOKV X-MailFrom: berrange@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1736365867043116600 Content-Type: text/plain; charset="utf-8" When doing managed save of VMs, triggered by OS shutdown, it may be desirable to control cache usage. Signed-off-by: Daniel P. Berrang=C3=A9 --- src/qemu/libvirtd_qemu.aug | 1 + src/qemu/qemu.conf.in | 8 ++++++++ src/qemu/qemu_conf.c | 3 +++ src/qemu/qemu_conf.h | 1 + src/qemu/qemu_driver.c | 1 + src/qemu/test_libvirtd_qemu.aug.in | 1 + 6 files changed, 15 insertions(+) diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug index 8cb1b144b9..9fa6398d8d 100644 --- a/src/qemu/libvirtd_qemu.aug +++ b/src/qemu/libvirtd_qemu.aug @@ -102,6 +102,7 @@ module Libvirtd_qemu =3D | str_entry "auto_shutdown_try_shutdown" | str_entry "auto_shutdown_poweroff" | int_entry "auto_shutdown_wait" + | bool_entry "auto_save_bypass_cache" =20 let process_entry =3D str_entry "hugetlbfs_mount" | str_entry "bridge_helper" diff --git a/src/qemu/qemu.conf.in b/src/qemu/qemu.conf.in index 9287196c42..d26ab4cb57 100644 --- a/src/qemu/qemu.conf.in +++ b/src/qemu/qemu.conf.in @@ -681,6 +681,14 @@ # when 'auto_shutdown_try_shutdown' is enabled #auto_shutdown_wait =3D 30 =20 +# When a domain is configured to be auto-saved on shutdown, enabling +# this flag has the same effect as using the VIR_DOMAIN_SAVE_BYPASS_CACHE +# flag with the virDomainManagedSave API. That is, the system will +# avoid using the file system cache when writing any managed state +# file, but may cause slower operation. +# +#auto_save_bypass_cache =3D 0 + # If provided by the host and a hugetlbfs mount point is configured, # a guest may request huge page backing. When this mount point is # unspecified here, determination of a host mount point in /proc/mounts diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 7ec682e533..af09920869 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -695,6 +695,9 @@ virQEMUDriverConfigLoadSaveEntry(virQEMUDriverConfig *c= fg, if (virConfGetValueInt(conf, "auto_shutdown_wait", &cfg->autoShutdownWait) < 0) return -1; + if (virConfGetValueBool(conf, "auto_save_bypass_cache", + &cfg->autoSaveBypassCache) < 0) + return -1; =20 return 0; } diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index b8f6be110d..9818a8cbb5 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -205,6 +205,7 @@ struct _virQEMUDriverConfig { int autoShutdownTryShutdown; int autoShutdownPoweroff; int autoShutdownWait; + bool autoSaveBypassCache; =20 char *lockManagerName; =20 diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index baa0d51244..8729b0fab0 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -951,6 +951,7 @@ qemuStateStop(void) .tryShutdown =3D cfg->autoShutdownTryShutdown, .poweroff =3D cfg->autoShutdownPoweroff, .waitShutdownSecs =3D cfg->autoShutdownWait, + .saveBypassCache =3D cfg->autoSaveBypassCache, }; =20 virDomainDriverAutoShutdown(&ascfg); diff --git a/src/qemu/test_libvirtd_qemu.aug.in b/src/qemu/test_libvirtd_qe= mu.aug.in index 4c6de31199..65d0c20fe1 100644 --- a/src/qemu/test_libvirtd_qemu.aug.in +++ b/src/qemu/test_libvirtd_qemu.aug.in @@ -80,6 +80,7 @@ module Test_libvirtd_qemu =3D { "auto_shutdown_try_shutdown" =3D "all" } { "auto_shutdown_poweroff" =3D "all" } { "auto_shutdown_wait" =3D "30" } +{ "auto_save_bypass_cache" =3D "0" } { "hugetlbfs_mount" =3D "/dev/hugepages" } { "bridge_helper" =3D "qemu-bridge-helper" } { "set_process_name" =3D "1" } --=20 2.47.1