From: Lepton Wu <ytht.net@gmail.com>
To: brijesh.singh@amd.com
Cc: tglx@linutronix.de, kvm@vger.kernel.org, Lepton Wu <ytht.net@gmail.com>
Subject: [PATCH v2] x86/mm: Guard adding .bbs..decrypted section with CONFIG_AMD_MEM_ENCRYPT
Date: Mon, 6 Nov 2023 14:16:52 -0800 [thread overview]
Message-ID: <20231106221831.3200581-1-ytht.net@gmail.com> (raw)
In-Reply-To: <20231106220528.3193206-1-ytht.net@gmail.com>
commit b3f0907c71e0 ("x86/mm: Add .bss..decrypted section to hold shared variables")
adds almost 2M memory usage on some kernels without CONFIG_AMD_MEM_ENCRYPT.
Fix it by guarding it with CONFIG_AMD_MEM_ENCRYPT.
Signed-off-by: Lepton Wu <ytht.net@gmail.com>
---
arch/x86/kernel/vmlinux.lds.S | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 54a5596adaa6..d39798a23f86 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -69,6 +69,8 @@ jiffies = jiffies_64;
#define ALIGN_ENTRY_TEXT_BEGIN . = ALIGN(PMD_SIZE);
#define ALIGN_ENTRY_TEXT_END . = ALIGN(PMD_SIZE);
+#ifdef CONFIG_AMD_MEM_ENCRYPT
+
/*
* This section contains data which will be mapped as decrypted. Memory
* encryption operates on a page basis. Make this section PMD-aligned
@@ -88,6 +90,12 @@ jiffies = jiffies_64;
#else
+#define BSS_DECRYPTED
+
+#endif
+
+#else
+
#define X86_ALIGN_RODATA_BEGIN
#define X86_ALIGN_RODATA_END \
. = ALIGN(PAGE_SIZE); \
--
2.42.0.869.gea05f2083d-goog
prev parent reply other threads:[~2023-11-06 22:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-06 22:05 [PATCH] x86/mm: Guard adding .bbs..decrypted section with CONFIG_AMD_MEM_ENCRYPT Lepton Wu
2023-11-06 22:16 ` Lepton Wu [this message]
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=20231106221831.3200581-1-ytht.net@gmail.com \
--to=ytht.net@gmail.com \
--cc=brijesh.singh@amd.com \
--cc=kvm@vger.kernel.org \
--cc=tglx@linutronix.de \
/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