All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: linux-efi@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H . Peter Anvin" <hpa@zytor.com>
Cc: Sai Praneeth <sai.praneeth.prakhya@intel.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	linux-kernel@vger.kernel.org, Borislav Petkov <bp@alien8.de>,
	Ricardo Neri <ricardo.neri@intel.com>,
	Ravi Shankar <ravi.v.shankar@intel.com>,
	Matt Fleming <matt@codeblueprint.co.uk>
Subject: [PATCH 12/13] x86/efi: Add EFI_PGT_DUMP support for x86_32 and kexec
Date: Fri,  2 Jun 2017 13:52:06 +0000	[thread overview]
Message-ID: <20170602135207.21708-13-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <20170602135207.21708-1-ard.biesheuvel@linaro.org>

From: Sai Praneeth <sai.praneeth.prakhya@intel.com>

EFI_PGT_DUMP, as the name suggests dumps efi page tables to dmesg during
kernel boot. This feature is very useful while debugging page
faults/null pointer dereferences to efi related addresses. Presently,
this feature is limited only to x86_64, so let's extend it to other efi
configurations like kexec kernel, efi=old_map and to x86_32 as well.
This doesn't effect normal boot path because this config option should
be used only for debug purposes.

Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Ricardo Neri <ricardo.neri@intel.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Ravi Shankar <ravi.v.shankar@intel.com>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
---
 arch/x86/platform/efi/efi.c    | 3 ++-
 arch/x86/platform/efi/efi_32.c | 9 ++++++++-
 arch/x86/platform/efi/efi_64.c | 5 ++++-
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index dc2da5e2c7e4..3cf8536e803b 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -1012,7 +1012,6 @@ static void __init __efi_enter_virtual_mode(void)
 	 * necessary relocation fixups for the new virtual addresses.
 	 */
 	efi_runtime_update_mappings();
-	efi_dump_pagetable();
 
 	/* clean DUMMY object */
 	efi_delete_dummy_variable();
@@ -1027,6 +1026,8 @@ void __init efi_enter_virtual_mode(void)
 		kexec_enter_virtual_mode();
 	else
 		__efi_enter_virtual_mode();
+
+	efi_dump_pagetable();
 }
 
 /*
diff --git a/arch/x86/platform/efi/efi_32.c b/arch/x86/platform/efi/efi_32.c
index 403a987d06c7..fe18c5d32bf0 100644
--- a/arch/x86/platform/efi/efi_32.c
+++ b/arch/x86/platform/efi/efi_32.c
@@ -44,7 +44,14 @@ int __init efi_alloc_page_tables(void)
 }
 
 void efi_sync_low_kernel_mappings(void) {}
-void __init efi_dump_pagetable(void) {}
+
+void __init efi_dump_pagetable(void)
+{
+#ifdef CONFIG_EFI_PGT_DUMP
+	ptdump_walk_pgd_level(NULL, swapper_pg_dir);
+#endif
+}
+
 int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
 {
 	return 0;
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 6fbf6c47e603..0d8180811445 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -528,7 +528,10 @@ void __init efi_runtime_update_mappings(void)
 void __init efi_dump_pagetable(void)
 {
 #ifdef CONFIG_EFI_PGT_DUMP
-	ptdump_walk_pgd_level(NULL, efi_pgd);
+	if (efi_enabled(EFI_OLD_MEMMAP))
+		ptdump_walk_pgd_level(NULL, swapper_pg_dir);
+	else
+		ptdump_walk_pgd_level(NULL, efi_pgd);
 #endif
 }
 
-- 
2.9.3

  parent reply	other threads:[~2017-06-02 13:55 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-02 13:51 [GIT PULL 00/13] First batch of EFI updates for v4.13 Ard Biesheuvel
2017-06-02 13:51 ` [PATCH 01/13] x86/efi: Clean up efi CR3 save/restore Ard Biesheuvel
2017-06-02 13:51   ` Ard Biesheuvel
2017-06-05 15:40   ` Ingo Molnar
2017-06-05 15:40     ` Ingo Molnar
2017-06-05 16:03     ` Ard Biesheuvel
2017-06-05 16:03       ` Ard Biesheuvel
2017-06-05 16:14       ` Andy Lutomirski
2017-06-02 13:51 ` [PATCH 02/13] efi/capsule: Fix return code on failing kmap/vmap Ard Biesheuvel
2017-06-05 17:10   ` [tip:efi/core] " tip-bot for Jan Kiszka
2017-06-02 13:51 ` [PATCH 03/13] efi/capsule: Remove pr_debug on ENOMEM or EFAULT Ard Biesheuvel
2017-06-02 13:51   ` Ard Biesheuvel
2017-06-05 17:10   ` [tip:efi/core] efi/capsule: Remove pr_debug() " tip-bot for Jan Kiszka
2017-06-02 13:51 ` [PATCH 04/13] efi/capsule: Clean up pr_err/info messages Ard Biesheuvel
2017-06-05 17:11   ` [tip:efi/core] efi/capsule: Clean up pr_err/_info() messages tip-bot for Jan Kiszka
2017-06-02 13:51 ` [PATCH 05/13] efi/capsule: Adjust return type of efi_capsule_setup_info Ard Biesheuvel
2017-06-05 17:12   ` [tip:efi/core] efi/capsule: Adjust return type of efi_capsule_setup_info() tip-bot for Jan Kiszka
2017-06-02 13:52 ` [PATCH 06/13] efi/capsule-loader: Use a cached copy of the capsule header Ard Biesheuvel
2017-06-05 17:12   ` [tip:efi/core] " tip-bot for Ard Biesheuvel
2017-06-02 13:52 ` [PATCH 07/13] efi/capsule: Remove NULL test on kmap() Ard Biesheuvel
2017-06-05 17:13   ` [tip:efi/core] " tip-bot for Fabian Frederick
2017-06-02 13:52 ` [PATCH 08/13] efi/capsule-loader: Redirect calls to efi_capsule_setup_info via weak alias Ard Biesheuvel
2017-06-05 17:13   ` [tip:efi/core] efi/capsule-loader: Redirect calls to efi_capsule_setup_info() " tip-bot for Ard Biesheuvel
2017-06-02 13:52 ` [PATCH 09/13] efi/capsule-loader: Use page addresses rather than struct page pointers Ard Biesheuvel
2017-06-02 13:52   ` Ard Biesheuvel
2017-06-05 17:14   ` [tip:efi/core] " tip-bot for Ard Biesheuvel
2017-06-02 13:52 ` [PATCH 10/13] efi/capsule: Add support for Quark security header Ard Biesheuvel
2017-06-05 15:50   ` Ingo Molnar
2017-06-05 16:00     ` Ard Biesheuvel
2017-06-05 16:00       ` Ard Biesheuvel
2017-06-05 16:11       ` Ingo Molnar
2017-06-05 17:14   ` [tip:efi/core] " tip-bot for Jan Kiszka
2017-06-02 13:52 ` [PATCH 11/13] efi/efi_test: Use memdup_user() helper Ard Biesheuvel
2017-06-02 13:52   ` Ard Biesheuvel
2017-06-05 17:15   ` [tip:efi/core] " tip-bot for Geliang Tang
2017-06-02 13:52 ` Ard Biesheuvel [this message]
2017-06-05 17:16   ` [tip:efi/core] x86/efi: Extend CONFIG_EFI_PGT_DUMP support to x86_32 and kexec as well tip-bot for Sai Praneeth
2017-06-02 13:52 ` [PATCH 13/13] efi: arm: enable DMI/SMBIOS Ard Biesheuvel
2017-06-05 17:16   ` [tip:efi/core] efi/arm: Enable DMI/SMBIOS tip-bot for Ard Biesheuvel
2017-06-05  8:15 ` [GIT PULL 00/13] First batch of EFI updates for v4.13 Ard Biesheuvel
2017-06-05  9:07   ` Ingo Molnar
2017-06-05  9:07     ` Ingo Molnar
2017-06-05  9:35     ` Ard Biesheuvel
2017-06-05  9:35       ` Ard Biesheuvel
2017-06-05 15:53       ` Ingo Molnar
2017-06-05 15:53         ` Ingo Molnar

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=20170602135207.21708-13-ard.biesheuvel@linaro.org \
    --to=ard.biesheuvel@linaro.org \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@codeblueprint.co.uk \
    --cc=mingo@kernel.org \
    --cc=ravi.v.shankar@intel.com \
    --cc=ricardo.neri@intel.com \
    --cc=sai.praneeth.prakhya@intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.