-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
x86/cpu_entry_area: Add debugstore entries to cpu_entry_area
The Intel PEBS/BTS debug store is a design trainwreck as it expects virtual addresses which must be visible in any execution context. So it is required to make these mappings visible to user space when kernel page table isolation is active. Provide enough room for the buffer mappings in the cpu_entry_area so the buffers are available in the user space visible page tables. At the point where the kernel side entry area is populated there is no buffer available yet, but the kernel PMD must be populated. To achieve this set the entries for these buffers to non present. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Andy Lutomirski <luto@kernel.org> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: David Laight <David.Laight@aculab.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: Eduardo Valentin <eduval@amazon.com> Cc: Greg KH <gregkh@linuxfoundation.org> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Juergen Gross <jgross@suse.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Will Deacon <will.deacon@arm.com> Cc: aliguori@amazon.com Cc: daniel.gruss@iaik.tugraz.at Cc: hughd@google.com Cc: keescook@google.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
- Loading branch information
Thomas Gleixner
authored and
Ingo Molnar
committed
Dec 23, 2017
1 parent
4b6bbe9
commit 10043e0
Showing
5 changed files
with
81 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#ifndef _ASM_INTEL_DS_H | ||
#define _ASM_INTEL_DS_H | ||
|
||
#include <linux/percpu-defs.h> | ||
|
||
#define BTS_BUFFER_SIZE (PAGE_SIZE << 4) | ||
#define PEBS_BUFFER_SIZE (PAGE_SIZE << 4) | ||
|
||
/* The maximal number of PEBS events: */ | ||
#define MAX_PEBS_EVENTS 8 | ||
|
||
/* | ||
* A debug store configuration. | ||
* | ||
* We only support architectures that use 64bit fields. | ||
*/ | ||
struct debug_store { | ||
u64 bts_buffer_base; | ||
u64 bts_index; | ||
u64 bts_absolute_maximum; | ||
u64 bts_interrupt_threshold; | ||
u64 pebs_buffer_base; | ||
u64 pebs_index; | ||
u64 pebs_absolute_maximum; | ||
u64 pebs_interrupt_threshold; | ||
u64 pebs_event_reset[MAX_PEBS_EVENTS]; | ||
} __aligned(PAGE_SIZE); | ||
|
||
DECLARE_PER_CPU_PAGE_ALIGNED(struct debug_store, cpu_debug_store); | ||
|
||
struct debug_store_buffers { | ||
char bts_buffer[BTS_BUFFER_SIZE]; | ||
char pebs_buffer[PEBS_BUFFER_SIZE]; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters