From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: David Gow <david@davidgow.net>
Cc: Ingo Molnar <mingo@kernel.org>, Thomas Gleixner <tglx@kernel.org>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, Andy Shevchenko <andy@kernel.org>,
Arnd Bergmann <arnd@kernel.org>,
Nikolay Borisov <nik.borisov@suse.com>,
"H . Peter Anvin" <hpa@zytor.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] x86/boot/e820: Re-enable fallback if e820 table is empty
Date: Thu, 16 Apr 2026 11:11:15 +0300 [thread overview]
Message-ID: <aeCZo0f1EH_E7Nv1@ashevche-desk.local> (raw)
In-Reply-To: <20260416065746.1896647-1-david@davidgow.net>
On Thu, Apr 16, 2026 at 02:57:43PM +0800, David Gow wrote:
> In commit 157266edcc56 ("x86/boot/e820: Simplify append_e820_table() and
> remove restriction on single-entry tables"), the check that the number of
> entries in the e820 table was removed. The intention was to support
> single-entry maps, but by removing the check entirely, we also skip the
> fallback (to, e.g., the BIOS 88h function).
>
> This means that if no E820 map is passed in from the bootloader (which is
> the case on some bootloaders, like linld), we end up with an empty memory
> map, and the kernel fails to boot (either by deadlocking on OOM, or by
> failing to allocate the real mode trampoline, or similar).
>
> Re-instate the check in append_e820_table(), but only check nr_entries is
> non-zero. This allows e820__memory_setup_default() to fall back to other
> memory size sources, and doesn't affect e820__memory_setup_extended(), as
> the latter ignores the return value from append_e820_table().
>
> In so doing, we also update the return values to be proper error codes,
> with -ENOENT for this case (there are no entries), and -EINVAL for the case
> where an entry appears invalid. Given none of the callers check the actual
> value -- just whether it's nonzero -- this is largely aesthetic in
> practice.
>
> Tested against linld, and the kernel boots again fine.
...
> Changes since v2:
> https://lore.kernel.org/lkml/20260415003021.1543723-1-david@davidgow.net/
> - Return -ENOENT instead of -1
> - Return -EINVAL instead of -1 for the case where an entry looks invalid due to
> an overflow (Thanks, Andy)
Oh, I didn't noticed it's overflow condition, so -ERANGE may suit better.
Whatever, the change looks good enough and it's up to you to follow the above.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-04-16 8:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-16 6:57 David Gow
2026-04-16 8:11 ` Andy Shevchenko [this message]
2026-05-07 8:05 ` Ingo Molnar
2026-05-07 8:08 ` [tip: x86/urgent] x86/boot/e820: Re-enable BIOS " tip-bot2 for David Gow
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=aeCZo0f1EH_E7Nv1@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=arnd@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=david@davidgow.net \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=nik.borisov@suse.com \
--cc=tglx@kernel.org \
--cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®