From nobody Fri Apr 19 07:19:14 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 1650963457477886.912568690195; Tue, 26 Apr 2022 01:57:37 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 2589716E3D6B; Tue, 26 Apr 2022 08:57:33 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 754DF16E3D5C for ; Tue, 26 Apr 2022 08:56:59 +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-326-wZYuK0K6N_GJV1Z4_aoPQA-1; Tue, 26 Apr 2022 04:56:57 -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 C77D82999B3D for ; Tue, 26 Apr 2022 08:56:46 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CCA46C53E43; Tue, 26 Apr 2022 08:56:43 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) id 583D51800623; Tue, 26 Apr 2022 10:56:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650963418; 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=cwPUwP29+nbelAsHN7Hmv+Parp+IZMWoMwJKUbZv4DA=; b=R0UkPafpxWUclLF93KFQCQFrwWPgFduniqMDHiBqag2cLHdaeA036Qdsb8avT06xszoOLW cYoyjfIpbkOeREjvTvc/rVXWaUkfQcy9GDInuF+iS+2gWoje1QpZYbXt5hMKe27fvH+CWv VR8puijH7gP18jPwaa6AcXoTrBud0bg= X-MC-Unique: wZYuK0K6N_GJV1Z4_aoPQA-1 From: Gerd Hoffmann To: seabios@seabios.org Date: Tue, 26 Apr 2022 10:56:41 +0200 Message-Id: <20220426085642.1158692-2-kraxel@redhat.com> In-Reply-To: <20220426085642.1158692-1-kraxel@redhat.com> References: <20220426085642.1158692-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: S3NUK6XPXME6BRKMRMX76HGWN2SPBSIQ X-Message-ID-Hash: S3NUK6XPXME6BRKMRMX76HGWN2SPBSIQ 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 v3 1/2] malloc: use variable for ZoneHigh size 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: 1650963459320100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Use the variable highram_size instead of the BUILD_MAX_HIGHTABLE #define for the ZoneHigh size. Initialize the new variable with the old #define, so behavior does not change. This allows to easily adjust the ZoneHigh size at runtime in a followup patch. Signed-off-by: Gerd Hoffmann --- src/malloc.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/malloc.c b/src/malloc.c index 3733855caf2c..7fa50a85595b 100644 --- a/src/malloc.c +++ b/src/malloc.c @@ -422,7 +422,8 @@ malloc_preinit(void) e820_add(BUILD_BIOS_ADDR, BUILD_BIOS_SIZE, E820_RESERVED); =20 // Populate temp high ram - u32 highram =3D 0; + u32 highram_start =3D 0; + u32 highram_size =3D BUILD_MAX_HIGHTABLE; int i; for (i=3De820_count-1; i>=3D0; i--) { struct e820entry *en =3D &e820_list[i]; @@ -432,10 +433,10 @@ malloc_preinit(void) if (en->type !=3D E820_RAM || end > 0xffffffff) continue; u32 s =3D en->start, e =3D end; - if (!highram) { - u32 newe =3D ALIGN_DOWN(e - BUILD_MAX_HIGHTABLE, MALLOC_MIN_AL= IGN); + if (!highram_start) { + u32 newe =3D ALIGN_DOWN(e - highram_size, MALLOC_MIN_ALIGN); if (newe <=3D e && newe >=3D s) { - highram =3D newe; + highram_start =3D newe; e =3D newe; } } @@ -444,9 +445,10 @@ malloc_preinit(void) =20 // Populate regions alloc_add(&ZoneTmpLow, BUILD_STACK_ADDR, BUILD_EBDA_MINIMUM); - if (highram) { - alloc_add(&ZoneHigh, highram, highram + BUILD_MAX_HIGHTABLE); - e820_add(highram, BUILD_MAX_HIGHTABLE, E820_RESERVED); + if (highram_start) { + dprintf(3, "malloc: using %dk for ZoneHigh\n", highram_size / 1024= ); + alloc_add(&ZoneHigh, highram_start, highram_start + highram_size); + e820_add(highram_start, highram_size, E820_RESERVED); } } =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 07:19:14 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 1650963443928575.0121660905744; Tue, 26 Apr 2022 01:57:23 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 8A2BD16E3D67; Tue, 26 Apr 2022 08:57:19 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 9386216E3D4D for ; Tue, 26 Apr 2022 08:56:52 +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-53-a58OWpZQOBi5yyDgXIA2kg-1; Tue, 26 Apr 2022 04:56:50 -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 6CF6A3811F24 for ; Tue, 26 Apr 2022 08:56:49 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6446B1D0B0; Tue, 26 Apr 2022 08:56:47 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) id 616A61800626; Tue, 26 Apr 2022 10:56:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650963411; 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=0ojY6Qq5lNAGKDnqIB9HoISNgX53Iq8KQyT9mlW1+2w=; b=FcDIigvCSbaikeeC96Py7zihq6ZxzKu0VAz3FsemEeg9s7o9JClMSEO9Z4SgeOOTT0IfHF qRPQ+me5muBmvPxtiYKohvrrefiOUbN3skdTMQIYYo/G68HNRD8K5fhmWUgUzVBSe3mqNA fFgkaRH//vuQOp3Oz8NAR7a7t5uywto= X-MC-Unique: a58OWpZQOBi5yyDgXIA2kg-1 From: Gerd Hoffmann To: seabios@seabios.org Date: Tue, 26 Apr 2022 10:56:42 +0200 Message-Id: <20220426085642.1158692-3-kraxel@redhat.com> In-Reply-To: <20220426085642.1158692-1-kraxel@redhat.com> References: <20220426085642.1158692-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: 6QJ73UGSVGM5T7HADO274D6FMZJPTIRP X-Message-ID-Hash: 6QJ73UGSVGM5T7HADO274D6FMZJPTIRP 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 v3 2/2] malloc: use large ZoneHigh when there is enough memory 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: 1650963445310100001 Content-Type: text/plain; charset="utf-8"; x-default="true" In case there is enough memory installed use a large ZoneHigh. Signed-off-by: Gerd Hoffmann --- src/config.h | 3 ++- src/malloc.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/config.h b/src/config.h index 93c8dbc2d530..9abe355b6c47 100644 --- a/src/config.h +++ b/src/config.h @@ -17,7 +17,8 @@ // Maximum number of map entries in the e820 map #define BUILD_MAX_E820 32 // Space to reserve in high-memory for tables -#define BUILD_MAX_HIGHTABLE (256*1024) +#define BUILD_MIN_HIGHTABLE (256*1024) +#define BUILD_MAX_HIGHTABLE (16*1024*1024) // Largest supported externaly facing drive id #define BUILD_MAX_EXTDRIVE 16 // Number of bytes the smbios may be and still live in the f-segment diff --git a/src/malloc.c b/src/malloc.c index 7fa50a85595b..967e000f51ba 100644 --- a/src/malloc.c +++ b/src/malloc.c @@ -423,7 +423,7 @@ malloc_preinit(void) =20 // Populate temp high ram u32 highram_start =3D 0; - u32 highram_size =3D BUILD_MAX_HIGHTABLE; + u32 highram_size =3D BUILD_MIN_HIGHTABLE; int i; for (i=3De820_count-1; i>=3D0; i--) { struct e820entry *en =3D &e820_list[i]; @@ -434,6 +434,8 @@ malloc_preinit(void) continue; u32 s =3D en->start, e =3D end; if (!highram_start) { + if (e - s > BUILD_MAX_HIGHTABLE * 16) + highram_size =3D BUILD_MAX_HIGHTABLE; u32 newe =3D ALIGN_DOWN(e - highram_size, MALLOC_MIN_ALIGN); if (newe <=3D e && newe >=3D s) { highram_start =3D newe; --=20 2.35.1 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org