From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <jbeulich@suse.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Julien Grall <julien@xen.org>,
Stefano Stabellini <sstabellini@kernel.org>,
Anthony PERARD <anthony.perard@vates.tech>,
Michal Orzel <michal.orzel@amd.com>,
Teddy Astie <teddy.astie@vates.tech>,
Marek Marczykowski <marmarek@invisiblethingslab.com>,
Daniel Smith <dpsmith@apertussolutions.com>
Subject: Re: [PATCH v2 2/3] x86/EFI: replace ebmalloc()
Date: Thu, 30 Jul 2026 19:08:13 +0100 [thread overview]
Message-ID: <2eb924b2-11fd-45be-b933-c6352fb2dfe0@citrix.com> (raw)
In-Reply-To: <98388998-c5c6-4991-8662-2b4bf25188f2@suse.com>
On 27/07/2026 11:20 am, Jan Beulich wrote:
> --- a/xen/arch/x86/setup.c
> +++ b/xen/arch/x86/setup.c
> @@ -31,6 +31,7 @@
> #include <asm/alternative.h>
> #include <asm/apic.h>
> #include <asm/bootinfo.h>
> +#include <asm/brk.h>
> #include <asm/bzimage.h>
> #include <asm/cpu-policy.h>
> #include <asm/e820.h>
> @@ -164,6 +165,8 @@ cpumask_t __read_mostly cpu_present_map;
>
> unsigned long __read_mostly xen_phys_start;
>
> +unsigned long __ro_after_init brk_end;
> +
> /* Only used in asm code and within this source file */
> char asmlinkage __section(".init.bss.stack_aligned") __aligned(STACK_SIZE)
> cpu0_stack[STACK_SIZE];
> @@ -1141,7 +1144,6 @@ void asmlinkage __init noreturn __start_
> struct boot_info *bi;
> unsigned long nr_pages, raw_max_page;
> int i, j, bytes = 0;
> - unsigned long eb_start, eb_end;
> bool acpi_boot_table_init_done = false, relocated = false;
> bool vm_init_done = false;
> int ret;
> @@ -1511,7 +1513,7 @@ void asmlinkage __init noreturn __start_
> /*
> * This needs to remain in sync with remove_xen_ranges() and the
> * respective reserve_e820_ram() invocation below. No need to
> - * query efi_boot_mem_unused() here, though.
> + * query brk_get_unused_start() here, though.
> */
> xen->start = virt_to_maddr(_stext);
> xen->size = __2M_rwdata_end - _stext;
> @@ -1654,18 +1656,11 @@ void asmlinkage __init noreturn __start_
> if ( !xen_phys_start )
> panic("Not enough memory to relocate Xen\n");
>
> - /* FIXME: Putting a hole in .bss would shatter the large page mapping. */
> - if ( using_2M_mapping() )
> - efi_boot_mem_unused(NULL, NULL);
> -
> /* This needs to remain in sync with remove_xen_ranges(). */
> - if ( efi_boot_mem_unused(&eb_start, &eb_end) )
> - {
> - reserve_e820_ram(&boot_e820, __pa(_stext), __pa(eb_start));
> - reserve_e820_ram(&boot_e820, __pa(eb_end), __pa(__2M_rwdata_end));
> - }
> - else
> - reserve_e820_ram(&boot_e820, __pa(_stext), __pa(__2M_rwdata_end));
> + brk_end = brk_get_unused_start();
> + if ( using_2M_mapping() )
> + brk_end = PAGE_ALIGN_2M(brk_end);
> + reserve_e820_ram(&boot_e820, __pa(_stext), __pa(brk_end));
Hiding brk_end in setup.c like this is quite rude. I guess it's because
you want to have brk.c be brk.init.o, but it really does live with the
other brk functions.
Furthermore, having brk_end right from the outset fixes the fact that
brk_get_unused_start() is doing things beyond retrieving a value.
With brk_end being the real bump pointer the allocator uses, then the
only function you need is brk_finish() (name subject to improvement)
which is now very clear about the point at which brk allocations cease
working.
The rest, dropping EFI's current ebmalloc() all looks fine now.
~Andrew
next prev parent reply other threads:[~2026-07-30 18:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-27 10:18 [PATCH v2 0/3] x86: "brk" allocator Jan Beulich
2026-07-27 10:19 ` [PATCH v2 1/3] x86: introduce " Jan Beulich
2026-07-28 8:36 ` Jan Beulich
2026-07-30 17:59 ` Andrew Cooper
2026-07-27 10:20 ` [PATCH v2 2/3] x86/EFI: replace ebmalloc() Jan Beulich
2026-07-30 18:08 ` Andrew Cooper [this message]
2026-07-27 10:20 ` [PATCH v2 3/3] xhci-dbc: use brk_alloc() Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2eb924b2-11fd-45be-b933-c6352fb2dfe0@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=dpsmith@apertussolutions.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=marmarek@invisiblethingslab.com \
--cc=michal.orzel@amd.com \
--cc=sstabellini@kernel.org \
--cc=teddy.astie@vates.tech \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.