From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sphereful.davidgow.net (sphereful.davidgow.net [203.29.242.92]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F08F73B27C4 for ; Wed, 15 Apr 2026 13:51:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.29.242.92 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776261070; cv=none; b=CIUk68+qVu0Jf4v9Vuv9VM2M9PCHm6ZEMByTxbU5j45huIMbpN1oitQGyVYnZu+BCQ1ddxJ1x9BvX1A6aW4XYPzsjtdBX+VfubV5GZAnatLb+LMCH5zcbkyCgCiI3gfliNt22uAp5jTK44gq4EzYmBbvi316AAK0dREa/jHpC2I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776261070; c=relaxed/simple; bh=L8rDiJcpVdnYH7tgZwlG63ObSHujY+i4y2751AqA6Qk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=AIQQaiB8owb71Eg8qpVm6BQqCD+MOfDMD01296ZB8hXeOhYHsC0mY0dfpJ60Ny0BAvKIyNExRLZIYkjZE1RjCK6LgBJvxrOTKNjAIw3FepBOuVaAPtfKj+zwZLEfJBwn452tMS/FjSq+17gnuspZq14x0OhS7bhmmwVDLH+IQD4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=davidgow.net; spf=pass smtp.mailfrom=davidgow.net; dkim=pass (4096-bit key) header.d=davidgow.net header.i=@davidgow.net header.b=X4dQ1gEs; dkim=pass (4096-bit key) header.d=davidgow.net header.i=@davidgow.net header.b=VkyKftv+; arc=none smtp.client-ip=203.29.242.92 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=davidgow.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=davidgow.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (4096-bit key) header.d=davidgow.net header.i=@davidgow.net header.b="X4dQ1gEs"; dkim=pass (4096-bit key) header.d=davidgow.net header.i=@davidgow.net header.b="VkyKftv+" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=davidgow.net; s=201606; t=1776261066; bh=L8rDiJcpVdnYH7tgZwlG63ObSHujY+i4y2751AqA6Qk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=X4dQ1gEsEaWHFeV+FXgKQH541OstXeka1RV/QAb02HgqwoJ4CtWhDCDX6keHWvJkH HnzchMj42DEAuZ3WyIxyOyB7ZkIvjKSim06auiuk66fmkwdpprcrbPXorTZ9XlZmkS lCdTwBF4/vvF+ulY7gWoftj8iLSPXy0gSjCDj270X0uvlpCakIS4s0LhybH8k6qdM2 Bnir/3EdG5E8YPGl7BVzURXQN+3IcJFqtXKW3nN9ZQcye1Mh8aeuqeyrT/FaaPNldL ZVONIqJBJUOmAjaJMnpvic0Dt0978bviBGjQ7V0oBVjORVKrl3VunALr4tXzrVkFPN dFryZSjiSjrzk9+nd1tDvUhcMsW4vC8SEF7rJRQAw5nkyqNlDNY13uSqFSAG7VHtEs /CCev7HQVhwCI2SMtdRCcpO5UH/FplhZhEpV3CZbYcB2cXJx0ilAxh9XsbBiTsj+J8 R4oU0Ea0tFsrTD6COAI1k+7vxg6WvezLol+7ayqjgHbbuikwVwixmV3YzsQF+R6NGb szVf/ZVwVg/4kaDMaapIdGlcTrmJZuHi01T+Or5bfzOgEUmZSmKdU+D9iMW56DkIJ3 SN+N41ds6QE+gRZf9Q1n7fAS3MMjfxnIQpPsdy25yPND8OBSOEE4q9rKOXAnQvwtLC PISYtBEXjS4vSua9XHNN5lho= Received: by sphereful.davidgow.net (Postfix, from userid 119) id 6FB6F1E6889; Wed, 15 Apr 2026 21:51:06 +0800 (AWST) X-Spam-Level: DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=davidgow.net; s=201606; t=1776261035; bh=L8rDiJcpVdnYH7tgZwlG63ObSHujY+i4y2751AqA6Qk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=VkyKftv+XanTQEFMfJJTocP1SqqpTW4L4vU5gy4fEMRi2YAoGIg/sPl5XWQ8SyfLe eCZEIT1H5VII9tRFYa3Utcu+iiS9AZztGZXucKVYNmBRZbenIKP4VhqESAsiVU4iPQ rppvASW8j9p/2IQgvYZ+EmynZA+YTrSGPirahpTeQyFP9mxHZ6iYiGtDt4WHABQWpO WKiVuQlEi2MZZycy1RotS2HmIRUfKtSK8+XddtXivsj2kxYuKJzSfi/yRXephQtXZZ AbgzslMqMpD7+UnoyIDzecOCCcn8Zd/o0DXahdcyafVOXd1uGG9pB9Q3LM5MQKGUOf LgyLfYC3qMUzDNvt5vpsDq1frqq9qi6gw/f+CHPnof8LkbrVVrps6BTLmBEPu/GRB6 78gUYJ6mpQo0XMMYR06bK5ht5pph9kWQK6QHnm0HwbUetY7uKa0MowhkqIhCnpH1eB iM+3G9q/MTsRz0GLZx30iLMw2HSMQ9hgegRg1Bo6bYhIx1s7uduwgaqLMrs1z3hOMU tSP6ni2mgQUoMZq5py9bjiGLVVW5J6KsNfdOL4dG6NzsbScwvfjk1mV+QxhCP9cMaw EC/DeyIbyLd9wJ/exsZJj01vMQwF7m740HHvlivtvVHW99xVMSM8AkyeJncMEN5Bvc 5OSFfXMM/6kg4amJTf9rZhJk= Received: from [IPV6:2001:8003:8810:ea00:ed87:ca88:5326:e11d] (unknown [IPv6:2001:8003:8810:ea00:ed87:ca88:5326:e11d]) by sphereful.davidgow.net (Postfix) with ESMTPSA id E63CE1E6887; Wed, 15 Apr 2026 21:50:35 +0800 (AWST) Message-ID: <5eed2487-4ccc-46d1-9227-46d729087505@davidgow.net> Date: Wed, 15 Apr 2026 21:50:32 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] x86/boot/e820: Re-enable fallback if e820 table is empty To: Andy Shevchenko Cc: Ingo Molnar , Thomas Gleixner , Borislav Petkov , Dave Hansen , x86@kernel.org, Andy Shevchenko , Arnd Bergmann , Nikolay Borisov , "H . Peter Anvin" , linux-kernel@vger.kernel.org References: <20260415003021.1543723-1-david@davidgow.net> Content-Language: fr From: David Gow In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Le 15/04/2026 à 4:51 PM, Andy Shevchenko a écrit : > On Wed, Apr 15, 2026 at 08:30:18AM +0800, David Gow wrote: >> In commit 157266edcc56 ("x86/boot/e820: Simplify append_e820_table() and remove restriction on single-entry tables"), > > Note, it's fine to wrap this line in the commit message, it's only requirement > to tags to be "1 tag — 1 line". > Thanks -- I vaguely recall checkpatch complaining about this at some point, though I could've been imagining it... >> 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(). >> >> Tested against linld, and the kernel boots again fine. >> >> Fixes: 157266edcc56 ("x86/boot/e820: Simplify append_e820_table() and remove restriction on single-entry tables") > > ... > >> struct boot_e820_entry *entry = entries; >> >> + /* If there aren't any entries, we'll want to fall-back to another source. */ >> + if (!nr_entries) >> + return -1; > > Can we return -ENODATA or -ENOENT here? > Sounds like a good idea. The previous code (like this) used -1 for both "there are no entires" and "there are entries which look bogus". Maybe we should replace the latter with -EINVAL, too. -- David