From: "Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>
To: x86@kernel.org, Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
"H . Peter Anvin" <hpa@zytor.com>
Cc: linux-kernel@vger.kernel.org,
"Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>,
"Cezary Rojewski" <cezary.rojewski@intel.com>,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>
Subject: [PATCH] x86: Preserve ACPI memory area during hibernation
Date: Fri, 21 Jan 2022 11:39:38 +0100 [thread overview]
Message-ID: <20220121103938.2602637-1-amadeuszx.slawinski@linux.intel.com> (raw)
When overriding NHLT ACPI-table tests show that on some platforms
there is problem that NHLT contains garbage after hibernation/resume
cycle.
Problem stems from the fact that ACPI override performs early memory
allocation using memblock_phys_alloc_range() in
memblock_phys_alloc_range(). This memory block is later being marked as
ACPI memory block in arch_reserve_mem_area(). Later when memory areas
are considered for hibernation it is being marked as nosave in
e820__register_nosave_regions().
Fix this by skipping ACPI memory area altogether when considering areas
to mark as nosave.
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
arch/x86/kernel/e820.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index bc0657f0deed..88c1b785ffe4 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -758,6 +758,18 @@ void __init e820__register_nosave_regions(unsigned long limit_pfn)
for (i = 0; i < e820_table->nr_entries; i++) {
struct e820_entry *entry = &e820_table->entries[i];
+ /*
+ * Areas containing ACPI tables should be preserved during
+ * hibernation to prevent potential problems caused by BIOS
+ * upgrades when offline, as well as to preserve initrd
+ * ACPI tables overrides which are applied on boot.
+ * See also acpi_table_upgrade() & arch_reserve_mem_area()
+ */
+ if (entry->type == E820_TYPE_ACPI) {
+ pfn = PFN_UP(entry->addr + entry->size);
+ continue;
+ }
+
if (pfn < PFN_UP(entry->addr))
register_nosave_region(pfn, PFN_UP(entry->addr));
--
2.25.1
next reply other threads:[~2022-01-21 10:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-21 10:39 Amadeusz Sławiński [this message]
2022-02-14 19:34 ` Rafael J. Wysocki
2022-02-15 12:22 ` Amadeusz Sławiński
2022-02-15 14:10 ` Rafael J. Wysocki
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=20220121103938.2602637-1-amadeuszx.slawinski@linux.intel.com \
--to=amadeuszx.slawinski@linux.intel.com \
--cc=bp@alien8.de \
--cc=cezary.rojewski@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rafael.j.wysocki@intel.com \
--cc=tglx@linutronix.de \
--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®