From: Dave Hansen <dave.hansen@intel.com>
To: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Borislav Petkov <bp@alien8.de>
Cc: Ard Biesheuvel <ardb@google.com>,
Kees Cook <keescook@chromium.org>, Aaron Lu <aaron.lu@intel.com>,
Bagas Sanjaya <bagasdotme@gmail.com>,
Tom Lendacky <thomas.lendacky@amd.com>,
x86@kernel.org, kexec@lists.infradead.org,
linux-kernel@vger.kernel.org, regressions@lists.linux.de
Subject: Re: [PATCH] x86/boot/compressed: Reserve more memory for page tables
Date: Thu, 14 Sep 2023 08:51:50 -0700 [thread overview]
Message-ID: <45cdb5ae-986e-d186-f0fd-a308f946ce8d@intel.com> (raw)
In-Reply-To: <20230914123001.27659-1-kirill.shutemov@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 898 bytes --]
On 9/14/23 05:30, Kirill A. Shutemov wrote:
> +/*
> + * Total number of page table kernel_add_identity_map() can allocate,
> + * including page tables consumed by startup_32().
> + */
> +# define BOOT_PGT_SIZE (32*4096)
I agree that needing to know this in advance *exactly* is troublesome.
But I do think that we should preserve the comment about the worst-case
scenario. Also, I thought this was triggered by unaccepted memory. Am
I remembering it wrong? How was it in play?
Either way, I think your general approach here is sound. But let's add
one little tweak to at least warn when we're getting close to the limit.
Now that nobody has to worry about the limit for the immediate future
it's a guarantee that in the long term someone will plow through it
accidentally.
Let's add a soft warning when we're nearing the limit so that there's a
chance to catch these things in the future.
[-- Attachment #2: pgtbuf.patch --]
[-- Type: text/x-patch, Size: 659 bytes --]
diff --git a/arch/x86/boot/compressed/ident_map_64.c b/arch/x86/boot/compressed/ident_map_64.c
index bcc956c17872..5dfb6a31bbb1 100644
--- a/arch/x86/boot/compressed/ident_map_64.c
+++ b/arch/x86/boot/compressed/ident_map_64.c
@@ -59,6 +59,13 @@ static void *alloc_pgt_page(void *context)
return NULL;
}
+ if (pages->pgt_buf_offset >= pages->pgt_buf_size * 3 / 4) {
+ debug_putstr("pgt_buf running low in " __FILE__ "\n");
+ debug_putstr("Need to raise BOOT_PGT_SIZE??\n");
+ debug_putaddr(pages->pgt_buf_offset);
+ debug_putaddr(pages->pgt_buf_size);
+ }
+
entry = pages->pgt_buf + pages->pgt_buf_offset;
pages->pgt_buf_offset += PAGE_SIZE;
[-- Attachment #3: Type: text/plain, Size: 143 bytes --]
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2023-09-14 15:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-14 12:30 [PATCH] x86/boot/compressed: Reserve more memory for page tables Kirill A. Shutemov
2023-09-14 15:51 ` Dave Hansen [this message]
2023-09-14 17:07 ` Kirill A. Shutemov
2023-09-15 7:02 ` [PATCHv2] " Kirill A. Shutemov
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=45cdb5ae-986e-d186-f0fd-a308f946ce8d@intel.com \
--to=dave.hansen@intel.com \
--cc=aaron.lu@intel.com \
--cc=ardb@google.com \
--cc=bagasdotme@gmail.com \
--cc=bp@alien8.de \
--cc=keescook@chromium.org \
--cc=kexec@lists.infradead.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=regressions@lists.linux.de \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--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