From nobody Tue Nov 12 07:55:41 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Xndy602sDz5bfC1; Tue, 12 Nov 2024 07:55:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xndy56C1vz4dlp; Tue, 12 Nov 2024 07:55:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731398141; 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; bh=f9XpFdu75kom2HnI1FXfWeaAo4zWULHKVHFrakh07Xk=; b=QIsTromHXfalPGbXoif7Ps/yDn+S/7TPzaDd5WFsbCwc/o3fSyIUdGLFaB8A2LUumZv74q f/Te67Azev9pHTBYaYaUWf3nyiL5NPL9GnivoQPY/b1HQ/nQ7NWLwbpoYL3w6LpcBNhWk8 O64TXA0CrFZtD12kPBoCU9SyESX9vea+21yfS0YZNsdxhDF/7gdtecaq1eaDfPF6dCWD2o UXWlSxTACizU3XOaW3DND4xPBGvYYBshVxaHUC8h+/+wysHaI+vVBrR3qOTEd+ha8qkiRT xH1+Zwd/VgpFr6+g/8t7NlZ5IJtRQlJBi2Um3fOIsPLX8/qGJFqAba5G3rJf2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731398141; 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; bh=f9XpFdu75kom2HnI1FXfWeaAo4zWULHKVHFrakh07Xk=; b=BaStDWK34jrhZe4ZI5x+kLL7dRx690Mx2Koy3MGVMz+Oe5NW6p/5TQFzYvXQ0uEJXwDmyr 0UJRUeQ9KkVRFjBfPL5o3fQlIvB1lqw+plgYhVmCJU92eW0GNf53umTp/HDVIVvtLFdbiX LwT1Z2n7l8slMmVeQUKh4RjLwgRzSC+SuJlCGr1nyuL61YG/J6tAhyWcg3KihROE+Wt8xd boPuTgx+s/+9O6I8rH8lgJl1snKCxqP3o3N1TQxkrcGic3McfgTHBRbtzOdOX5CPw+BK1j q1OXaMIaN6MQkpIBlmStjqNgOUsU3bbxkOGQPF0AhuEZUutpJuS3u5nNtxP0Ew== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1731398141; a=rsa-sha256; cv=none; b=qKxV978QKRyN3PO0co03iWTU+4HAzJPEJfNOKrtjiT4cq8eLk6Wn+oVP8/vYbULoFXa1Ej W0XLMqGVWpml2+PlxAYBhSEAhVlflVBBqXg+aD9ER7ZEg0SjNdwuGhqmHR3ygHR/HkJGvf T2gB3+kV14TguUX4Bni9gpPEZOlX8/YYTLD7oFbnysO9ntOwD3tz/W4GteOy9UK580u292 qS5zwC/wEmBYflRocvU/Aru8JRNy4JFMnkwkTzd0WRTOp5gwfMXTKPHisWLYZKZy/qcf2k YE/kiSk7Nxmq3LpMX+KXp9aBgrfzzpTHrWqzRKFFu3PdXuGU4Lazt8Sii2k0mA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Xndy55pkZz122X; Tue, 12 Nov 2024 07:55:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4AC7tfeM077034; Tue, 12 Nov 2024 07:55:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AC7tfen077031; Tue, 12 Nov 2024 07:55:41 GMT (envelope-from git) Date: Tue, 12 Nov 2024 07:55:41 GMT Message-Id: <202411120755.4AC7tfen077031@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Corvin =?utf-8?Q?K=C3=B6hne?= Subject: git: 541696f2a1d0 - stable/14 - bhyve: remove empty E820 entries List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: corvink X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 541696f2a1d08eb7f808b3ac183dc64fa8fe3cf2 Auto-Submitted: auto-generated The branch stable/14 has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=541696f2a1d08eb7f808b3ac183dc64fa8fe3cf2 commit 541696f2a1d08eb7f808b3ac183dc64fa8fe3cf2 Author: Corvin Köhne AuthorDate: 2024-06-04 07:38:02 +0000 Commit: Corvin Köhne CommitDate: 2024-11-12 07:54:21 +0000 bhyve: remove empty E820 entries When reserving a block with the same size of a RAM segement, we can end up with an empty RAM segmenet. Avoid that by removing this empty segment from the E820 table. Reviewed by: jhb, markj (older version) MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D45480 (cherry picked from commit f325f81f4ab93646debed0c2291c4c7f31470cfb) --- usr.sbin/bhyve/amd64/e820.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/amd64/e820.c b/usr.sbin/bhyve/amd64/e820.c index 9d95ec8ce688..148cae72ca6e 100644 --- a/usr.sbin/bhyve/amd64/e820.c +++ b/usr.sbin/bhyve/amd64/e820.c @@ -210,7 +210,19 @@ e820_add_entry(const uint64_t base, const uint64_t end, (base < element->base || end > element->end)) return (ENOMEM); - if (base == element->base) { + if (base == element->base && end == element->end) { + /* + * The new entry replaces an existing one. + * + * Old table: + * [ 0x1000, 0x4000] RAM <-- element + * New table: + * [ 0x1000, 0x4000] Reserved + */ + TAILQ_INSERT_BEFORE(element, new_element, chain); + TAILQ_REMOVE(&e820_table, element, chain); + free(element); + } else if (base == element->base) { /* * New element at system memory base boundary. Add new * element before current and adjust the base of the old