From nobody Sat May 18 23:55:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1582998720; cv=none; d=zohomail.com; s=zohoarc; b=KJDrWfX1lwOP7vHEqEFnWKQCXRbFucGXOZpeGz/sGtDualVrogRlYz8SVyorFAs0L8CAQ9ieugsBnPCjS2aCntX30kohhYe15WRvE8OtXq8N5Ko6V9ZnSECSkrft9QCGdo5LC2Zy450VRJyTlNRCGoKgEVKqayAqzd6FUQy12Qs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582998720; h=Content-Type:Content-Transfer-Encoding:Cc: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=4HSk5s4pTlJwQMM+rDkEWH3nJafv4cP/rR3tH05P8W4=; b=GpAQnu/+hDdj+d3D/rbssfbpoVQIELUiGV55p7xmdEyVMtgV25+UX4SLYPZ7ZxMtrsh0Yq4KSeV8plLQ85o/OCVdX/IR6tOwWmIsql/25bRDgvm+nC5ZFecc2nmlnDfOCBFPiFPdJVwVuYTiPlVB4F7iNQl1tQ6iZpahKB2lk9Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1582998720161782.3289304396659; Sat, 29 Feb 2020 09:52:00 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-278-UWVuVWnKOseOy8VTk4zITA-1; Sat, 29 Feb 2020 12:51:56 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 28378801E66; Sat, 29 Feb 2020 17:51:51 +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 9D55C8D543; Sat, 29 Feb 2020 17:51:50 +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 0015184484; Sat, 29 Feb 2020 17:51:49 +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 01THpa5j014195 for ; Sat, 29 Feb 2020 12:51:36 -0500 Received: by smtp.corp.redhat.com (Postfix) id 598F82063206; Sat, 29 Feb 2020 17:51:36 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 51F642026D69 for ; Sat, 29 Feb 2020 17:51:35 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EF2858007AC for ; Sat, 29 Feb 2020 17:51:34 +0000 (UTC) Received: from mail-qv1-f65.google.com (mail-qv1-f65.google.com [209.85.219.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-212-NHRzhAtzPGmmZsJlYsxjUg-1; Sat, 29 Feb 2020 12:51:32 -0500 Received: by mail-qv1-f65.google.com with SMTP id l13so952136qvo.12 for ; Sat, 29 Feb 2020 09:51:32 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c7:8749:2052:fc6c:a4b4:ccbc]) by smtp.gmail.com with ESMTPSA id b5sm7158282qkh.58.2020.02.29.09.51.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Feb 2020 09:51:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582998718; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=4HSk5s4pTlJwQMM+rDkEWH3nJafv4cP/rR3tH05P8W4=; b=JrPxP/QQCKNBvkStkT8becSHAi6m5Vw0ZFP4B4e5a6fnGhUO2wnegpNqt9DtSuBgTlgSiu CKzjb0OotRVyaTzva81sDnxUfcdFEsyouggXKdMmA+v86wDU2A7D7QXyBevyZoqzoELjYe Q071foCIOFQhWc+tXThz9ZC9VHN4A9E= X-MC-Unique: UWVuVWnKOseOy8VTk4zITA-1 X-MC-Unique: NHRzhAtzPGmmZsJlYsxjUg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CFsU2rS2e75B72njkdBXSE8RKzE4Nt1GVdB09x5K+uk=; b=mvGJNtb7pAJnXpsuCeTp0o+96MYmZwXes9Uex0ZrIDWSzhwuRN8S4IQcXaKu/YYUpL NlatfWpn9aRPRmKeOsui5238XLGfoEBcSBJtpoUvTWRhom8IwWdZ83XVOKnepoCroTu5 FpwUo9kBd47Glh4fhxdz9K2arAuZ2Dc8MuTbXMvca+3S/eP0S7VORocVE4fWlo4UrmMK E5JFf17OGk4VlTpgcUV1+/+FdwGYS0LeiI4rQD7SmKtPxU1CuXX6aA/wWeh2bQ9LclBr ft1epogm0lT0bt7FFOe2ni5evaEoGfLuZuvAu/aXJ07R5sUPlOl2O1K9Nn7/2jREn16N rbeg== X-Gm-Message-State: APjAAAXOYnXmoTRpwazDt6KmhBe/5Kv0wHbyKh4xYoLFerBBfw+Hgddd 2f4lM2wU1HraWnhcNmgyOkhv/R/l4dI= X-Google-Smtp-Source: APXvYqyaiMYRt2+22rcn1N4EifYBgvKGZ1WtSapCmmbhMRBAboWjRed7Pq37/4iLija5Js+5ANPILQ== X-Received: by 2002:a0c:ecc6:: with SMTP id o6mr8672344qvq.220.1582998691696; Sat, 29 Feb 2020 09:51:31 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 1/3] qemu_domain.c: make qemuDomainGetMemoryModuleSizeAlignment() public Date: Sat, 29 Feb 2020 14:51:12 -0300 Message-Id: <20200229175114.376223-2-danielhb413@gmail.com> In-Reply-To: <20200229175114.376223-1-danielhb413@gmail.com> References: <20200229175114.376223-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 01THpa5j014195 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This function will be used in qemu_hotplug.c in the next patch. While we're at it, we can remove the virDomainMemoryDef argument since the alignment size doesn't change with this object. The only existent caller can also be brought out of a loop which iterates in a virDomainMemoryDef list. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_domain.c | 7 +++---- src/qemu/qemu_domain.h | 2 ++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 3dfa71650d..27f400005e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -12308,9 +12308,8 @@ qemuDomainGetMemorySizeAlignment(virDomainDefPtr de= f) } =20 =20 -static unsigned long long -qemuDomainGetMemoryModuleSizeAlignment(const virDomainDef *def, - const virDomainMemoryDef *mem G_GNU= C_UNUSED) +unsigned long long +qemuDomainGetMemoryModuleSizeAlignment(const virDomainDef *def) { /* PPC requires the memory sizes to be rounded to 256MiB increments, so * round them to the size always. */ @@ -12368,8 +12367,8 @@ qemuDomainAlignMemorySizes(virDomainDefPtr def) } =20 /* Align memory module sizes */ + align =3D qemuDomainGetMemoryModuleSizeAlignment(def); for (i =3D 0; i < def->nmems; i++) { - align =3D qemuDomainGetMemoryModuleSizeAlignment(def, def->mems[i]= ); def->mems[i]->size =3D VIR_ROUND_UP(def->mems[i]->size, align); hotplugmem +=3D def->mems[i]->size; =20 diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index f8fb48f2ff..d27d7e78d9 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -996,6 +996,8 @@ int qemuDomainDefValidateMemoryHotplug(const virDomainD= ef *def, virQEMUCapsPtr qemuCaps, const virDomainMemoryDef *mem); =20 +unsigned long long qemuDomainGetMemoryModuleSizeAlignment(const virDomainD= ef *def); + bool qemuDomainSupportsNewVcpuHotplug(virDomainObjPtr vm); bool qemuDomainHasVcpuPids(virDomainObjPtr vm); pid_t qemuDomainGetVcpuPid(virDomainObjPtr vm, unsigned int vcpuid); --=20 2.24.1 From nobody Sat May 18 23:55:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1582998725; cv=none; d=zohomail.com; s=zohoarc; b=ixetR3x0CsEHX7ZyE9E+PqRKFE0ezl6PKcZBDXxPRfsaXyvqzlejyn4oWRuzb3GYsQUjks19r7ub80bSxan2q8hQ48mkDdW3i6irl5/FEo+y3NESQABxJ+HSKU6WXaqyU/qDi+ihJ8xpdMlxT+7TsHBQQZvNBMYXOTD9pNyy2i0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582998725; h=Content-Type:Content-Transfer-Encoding:Cc: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=U4xqs66fdOhftG7U/qZ4AK48SUX+F2K9pmE0d3/HNtM=; b=Pc4Fi5p9VGrHTbmWwOXjgfkk3eEMAJSumwiTCUbm1cGcoKrh00/tfY4xl+Z7qTjFfXUvIzm55E71UDXREve81u8zUCanr4Oc6HC96oegzMU6sK0mjQH6vVsPt+CuG7VRgMLMpiLXckLkJXzi3w1mczITjXIHpTXftSxrxHB9osY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1582998725610903.7291376589518; Sat, 29 Feb 2020 09:52:05 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-308-fgtDfXPbOx-n9bTGcPSRyw-1; Sat, 29 Feb 2020 12:52:01 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8820D107ACC5; Sat, 29 Feb 2020 17:51:56 +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 616A990526; Sat, 29 Feb 2020 17:51:56 +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 8854718089CF; Sat, 29 Feb 2020 17:51:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01THpfsv014223 for ; Sat, 29 Feb 2020 12:51:41 -0500 Received: by smtp.corp.redhat.com (Postfix) id EBE1510DCF6D; Sat, 29 Feb 2020 17:51:40 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E6CAA10DCF6C for ; Sat, 29 Feb 2020 17:51:38 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 62700867B17 for ; Sat, 29 Feb 2020 17:51:38 +0000 (UTC) Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-396-f71yw8wXO_G_r3LsEbADdA-1; Sat, 29 Feb 2020 12:51:34 -0500 Received: by mail-qt1-f194.google.com with SMTP id r5so4515014qtt.9; Sat, 29 Feb 2020 09:51:34 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c7:8749:2052:fc6c:a4b4:ccbc]) by smtp.gmail.com with ESMTPSA id b5sm7158282qkh.58.2020.02.29.09.51.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Feb 2020 09:51:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582998724; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=U4xqs66fdOhftG7U/qZ4AK48SUX+F2K9pmE0d3/HNtM=; b=N6nQyqiAHmW475ISdcZbRK676MjiXgbqXnVsQopJrNBHovE10xMA09pPy8gesjaBSDRX0P EVVc2Qyv98b3gN7JkFRfT5LgvbG3Q7YlzJvuG+SsjcZILotYTZjiqRM5mPDjH5F6cd2Qfk RSVjWckjtFKue8y7iyXtejoW39rT+to= X-MC-Unique: fgtDfXPbOx-n9bTGcPSRyw-1 X-MC-Unique: f71yw8wXO_G_r3LsEbADdA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nvOKQ/Xmkdd30/0wDkWWYHOlgKruk6myixSPoUmOy7s=; b=W2dJGJdF7/OOyRinUgRPYNc9PKOek3daQx046xjh2Gx372VzPAPvX0QXB03gcvE7eN 7eLr83QRfh4+5vfh2hUEXj3DFezD7pPyeImwRDYh7sywjh6q23DfgtYqo27HGeJqInhF d0pbbXIOJVElvpT6yeFVUDybjatCCOj3sV1y6zaHQiQt66H/absop/IX4aTCbfQBl+nO 04PHGorJ4bkVodkbupDLFxaAsEEe2ouerxDsOvFik32XJQx6NCPdHeehXNXch/b5mCup V5tCQqXT12zpj0rAHGxhsop7I7gvmV7vWPC2uQP+NWhUbXBSHeKHK9BNq5qlOmXZ1VGg b+SQ== X-Gm-Message-State: APjAAAWljRaqhX/S6N9pI8/KHejZtlrUjDRA+NBI54MYDzaBj/wNho4P 5JhQkRFnnvlEtjgNPpHa+PrbrfFDr5k= X-Google-Smtp-Source: APXvYqx9z9shBObGW6nxmqf3FmikOAXdDuXxjNq0RYDhqqL0IVxxdkp4R/ARMtLA6RU9AY7O1NUBVg== X-Received: by 2002:ac8:4cc5:: with SMTP id l5mr5136154qtv.16.1582998693216; Sat, 29 Feb 2020 09:51:33 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 2/3] qemu_hotplug.c: remove dimm auto-align on hotplug/unplug Date: Sat, 29 Feb 2020 14:51:13 -0300 Message-Id: <20200229175114.376223-3-danielhb413@gmail.com> In-Reply-To: <20200229175114.376223-1-danielhb413@gmail.com> References: <20200229175114.376223-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 01THpfsv014223 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , Dan Zheng 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" ppc64 guests need the dimm to be aligned to 256MiB. The existing auto-align mechanic in qemuDomainAttachMemory(), via qemuDomainMemoryDeviceAlignSize(), is rounding up the dimms to the next 256MiB alignment. This leads to confusing situations in which the user intended to hotplug 300MiB, but see 512MiB memory being added, an extra 212MiB due to this rounding. The auto-align is also active for x86, but it is currently broken. qemuDomainMemoryDeviceAlignSize() is checking for the memory alignment (1MiB) instead of memory module alignment (2MiB). The end result is that QEMU ends up firing an error, warning the user of the 2MiB alignment requirement. Removing the auto-alignment of memory dimms in hotplug/unplug, warning the user of the dimm alignment error instead, allows ppc64 users to get a proper error message instead of seeing unintended extra MBs appearing in the guest. For x86, instead of fixing the auto-align and changing the current user expectation of seeing an error message on dimm misalign, while adding yet another x86 vs ppc64 difference in the code, remove auto-align for x86 as well. x86 users will benefit from a friendlier error message, and this time an intended one. This is the current QEMU error when an misaligned x86 dimm is hotplugged: $ sudo ./run virsh attach-device memtest mem_err.xml error: Failed to attach device from mem_err.xml error: internal error: unable to execute QEMU command 'device_add': backend= memory size must be multiple of 0x200000 This is the new error message: $ sudo ./run virsh detach-device memtest mem_err.xml error: Failed to detach device from mem_err.xml error: unsupported configuration: dimm memory must be aligned with 2 MiB A similar error message is displayed in the ppc64 case. Reported-by: Dan Zheng Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=3D1780506 Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_hotplug.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index ca18bb9e5f..576eb37f0b 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -2317,6 +2317,23 @@ qemuDomainAttachRNGDevice(virQEMUDriverPtr driver, } =20 =20 +static int +qemuDomainMemoryDimmIsAligned(const virDomainDef *def, + virDomainMemoryDefPtr mem) +{ + unsigned long long align =3D qemuDomainGetMemoryModuleSizeAlignment(de= f); + + if (mem->size % align !=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("dimm memory must be aligned with %llu MiB"), + align / 1024); + return -1; + } + + return 0; +} + + /** * qemuDomainAttachMemory: * @driver: qemu driver data @@ -2348,7 +2365,8 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver, int id; int ret =3D -1; =20 - qemuDomainMemoryDeviceAlignSize(vm->def, mem); + if (qemuDomainMemoryDimmIsAligned(vm->def, mem) < 0) + goto cleanup; =20 if (qemuDomainDefValidateMemoryHotplug(vm->def, priv->qemuCaps, mem) <= 0) goto cleanup; @@ -5637,7 +5655,8 @@ qemuDomainDetachPrepMemory(virDomainObjPtr vm, virDomainMemoryDefPtr mem; int idx; =20 - qemuDomainMemoryDeviceAlignSize(vm->def, match); + if (qemuDomainMemoryDimmIsAligned(vm->def, match) < 0) + return -1; =20 if ((idx =3D virDomainMemoryFindByDef(vm->def, match)) < 0) { virReportError(VIR_ERR_DEVICE_MISSING, --=20 2.24.1 From nobody Sat May 18 23:55:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1582998740; cv=none; d=zohomail.com; s=zohoarc; b=Zt99bWMrsHQbRwoML2kVVqB5ZJgkkdc9jaCwb+VooyW4B9679qDbK3dV7kUg1fbuarrMk46R6w0IneuQLRaXaeyE3ajeJcz5NrjE1T0N7juhFUxemSpWwAiBjhvJ0sFBTxzXr4uQ8Uw7oJVA8FiMjUOglii5Atvgjq3ccw1Zik4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582998740; h=Content-Type:Content-Transfer-Encoding:Cc: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=dG/cv+U2VZu5CccBxFDHmVJ4lEdWpta45QhZ9xIAAQE=; b=DL4mDj/nxCZpMpTQIUfK0pc2QzkrmQx3LPVarZDIVabOzk83vAvw+ZXODmjw/M7jnuKVckVy5TWC2NHMsB+mqmvhWnBWDi4g10Qlowb9jQhniVncv8as9fl1H/Z/ni0a9zGFDX8XMXZ4UjjmLWeLxuJFW2L5SIzi7aPIvxSh4YQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1582998740771401.8902316104163; Sat, 29 Feb 2020 09:52:20 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-226-pMTJs_HfPoqorpLOU-fUVw-1; Sat, 29 Feb 2020 12:52:16 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D0F68107ACC5; Sat, 29 Feb 2020 17:52:11 +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 9995E87B0A; Sat, 29 Feb 2020 17:52:11 +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 4F51784484; Sat, 29 Feb 2020 17:52:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01THpeOQ014218 for ; Sat, 29 Feb 2020 12:51:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3AEDADBF02; Sat, 29 Feb 2020 17:51:40 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 36C64DA673 for ; Sat, 29 Feb 2020 17:51:37 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 762B28007A4 for ; Sat, 29 Feb 2020 17:51:37 +0000 (UTC) Received: from mail-qv1-f66.google.com (mail-qv1-f66.google.com [209.85.219.66]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-294-dlD2Ad_0N96X8Fa0H__bgQ-1; Sat, 29 Feb 2020 12:51:35 -0500 Received: by mail-qv1-f66.google.com with SMTP id ea1so2933867qvb.7 for ; Sat, 29 Feb 2020 09:51:35 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c7:8749:2052:fc6c:a4b4:ccbc]) by smtp.gmail.com with ESMTPSA id b5sm7158282qkh.58.2020.02.29.09.51.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Feb 2020 09:51:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582998739; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=dG/cv+U2VZu5CccBxFDHmVJ4lEdWpta45QhZ9xIAAQE=; b=aN6460UDyZTUG5pg/t0+N9ZE6sIH2yBN0cmtphbHQpNM1j1jtFOTJLDlDEgoNiVu0A02ro TCDex0C3P3zMdfFcpKdlBCqxvDdaRnUpQQpwZKbbGc/XLMIC7fwErPpHgPyaSf7BwHB7xY 3YWXw79qG3Gz60W4sBMZj7Gd3xHQJzI= X-MC-Unique: pMTJs_HfPoqorpLOU-fUVw-1 X-MC-Unique: dlD2Ad_0N96X8Fa0H__bgQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5CY76MxSiqMTEF3qBPbJHSyZtW+z/HRYYiwpTSw7Hbc=; b=cePfsOIleqvxovdA3deySZ9h2lHiwY6jJw4M/zecFQ72TmmduTmdAZyOeoVMBwVMHG RSr0FxB7EJCt3O3kWLibHIZfJ1gMkdik0w2AJKr6d/V1/QIg1dZrofMINtkt19c5j01u 9ziZTBc8I+W+1eGIR094pUlltZkyta/ZOrJNRK+GmnaLB1riA3p2S6GZ4RWVQy42GCMk NkKb0OM7uvBTLqDLM1F3wJt5rHGkdU4z3u9rdXti8X5uxuK28pS9Lqs1+84t+wmB43AE 70fwz2OapUod9kZDNaIXGR7nu6A5XPdTd9Z8V2t8zfhG3GEHXdZqbHXY+e1HhJwKZohV wipQ== X-Gm-Message-State: APjAAAU+XlWbojGkIo8RvWj5c2ojGlUOulMVqe8LC5paWJ+9LSdSNfgL vyAr+WnHBdms2geK4gIt7hZCXL8ET0o= X-Google-Smtp-Source: APXvYqzHiTtGXoUn4et9T/0mXYYEcVl98PkEe+K2BDIlAl+o6+HyX2lpRFTn4XmriOpgu+voBWdpKg== X-Received: by 2002:ad4:4650:: with SMTP id y16mr8424174qvv.216.1582998694529; Sat, 29 Feb 2020 09:51:34 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 3/3] qemu_domain.c: remove qemuDomainMemoryDeviceAlignSize() Date: Sat, 29 Feb 2020 14:51:14 -0300 Message-Id: <20200229175114.376223-4-danielhb413@gmail.com> In-Reply-To: <20200229175114.376223-1-danielhb413@gmail.com> References: <20200229175114.376223-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 01THpeOQ014218 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Previous patch removed all the callers of the function. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_domain.c | 16 ---------------- src/qemu/qemu_domain.h | 2 -- 2 files changed, 18 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 27f400005e..1c22bba052 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -12386,22 +12386,6 @@ qemuDomainAlignMemorySizes(virDomainDefPtr def) } =20 =20 -/** - * qemuDomainMemoryDeviceAlignSize: - * @mem: memory device definition object - * - * Aligns the size of the memory module as qemu enforces it. The size is u= pdated - * inplace. Default rounding is now to 1 MiB (qemu requires rouding to pag= e, - * size so this should be safe). - */ -void -qemuDomainMemoryDeviceAlignSize(virDomainDefPtr def, - virDomainMemoryDefPtr mem) -{ - mem->size =3D VIR_ROUND_UP(mem->size, qemuDomainGetMemorySizeAlignment= (def)); -} - - /** * qemuDomainGetMonitor: * @vm: domain object diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index d27d7e78d9..efd65be779 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -956,8 +956,6 @@ bool qemuDomainHasBlockjob(virDomainObjPtr vm, bool cop= y_only) ATTRIBUTE_NONNULL(1); =20 int qemuDomainAlignMemorySizes(virDomainDefPtr def); -void qemuDomainMemoryDeviceAlignSize(virDomainDefPtr def, - virDomainMemoryDefPtr mem); =20 virDomainChrDefPtr qemuFindAgentConfig(virDomainDefPtr def); =20 --=20 2.24.1