Skip to contentSkip to conversation

x86/ptdump: Remove paravirt_enabled()

PATCH In review Borislav Petkov 3 participants 3 messages Feb 18, 2016 – Feb 20, 2016

Subsystems (2)
lore
Share & tools
lore

Borislav Petkov

author maintainer
#0 lore raw

PATCH 1/1 x86/ptdump: Remove paravirt_enabled()

From: Borislav Petkov <[email protected]>

is_hypervisor_range() can simply check if the PGD index is within ffff800000000000 - ffff87ffffffffff which is the range reserved for a hypervisor. That range is practically an ABI, see Documentation/x86/x86_64/mm.txt.

Cc Andy Lutomirski <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc "Luis R. Rodriguez" <[email protected]>
---
 arch/x86/mm/dump_pagetables.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
arch/x86/mm/dump_pagetables.c +5 -6
index 4a6f1d9b5106..99bfb192803f 100644
@@ -358,20 +358,19 @@ static void walk_pud_level(struct seq_file *m, struct pg_state *st, pgd_t addr,
 #define pgd_none(a)  pud_none(__pud(pgd_val(a)))
 #endif
 
-#ifdef CONFIG_X86_64
 static inline bool is_hypervisor_range(int idx)
 {
+#ifdef CONFIG_X86_64
 	/*
 	 * ffff800000000000 - ffff87ffffffffff is reserved for
 	 * the hypervisor.
 	 */
-	return paravirt_enabled() &&
-		(idx >= pgd_index(__PAGE_OFFSET) - 16) &&
-		(idx < pgd_index(__PAGE_OFFSET));
-}
+	return	(idx >= pgd_index(__PAGE_OFFSET) - 16) &&
+		(idx <  pgd_index(__PAGE_OFFSET));
 #else
-static inline bool is_hypervisor_range(int idx) { return false; }
+	return false;
 #endif
+}
 
 static void ptdump_walk_pgd_level_core(struct seq_file *m, pgd_t *pgd,
 				       bool checkwx)
Signature · 1 line
2.3.5
Tested-by on v1 1/1
#1 lore raw
Quoted 11 lines · Borislav Petkov

From: Borislav Petkov <[email protected]>

is_hypervisor_range() can simply check if the PGD index is within ffff800000000000 - ffff87ffffffffff which is the range reserved for a hypervisor. That range is practically an ABI, see Documentation/x86/x86_64/mm.txt.

Cc Andy Lutomirski <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc "Luis R. Rodriguez" <[email protected]>

Under Xen, as PV guest:

#2 lore raw

[tip:x86/mm] x86/mm/ptdump: Remove paravirt_enabled()

In reply to Borislav Petkov
x86/mm/ptdump: Remove paravirt_enabled()
Commit-ID:  b176862fca8625b0a8bee207bca9b611413e5e24
Gitweb:     http://git.kernel.org/tip/b176862fca8625b0a8bee207bca9b611413e5e24
Author:     Borislav Petkov <[email protected]>
AuthorDate: Thu, 18 Feb 2016 21:00:41 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Sat, 20 Feb 2016 12:25:45 +0100

x86/mm/ptdump: Remove paravirt_enabled()

is_hypervisor_range() can simply check if the PGD index is within ffff800000000000 - ffff87ffffffffff which is the range reserved for a hypervisor. That range is practically an ABI, see Documentation/x86/x86_64/mm.txt.

---
 arch/x86/mm/dump_pagetables.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
arch/x86/mm/dump_pagetables.c +5 -6
index 4a6f1d9..99bfb19 100644
@@ -358,20 +358,19 @@ static void walk_pud_level(struct seq_file *m, struct pg_state *st, pgd_t addr,
 #define pgd_none(a)  pud_none(__pud(pgd_val(a)))
 #endif
 
-#ifdef CONFIG_X86_64
 static inline bool is_hypervisor_range(int idx)
 {
+#ifdef CONFIG_X86_64
 	/*
 	 * ffff800000000000 - ffff87ffffffffff is reserved for
 	 * the hypervisor.
 	 */
-	return paravirt_enabled() &&
-		(idx >= pgd_index(__PAGE_OFFSET) - 16) &&
-		(idx < pgd_index(__PAGE_OFFSET));
-}
+	return	(idx >= pgd_index(__PAGE_OFFSET) - 16) &&
+		(idx <  pgd_index(__PAGE_OFFSET));
 #else
-static inline bool is_hypervisor_range(int idx) { return false; }
+	return false;
 #endif
+}
 
 static void ptdump_walk_pgd_level_core(struct seq_file *m, pgd_t *pgd,
 				       bool checkwx)