From nobody Wed May 14 13:28:11 2025 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; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1523963830355731.9786341112575; Tue, 17 Apr 2018 04:17:10 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AF6373162521; Tue, 17 Apr 2018 11:17:08 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5545217D4E; Tue, 17 Apr 2018 11:17:08 +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 EB7784CAA2; Tue, 17 Apr 2018 11:17:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3HBGpNj026851 for ; Tue, 17 Apr 2018 07:16:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id A0EF52024CA2; Tue, 17 Apr 2018 11:16:51 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A63B2024CA1; Tue, 17 Apr 2018 11:16:50 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 17 Apr 2018 13:16:42 +0200 Message-Id: <40fcd1016eaf21c216dfad2e710b463a824e2ab6.1523963533.git.mprivozn@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: zack.cornelius@kove.net, ehabkost@redhat.com Subject: [libvirt] [PATCH v2 5/5] qemu: Enable memory-backend-file.discard-data whenever possible 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Tue, 17 Apr 2018 11:17:09 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" https://bugzilla.redhat.com/show_bug.cgi?id=3D1480668 The cases when we cannot enable this optimization are: 1) nvdimms 2) if memAccess=3D'shared' Otherwise it is safe to enable it. Signed-off-by: Michal Privoznik --- src/qemu/qemu_command.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 527a35779d..b920f5c3e4 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3121,6 +3121,13 @@ qemuBuildMemoryBackendStr(virJSONValuePtr *backendPr= ops, NULL) < 0) goto cleanup; =20 + if (!mem->nvdimmPath && memAccess !=3D VIR_DOMAIN_MEMORY_ACCESS_SH= ARED && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD)= && + virJSONValueObjectAdd(props, + "B:discard-data", true, + NULL) < 0) + goto cleanup; + switch (memAccess) { case VIR_DOMAIN_MEMORY_ACCESS_SHARED: if (virJSONValueObjectAdd(props, "b:share", true, NULL) < 0) --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list