From nobody Fri Aug 09 06:16:11 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 4WgDF74t6nz5StC3; Fri, 09 Aug 2024 06:16:11 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WgDF74Mk9z4jfd; Fri, 9 Aug 2024 06:16:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723184171; 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=B+R+4sbmmlRknNvBomQefzuQ+MFD5DmSH2OaDPWNvLc=; b=i3WZu6vh/+60SdX5apPKwLTbD14KJ9Hfjt007V9DQTP0ztQbbvlhZOva8Y0G8cJ7iqWzCu fRB0TLqG5EU8Z/MKsU43HHsrXAoJphmb8Z6tNB3FUFiGp3uDmtZdl8Jsxx791fRoMNQA47 4+i++/QsI2DEKbKsCympy3WkJdRxD46vwqDYqRCKlj/tYSy0FeJCYCIc/40GtqJRePZawP Ra8jKkt2HpJdi7THkr5RsUmTML1Fy6XR3URxlVibadUV3HU88xWFsOFtRFBayYMoO5iCtP uioW2sPPc6YFE9evszcFVk1sTaDLMzFzEjSEovnDi2tCpxPCtavDtULxTijlTw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1723184171; a=rsa-sha256; cv=none; b=PKVwDctFQ+xhMNFm/JYUZiXWKvZ+JGCAb2QIC8nXt14lmsJFUrwDsjM3gEOxmG6pNEZp95 rxBvaLvw0OZoX6XK56v2p/+18GotDj/tXXl3/bpI7B3HftLjfhXvZHI/Vk5Ung5p4rYMCO eZ6l8RXbKv81zwd1Uw6+g2nBCJiG9+pxkgrGtwh9hfcrmo0TVn5mtJ4mEVanZ1C96E4973 G6thougmxKjSvt8COtWHjKYxU+g8duip3it3L2MCumifA7lZyENr7JUJHMRgmdAYsF6a9G QHGy0OnsM6VmTP4ntC1mvkU9/DHDhEmwxuXARubhupNXWsyNel98sB6icTMN7w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723184171; 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=B+R+4sbmmlRknNvBomQefzuQ+MFD5DmSH2OaDPWNvLc=; b=RkaGqAlnmvbFyygagzVdv/KOMU9U+ge956RUcNf6cG9jBUmrkE6E6SbV3k8lOZ3ZxIl5mG fYoEw2TE/9WCjpE+WJ2ThkY0Cl56m5qHbrugnqr9HWyb+JW+JKio5BNWNBiI07KR3diE9a ZE4CER6ZreUI2PmVYzVddFseNg9ODkvKLp7x1FgU4p9a7qTD0Lgk8sYo5nPhFATfefJrqq vXrv2jXqTxqdZZ654wUIxxLmoGWmqYdltb9wLRbwaif+wd29uFdQjAx5Fw5MEvYsop7MEB 5W0ZhozUiumIAleoS9r4H/Gv+uRu1mviAwnCyGvS+oX8pPIkyzQ0asrPKTtwTw== 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 4WgDF73rvXz14gB; Fri, 9 Aug 2024 06:16:11 +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 4796GBvq049515; Fri, 9 Aug 2024 06:16:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4796GBKV049512; Fri, 9 Aug 2024 06:16:11 GMT (envelope-from git) Date: Fri, 9 Aug 2024 06:16:11 GMT Message-Id: <202408090616.4796GBKV049512@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Corvin =?utf-8?Q?K=C3=B6hne?= Subject: git: f325f81f4ab9 - main - 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/main X-Git-Reftype: branch X-Git-Commit: f325f81f4ab93646debed0c2291c4c7f31470cfb Auto-Submitted: auto-generated The branch main has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=f325f81f4ab93646debed0c2291c4c7f31470cfb commit f325f81f4ab93646debed0c2291c4c7f31470cfb Author: Corvin Köhne AuthorDate: 2024-06-04 07:38:02 +0000 Commit: Corvin Köhne CommitDate: 2024-08-09 06:15:06 +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 --- 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