From nobody Wed May 15 16:33:13 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1633974436699758.5694485760213; Mon, 11 Oct 2021 10:47:16 -0700 (PDT) Received: from localhost ([::1]:44986 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mZzON-0006kC-5q for importer@patchew.org; Mon, 11 Oct 2021 13:47:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57586) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mZzMs-0005I2-5o for qemu-devel@nongnu.org; Mon, 11 Oct 2021 13:45:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:32171) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mZzMj-0001QL-MK for qemu-devel@nongnu.org; Mon, 11 Oct 2021 13:45:40 -0400 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-367-JTphlqWzMSGFoRl7OjXwzw-1; Mon, 11 Oct 2021 13:45:29 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4BB6D100C67B; Mon, 11 Oct 2021 17:45:28 +0000 (UTC) Received: from t480s.redhat.com (unknown [10.39.192.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD688ADCF; Mon, 11 Oct 2021 17:45:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633974332; 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=2C6ZPQ/IUloN0BLppwVSOFa1qzaeGoIE0ME10GKv/1o=; b=IJTvB6xiPqAtq98Tk5kUNvhsxLcpDKyvlyHUwyUn6CnNwbib8pLrCqsGnRm8hy77cHh1vd jcVX5DoU0cx2A0AzjY5FBG8NfMnbyjmxACnyMTbN0kseSIjRw5BwkCDL9UGMJTl0opYeJF chqej4geK+DXi636GXfk23Y2fgMnhVM= X-MC-Unique: JTphlqWzMSGFoRl7OjXwzw-1 From: David Hildenbrand To: qemu-devel@nongnu.org Subject: [PATCH v1 1/2] machine: Use host_memory_backend_is_mapped() in machine_consume_memdev() Date: Mon, 11 Oct 2021 19:45:20 +0200 Message-Id: <20211011174522.14351-2-david@redhat.com> In-Reply-To: <20211011174522.14351-1-david@redhat.com> References: <20211011174522.14351-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=david@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.049, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , David Hildenbrand , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Xu , Igor Mammedov , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1633974438088100005 Content-Type: text/plain; charset="utf-8" memory_region_is_mapped() is the wrong check, we actually want to check whether the backend is already marked mapped. For example, memory regions mapped via an alias, such as NVDIMMs, currently don't make memory_region_is_mapped() return "true". As the machine is initialized before any memory devices (and thereby before NVDIMMs are initialized), this isn't a fix but merely a cleanup. Signed-off-by: David Hildenbrand Reviewed-by: Igor Mammedov Reviewed-by: Richard Henderson --- hw/core/machine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index b8d95eec32..a1db865939 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -1260,7 +1260,7 @@ MemoryRegion *machine_consume_memdev(MachineState *ma= chine, { MemoryRegion *ret =3D host_memory_backend_get_memory(backend); =20 - if (memory_region_is_mapped(ret)) { + if (host_memory_backend_is_mapped(backend)) { error_report("memory backend %s can't be used multiple times.", object_get_canonical_path_component(OBJECT(backend))); exit(EXIT_FAILURE); --=20 2.31.1 From nobody Wed May 15 16:33:13 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1633974558159615.6799338729425; Mon, 11 Oct 2021 10:49:18 -0700 (PDT) Received: from localhost ([::1]:49078 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mZzQL-00018C-5t for importer@patchew.org; Mon, 11 Oct 2021 13:49:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57566) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mZzMo-0005GT-89 for qemu-devel@nongnu.org; Mon, 11 Oct 2021 13:45:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:32954) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mZzMk-0001Qe-Al for qemu-devel@nongnu.org; Mon, 11 Oct 2021 13:45:37 -0400 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-113-3uP3GOZ0Ov-t7UTTtJ_wiA-1; Mon, 11 Oct 2021 13:45:32 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5940618125DF; Mon, 11 Oct 2021 17:45:31 +0000 (UTC) Received: from t480s.redhat.com (unknown [10.39.192.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6AA63ADEB; Mon, 11 Oct 2021 17:45:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633974333; 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=uJZT7kZKsjzVFTbBDJjSNXKf9s3+cTG9pTvhqdd9ups=; b=arG83VfDgq7iepsWxnXfV7R0G7xYeNrsiYwZ/tGvfaNBBPFv6HE0C6vnWz8DlbAn5JnSWV kLg0Hk976TaMcYKX1T0F5Z0c7OIAzre1k9a34l4tSZR7SwZF6E2/D+53RW9yOBx/KOLFMy CTad/UL/t33l/gmcGT0cQaaXWABP/BM= X-MC-Unique: 3uP3GOZ0Ov-t7UTTtJ_wiA-1 From: David Hildenbrand To: qemu-devel@nongnu.org Subject: [PATCH v1 2/2] memory: Update description of memory_region_is_mapped() Date: Mon, 11 Oct 2021 19:45:21 +0200 Message-Id: <20211011174522.14351-3-david@redhat.com> In-Reply-To: <20211011174522.14351-1-david@redhat.com> References: <20211011174522.14351-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=david@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.049, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , David Hildenbrand , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Xu , Igor Mammedov , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1633974558446100001 Content-Type: text/plain; charset="utf-8" memory_region_is_mapped() only indicates if the memory region is mapped into a different memory region, and only if it is mapped directly (->container), not via an alias. Update the documentation to make this clearer. Signed-off-by: David Hildenbrand --- include/exec/memory.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index a185b6dcb8..abc17fc3c0 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -2265,7 +2265,8 @@ bool memory_region_present(MemoryRegion *container, h= waddr addr); =20 /** * memory_region_is_mapped: returns true if #MemoryRegion is mapped - * into any address space. + * into another #MemoryRegion directly. Will return false if the + * #MemoryRegion is mapped indirectly via an alias. * * @mr: a #MemoryRegion which should be checked if it's mapped */ --=20 2.31.1