From nobody Fri Apr 19 16:40:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1650533646288972.3082759222846; Thu, 21 Apr 2022 02:34:06 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 3AC8616E3D0B; Thu, 21 Apr 2022 09:34:01 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 87DA216E3655 for ; Thu, 21 Apr 2022 09:33:31 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-321-xSYxy4-8PGq7lT1CpXcD7g-1; Thu, 21 Apr 2022 05:33:29 -0400 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D0B173C172CF for ; Thu, 21 Apr 2022 09:33:28 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8E75F43E782; Thu, 21 Apr 2022 09:33:28 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) id B2268180039F; Thu, 21 Apr 2022 11:33:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650533610; 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=DgWjSqy31tqcl9CuBnhLtks75MX6Rls+PcHPn4NNUJw=; b=IXnZDRT2rSeqDbTplJzC46sQlk8EQgn/aAVhs54aV8YIzUzEcrQVmm302aIe3APD+W0IpX eMRARTzWFfMPC/1SaMyjdphHsNFpbKPRbsRgqn5g/1RPACZt0HtUi6WSr6pUPo6UJa0e6u 4V2kfj1uHZQ+p0izL+FzvmTYGuOkE+Y= X-MC-Unique: xSYxy4-8PGq7lT1CpXcD7g-1 From: Gerd Hoffmann To: seabios@seabios.org Date: Thu, 21 Apr 2022 11:33:25 +0200 Message-Id: <20220421093326.1382452-2-kraxel@redhat.com> In-Reply-To: <20220421093326.1382452-1-kraxel@redhat.com> References: <20220421093326.1382452-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: AWSWY2CC7YYVATKH2MPII3ASVZA4FVMO X-Message-ID-Hash: AWSWY2CC7YYVATKH2MPII3ASVZA4FVMO X-MailFrom: kraxel@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Gerd Hoffmann X-Mailman-Version: 3.3.5rc1 Precedence: list Subject: [SeaBIOS] [PATCH 1/2] malloc: add on demand ZoneHigh expansion support List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: ------ X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650533647633100001 Content-Type: text/plain; charset="utf-8"; x-default="true" When running out of memory in ZoneHigh go alloc memory from ZoneTmpHigh, add it as reserved to the e820 map and expand ZoneHigh Signed-off-by: Gerd Hoffmann --- src/malloc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/malloc.c b/src/malloc.c index 3733855caf2c..02067b5370f9 100644 --- a/src/malloc.c +++ b/src/malloc.c @@ -226,6 +226,20 @@ zonelow_expand(u32 size, u32 align, struct allocinfo_s= *fill) return alloc_new(&ZoneLow, size, align, fill); } =20 +static u32 +zonehigh_expand(u32 size, u32 align, struct allocinfo_s *fill) +{ + u32 xsize =3D ALIGN(size, BUILD_MAX_HIGHTABLE); + u32 xalign =3D align > PAGE_SIZE ? align : PAGE_SIZE; + u32 xdata =3D malloc_palloc(&ZoneTmpHigh, xsize, xalign); + if (!xdata) + return 0; + + alloc_add(&ZoneHigh, xdata, xdata + xsize); + e820_add(xdata, size, E820_RESERVED); + return alloc_new(&ZoneHigh, size, align, fill); +} + =20 /**************************************************************** * tracked memory allocations @@ -245,6 +259,8 @@ malloc_palloc(struct zone_s *zone, u32 size, u32 align) u32 data =3D alloc_new(zone, size, align, &tempdetail.datainfo); if (!CONFIG_MALLOC_UPPERMEMORY && !data && zone =3D=3D &ZoneLow) data =3D zonelow_expand(size, align, &tempdetail.datainfo); + if (!data && zone =3D=3D &ZoneHigh) + data =3D zonehigh_expand(size, align, &tempdetail.datainfo); if (!data) return 0; =20 --=20 2.35.1 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Fri Apr 19 16:40:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1650533658272995.1204733986632; Thu, 21 Apr 2022 02:34:18 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id E621416E3D14; Thu, 21 Apr 2022 09:34:13 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 3143616E36D5 for ; Thu, 21 Apr 2022 09:33:33 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-471-5lrZTC5SNbOe3smqghI7KQ-1; Thu, 21 Apr 2022 05:33:31 -0400 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CEE8318A6585 for ; Thu, 21 Apr 2022 09:33:30 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9BDA540D016A; Thu, 21 Apr 2022 09:33:30 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) id B793A180079D; Thu, 21 Apr 2022 11:33:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650533612; 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=Z227b80h8GntCRjxE3C76bOzJwHS4eJlkRo71a81NQw=; b=RzwfcSYOPo/xaDbA0zXi0Uf57XFC9xYhkO/xQbibODwo71nIUoqOCffwSvzoehx6cNWjVc sVDvyvsM9sMzMWwfLUfSAeDS6DtlUnf1dBqJa4gL1oOaEO/oAh1jKl6Ug2RH5d8e+XlWc1 WZl8yXmD1CwqJJugvjbyqmBp++KDItw= X-MC-Unique: 5lrZTC5SNbOe3smqghI7KQ-1 From: Gerd Hoffmann To: seabios@seabios.org Date: Thu, 21 Apr 2022 11:33:26 +0200 Message-Id: <20220421093326.1382452-3-kraxel@redhat.com> In-Reply-To: <20220421093326.1382452-1-kraxel@redhat.com> References: <20220421093326.1382452-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: M7W52INO5R2TGTRD4QCIQWFTFNILLR4Y X-Message-ID-Hash: M7W52INO5R2TGTRD4QCIQWFTFNILLR4Y X-MailFrom: kraxel@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Gerd Hoffmann X-Mailman-Version: 3.3.5rc1 Precedence: list Subject: [SeaBIOS] [PATCH 2/2] Revert "pmm: use tmp zone on oom" List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: ------ X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650533660004100001 Content-Type: text/plain; charset="utf-8"; x-default="true" This reverts commit a638acfa4cc772b42093c8bfe55669829a641293. Not needed any more now that ZoneHigh is expanded on demand. Signed-off-by: Gerd Hoffmann --- src/pmm.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/pmm.c b/src/pmm.c index 28b253b2d33c..640341472486 100644 --- a/src/pmm.c +++ b/src/pmm.c @@ -8,7 +8,6 @@ #include "config.h" // CONFIG_* #include "malloc.h" // _malloc #include "output.h" // dprintf -#include "e820map.h" // struct e820entry #include "std/pmm.h" // PMM_SIGNATURE #include "string.h" // checksum #include "util.h" // pmm_init @@ -76,18 +75,6 @@ handle_pmm00(u16 *args) break; case 2: data =3D malloc_palloc(highzone, size, align); - if (!data && (flags & 8)) { - /* - * We are out of meory. So go allocate from the (big) - * ZoneTmpHigh instead and reserve the block in the e820 - * map so the OS will not override it. That way we can - * handle big permanent allocations without needing a big - * ZoneHigh. - */ - data =3D malloc_palloc(&ZoneTmpHigh, size, align); - if (data) - e820_add(data, size, E820_RESERVED); - } break; case 3: { data =3D malloc_palloc(lowzone, size, align); --=20 2.35.1 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org