From nobody Sun Feb 8 22:19:06 2026 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 1727092179086503.74634747872983; Mon, 23 Sep 2024 04:49:39 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 30798142C; Mon, 23 Sep 2024 07:49:36 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 7D935176C; Mon, 23 Sep 2024 07:48:12 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 1AB751419; Mon, 23 Sep 2024 07:48:06 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 999D513F2 for ; Mon, 23 Sep 2024 07:48:05 -0400 (EDT) Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-290-Lop3j2wLNm2Wde87BFeiMQ-1; Mon, 23 Sep 2024 07:48:04 -0400 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a8d21b5cb5fso262105566b.0 for ; Mon, 23 Sep 2024 04:48:03 -0700 (PDT) Received: from wheatley.localdomain (37-188-137-5.red.o2.cz. [37.188.137.5]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90613315e3sm1205510566b.209.2024.09.23.04.48.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2024 04:48:02 -0700 (PDT) Received: from wheatley.pinto-pinecone.ts.net (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id A599A26732ED for ; Mon, 23 Sep 2024 13:48:00 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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=1727092085; 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=rU+hHIsGYBCXzM8eJHqxfZ/Z7eeGn0mrbNIYwD45otE=; b=bSEzDKKwCl4+zku5nrEdyvjqSkfn4/twIG1oKpo+Q+WdyBkGIjWyjub01ISXOC2MK5rAHR ZgCqQMt1tA3lptsaJw6cFi1qOZmveIxZbIqXhnOBm1QF2WyEHKYQ0FdTclAlSjWzInLN3z +4DxPzsryzl8AQ9dTIVpIVTuOhLVHJI= X-MC-Unique: Lop3j2wLNm2Wde87BFeiMQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727092083; x=1727696883; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rU+hHIsGYBCXzM8eJHqxfZ/Z7eeGn0mrbNIYwD45otE=; b=ILELq57HlcH4OOJMx0ARqEYZfp3TFVSSkMoZgF76I7Fk7LMXrzgUMlYgdScwNIOM+s aiQn3nhiw80qPdDPs+VO+dcl+f5LdwPSOqYtmMCvRNXGarFz4/+m2mTZmrEE0lhnQrLL aTexvCOmbe8mWd66+lkTa0msNPp/HStGubc6msHxCOHjqsFyOCr8IdvtznBDlRdCYXGs 8n+A3ERnwocKxMvs6SqRgPzp3UUsxDrdzZD8awDyQVFxGZMHMtFc7Vn4iZhSpYLoVNm8 5ASKZ38Cfb0SuO0Ui/hYbZ/3dO7+31Rd6BtkizNFS+KZXuY58t6ZJG/HGFRRA66D23dl 7QgQ== X-Gm-Message-State: AOJu0Yz+phqiFcW0Oj+NnpqdIzLUWedCe40B6ovZjQTY7VhznPxj/v5b vAiH3+vbmuansM0RiCOrTOzBUfv6j1CPU+eU5DBo/mbklZ0h0DbOryXZS4wlvTG/uhOxVKEPgY3 qJw87Us9ifTY4KM8P3CLPqvp+7zUCPnESXyFTMNg6eFY8nA2YB8oKJhE6vtzI0XUcv7bb1m7V4V 66w0GazkaM7XU0xvtNQozCUyg5VezYTdq68+pTpO4= X-Received: by 2002:a17:907:6e88:b0:a8d:6648:813f with SMTP id a640c23a62f3a-a90d5672de2mr1319316866b.3.1727092082912; Mon, 23 Sep 2024 04:48:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHxt+zvLdWP3mmdlQIPxFBGLJ9OGwbe2NgirZAOHtVqEgNZZxMuz9f1NiHX3lRRran73f1N+A== X-Received: by 2002:a17:907:6e88:b0:a8d:6648:813f with SMTP id a640c23a62f3a-a90d5672de2mr1319314566b.3.1727092082417; Mon, 23 Sep 2024 04:48:02 -0700 (PDT) From: Martin Kletzander To: devel@lists.libvirt.org Subject: [PATCH v2 5/8] qemu: Use per-domain private memoryBackingDir for new memory backends Date: Mon, 23 Sep 2024 13:47:55 +0200 Message-ID: <8bcbea86760addf529f90d150d774b65127a4d5f.1727092045.git.mkletzan@redhat.com> X-Mailer: git-send-email 2.46.1 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: EBUDV4QO7WMEDS3ART6BZYZS6XIDBFTL X-Message-ID-Hash: EBUDV4QO7WMEDS3ART6BZYZS6XIDBFTL X-MailFrom: mkletzan@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: 1727092180450116600 Content-Type: text/plain; charset="utf-8"; x-default="true" The function qemuGetMemoryBackingPath() does not need the @def any more and priv->memoryBackingDir can be used instead of constructing the path by calling qemuGetMemoryBackingDomainPath(). Signed-off-by: Martin Kletzander --- src/qemu/qemu_command.c | 4 ++-- src/qemu/qemu_domain.c | 8 +------- src/qemu/qemu_domain.h | 1 - src/qemu/qemu_process.c | 9 +++------ 4 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index f36b02b76b35..167ee8240b22 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3222,7 +3222,7 @@ qemuBuildMemoryBackendProps(virJSONValue **backendPro= ps, } else { /* We can have both pagesize and mem source. If that's the cas= e, * prefer hugepages as those are more specific. */ - if (qemuGetMemoryBackingPath(priv, def, mem->info.alias, &memP= ath) < 0) + if (qemuGetMemoryBackingPath(priv, mem->info.alias, &memPath) = < 0) return -1; } =20 @@ -7116,7 +7116,7 @@ qemuBuildMemPathStr(const virDomainDef *def, return -1; prealloc =3D true; } else if (def->mem.source =3D=3D VIR_DOMAIN_MEMORY_SOURCE_FILE) { - if (qemuGetMemoryBackingPath(priv, def, "ram", &mem_path) < 0) + if (qemuGetMemoryBackingPath(priv, "ram", &mem_path) < 0) return -1; } =20 diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index b05b1c9647a8..3e80313ab748 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1762,7 +1762,6 @@ qemuGetMemoryBackingDomainPath(qemuDomainObjPrivate *= priv, /** * qemuGetMemoryBackingPath: * @priv: domain private data - * @def: domain definition * @alias: memory object alias * @memPath: constructed path * @@ -1773,12 +1772,9 @@ qemuGetMemoryBackingDomainPath(qemuDomainObjPrivate = *priv, */ int qemuGetMemoryBackingPath(qemuDomainObjPrivate *priv, - const virDomainDef *def, const char *alias, char **memPath) { - g_autofree char *domainPath =3D NULL; - if (!alias) { /* This should never happen (TM) */ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -1786,10 +1782,8 @@ qemuGetMemoryBackingPath(qemuDomainObjPrivate *priv, return -1; } =20 - if (qemuGetMemoryBackingDomainPath(priv, def, &domainPath) < 0) - return -1; + *memPath =3D g_strdup_printf("%s/%s", priv->memoryBackingDir, alias); =20 - *memPath =3D g_strdup_printf("%s/%s", domainPath, alias); return 0; } =20 diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 8f41c4af81c0..dcff4272b869 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -944,7 +944,6 @@ int qemuGetMemoryBackingDomainPath(qemuDomainObjPrivate= *priv, char **path); =20 int qemuGetMemoryBackingPath(qemuDomainObjPrivate *priv, - const virDomainDef *def, const char *alias, char **memPath); =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 1d3a905dd854..dd3afbeb39ac 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4094,12 +4094,9 @@ qemuProcessBuildDestroyMemoryPaths(virQEMUDriver *dr= iver, } =20 if (!build || shouldBuildMB) { - g_autofree char *path =3D NULL; - if (qemuGetMemoryBackingDomainPath(QEMU_DOMAIN_PRIVATE(vm), vm->de= f, &path) < 0) - return -1; - if (qemuProcessBuildDestroyMemoryPathsImpl(driver, vm, - path, build) < 0) + QEMU_DOMAIN_PRIVATE(vm)= ->memoryBackingDir, + build) < 0) return -1; } =20 @@ -4113,7 +4110,7 @@ qemuProcessDestroyMemoryBackingPath(virDomainObj *vm, { g_autofree char *path =3D NULL; =20 - if (qemuGetMemoryBackingPath(QEMU_DOMAIN_PRIVATE(vm), vm->def, mem->in= fo.alias, &path) < 0) + if (qemuGetMemoryBackingPath(QEMU_DOMAIN_PRIVATE(vm), mem->info.alias,= &path) < 0) return -1; =20 if (unlink(path) < 0 && --=20 2.46.1