Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
c272477
Documentation
arch
alpha
arm
avr32
blackfin
cris
frv
h8300
ia64
m32r
m68k
m68knommu
mips
mn10300
parisc
powerpc
s390
sh
sparc
sparc64
um
x86
boot
configs
crypto
ia32
include/asm
bigsmp
es7000
mach-default
mach-generic
mach-rdc321x
mach-voyager
numaq
summit
uv
visws
xen
Kbuild
a.out-core.h
a.out.h
acpi.h
agp.h
alternative-asm.h
alternative.h
amd_iommu.h
amd_iommu_types.h
apic.h
apicdef.h
arch_hooks.h
asm.h
atomic.h
atomic_32.h
atomic_64.h
auxvec.h
bios_ebda.h
bitops.h
boot.h
bootparam.h
bug.h
bugs.h
byteorder.h
cache.h
cacheflush.h
calgary.h
calling.h
checksum.h
checksum_32.h
checksum_64.h
cmpxchg.h
cmpxchg_32.h
cmpxchg_64.h
compat.h
cpu.h
cpufeature.h
cputime.h
current.h
debugreg.h
delay.h
desc.h
desc_defs.h
device.h
div64.h
dma-mapping.h
dma.h
dmi.h
ds.h
dwarf2.h
e820.h
edac.h
efi.h
elf.h
emergency-restart.h
errno.h
fb.h
fcntl.h
fixmap.h
fixmap_32.h
fixmap_64.h
floppy.h
frame.h
ftrace.h
futex.h
gart.h
genapic.h
genapic_32.h
genapic_64.h
geode.h
gpio.h
hardirq.h
hardirq_32.h
hardirq_64.h
highmem.h
hpet.h
hugetlb.h
hw_irq.h
hypertransport.h
i387.h
i8253.h
i8259.h
ia32.h
ia32_unistd.h
idle.h
intel_arch_perfmon.h
io.h
io_32.h
io_64.h
io_apic.h
ioctl.h
ioctls.h
iomap.h
iommu.h
ipcbuf.h
ipi.h
irq.h
irq_regs.h
irq_regs_32.h
irq_regs_64.h
irq_remapping.h
irq_vectors.h
irqflags.h
ist.h
k8.h
kdebug.h
kexec.h
kgdb.h
kmap_types.h
kprobes.h
kvm.h
kvm_host.h
kvm_para.h
kvm_x86_emulate.h
ldt.h
lguest.h
lguest_hcall.h
linkage.h
local.h
math_emu.h
mc146818rtc.h
mca.h
mca_dma.h
mce.h
microcode.h
mman.h
mmconfig.h
mmu.h
mmu_context.h
mmu_context_32.h
mmu_context_64.h
mmx.h
mmzone.h
mmzone_32.h
mmzone_64.h
module.h
mpspec.h
mpspec_def.h
msgbuf.h
msidef.h
msr-index.h
msr.h
mtrr.h
mutex.h
mutex_32.h
mutex_64.h
nmi.h
nops.h
numa.h
numa_32.h
numa_64.h
numaq.h
olpc.h
page.h
page_32.h
page_64.h
param.h
paravirt.h
parport.h
pat.h
pci-direct.h
pci.h
pci_32.h
pci_64.h
pda.h
percpu.h
pgalloc.h
pgtable-2level-defs.h
pgtable-2level.h
pgtable-3level-defs.h
pgtable-3level.h
pgtable.h
pgtable_32.h
pgtable_64.h
poll.h
posix_types.h
posix_types_32.h
posix_types_64.h
prctl.h
processor-cyrix.h
processor-flags.h
processor.h
proto.h
ptrace-abi.h
ptrace.h
pvclock-abi.h
pvclock.h
reboot.h
reboot_fixups.h
required-features.h
resource.h
resume-trace.h
rio.h
rtc.h
rwlock.h
rwsem.h
scatterlist.h
seccomp.h
seccomp_32.h
seccomp_64.h
sections.h
segment.h
sembuf.h
serial.h
setup.h
shmbuf.h
shmparam.h
sigcontext.h
sigcontext32.h
siginfo.h
signal.h
smp.h
socket.h
sockios.h
sparsemem.h
spinlock.h
spinlock_types.h
srat.h
stacktrace.h
stat.h
statfs.h
string.h
string_32.h
string_64.h
suspend.h
suspend_32.h
suspend_64.h
swiotlb.h
sync_bitops.h
syscall.h
syscalls.h
system.h
system_64.h
tce.h
termbits.h
termios.h
therm_throt.h
thread_info.h
time.h
timer.h
timex.h
tlb.h
tlbflush.h
topology.h
trampoline.h
traps.h
tsc.h
types.h
uaccess.h
uaccess_32.h
uaccess_64.h
ucontext.h
unaligned.h
unistd.h
unistd_32.h
unistd_64.h
unwind.h
user.h
user32.h
user_32.h
user_64.h
vdso.h
vga.h
vgtod.h
vic.h
vm86.h
vmi.h
vmi_time.h
voyager.h
vsyscall.h
xcr.h
xor.h
xor_32.h
xor_64.h
xsave.h
kernel
kvm
lguest
lib
mach-default
mach-generic
mach-rdc321x
mach-voyager
math-emu
mm
oprofile
pci
power
vdso
video
xen
Kconfig
Kconfig.cpu
Kconfig.debug
Makefile
Makefile_32.cpu
xtensa
.gitignore
Kconfig
block
crypto
drivers
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
usr
virt
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
MAINTAINERS
Makefile
README
REPORTING-BUGS
Breadcrumbs
linux
/
arch
/
x86
/
include
/
asm
/
ds.h
Copy path
Blame
Blame
Latest commit
History
History
263 lines (223 loc) · 6.44 KB
Breadcrumbs
linux
/
arch
/
x86
/
include
/
asm
/
ds.h
Top
File metadata and controls
Code
Blame
263 lines (223 loc) · 6.44 KB
Raw
/* * Debug Store (DS) support * * This provides a low-level interface to the hardware's Debug Store * feature that is used for branch trace store (BTS) and * precise-event based sampling (PEBS). * * It manages: * - DS and BTS hardware configuration * - buffer overflow handling (to be done) * - buffer access * * It does not do: * - security checking (is the caller allowed to trace the task) * - buffer allocation (memory accounting) * * * Copyright (C) 2007-2008 Intel Corporation. * Markus Metzger <markus.t.metzger@intel.com>, 2007-2008 */ #ifndef _ASM_X86_DS_H #define _ASM_X86_DS_H #include <linux/types.h> #include <linux/init.h> #include <linux/err.h> #ifdef CONFIG_X86_DS struct task_struct; struct ds_context; struct ds_tracer; struct bts_tracer; struct pebs_tracer; typedef void (*bts_ovfl_callback_t)(struct bts_tracer *); typedef void (*pebs_ovfl_callback_t)(struct pebs_tracer *); /* * A list of features plus corresponding macros to talk about them in * the ds_request function's flags parameter. * * We use the enum to index an array of corresponding control bits; * we use the macro to index a flags bit-vector. */ enum ds_feature { dsf_bts = 0, dsf_bts_kernel, #define BTS_KERNEL (1 << dsf_bts_kernel) /* trace kernel-mode branches */ dsf_bts_user, #define BTS_USER (1 << dsf_bts_user) /* trace user-mode branches */ dsf_bts_overflow, dsf_bts_max, dsf_pebs = dsf_bts_max, dsf_pebs_max, dsf_ctl_max = dsf_pebs_max, dsf_bts_timestamps = dsf_ctl_max, #define BTS_TIMESTAMPS (1 << dsf_bts_timestamps) /* add timestamps into BTS trace */ #define BTS_USER_FLAGS (BTS_KERNEL | BTS_USER | BTS_TIMESTAMPS) }; /* * Request BTS or PEBS * * Due to alignement constraints, the actual buffer may be slightly * smaller than the requested or provided buffer. * * Returns a pointer to a tracer structure on success, or * ERR_PTR(errcode) on failure. * * The interrupt threshold is independent from the overflow callback * to allow users to use their own overflow interrupt handling mechanism. * * task: the task to request recording for; * NULL for per-cpu recording on the current cpu * base: the base pointer for the (non-pageable) buffer; * size: the size of the provided buffer in bytes * ovfl: pointer to a function to be called on buffer overflow; * NULL if cyclic buffer requested * th: the interrupt threshold in records from the end of the buffer; * -1 if no interrupt threshold is requested. * flags: a bit-mask of the above flags */ extern struct bts_tracer *ds_request_bts(struct task_struct *task, void *base, size_t size, bts_ovfl_callback_t ovfl, size_t th, unsigned int flags); extern struct pebs_tracer *ds_request_pebs(struct task_struct *task, void *base, size_t size, pebs_ovfl_callback_t ovfl, size_t th, unsigned int flags); /* * Release BTS or PEBS resources * Suspend and resume BTS or PEBS tracing * * tracer: the tracer handle returned from ds_request_~() */ extern void ds_release_bts(struct bts_tracer *tracer); extern void ds_suspend_bts(struct bts_tracer *tracer); extern void ds_resume_bts(struct bts_tracer *tracer); extern void ds_release_pebs(struct pebs_tracer *tracer); extern void ds_suspend_pebs(struct pebs_tracer *tracer); extern void ds_resume_pebs(struct pebs_tracer *tracer); /* * The raw DS buffer state as it is used for BTS and PEBS recording. * * This is the low-level, arch-dependent interface for working * directly on the raw trace data. */ struct ds_trace { /* the number of bts/pebs records */ size_t n; /* the size of a bts/pebs record in bytes */ size_t size; /* pointers into the raw buffer: - to the first entry */ void *begin; /* - one beyond the last entry */ void *end; /* - one beyond the newest entry */ void *top; /* - the interrupt threshold */ void *ith; /* flags given on ds_request() */ unsigned int flags; }; /* * An arch-independent view on branch trace data. */ enum bts_qualifier { bts_invalid, #define BTS_INVALID bts_invalid bts_branch, #define BTS_BRANCH bts_branch bts_task_arrives, #define BTS_TASK_ARRIVES bts_task_arrives bts_task_departs, #define BTS_TASK_DEPARTS bts_task_departs bts_qual_bit_size = 4, bts_qual_max = (1 << bts_qual_bit_size), }; struct bts_struct { __u64 qualifier; union { /* BTS_BRANCH */ struct { __u64 from; __u64 to; } lbr; /* BTS_TASK_ARRIVES or BTS_TASK_DEPARTS */ struct { __u64 jiffies; pid_t pid; } timestamp; } variant; }; /* * The BTS state. * * This gives access to the raw DS state and adds functions to provide * an arch-independent view of the BTS data. */ struct bts_trace { struct ds_trace ds; int (*read)(struct bts_tracer *tracer, const void *at, struct bts_struct *out); int (*write)(struct bts_tracer *tracer, const struct bts_struct *in); }; /* * The PEBS state. * * This gives access to the raw DS state and the PEBS-specific counter * reset value. */ struct pebs_trace { struct ds_trace ds; /* the PEBS reset value */ unsigned long long reset_value; }; /* * Read the BTS or PEBS trace. * * Returns a view on the trace collected for the parameter tracer. * * The view remains valid as long as the traced task is not running or * the tracer is suspended. * Writes into the trace buffer are not reflected. * * tracer: the tracer handle returned from ds_request_~() */ extern const struct bts_trace *ds_read_bts(struct bts_tracer *tracer); extern const struct pebs_trace *ds_read_pebs(struct pebs_tracer *tracer); /* * Reset the write pointer of the BTS/PEBS buffer. * * Returns 0 on success; -Eerrno on error * * tracer: the tracer handle returned from ds_request_~() */ extern int ds_reset_bts(struct bts_tracer *tracer); extern int ds_reset_pebs(struct pebs_tracer *tracer); /* * Set the PEBS counter reset value. * * Returns 0 on success; -Eerrno on error * * tracer: the tracer handle returned from ds_request_pebs() * value: the new counter reset value */ extern int ds_set_pebs_reset(struct pebs_tracer *tracer, u64 value); /* * Initialization */ struct cpuinfo_x86; extern void __cpuinit ds_init_intel(struct cpuinfo_x86 *); /* * Context switch work */ extern void ds_switch_to(struct task_struct *prev, struct task_struct *next); #else /* CONFIG_X86_DS */ struct cpuinfo_x86; static inline void __cpuinit ds_init_intel(struct cpuinfo_x86 *ignored) {} static inline void ds_switch_to(struct task_struct *prev, struct task_struct *next) {} #endif /* CONFIG_X86_DS */ #endif /* _ASM_X86_DS_H */
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
You can’t perform that action at this time.