diff options
author | Takashi Iwai <tiwai@suse.de> | 2017-07-03 13:51:42 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-07-03 13:51:42 -0400 |
commit | 818a23e3882b1bf65d1719e407be04716e69a4d5 (patch) | |
tree | 6e4267b570541f779e7d85c11eb14312fa86fbb1 /tools | |
parent | a178232ddab55048e347b43b697bfa5013ef819e (diff) | |
parent | b821d298f8864dc3c3d42643812df43289159507 (diff) |
Merge tag 'asoc-v4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Updates for v4.13
The big news with this release is the of-graph card, this provides a
replacement for simple-card that is much more flexibile and scalable,
allowing many more systems to use a generic sound card than was possible
before:
- The of-graph card, finally merged after a long and dedicated effort
by Morimoto-san.
- New widget types intended mainly for use with DSPs.
- New drivers for Allwinner V3s SoCs, Ensonic ES8316, several classes
of x86 machine, Rockchip PDM controllers, STM32 I2S and S/PDIF
controllers and ZTE AUD96P22 CODECs.
Diffstat (limited to 'tools')
54 files changed, 836 insertions, 251 deletions
diff --git a/tools/arch/arm/include/uapi/asm/kvm.h b/tools/arch/arm/include/uapi/asm/kvm.h index 6ebd3e6a1fd1..5e3c673fa3f4 100644 --- a/tools/arch/arm/include/uapi/asm/kvm.h +++ b/tools/arch/arm/include/uapi/asm/kvm.h | |||
@@ -27,6 +27,8 @@ | |||
27 | #define __KVM_HAVE_IRQ_LINE | 27 | #define __KVM_HAVE_IRQ_LINE |
28 | #define __KVM_HAVE_READONLY_MEM | 28 | #define __KVM_HAVE_READONLY_MEM |
29 | 29 | ||
30 | #define KVM_COALESCED_MMIO_PAGE_OFFSET 1 | ||
31 | |||
30 | #define KVM_REG_SIZE(id) \ | 32 | #define KVM_REG_SIZE(id) \ |
31 | (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT)) | 33 | (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT)) |
32 | 34 | ||
@@ -114,6 +116,8 @@ struct kvm_debug_exit_arch { | |||
114 | }; | 116 | }; |
115 | 117 | ||
116 | struct kvm_sync_regs { | 118 | struct kvm_sync_regs { |
119 | /* Used with KVM_CAP_ARM_USER_IRQ */ | ||
120 | __u64 device_irq_level; | ||
117 | }; | 121 | }; |
118 | 122 | ||
119 | struct kvm_arch_memory_slot { | 123 | struct kvm_arch_memory_slot { |
@@ -192,13 +196,17 @@ struct kvm_arch_memory_slot { | |||
192 | #define KVM_DEV_ARM_VGIC_GRP_REDIST_REGS 5 | 196 | #define KVM_DEV_ARM_VGIC_GRP_REDIST_REGS 5 |
193 | #define KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS 6 | 197 | #define KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS 6 |
194 | #define KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO 7 | 198 | #define KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO 7 |
199 | #define KVM_DEV_ARM_VGIC_GRP_ITS_REGS 8 | ||
195 | #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT 10 | 200 | #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT 10 |
196 | #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_MASK \ | 201 | #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_MASK \ |
197 | (0x3fffffULL << KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT) | 202 | (0x3fffffULL << KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT) |
198 | #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INTID_MASK 0x3ff | 203 | #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INTID_MASK 0x3ff |
199 | #define VGIC_LEVEL_INFO_LINE_LEVEL 0 | 204 | #define VGIC_LEVEL_INFO_LINE_LEVEL 0 |
200 | 205 | ||
201 | #define KVM_DEV_ARM_VGIC_CTRL_INIT 0 | 206 | #define KVM_DEV_ARM_VGIC_CTRL_INIT 0 |
207 | #define KVM_DEV_ARM_ITS_SAVE_TABLES 1 | ||
208 | #define KVM_DEV_ARM_ITS_RESTORE_TABLES 2 | ||
209 | #define KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES 3 | ||
202 | 210 | ||
203 | /* KVM_IRQ_LINE irq field index values */ | 211 | /* KVM_IRQ_LINE irq field index values */ |
204 | #define KVM_ARM_IRQ_TYPE_SHIFT 24 | 212 | #define KVM_ARM_IRQ_TYPE_SHIFT 24 |
diff --git a/tools/arch/arm64/include/uapi/asm/kvm.h b/tools/arch/arm64/include/uapi/asm/kvm.h index c2860358ae3e..70eea2ecc663 100644 --- a/tools/arch/arm64/include/uapi/asm/kvm.h +++ b/tools/arch/arm64/include/uapi/asm/kvm.h | |||
@@ -39,6 +39,8 @@ | |||
39 | #define __KVM_HAVE_IRQ_LINE | 39 | #define __KVM_HAVE_IRQ_LINE |
40 | #define __KVM_HAVE_READONLY_MEM | 40 | #define __KVM_HAVE_READONLY_MEM |
41 | 41 | ||
42 | #define KVM_COALESCED_MMIO_PAGE_OFFSET 1 | ||
43 | |||
42 | #define KVM_REG_SIZE(id) \ | 44 | #define KVM_REG_SIZE(id) \ |
43 | (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT)) | 45 | (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT)) |
44 | 46 | ||
@@ -143,6 +145,8 @@ struct kvm_debug_exit_arch { | |||
143 | #define KVM_GUESTDBG_USE_HW (1 << 17) | 145 | #define KVM_GUESTDBG_USE_HW (1 << 17) |
144 | 146 | ||
145 | struct kvm_sync_regs { | 147 | struct kvm_sync_regs { |
148 | /* Used with KVM_CAP_ARM_USER_IRQ */ | ||
149 | __u64 device_irq_level; | ||
146 | }; | 150 | }; |
147 | 151 | ||
148 | struct kvm_arch_memory_slot { | 152 | struct kvm_arch_memory_slot { |
@@ -212,13 +216,17 @@ struct kvm_arch_memory_slot { | |||
212 | #define KVM_DEV_ARM_VGIC_GRP_REDIST_REGS 5 | 216 | #define KVM_DEV_ARM_VGIC_GRP_REDIST_REGS 5 |
213 | #define KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS 6 | 217 | #define KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS 6 |
214 | #define KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO 7 | 218 | #define KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO 7 |
219 | #define KVM_DEV_ARM_VGIC_GRP_ITS_REGS 8 | ||
215 | #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT 10 | 220 | #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT 10 |
216 | #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_MASK \ | 221 | #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_MASK \ |
217 | (0x3fffffULL << KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT) | 222 | (0x3fffffULL << KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT) |
218 | #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INTID_MASK 0x3ff | 223 | #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INTID_MASK 0x3ff |
219 | #define VGIC_LEVEL_INFO_LINE_LEVEL 0 | 224 | #define VGIC_LEVEL_INFO_LINE_LEVEL 0 |
220 | 225 | ||
221 | #define KVM_DEV_ARM_VGIC_CTRL_INIT 0 | 226 | #define KVM_DEV_ARM_VGIC_CTRL_INIT 0 |
227 | #define KVM_DEV_ARM_ITS_SAVE_TABLES 1 | ||
228 | #define KVM_DEV_ARM_ITS_RESTORE_TABLES 2 | ||
229 | #define KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES 3 | ||
222 | 230 | ||
223 | /* Device Control API on vcpu fd */ | 231 | /* Device Control API on vcpu fd */ |
224 | #define KVM_ARM_VCPU_PMU_V3_CTRL 0 | 232 | #define KVM_ARM_VCPU_PMU_V3_CTRL 0 |
diff --git a/tools/arch/powerpc/include/uapi/asm/kvm.h b/tools/arch/powerpc/include/uapi/asm/kvm.h index 4edbe4bb0e8b..07fbeb927834 100644 --- a/tools/arch/powerpc/include/uapi/asm/kvm.h +++ b/tools/arch/powerpc/include/uapi/asm/kvm.h | |||
@@ -29,6 +29,9 @@ | |||
29 | #define __KVM_HAVE_IRQ_LINE | 29 | #define __KVM_HAVE_IRQ_LINE |
30 | #define __KVM_HAVE_GUEST_DEBUG | 30 | #define __KVM_HAVE_GUEST_DEBUG |
31 | 31 | ||
32 | /* Not always available, but if it is, this is the correct offset. */ | ||
33 | #define KVM_COALESCED_MMIO_PAGE_OFFSET 1 | ||
34 | |||
32 | struct kvm_regs { | 35 | struct kvm_regs { |
33 | __u64 pc; | 36 | __u64 pc; |
34 | __u64 cr; | 37 | __u64 cr; |
diff --git a/tools/arch/s390/include/uapi/asm/kvm.h b/tools/arch/s390/include/uapi/asm/kvm.h index 7f4fd65e9208..3dd2a1d308dd 100644 --- a/tools/arch/s390/include/uapi/asm/kvm.h +++ b/tools/arch/s390/include/uapi/asm/kvm.h | |||
@@ -26,6 +26,8 @@ | |||
26 | #define KVM_DEV_FLIC_ADAPTER_REGISTER 6 | 26 | #define KVM_DEV_FLIC_ADAPTER_REGISTER 6 |
27 | #define KVM_DEV_FLIC_ADAPTER_MODIFY 7 | 27 | #define KVM_DEV_FLIC_ADAPTER_MODIFY 7 |
28 | #define KVM_DEV_FLIC_CLEAR_IO_IRQ 8 | 28 | #define KVM_DEV_FLIC_CLEAR_IO_IRQ 8 |
29 | #define KVM_DEV_FLIC_AISM 9 | ||
30 | #define KVM_DEV_FLIC_AIRQ_INJECT 10 | ||
29 | /* | 31 | /* |
30 | * We can have up to 4*64k pending subchannels + 8 adapter interrupts, | 32 | * We can have up to 4*64k pending subchannels + 8 adapter interrupts, |
31 | * as well as up to ASYNC_PF_PER_VCPU*KVM_MAX_VCPUS pfault done interrupts. | 33 | * as well as up to ASYNC_PF_PER_VCPU*KVM_MAX_VCPUS pfault done interrupts. |
@@ -41,7 +43,14 @@ struct kvm_s390_io_adapter { | |||
41 | __u8 isc; | 43 | __u8 isc; |
42 | __u8 maskable; | 44 | __u8 maskable; |
43 | __u8 swap; | 45 | __u8 swap; |
44 | __u8 pad; | 46 | __u8 flags; |
47 | }; | ||
48 | |||
49 | #define KVM_S390_ADAPTER_SUPPRESSIBLE 0x01 | ||
50 | |||
51 | struct kvm_s390_ais_req { | ||
52 | __u8 isc; | ||
53 | __u16 mode; | ||
45 | }; | 54 | }; |
46 | 55 | ||
47 | #define KVM_S390_IO_ADAPTER_MASK 1 | 56 | #define KVM_S390_IO_ADAPTER_MASK 1 |
@@ -110,6 +119,7 @@ struct kvm_s390_vm_cpu_machine { | |||
110 | #define KVM_S390_VM_CPU_FEAT_CMMA 10 | 119 | #define KVM_S390_VM_CPU_FEAT_CMMA 10 |
111 | #define KVM_S390_VM_CPU_FEAT_PFMFI 11 | 120 | #define KVM_S390_VM_CPU_FEAT_PFMFI 11 |
112 | #define KVM_S390_VM_CPU_FEAT_SIGPIF 12 | 121 | #define KVM_S390_VM_CPU_FEAT_SIGPIF 12 |
122 | #define KVM_S390_VM_CPU_FEAT_KSS 13 | ||
113 | struct kvm_s390_vm_cpu_feat { | 123 | struct kvm_s390_vm_cpu_feat { |
114 | __u64 feat[16]; | 124 | __u64 feat[16]; |
115 | }; | 125 | }; |
@@ -198,6 +208,10 @@ struct kvm_guest_debug_arch { | |||
198 | #define KVM_SYNC_VRS (1UL << 6) | 208 | #define KVM_SYNC_VRS (1UL << 6) |
199 | #define KVM_SYNC_RICCB (1UL << 7) | 209 | #define KVM_SYNC_RICCB (1UL << 7) |
200 | #define KVM_SYNC_FPRS (1UL << 8) | 210 | #define KVM_SYNC_FPRS (1UL << 8) |
211 | #define KVM_SYNC_GSCB (1UL << 9) | ||
212 | /* length and alignment of the sdnx as a power of two */ | ||
213 | #define SDNXC 8 | ||
214 | #define SDNXL (1UL << SDNXC) | ||
201 | /* definition of registers in kvm_run */ | 215 | /* definition of registers in kvm_run */ |
202 | struct kvm_sync_regs { | 216 | struct kvm_sync_regs { |
203 | __u64 prefix; /* prefix register */ | 217 | __u64 prefix; /* prefix register */ |
@@ -218,8 +232,16 @@ struct kvm_sync_regs { | |||
218 | }; | 232 | }; |
219 | __u8 reserved[512]; /* for future vector expansion */ | 233 | __u8 reserved[512]; /* for future vector expansion */ |
220 | __u32 fpc; /* valid on KVM_SYNC_VRS or KVM_SYNC_FPRS */ | 234 | __u32 fpc; /* valid on KVM_SYNC_VRS or KVM_SYNC_FPRS */ |
221 | __u8 padding[52]; /* riccb needs to be 64byte aligned */ | 235 | __u8 padding1[52]; /* riccb needs to be 64byte aligned */ |
222 | __u8 riccb[64]; /* runtime instrumentation controls block */ | 236 | __u8 riccb[64]; /* runtime instrumentation controls block */ |
237 | __u8 padding2[192]; /* sdnx needs to be 256byte aligned */ | ||
238 | union { | ||
239 | __u8 sdnx[SDNXL]; /* state description annex */ | ||
240 | struct { | ||
241 | __u64 reserved1[2]; | ||
242 | __u64 gscb[4]; | ||
243 | }; | ||
244 | }; | ||
223 | }; | 245 | }; |
224 | 246 | ||
225 | #define KVM_REG_S390_TODPR (KVM_REG_S390 | KVM_REG_SIZE_U32 | 0x1) | 247 | #define KVM_REG_S390_TODPR (KVM_REG_S390 | KVM_REG_SIZE_U32 | 0x1) |
diff --git a/tools/arch/x86/include/asm/cpufeatures.h b/tools/arch/x86/include/asm/cpufeatures.h index 0fe00446f9ca..2701e5f8145b 100644 --- a/tools/arch/x86/include/asm/cpufeatures.h +++ b/tools/arch/x86/include/asm/cpufeatures.h | |||
@@ -202,6 +202,8 @@ | |||
202 | #define X86_FEATURE_AVX512_4VNNIW (7*32+16) /* AVX-512 Neural Network Instructions */ | 202 | #define X86_FEATURE_AVX512_4VNNIW (7*32+16) /* AVX-512 Neural Network Instructions */ |
203 | #define X86_FEATURE_AVX512_4FMAPS (7*32+17) /* AVX-512 Multiply Accumulation Single precision */ | 203 | #define X86_FEATURE_AVX512_4FMAPS (7*32+17) /* AVX-512 Multiply Accumulation Single precision */ |
204 | 204 | ||
205 | #define X86_FEATURE_MBA ( 7*32+18) /* Memory Bandwidth Allocation */ | ||
206 | |||
205 | /* Virtualization flags: Linux defined, word 8 */ | 207 | /* Virtualization flags: Linux defined, word 8 */ |
206 | #define X86_FEATURE_TPR_SHADOW ( 8*32+ 0) /* Intel TPR Shadow */ | 208 | #define X86_FEATURE_TPR_SHADOW ( 8*32+ 0) /* Intel TPR Shadow */ |
207 | #define X86_FEATURE_VNMI ( 8*32+ 1) /* Intel Virtual NMI */ | 209 | #define X86_FEATURE_VNMI ( 8*32+ 1) /* Intel Virtual NMI */ |
diff --git a/tools/arch/x86/include/asm/disabled-features.h b/tools/arch/x86/include/asm/disabled-features.h index 85599ad4d024..5dff775af7cd 100644 --- a/tools/arch/x86/include/asm/disabled-features.h +++ b/tools/arch/x86/include/asm/disabled-features.h | |||
@@ -36,6 +36,12 @@ | |||
36 | # define DISABLE_OSPKE (1<<(X86_FEATURE_OSPKE & 31)) | 36 | # define DISABLE_OSPKE (1<<(X86_FEATURE_OSPKE & 31)) |
37 | #endif /* CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS */ | 37 | #endif /* CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS */ |
38 | 38 | ||
39 | #ifdef CONFIG_X86_5LEVEL | ||
40 | # define DISABLE_LA57 0 | ||
41 | #else | ||
42 | # define DISABLE_LA57 (1<<(X86_FEATURE_LA57 & 31)) | ||
43 | #endif | ||
44 | |||
39 | /* | 45 | /* |
40 | * Make sure to add features to the correct mask | 46 | * Make sure to add features to the correct mask |
41 | */ | 47 | */ |
@@ -55,7 +61,7 @@ | |||
55 | #define DISABLED_MASK13 0 | 61 | #define DISABLED_MASK13 0 |
56 | #define DISABLED_MASK14 0 | 62 | #define DISABLED_MASK14 0 |
57 | #define DISABLED_MASK15 0 | 63 | #define DISABLED_MASK15 0 |
58 | #define DISABLED_MASK16 (DISABLE_PKU|DISABLE_OSPKE) | 64 | #define DISABLED_MASK16 (DISABLE_PKU|DISABLE_OSPKE|DISABLE_LA57) |
59 | #define DISABLED_MASK17 0 | 65 | #define DISABLED_MASK17 0 |
60 | #define DISABLED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 18) | 66 | #define DISABLED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 18) |
61 | 67 | ||
diff --git a/tools/arch/x86/include/asm/required-features.h b/tools/arch/x86/include/asm/required-features.h index fac9a5c0abe9..d91ba04dd007 100644 --- a/tools/arch/x86/include/asm/required-features.h +++ b/tools/arch/x86/include/asm/required-features.h | |||
@@ -53,6 +53,12 @@ | |||
53 | # define NEED_MOVBE 0 | 53 | # define NEED_MOVBE 0 |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | #ifdef CONFIG_X86_5LEVEL | ||
57 | # define NEED_LA57 (1<<(X86_FEATURE_LA57 & 31)) | ||
58 | #else | ||
59 | # define NEED_LA57 0 | ||
60 | #endif | ||
61 | |||
56 | #ifdef CONFIG_X86_64 | 62 | #ifdef CONFIG_X86_64 |
57 | #ifdef CONFIG_PARAVIRT | 63 | #ifdef CONFIG_PARAVIRT |
58 | /* Paravirtualized systems may not have PSE or PGE available */ | 64 | /* Paravirtualized systems may not have PSE or PGE available */ |
@@ -98,7 +104,7 @@ | |||
98 | #define REQUIRED_MASK13 0 | 104 | #define REQUIRED_MASK13 0 |
99 | #define REQUIRED_MASK14 0 | 105 | #define REQUIRED_MASK14 0 |
100 | #define REQUIRED_MASK15 0 | 106 | #define REQUIRED_MASK15 0 |
101 | #define REQUIRED_MASK16 0 | 107 | #define REQUIRED_MASK16 (NEED_LA57) |
102 | #define REQUIRED_MASK17 0 | 108 | #define REQUIRED_MASK17 0 |
103 | #define REQUIRED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 18) | 109 | #define REQUIRED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 18) |
104 | 110 | ||
diff --git a/tools/arch/x86/include/uapi/asm/kvm.h b/tools/arch/x86/include/uapi/asm/kvm.h index 739c0c594022..c2824d02ba37 100644 --- a/tools/arch/x86/include/uapi/asm/kvm.h +++ b/tools/arch/x86/include/uapi/asm/kvm.h | |||
@@ -9,6 +9,9 @@ | |||
9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
10 | #include <linux/ioctl.h> | 10 | #include <linux/ioctl.h> |
11 | 11 | ||
12 | #define KVM_PIO_PAGE_OFFSET 1 | ||
13 | #define KVM_COALESCED_MMIO_PAGE_OFFSET 2 | ||
14 | |||
12 | #define DE_VECTOR 0 | 15 | #define DE_VECTOR 0 |
13 | #define DB_VECTOR 1 | 16 | #define DB_VECTOR 1 |
14 | #define BP_VECTOR 3 | 17 | #define BP_VECTOR 3 |
diff --git a/tools/arch/x86/include/uapi/asm/vmx.h b/tools/arch/x86/include/uapi/asm/vmx.h index 14458658e988..690a2dcf4078 100644 --- a/tools/arch/x86/include/uapi/asm/vmx.h +++ b/tools/arch/x86/include/uapi/asm/vmx.h | |||
@@ -76,7 +76,11 @@ | |||
76 | #define EXIT_REASON_WBINVD 54 | 76 | #define EXIT_REASON_WBINVD 54 |
77 | #define EXIT_REASON_XSETBV 55 | 77 | #define EXIT_REASON_XSETBV 55 |
78 | #define EXIT_REASON_APIC_WRITE 56 | 78 | #define EXIT_REASON_APIC_WRITE 56 |
79 | #define EXIT_REASON_RDRAND 57 | ||
79 | #define EXIT_REASON_INVPCID 58 | 80 | #define EXIT_REASON_INVPCID 58 |
81 | #define EXIT_REASON_VMFUNC 59 | ||
82 | #define EXIT_REASON_ENCLS 60 | ||
83 | #define EXIT_REASON_RDSEED 61 | ||
80 | #define EXIT_REASON_PML_FULL 62 | 84 | #define EXIT_REASON_PML_FULL 62 |
81 | #define EXIT_REASON_XSAVES 63 | 85 | #define EXIT_REASON_XSAVES 63 |
82 | #define EXIT_REASON_XRSTORS 64 | 86 | #define EXIT_REASON_XRSTORS 64 |
@@ -90,6 +94,7 @@ | |||
90 | { EXIT_REASON_TASK_SWITCH, "TASK_SWITCH" }, \ | 94 | { EXIT_REASON_TASK_SWITCH, "TASK_SWITCH" }, \ |
91 | { EXIT_REASON_CPUID, "CPUID" }, \ | 95 | { EXIT_REASON_CPUID, "CPUID" }, \ |
92 | { EXIT_REASON_HLT, "HLT" }, \ | 96 | { EXIT_REASON_HLT, "HLT" }, \ |
97 | { EXIT_REASON_INVD, "INVD" }, \ | ||
93 | { EXIT_REASON_INVLPG, "INVLPG" }, \ | 98 | { EXIT_REASON_INVLPG, "INVLPG" }, \ |
94 | { EXIT_REASON_RDPMC, "RDPMC" }, \ | 99 | { EXIT_REASON_RDPMC, "RDPMC" }, \ |
95 | { EXIT_REASON_RDTSC, "RDTSC" }, \ | 100 | { EXIT_REASON_RDTSC, "RDTSC" }, \ |
@@ -108,6 +113,8 @@ | |||
108 | { EXIT_REASON_IO_INSTRUCTION, "IO_INSTRUCTION" }, \ | 113 | { EXIT_REASON_IO_INSTRUCTION, "IO_INSTRUCTION" }, \ |
109 | { EXIT_REASON_MSR_READ, "MSR_READ" }, \ | 114 | { EXIT_REASON_MSR_READ, "MSR_READ" }, \ |
110 | { EXIT_REASON_MSR_WRITE, "MSR_WRITE" }, \ | 115 | { EXIT_REASON_MSR_WRITE, "MSR_WRITE" }, \ |
116 | { EXIT_REASON_INVALID_STATE, "INVALID_STATE" }, \ | ||
117 | { EXIT_REASON_MSR_LOAD_FAIL, "MSR_LOAD_FAIL" }, \ | ||
111 | { EXIT_REASON_MWAIT_INSTRUCTION, "MWAIT_INSTRUCTION" }, \ | 118 | { EXIT_REASON_MWAIT_INSTRUCTION, "MWAIT_INSTRUCTION" }, \ |
112 | { EXIT_REASON_MONITOR_TRAP_FLAG, "MONITOR_TRAP_FLAG" }, \ | 119 | { EXIT_REASON_MONITOR_TRAP_FLAG, "MONITOR_TRAP_FLAG" }, \ |
113 | { EXIT_REASON_MONITOR_INSTRUCTION, "MONITOR_INSTRUCTION" }, \ | 120 | { EXIT_REASON_MONITOR_INSTRUCTION, "MONITOR_INSTRUCTION" }, \ |
@@ -115,20 +122,24 @@ | |||
115 | { EXIT_REASON_MCE_DURING_VMENTRY, "MCE_DURING_VMENTRY" }, \ | 122 | { EXIT_REASON_MCE_DURING_VMENTRY, "MCE_DURING_VMENTRY" }, \ |
116 | { EXIT_REASON_TPR_BELOW_THRESHOLD, "TPR_BELOW_THRESHOLD" }, \ | 123 | { EXIT_REASON_TPR_BELOW_THRESHOLD, "TPR_BELOW_THRESHOLD" }, \ |
117 | { EXIT_REASON_APIC_ACCESS, "APIC_ACCESS" }, \ | 124 | { EXIT_REASON_APIC_ACCESS, "APIC_ACCESS" }, \ |
118 | { EXIT_REASON_GDTR_IDTR, "GDTR_IDTR" }, \ | 125 | { EXIT_REASON_EOI_INDUCED, "EOI_INDUCED" }, \ |
119 | { EXIT_REASON_LDTR_TR, "LDTR_TR" }, \ | 126 | { EXIT_REASON_GDTR_IDTR, "GDTR_IDTR" }, \ |
127 | { EXIT_REASON_LDTR_TR, "LDTR_TR" }, \ | ||
120 | { EXIT_REASON_EPT_VIOLATION, "EPT_VIOLATION" }, \ | 128 | { EXIT_REASON_EPT_VIOLATION, "EPT_VIOLATION" }, \ |
121 | { EXIT_REASON_EPT_MISCONFIG, "EPT_MISCONFIG" }, \ | 129 | { EXIT_REASON_EPT_MISCONFIG, "EPT_MISCONFIG" }, \ |
122 | { EXIT_REASON_INVEPT, "INVEPT" }, \ | 130 | { EXIT_REASON_INVEPT, "INVEPT" }, \ |
131 | { EXIT_REASON_RDTSCP, "RDTSCP" }, \ | ||
123 | { EXIT_REASON_PREEMPTION_TIMER, "PREEMPTION_TIMER" }, \ | 132 | { EXIT_REASON_PREEMPTION_TIMER, "PREEMPTION_TIMER" }, \ |
133 | { EXIT_REASON_INVVPID, "INVVPID" }, \ | ||
124 | { EXIT_REASON_WBINVD, "WBINVD" }, \ | 134 | { EXIT_REASON_WBINVD, "WBINVD" }, \ |
135 | { EXIT_REASON_XSETBV, "XSETBV" }, \ | ||
125 | { EXIT_REASON_APIC_WRITE, "APIC_WRITE" }, \ | 136 | { EXIT_REASON_APIC_WRITE, "APIC_WRITE" }, \ |
126 | { EXIT_REASON_EOI_INDUCED, "EOI_INDUCED" }, \ | 137 | { EXIT_REASON_RDRAND, "RDRAND" }, \ |
127 | { EXIT_REASON_INVALID_STATE, "INVALID_STATE" }, \ | ||
128 | { EXIT_REASON_MSR_LOAD_FAIL, "MSR_LOAD_FAIL" }, \ | ||
129 | { EXIT_REASON_INVD, "INVD" }, \ | ||
130 | { EXIT_REASON_INVVPID, "INVVPID" }, \ | ||
131 | { EXIT_REASON_INVPCID, "INVPCID" }, \ | 138 | { EXIT_REASON_INVPCID, "INVPCID" }, \ |
139 | { EXIT_REASON_VMFUNC, "VMFUNC" }, \ | ||
140 | { EXIT_REASON_ENCLS, "ENCLS" }, \ | ||
141 | { EXIT_REASON_RDSEED, "RDSEED" }, \ | ||
142 | { EXIT_REASON_PML_FULL, "PML_FULL" }, \ | ||
132 | { EXIT_REASON_XSAVES, "XSAVES" }, \ | 143 | { EXIT_REASON_XSAVES, "XSAVES" }, \ |
133 | { EXIT_REASON_XRSTORS, "XRSTORS" } | 144 | { EXIT_REASON_XRSTORS, "XRSTORS" } |
134 | 145 | ||
diff --git a/tools/include/linux/filter.h b/tools/include/linux/filter.h index 390d7c9685fd..4ce25d43e8e3 100644 --- a/tools/include/linux/filter.h +++ b/tools/include/linux/filter.h | |||
@@ -208,6 +208,16 @@ | |||
208 | .off = OFF, \ | 208 | .off = OFF, \ |
209 | .imm = IMM }) | 209 | .imm = IMM }) |
210 | 210 | ||
211 | /* Unconditional jumps, goto pc + off16 */ | ||
212 | |||
213 | #define BPF_JMP_A(OFF) \ | ||
214 | ((struct bpf_insn) { \ | ||
215 | .code = BPF_JMP | BPF_JA, \ | ||
216 | .dst_reg = 0, \ | ||
217 | .src_reg = 0, \ | ||
218 | .off = OFF, \ | ||
219 | .imm = 0 }) | ||
220 | |||
211 | /* Function call */ | 221 | /* Function call */ |
212 | 222 | ||
213 | #define BPF_EMIT_CALL(FUNC) \ | 223 | #define BPF_EMIT_CALL(FUNC) \ |
diff --git a/tools/include/uapi/linux/stat.h b/tools/include/uapi/linux/stat.h index d538897b8e08..17b10304c393 100644 --- a/tools/include/uapi/linux/stat.h +++ b/tools/include/uapi/linux/stat.h | |||
@@ -48,17 +48,13 @@ | |||
48 | * tv_sec holds the number of seconds before (negative) or after (positive) | 48 | * tv_sec holds the number of seconds before (negative) or after (positive) |
49 | * 00:00:00 1st January 1970 UTC. | 49 | * 00:00:00 1st January 1970 UTC. |
50 | * | 50 | * |
51 | * tv_nsec holds a number of nanoseconds before (0..-999,999,999 if tv_sec is | 51 | * tv_nsec holds a number of nanoseconds (0..999,999,999) after the tv_sec time. |
52 | * negative) or after (0..999,999,999 if tv_sec is positive) the tv_sec time. | ||
53 | * | ||
54 | * Note that if both tv_sec and tv_nsec are non-zero, then the two values must | ||
55 | * either be both positive or both negative. | ||
56 | * | 52 | * |
57 | * __reserved is held in case we need a yet finer resolution. | 53 | * __reserved is held in case we need a yet finer resolution. |
58 | */ | 54 | */ |
59 | struct statx_timestamp { | 55 | struct statx_timestamp { |
60 | __s64 tv_sec; | 56 | __s64 tv_sec; |
61 | __s32 tv_nsec; | 57 | __u32 tv_nsec; |
62 | __s32 __reserved; | 58 | __s32 __reserved; |
63 | }; | 59 | }; |
64 | 60 | ||
diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c index 282a60368b14..5f66697fe1e0 100644 --- a/tools/objtool/builtin-check.c +++ b/tools/objtool/builtin-check.c | |||
@@ -192,7 +192,8 @@ static int __dead_end_function(struct objtool_file *file, struct symbol *func, | |||
192 | "complete_and_exit", | 192 | "complete_and_exit", |
193 | "kvm_spurious_fault", | 193 | "kvm_spurious_fault", |
194 | "__reiserfs_panic", | 194 | "__reiserfs_panic", |
195 | "lbug_with_loc" | 195 | "lbug_with_loc", |
196 | "fortify_panic", | ||
196 | }; | 197 | }; |
197 | 198 | ||
198 | if (func->bind == STB_WEAK) | 199 | if (func->bind == STB_WEAK) |
diff --git a/tools/perf/Documentation/perf-probe.txt b/tools/perf/Documentation/perf-probe.txt index e6c9902c6d82..165c2b1d4317 100644 --- a/tools/perf/Documentation/perf-probe.txt +++ b/tools/perf/Documentation/perf-probe.txt | |||
@@ -240,9 +240,13 @@ Add a probe on schedule() function 12th line with recording cpu local variable: | |||
240 | or | 240 | or |
241 | ./perf probe --add='schedule:12 cpu' | 241 | ./perf probe --add='schedule:12 cpu' |
242 | 242 | ||
243 | this will add one or more probes which has the name start with "schedule". | 243 | Add one or more probes which has the name start with "schedule". |
244 | 244 | ||
245 | Add probes on lines in schedule() function which calls update_rq_clock(). | 245 | ./perf probe schedule* |
246 | or | ||
247 | ./perf probe --add='schedule*' | ||
248 | |||
249 | Add probes on lines in schedule() function which calls update_rq_clock(). | ||
246 | 250 | ||
247 | ./perf probe 'schedule;update_rq_clock*' | 251 | ./perf probe 'schedule;update_rq_clock*' |
248 | or | 252 | or |
diff --git a/tools/perf/Documentation/perf-script-perl.txt b/tools/perf/Documentation/perf-script-perl.txt index dfbb506d2c34..142606c0ec9c 100644 --- a/tools/perf/Documentation/perf-script-perl.txt +++ b/tools/perf/Documentation/perf-script-perl.txt | |||
@@ -39,7 +39,7 @@ EVENT HANDLERS | |||
39 | When perf script is invoked using a trace script, a user-defined | 39 | When perf script is invoked using a trace script, a user-defined |
40 | 'handler function' is called for each event in the trace. If there's | 40 | 'handler function' is called for each event in the trace. If there's |
41 | no handler function defined for a given event type, the event is | 41 | no handler function defined for a given event type, the event is |
42 | ignored (or passed to a 'trace_handled' function, see below) and the | 42 | ignored (or passed to a 'trace_unhandled' function, see below) and the |
43 | next event is processed. | 43 | next event is processed. |
44 | 44 | ||
45 | Most of the event's field values are passed as arguments to the | 45 | Most of the event's field values are passed as arguments to the |
diff --git a/tools/perf/Documentation/perf-script-python.txt b/tools/perf/Documentation/perf-script-python.txt index 54acba221558..51ec2d20068a 100644 --- a/tools/perf/Documentation/perf-script-python.txt +++ b/tools/perf/Documentation/perf-script-python.txt | |||
@@ -149,10 +149,8 @@ def raw_syscalls__sys_enter(event_name, context, common_cpu, | |||
149 | print "id=%d, args=%s\n" % \ | 149 | print "id=%d, args=%s\n" % \ |
150 | (id, args), | 150 | (id, args), |
151 | 151 | ||
152 | def trace_unhandled(event_name, context, common_cpu, common_secs, common_nsecs, | 152 | def trace_unhandled(event_name, context, event_fields_dict): |
153 | common_pid, common_comm): | 153 | print ' '.join(['%s=%s'%(k,str(v))for k,v in sorted(event_fields_dict.items())]) |
154 | print_header(event_name, common_cpu, common_secs, common_nsecs, | ||
155 | common_pid, common_comm) | ||
156 | 154 | ||
157 | def print_header(event_name, cpu, secs, nsecs, pid, comm): | 155 | def print_header(event_name, cpu, secs, nsecs, pid, comm): |
158 | print "%-20s %5u %05u.%09u %8u %-20s " % \ | 156 | print "%-20s %5u %05u.%09u %8u %-20s " % \ |
@@ -321,7 +319,7 @@ So those are the essential steps in writing and running a script. The | |||
321 | process can be generalized to any tracepoint or set of tracepoints | 319 | process can be generalized to any tracepoint or set of tracepoints |
322 | you're interested in - basically find the tracepoint(s) you're | 320 | you're interested in - basically find the tracepoint(s) you're |
323 | interested in by looking at the list of available events shown by | 321 | interested in by looking at the list of available events shown by |
324 | 'perf list' and/or look in /sys/kernel/debug/tracing events for | 322 | 'perf list' and/or look in /sys/kernel/debug/tracing/events/ for |
325 | detailed event and field info, record the corresponding trace data | 323 | detailed event and field info, record the corresponding trace data |
326 | using 'perf record', passing it the list of interesting events, | 324 | using 'perf record', passing it the list of interesting events, |
327 | generate a skeleton script using 'perf script -g python' and modify the | 325 | generate a skeleton script using 'perf script -g python' and modify the |
@@ -334,7 +332,7 @@ right place, you can have your script listed alongside the other | |||
334 | scripts listed by the 'perf script -l' command e.g.: | 332 | scripts listed by the 'perf script -l' command e.g.: |
335 | 333 | ||
336 | ---- | 334 | ---- |
337 | root@tropicana:~# perf script -l | 335 | # perf script -l |
338 | List of available trace scripts: | 336 | List of available trace scripts: |
339 | wakeup-latency system-wide min/max/avg wakeup latency | 337 | wakeup-latency system-wide min/max/avg wakeup latency |
340 | rw-by-file <comm> r/w activity for a program, by file | 338 | rw-by-file <comm> r/w activity for a program, by file |
@@ -383,8 +381,6 @@ source tree: | |||
383 | 381 | ||
384 | ---- | 382 | ---- |
385 | # ls -al kernel-source/tools/perf/scripts/python | 383 | # ls -al kernel-source/tools/perf/scripts/python |
386 | |||
387 | root@tropicana:/home/trz/src/tip# ls -al tools/perf/scripts/python | ||
388 | total 32 | 384 | total 32 |
389 | drwxr-xr-x 4 trz trz 4096 2010-01-26 22:30 . | 385 | drwxr-xr-x 4 trz trz 4096 2010-01-26 22:30 . |
390 | drwxr-xr-x 4 trz trz 4096 2010-01-26 22:29 .. | 386 | drwxr-xr-x 4 trz trz 4096 2010-01-26 22:29 .. |
@@ -399,7 +395,7 @@ otherwise your script won't show up at run-time), 'perf script -l' | |||
399 | should show a new entry for your script: | 395 | should show a new entry for your script: |
400 | 396 | ||
401 | ---- | 397 | ---- |
402 | root@tropicana:~# perf script -l | 398 | # perf script -l |
403 | List of available trace scripts: | 399 | List of available trace scripts: |
404 | wakeup-latency system-wide min/max/avg wakeup latency | 400 | wakeup-latency system-wide min/max/avg wakeup latency |
405 | rw-by-file <comm> r/w activity for a program, by file | 401 | rw-by-file <comm> r/w activity for a program, by file |
@@ -437,7 +433,7 @@ EVENT HANDLERS | |||
437 | When perf script is invoked using a trace script, a user-defined | 433 | When perf script is invoked using a trace script, a user-defined |
438 | 'handler function' is called for each event in the trace. If there's | 434 | 'handler function' is called for each event in the trace. If there's |
439 | no handler function defined for a given event type, the event is | 435 | no handler function defined for a given event type, the event is |
440 | ignored (or passed to a 'trace_handled' function, see below) and the | 436 | ignored (or passed to a 'trace_unhandled' function, see below) and the |
441 | next event is processed. | 437 | next event is processed. |
442 | 438 | ||
443 | Most of the event's field values are passed as arguments to the | 439 | Most of the event's field values are passed as arguments to the |
@@ -532,7 +528,7 @@ can implement a set of optional functions: | |||
532 | gives scripts a chance to do setup tasks: | 528 | gives scripts a chance to do setup tasks: |
533 | 529 | ||
534 | ---- | 530 | ---- |
535 | def trace_begin: | 531 | def trace_begin(): |
536 | pass | 532 | pass |
537 | ---- | 533 | ---- |
538 | 534 | ||
@@ -541,7 +537,7 @@ def trace_begin: | |||
541 | as display results: | 537 | as display results: |
542 | 538 | ||
543 | ---- | 539 | ---- |
544 | def trace_end: | 540 | def trace_end(): |
545 | pass | 541 | pass |
546 | ---- | 542 | ---- |
547 | 543 | ||
@@ -550,8 +546,7 @@ def trace_end: | |||
550 | of common arguments are passed into it: | 546 | of common arguments are passed into it: |
551 | 547 | ||
552 | ---- | 548 | ---- |
553 | def trace_unhandled(event_name, context, common_cpu, common_secs, | 549 | def trace_unhandled(event_name, context, event_fields_dict): |
554 | common_nsecs, common_pid, common_comm): | ||
555 | pass | 550 | pass |
556 | ---- | 551 | ---- |
557 | 552 | ||
diff --git a/tools/perf/Documentation/perf-script.txt b/tools/perf/Documentation/perf-script.txt index cb0eda3925e6..3517e204a2b3 100644 --- a/tools/perf/Documentation/perf-script.txt +++ b/tools/perf/Documentation/perf-script.txt | |||
@@ -311,6 +311,10 @@ include::itrace.txt[] | |||
311 | Set the maximum number of program blocks to print with brstackasm for | 311 | Set the maximum number of program blocks to print with brstackasm for |
312 | each sample. | 312 | each sample. |
313 | 313 | ||
314 | --inline:: | ||
315 | If a callgraph address belongs to an inlined function, the inline stack | ||
316 | will be printed. Each entry has function name and file/line. | ||
317 | |||
314 | SEE ALSO | 318 | SEE ALSO |
315 | -------- | 319 | -------- |
316 | linkperf:perf-record[1], linkperf:perf-script-perl[1], | 320 | linkperf:perf-record[1], linkperf:perf-script-perl[1], |
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 8354d04b392f..1f4fbc9a3292 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config | |||
@@ -19,18 +19,18 @@ CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS) | |||
19 | 19 | ||
20 | include $(srctree)/tools/scripts/Makefile.arch | 20 | include $(srctree)/tools/scripts/Makefile.arch |
21 | 21 | ||
22 | $(call detected_var,ARCH) | 22 | $(call detected_var,SRCARCH) |
23 | 23 | ||
24 | NO_PERF_REGS := 1 | 24 | NO_PERF_REGS := 1 |
25 | 25 | ||
26 | # Additional ARCH settings for ppc | 26 | # Additional ARCH settings for ppc |
27 | ifeq ($(ARCH),powerpc) | 27 | ifeq ($(SRCARCH),powerpc) |
28 | NO_PERF_REGS := 0 | 28 | NO_PERF_REGS := 0 |
29 | LIBUNWIND_LIBS := -lunwind -lunwind-ppc64 | 29 | LIBUNWIND_LIBS := -lunwind -lunwind-ppc64 |
30 | endif | 30 | endif |
31 | 31 | ||
32 | # Additional ARCH settings for x86 | 32 | # Additional ARCH settings for x86 |
33 | ifeq ($(ARCH),x86) | 33 | ifeq ($(SRCARCH),x86) |
34 | $(call detected,CONFIG_X86) | 34 | $(call detected,CONFIG_X86) |
35 | ifeq (${IS_64_BIT}, 1) | 35 | ifeq (${IS_64_BIT}, 1) |
36 | CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT -DHAVE_SYSCALL_TABLE -I$(OUTPUT)arch/x86/include/generated | 36 | CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT -DHAVE_SYSCALL_TABLE -I$(OUTPUT)arch/x86/include/generated |
@@ -43,12 +43,12 @@ ifeq ($(ARCH),x86) | |||
43 | NO_PERF_REGS := 0 | 43 | NO_PERF_REGS := 0 |
44 | endif | 44 | endif |
45 | 45 | ||
46 | ifeq ($(ARCH),arm) | 46 | ifeq ($(SRCARCH),arm) |
47 | NO_PERF_REGS := 0 | 47 | NO_PERF_REGS := 0 |
48 | LIBUNWIND_LIBS = -lunwind -lunwind-arm | 48 | LIBUNWIND_LIBS = -lunwind -lunwind-arm |
49 | endif | 49 | endif |
50 | 50 | ||
51 | ifeq ($(ARCH),arm64) | 51 | ifeq ($(SRCARCH),arm64) |
52 | NO_PERF_REGS := 0 | 52 | NO_PERF_REGS := 0 |
53 | LIBUNWIND_LIBS = -lunwind -lunwind-aarch64 | 53 | LIBUNWIND_LIBS = -lunwind -lunwind-aarch64 |
54 | endif | 54 | endif |
@@ -61,7 +61,7 @@ endif | |||
61 | # Disable it on all other architectures in case libdw unwind | 61 | # Disable it on all other architectures in case libdw unwind |
62 | # support is detected in system. Add supported architectures | 62 | # support is detected in system. Add supported architectures |
63 | # to the check. | 63 | # to the check. |
64 | ifneq ($(ARCH),$(filter $(ARCH),x86 arm)) | 64 | ifneq ($(SRCARCH),$(filter $(SRCARCH),x86 arm)) |
65 | NO_LIBDW_DWARF_UNWIND := 1 | 65 | NO_LIBDW_DWARF_UNWIND := 1 |
66 | endif | 66 | endif |
67 | 67 | ||
@@ -115,9 +115,9 @@ endif | |||
115 | FEATURE_CHECK_CFLAGS-libbabeltrace := $(LIBBABELTRACE_CFLAGS) | 115 | FEATURE_CHECK_CFLAGS-libbabeltrace := $(LIBBABELTRACE_CFLAGS) |
116 | FEATURE_CHECK_LDFLAGS-libbabeltrace := $(LIBBABELTRACE_LDFLAGS) -lbabeltrace-ctf | 116 | FEATURE_CHECK_LDFLAGS-libbabeltrace := $(LIBBABELTRACE_LDFLAGS) -lbabeltrace-ctf |
117 | 117 | ||
118 | FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(ARCH)/include/uapi -I$(srctree)/tools/include/uapi | 118 | FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi -I$(srctree)/tools/include/uapi |
119 | # include ARCH specific config | 119 | # include ARCH specific config |
120 | -include $(src-perf)/arch/$(ARCH)/Makefile | 120 | -include $(src-perf)/arch/$(SRCARCH)/Makefile |
121 | 121 | ||
122 | ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET | 122 | ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET |
123 | CFLAGS += -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET | 123 | CFLAGS += -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET |
@@ -228,12 +228,12 @@ ifeq ($(DEBUG),0) | |||
228 | endif | 228 | endif |
229 | 229 | ||
230 | INC_FLAGS += -I$(src-perf)/util/include | 230 | INC_FLAGS += -I$(src-perf)/util/include |
231 | INC_FLAGS += -I$(src-perf)/arch/$(ARCH)/include | 231 | INC_FLAGS += -I$(src-perf)/arch/$(SRCARCH)/include |
232 | INC_FLAGS += -I$(srctree)/tools/include/uapi | 232 | INC_FLAGS += -I$(srctree)/tools/include/uapi |
233 | INC_FLAGS += -I$(srctree)/tools/include/ | 233 | INC_FLAGS += -I$(srctree)/tools/include/ |
234 | INC_FLAGS += -I$(srctree)/tools/arch/$(ARCH)/include/uapi | 234 | INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi |
235 | INC_FLAGS += -I$(srctree)/tools/arch/$(ARCH)/include/ | 235 | INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/ |
236 | INC_FLAGS += -I$(srctree)/tools/arch/$(ARCH)/ | 236 | INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/ |
237 | 237 | ||
238 | # $(obj-perf) for generated common-cmds.h | 238 | # $(obj-perf) for generated common-cmds.h |
239 | # $(obj-perf)/util for generated bison/flex headers | 239 | # $(obj-perf)/util for generated bison/flex headers |
@@ -355,7 +355,7 @@ ifndef NO_LIBELF | |||
355 | 355 | ||
356 | ifndef NO_DWARF | 356 | ifndef NO_DWARF |
357 | ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) | 357 | ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) |
358 | msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled); | 358 | msg := $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled); |
359 | NO_DWARF := 1 | 359 | NO_DWARF := 1 |
360 | else | 360 | else |
361 | CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS) | 361 | CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS) |
@@ -380,7 +380,7 @@ ifndef NO_LIBELF | |||
380 | CFLAGS += -DHAVE_BPF_PROLOGUE | 380 | CFLAGS += -DHAVE_BPF_PROLOGUE |
381 | $(call detected,CONFIG_BPF_PROLOGUE) | 381 | $(call detected,CONFIG_BPF_PROLOGUE) |
382 | else | 382 | else |
383 | msg := $(warning BPF prologue is not supported by architecture $(ARCH), missing regs_query_register_offset()); | 383 | msg := $(warning BPF prologue is not supported by architecture $(SRCARCH), missing regs_query_register_offset()); |
384 | endif | 384 | endif |
385 | else | 385 | else |
386 | msg := $(warning DWARF support is off, BPF prologue is disabled); | 386 | msg := $(warning DWARF support is off, BPF prologue is disabled); |
@@ -406,7 +406,7 @@ ifdef PERF_HAVE_JITDUMP | |||
406 | endif | 406 | endif |
407 | endif | 407 | endif |
408 | 408 | ||
409 | ifeq ($(ARCH),powerpc) | 409 | ifeq ($(SRCARCH),powerpc) |
410 | ifndef NO_DWARF | 410 | ifndef NO_DWARF |
411 | CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX | 411 | CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX |
412 | endif | 412 | endif |
@@ -487,7 +487,7 @@ else | |||
487 | endif | 487 | endif |
488 | 488 | ||
489 | ifndef NO_LOCAL_LIBUNWIND | 489 | ifndef NO_LOCAL_LIBUNWIND |
490 | ifeq ($(ARCH),$(filter $(ARCH),arm arm64)) | 490 | ifeq ($(SRCARCH),$(filter $(SRCARCH),arm arm64)) |
491 | $(call feature_check,libunwind-debug-frame) | 491 | $(call feature_check,libunwind-debug-frame) |
492 | ifneq ($(feature-libunwind-debug-frame), 1) | 492 | ifneq ($(feature-libunwind-debug-frame), 1) |
493 | msg := $(warning No debug_frame support found in libunwind); | 493 | msg := $(warning No debug_frame support found in libunwind); |
@@ -740,7 +740,7 @@ ifeq (${IS_64_BIT}, 1) | |||
740 | NO_PERF_READ_VDSO32 := 1 | 740 | NO_PERF_READ_VDSO32 := 1 |
741 | endif | 741 | endif |
742 | endif | 742 | endif |
743 | ifneq ($(ARCH), x86) | 743 | ifneq ($(SRCARCH), x86) |
744 | NO_PERF_READ_VDSOX32 := 1 | 744 | NO_PERF_READ_VDSOX32 := 1 |
745 | endif | 745 | endif |
746 | ifndef NO_PERF_READ_VDSOX32 | 746 | ifndef NO_PERF_READ_VDSOX32 |
@@ -769,7 +769,7 @@ ifdef LIBBABELTRACE | |||
769 | endif | 769 | endif |
770 | 770 | ||
771 | ifndef NO_AUXTRACE | 771 | ifndef NO_AUXTRACE |
772 | ifeq ($(ARCH),x86) | 772 | ifeq ($(SRCARCH),x86) |
773 | ifeq ($(feature-get_cpuid), 0) | 773 | ifeq ($(feature-get_cpuid), 0) |
774 | msg := $(warning Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc); | 774 | msg := $(warning Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc); |
775 | NO_AUXTRACE := 1 | 775 | NO_AUXTRACE := 1 |
@@ -872,7 +872,7 @@ sysconfdir = $(prefix)/etc | |||
872 | ETC_PERFCONFIG = etc/perfconfig | 872 | ETC_PERFCONFIG = etc/perfconfig |
873 | endif | 873 | endif |
874 | ifndef lib | 874 | ifndef lib |
875 | ifeq ($(ARCH)$(IS_64_BIT), x861) | 875 | ifeq ($(SRCARCH)$(IS_64_BIT), x861) |
876 | lib = lib64 | 876 | lib = lib64 |
877 | else | 877 | else |
878 | lib = lib | 878 | lib = lib |
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 79fe31f20a17..5008f51a08a2 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf | |||
@@ -226,7 +226,7 @@ endif | |||
226 | 226 | ||
227 | ifeq ($(config),0) | 227 | ifeq ($(config),0) |
228 | include $(srctree)/tools/scripts/Makefile.arch | 228 | include $(srctree)/tools/scripts/Makefile.arch |
229 | -include arch/$(ARCH)/Makefile | 229 | -include arch/$(SRCARCH)/Makefile |
230 | endif | 230 | endif |
231 | 231 | ||
232 | # The FEATURE_DUMP_EXPORT holds location of the actual | 232 | # The FEATURE_DUMP_EXPORT holds location of the actual |
diff --git a/tools/perf/arch/Build b/tools/perf/arch/Build index 109eb75cf7de..d9b6af837c7d 100644 --- a/tools/perf/arch/Build +++ b/tools/perf/arch/Build | |||
@@ -1,2 +1,2 @@ | |||
1 | libperf-y += common.o | 1 | libperf-y += common.o |
2 | libperf-y += $(ARCH)/ | 2 | libperf-y += $(SRCARCH)/ |
diff --git a/tools/perf/arch/common.c b/tools/perf/arch/common.c index 837067f48a4c..6b40e9f01740 100644 --- a/tools/perf/arch/common.c +++ b/tools/perf/arch/common.c | |||
@@ -26,6 +26,7 @@ const char *const arm64_triplets[] = { | |||
26 | 26 | ||
27 | const char *const powerpc_triplets[] = { | 27 | const char *const powerpc_triplets[] = { |
28 | "powerpc-unknown-linux-gnu-", | 28 | "powerpc-unknown-linux-gnu-", |
29 | "powerpc-linux-gnu-", | ||
29 | "powerpc64-unknown-linux-gnu-", | 30 | "powerpc64-unknown-linux-gnu-", |
30 | "powerpc64-linux-gnu-", | 31 | "powerpc64-linux-gnu-", |
31 | "powerpc64le-linux-gnu-", | 32 | "powerpc64le-linux-gnu-", |
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index d05aec491cff..4761b0d7fcb5 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c | |||
@@ -2494,6 +2494,8 @@ int cmd_script(int argc, const char **argv) | |||
2494 | "Enable kernel symbol demangling"), | 2494 | "Enable kernel symbol demangling"), |
2495 | OPT_STRING(0, "time", &script.time_str, "str", | 2495 | OPT_STRING(0, "time", &script.time_str, "str", |
2496 | "Time span of interest (start,stop)"), | 2496 | "Time span of interest (start,stop)"), |
2497 | OPT_BOOLEAN(0, "inline", &symbol_conf.inline_name, | ||
2498 | "Show inline function"), | ||
2497 | OPT_END() | 2499 | OPT_END() |
2498 | }; | 2500 | }; |
2499 | const char * const script_subcommands[] = { "record", "report", NULL }; | 2501 | const char * const script_subcommands[] = { "record", "report", NULL }; |
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index a935b5023732..ad9324d1daf9 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -1578,6 +1578,7 @@ static void print_header(int argc, const char **argv) | |||
1578 | static void print_footer(void) | 1578 | static void print_footer(void) |
1579 | { | 1579 | { |
1580 | FILE *output = stat_config.output; | 1580 | FILE *output = stat_config.output; |
1581 | int n; | ||
1581 | 1582 | ||
1582 | if (!null_run) | 1583 | if (!null_run) |
1583 | fprintf(output, "\n"); | 1584 | fprintf(output, "\n"); |
@@ -1590,7 +1591,9 @@ static void print_footer(void) | |||
1590 | } | 1591 | } |
1591 | fprintf(output, "\n\n"); | 1592 | fprintf(output, "\n\n"); |
1592 | 1593 | ||
1593 | if (print_free_counters_hint) | 1594 | if (print_free_counters_hint && |
1595 | sysctl__read_int("kernel/nmi_watchdog", &n) >= 0 && | ||
1596 | n > 0) | ||
1594 | fprintf(output, | 1597 | fprintf(output, |
1595 | "Some events weren't counted. Try disabling the NMI watchdog:\n" | 1598 | "Some events weren't counted. Try disabling the NMI watchdog:\n" |
1596 | " echo 0 > /proc/sys/kernel/nmi_watchdog\n" | 1599 | " echo 0 > /proc/sys/kernel/nmi_watchdog\n" |
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index d014350adc52..4b2a5d298197 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -681,6 +681,10 @@ static struct syscall_fmt { | |||
681 | { .name = "mlockall", .errmsg = true, | 681 | { .name = "mlockall", .errmsg = true, |
682 | .arg_scnprintf = { [0] = SCA_HEX, /* addr */ }, }, | 682 | .arg_scnprintf = { [0] = SCA_HEX, /* addr */ }, }, |
683 | { .name = "mmap", .hexret = true, | 683 | { .name = "mmap", .hexret = true, |
684 | /* The standard mmap maps to old_mmap on s390x */ | ||
685 | #if defined(__s390x__) | ||
686 | .alias = "old_mmap", | ||
687 | #endif | ||
684 | .arg_scnprintf = { [0] = SCA_HEX, /* addr */ | 688 | .arg_scnprintf = { [0] = SCA_HEX, /* addr */ |
685 | [2] = SCA_MMAP_PROT, /* prot */ | 689 | [2] = SCA_MMAP_PROT, /* prot */ |
686 | [3] = SCA_MMAP_FLAGS, /* flags */ }, }, | 690 | [3] = SCA_MMAP_FLAGS, /* flags */ }, }, |
diff --git a/tools/perf/pmu-events/Build b/tools/perf/pmu-events/Build index 9213a1273697..999a4e878162 100644 --- a/tools/perf/pmu-events/Build +++ b/tools/perf/pmu-events/Build | |||
@@ -2,7 +2,7 @@ hostprogs := jevents | |||
2 | 2 | ||
3 | jevents-y += json.o jsmn.o jevents.o | 3 | jevents-y += json.o jsmn.o jevents.o |
4 | pmu-events-y += pmu-events.o | 4 | pmu-events-y += pmu-events.o |
5 | JDIR = pmu-events/arch/$(ARCH) | 5 | JDIR = pmu-events/arch/$(SRCARCH) |
6 | JSON = $(shell [ -d $(JDIR) ] && \ | 6 | JSON = $(shell [ -d $(JDIR) ] && \ |
7 | find $(JDIR) -name '*.json' -o -name 'mapfile.csv') | 7 | find $(JDIR) -name '*.json' -o -name 'mapfile.csv') |
8 | # | 8 | # |
@@ -10,4 +10,4 @@ JSON = $(shell [ -d $(JDIR) ] && \ | |||
10 | # directory and create tables in pmu-events.c. | 10 | # directory and create tables in pmu-events.c. |
11 | # | 11 | # |
12 | $(OUTPUT)pmu-events/pmu-events.c: $(JSON) $(JEVENTS) | 12 | $(OUTPUT)pmu-events/pmu-events.c: $(JSON) $(JEVENTS) |
13 | $(Q)$(call echo-cmd,gen)$(JEVENTS) $(ARCH) pmu-events/arch $(OUTPUT)pmu-events/pmu-events.c $(V) | 13 | $(Q)$(call echo-cmd,gen)$(JEVENTS) $(SRCARCH) pmu-events/arch $(OUTPUT)pmu-events/pmu-events.c $(V) |
diff --git a/tools/perf/tests/Build b/tools/perf/tests/Build index af58ebc243ef..84222bdb8689 100644 --- a/tools/perf/tests/Build +++ b/tools/perf/tests/Build | |||
@@ -75,7 +75,7 @@ $(OUTPUT)tests/llvm-src-relocation.c: tests/bpf-script-test-relocation.c tests/B | |||
75 | $(Q)sed -e 's/"/\\"/g' -e 's/\(.*\)/"\1\\n"/g' $< >> $@ | 75 | $(Q)sed -e 's/"/\\"/g' -e 's/\(.*\)/"\1\\n"/g' $< >> $@ |
76 | $(Q)echo ';' >> $@ | 76 | $(Q)echo ';' >> $@ |
77 | 77 | ||
78 | ifeq ($(ARCH),$(filter $(ARCH),x86 arm arm64 powerpc)) | 78 | ifeq ($(SRCARCH),$(filter $(SRCARCH),x86 arm arm64 powerpc)) |
79 | perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o | 79 | perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o |
80 | endif | 80 | endif |
81 | 81 | ||
diff --git a/tools/perf/tests/bp_signal.c b/tools/perf/tests/bp_signal.c index e7664fe3bd33..8ba2c4618fe9 100644 --- a/tools/perf/tests/bp_signal.c +++ b/tools/perf/tests/bp_signal.c | |||
@@ -288,3 +288,17 @@ int test__bp_signal(int subtest __maybe_unused) | |||
288 | return count1 == 1 && overflows == 3 && count2 == 3 && overflows_2 == 3 && count3 == 2 ? | 288 | return count1 == 1 && overflows == 3 && count2 == 3 && overflows_2 == 3 && count3 == 2 ? |
289 | TEST_OK : TEST_FAIL; | 289 | TEST_OK : TEST_FAIL; |
290 | } | 290 | } |
291 | |||
292 | bool test__bp_signal_is_supported(void) | ||
293 | { | ||
294 | /* | ||
295 | * The powerpc so far does not have support to even create | ||
296 | * instruction breakpoint using the perf event interface. | ||
297 | * Once it's there we can release this. | ||
298 | */ | ||
299 | #ifdef __powerpc__ | ||
300 | return false; | ||
301 | #else | ||
302 | return true; | ||
303 | #endif | ||
304 | } | ||
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c index 9e08d297f1a9..3ccfd58a8c3c 100644 --- a/tools/perf/tests/builtin-test.c +++ b/tools/perf/tests/builtin-test.c | |||
@@ -97,10 +97,12 @@ static struct test generic_tests[] = { | |||
97 | { | 97 | { |
98 | .desc = "Breakpoint overflow signal handler", | 98 | .desc = "Breakpoint overflow signal handler", |
99 | .func = test__bp_signal, | 99 | .func = test__bp_signal, |
100 | .is_supported = test__bp_signal_is_supported, | ||
100 | }, | 101 | }, |
101 | { | 102 | { |
102 | .desc = "Breakpoint overflow sampling", | 103 | .desc = "Breakpoint overflow sampling", |
103 | .func = test__bp_signal_overflow, | 104 | .func = test__bp_signal_overflow, |
105 | .is_supported = test__bp_signal_is_supported, | ||
104 | }, | 106 | }, |
105 | { | 107 | { |
106 | .desc = "Number of exit events of a simple workload", | 108 | .desc = "Number of exit events of a simple workload", |
@@ -401,6 +403,11 @@ static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist) | |||
401 | if (!perf_test__matches(t, curr, argc, argv)) | 403 | if (!perf_test__matches(t, curr, argc, argv)) |
402 | continue; | 404 | continue; |
403 | 405 | ||
406 | if (t->is_supported && !t->is_supported()) { | ||
407 | pr_debug("%2d: %-*s: Disabled\n", i, width, t->desc); | ||
408 | continue; | ||
409 | } | ||
410 | |||
404 | pr_info("%2d: %-*s:", i, width, t->desc); | 411 | pr_info("%2d: %-*s:", i, width, t->desc); |
405 | 412 | ||
406 | if (intlist__find(skiplist, i)) { | 413 | if (intlist__find(skiplist, i)) { |
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c index 1f14e7612cbb..94b7c7b02bde 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c | |||
@@ -229,6 +229,8 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode, | |||
229 | unsigned char buf2[BUFSZ]; | 229 | unsigned char buf2[BUFSZ]; |
230 | size_t ret_len; | 230 | size_t ret_len; |
231 | u64 objdump_addr; | 231 | u64 objdump_addr; |
232 | const char *objdump_name; | ||
233 | char decomp_name[KMOD_DECOMP_LEN]; | ||
232 | int ret; | 234 | int ret; |
233 | 235 | ||
234 | pr_debug("Reading object code for memory address: %#"PRIx64"\n", addr); | 236 | pr_debug("Reading object code for memory address: %#"PRIx64"\n", addr); |
@@ -289,9 +291,25 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode, | |||
289 | state->done[state->done_cnt++] = al.map->start; | 291 | state->done[state->done_cnt++] = al.map->start; |
290 | } | 292 | } |
291 | 293 | ||
294 | objdump_name = al.map->dso->long_name; | ||
295 | if (dso__needs_decompress(al.map->dso)) { | ||
296 | if (dso__decompress_kmodule_path(al.map->dso, objdump_name, | ||
297 | decomp_name, | ||
298 | sizeof(decomp_name)) < 0) { | ||
299 | pr_debug("decompression failed\n"); | ||
300 | return -1; | ||
301 | } | ||
302 | |||
303 | objdump_name = decomp_name; | ||
304 | } | ||
305 | |||
292 | /* Read the object code using objdump */ | 306 | /* Read the object code using objdump */ |
293 | objdump_addr = map__rip_2objdump(al.map, al.addr); | 307 | objdump_addr = map__rip_2objdump(al.map, al.addr); |
294 | ret = read_via_objdump(al.map->dso->long_name, objdump_addr, buf2, len); | 308 | ret = read_via_objdump(objdump_name, objdump_addr, buf2, len); |
309 | |||
310 | if (dso__needs_decompress(al.map->dso)) | ||
311 | unlink(objdump_name); | ||
312 | |||
295 | if (ret > 0) { | 313 | if (ret > 0) { |
296 | /* | 314 | /* |
297 | * The kernel maps are inaccurate - assume objdump is right in | 315 | * The kernel maps are inaccurate - assume objdump is right in |
diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c index 32873ec91a4e..cf00ebad2ef5 100644 --- a/tools/perf/tests/task-exit.c +++ b/tools/perf/tests/task-exit.c | |||
@@ -83,7 +83,7 @@ int test__task_exit(int subtest __maybe_unused) | |||
83 | 83 | ||
84 | evsel = perf_evlist__first(evlist); | 84 | evsel = perf_evlist__first(evlist); |
85 | evsel->attr.task = 1; | 85 | evsel->attr.task = 1; |
86 | evsel->attr.sample_freq = 0; | 86 | evsel->attr.sample_freq = 1; |
87 | evsel->attr.inherit = 0; | 87 | evsel->attr.inherit = 0; |
88 | evsel->attr.watermark = 0; | 88 | evsel->attr.watermark = 0; |
89 | evsel->attr.wakeup_events = 1; | 89 | evsel->attr.wakeup_events = 1; |
diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h index 631859629403..577363809c9b 100644 --- a/tools/perf/tests/tests.h +++ b/tools/perf/tests/tests.h | |||
@@ -34,6 +34,7 @@ struct test { | |||
34 | int (*get_nr)(void); | 34 | int (*get_nr)(void); |
35 | const char *(*get_desc)(int subtest); | 35 | const char *(*get_desc)(int subtest); |
36 | } subtest; | 36 | } subtest; |
37 | bool (*is_supported)(void); | ||
37 | }; | 38 | }; |
38 | 39 | ||
39 | /* Tests */ | 40 | /* Tests */ |
@@ -99,6 +100,8 @@ const char *test__clang_subtest_get_desc(int subtest); | |||
99 | int test__clang_subtest_get_nr(void); | 100 | int test__clang_subtest_get_nr(void); |
100 | int test__unit_number__scnprint(int subtest); | 101 | int test__unit_number__scnprint(int subtest); |
101 | 102 | ||
103 | bool test__bp_signal_is_supported(void); | ||
104 | |||
102 | #if defined(__arm__) || defined(__aarch64__) | 105 | #if defined(__arm__) || defined(__aarch64__) |
103 | #ifdef HAVE_DWARF_UNWIND_SUPPORT | 106 | #ifdef HAVE_DWARF_UNWIND_SUPPORT |
104 | struct thread; | 107 | struct thread; |
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index 59addd52d9cd..ddb2c6fbdf91 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c | |||
@@ -210,6 +210,8 @@ static int __hpp__sort_acc(struct hist_entry *a, struct hist_entry *b, | |||
210 | return 0; | 210 | return 0; |
211 | 211 | ||
212 | ret = b->callchain->max_depth - a->callchain->max_depth; | 212 | ret = b->callchain->max_depth - a->callchain->max_depth; |
213 | if (callchain_param.order == ORDER_CALLER) | ||
214 | ret = -ret; | ||
213 | } | 215 | } |
214 | return ret; | 216 | return ret; |
215 | } | 217 | } |
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 683f8340460c..ddbd56df9187 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -239,10 +239,20 @@ static int jump__parse(struct arch *arch __maybe_unused, struct ins_operands *op | |||
239 | const char *s = strchr(ops->raw, '+'); | 239 | const char *s = strchr(ops->raw, '+'); |
240 | const char *c = strchr(ops->raw, ','); | 240 | const char *c = strchr(ops->raw, ','); |
241 | 241 | ||
242 | if (c++ != NULL) | 242 | /* |
243 | * skip over possible up to 2 operands to get to address, e.g.: | ||
244 | * tbnz w0, #26, ffff0000083cd190 <security_file_permission+0xd0> | ||
245 | */ | ||
246 | if (c++ != NULL) { | ||
243 | ops->target.addr = strtoull(c, NULL, 16); | 247 | ops->target.addr = strtoull(c, NULL, 16); |
244 | else | 248 | if (!ops->target.addr) { |
249 | c = strchr(c, ','); | ||
250 | if (c++ != NULL) | ||
251 | ops->target.addr = strtoull(c, NULL, 16); | ||
252 | } | ||
253 | } else { | ||
245 | ops->target.addr = strtoull(ops->raw, NULL, 16); | 254 | ops->target.addr = strtoull(ops->raw, NULL, 16); |
255 | } | ||
246 | 256 | ||
247 | if (s++ != NULL) { | 257 | if (s++ != NULL) { |
248 | ops->target.offset = strtoull(s, NULL, 16); | 258 | ops->target.offset = strtoull(s, NULL, 16); |
@@ -257,10 +267,27 @@ static int jump__parse(struct arch *arch __maybe_unused, struct ins_operands *op | |||
257 | static int jump__scnprintf(struct ins *ins, char *bf, size_t size, | 267 | static int jump__scnprintf(struct ins *ins, char *bf, size_t size, |
258 | struct ins_operands *ops) | 268 | struct ins_operands *ops) |
259 | { | 269 | { |
270 | const char *c = strchr(ops->raw, ','); | ||
271 | |||
260 | if (!ops->target.addr || ops->target.offset < 0) | 272 | if (!ops->target.addr || ops->target.offset < 0) |
261 | return ins__raw_scnprintf(ins, bf, size, ops); | 273 | return ins__raw_scnprintf(ins, bf, size, ops); |
262 | 274 | ||
263 | return scnprintf(bf, size, "%-6.6s %" PRIx64, ins->name, ops->target.offset); | 275 | if (c != NULL) { |
276 | const char *c2 = strchr(c + 1, ','); | ||
277 | |||
278 | /* check for 3-op insn */ | ||
279 | if (c2 != NULL) | ||
280 | c = c2; | ||
281 | c++; | ||
282 | |||
283 | /* mirror arch objdump's space-after-comma style */ | ||
284 | if (*c == ' ') | ||
285 | c++; | ||
286 | } | ||
287 | |||
288 | return scnprintf(bf, size, "%-6.6s %.*s%" PRIx64, | ||
289 | ins->name, c ? c - ops->raw : 0, ops->raw, | ||
290 | ops->target.offset); | ||
264 | } | 291 | } |
265 | 292 | ||
266 | static struct ins_ops jump_ops = { | 293 | static struct ins_ops jump_ops = { |
@@ -1294,6 +1321,7 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil | |||
1294 | char linkname[PATH_MAX]; | 1321 | char linkname[PATH_MAX]; |
1295 | char *build_id_filename; | 1322 | char *build_id_filename; |
1296 | char *build_id_path = NULL; | 1323 | char *build_id_path = NULL; |
1324 | char *pos; | ||
1297 | 1325 | ||
1298 | if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS && | 1326 | if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS && |
1299 | !dso__is_kcore(dso)) | 1327 | !dso__is_kcore(dso)) |
@@ -1313,7 +1341,14 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil | |||
1313 | if (!build_id_path) | 1341 | if (!build_id_path) |
1314 | return -1; | 1342 | return -1; |
1315 | 1343 | ||
1316 | dirname(build_id_path); | 1344 | /* |
1345 | * old style build-id cache has name of XX/XXXXXXX.. while | ||
1346 | * new style has XX/XXXXXXX../{elf,kallsyms,vdso}. | ||
1347 | * extract the build-id part of dirname in the new style only. | ||
1348 | */ | ||
1349 | pos = strrchr(build_id_path, '/'); | ||
1350 | if (pos && strlen(pos) < SBUILD_ID_SIZE - 2) | ||
1351 | dirname(build_id_path); | ||
1317 | 1352 | ||
1318 | if (dso__is_kcore(dso) || | 1353 | if (dso__is_kcore(dso) || |
1319 | readlink(build_id_path, linkname, sizeof(linkname)) < 0 || | 1354 | readlink(build_id_path, linkname, sizeof(linkname)) < 0 || |
@@ -1396,31 +1431,10 @@ int symbol__disassemble(struct symbol *sym, struct map *map, const char *arch_na | |||
1396 | sizeof(symfs_filename)); | 1431 | sizeof(symfs_filename)); |
1397 | } | 1432 | } |
1398 | } else if (dso__needs_decompress(dso)) { | 1433 | } else if (dso__needs_decompress(dso)) { |
1399 | char tmp[PATH_MAX]; | 1434 | char tmp[KMOD_DECOMP_LEN]; |
1400 | struct kmod_path m; | ||
1401 | int fd; | ||
1402 | bool ret; | ||
1403 | |||
1404 | if (kmod_path__parse_ext(&m, symfs_filename)) | ||
1405 | goto out; | ||
1406 | |||
1407 | snprintf(tmp, PATH_MAX, "/tmp/perf-kmod-XXXXXX"); | ||
1408 | |||
1409 | fd = mkstemp(tmp); | ||
1410 | if (fd < 0) { | ||
1411 | free(m.ext); | ||
1412 | goto out; | ||
1413 | } | ||
1414 | |||
1415 | ret = decompress_to_file(m.ext, symfs_filename, fd); | ||
1416 | |||
1417 | if (ret) | ||
1418 | pr_err("Cannot decompress %s %s\n", m.ext, symfs_filename); | ||
1419 | |||
1420 | free(m.ext); | ||
1421 | close(fd); | ||
1422 | 1435 | ||
1423 | if (!ret) | 1436 | if (dso__decompress_kmodule_path(dso, symfs_filename, |
1437 | tmp, sizeof(tmp)) < 0) | ||
1424 | goto out; | 1438 | goto out; |
1425 | 1439 | ||
1426 | strcpy(symfs_filename, tmp); | 1440 | strcpy(symfs_filename, tmp); |
@@ -1429,7 +1443,7 @@ int symbol__disassemble(struct symbol *sym, struct map *map, const char *arch_na | |||
1429 | snprintf(command, sizeof(command), | 1443 | snprintf(command, sizeof(command), |
1430 | "%s %s%s --start-address=0x%016" PRIx64 | 1444 | "%s %s%s --start-address=0x%016" PRIx64 |
1431 | " --stop-address=0x%016" PRIx64 | 1445 | " --stop-address=0x%016" PRIx64 |
1432 | " -l -d %s %s -C %s 2>/dev/null|grep -v %s:|expand", | 1446 | " -l -d %s %s -C \"%s\" 2>/dev/null|grep -v \"%s:\"|expand", |
1433 | objdump_path ? objdump_path : "objdump", | 1447 | objdump_path ? objdump_path : "objdump", |
1434 | disassembler_style ? "-M " : "", | 1448 | disassembler_style ? "-M " : "", |
1435 | disassembler_style ? disassembler_style : "", | 1449 | disassembler_style ? disassembler_style : "", |
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c index 168cc49654e7..e0148b081bdf 100644 --- a/tools/perf/util/build-id.c +++ b/tools/perf/util/build-id.c | |||
@@ -278,51 +278,6 @@ char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size) | |||
278 | return bf; | 278 | return bf; |
279 | } | 279 | } |
280 | 280 | ||
281 | bool dso__build_id_is_kmod(const struct dso *dso, char *bf, size_t size) | ||
282 | { | ||
283 | char *id_name = NULL, *ch; | ||
284 | struct stat sb; | ||
285 | char sbuild_id[SBUILD_ID_SIZE]; | ||
286 | |||
287 | if (!dso->has_build_id) | ||
288 | goto err; | ||
289 | |||
290 | build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id); | ||
291 | id_name = build_id_cache__linkname(sbuild_id, NULL, 0); | ||
292 | if (!id_name) | ||
293 | goto err; | ||
294 | if (access(id_name, F_OK)) | ||
295 | goto err; | ||
296 | if (lstat(id_name, &sb) == -1) | ||
297 | goto err; | ||
298 | if ((size_t)sb.st_size > size - 1) | ||
299 | goto err; | ||
300 | if (readlink(id_name, bf, size - 1) < 0) | ||
301 | goto err; | ||
302 | |||
303 | bf[sb.st_size] = '\0'; | ||
304 | |||
305 | /* | ||
306 | * link should be: | ||
307 | * ../../lib/modules/4.4.0-rc4/kernel/net/ipv4/netfilter/nf_nat_ipv4.ko/a09fe3eb3147dafa4e3b31dbd6257e4d696bdc92 | ||
308 | */ | ||
309 | ch = strrchr(bf, '/'); | ||
310 | if (!ch) | ||
311 | goto err; | ||
312 | if (ch - 3 < bf) | ||
313 | goto err; | ||
314 | |||
315 | free(id_name); | ||
316 | return strncmp(".ko", ch - 3, 3) == 0; | ||
317 | err: | ||
318 | pr_err("Invalid build id: %s\n", id_name ? : | ||
319 | dso->long_name ? : | ||
320 | dso->short_name ? : | ||
321 | "[unknown]"); | ||
322 | free(id_name); | ||
323 | return false; | ||
324 | } | ||
325 | |||
326 | #define dsos__for_each_with_build_id(pos, head) \ | 281 | #define dsos__for_each_with_build_id(pos, head) \ |
327 | list_for_each_entry(pos, head, node) \ | 282 | list_for_each_entry(pos, head, node) \ |
328 | if (!pos->has_build_id) \ | 283 | if (!pos->has_build_id) \ |
diff --git a/tools/perf/util/build-id.h b/tools/perf/util/build-id.h index 8a89b195c1fc..96690a55c62c 100644 --- a/tools/perf/util/build-id.h +++ b/tools/perf/util/build-id.h | |||
@@ -17,7 +17,6 @@ char *build_id_cache__kallsyms_path(const char *sbuild_id, char *bf, | |||
17 | size_t size); | 17 | size_t size); |
18 | 18 | ||
19 | char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size); | 19 | char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size); |
20 | bool dso__build_id_is_kmod(const struct dso *dso, char *bf, size_t size); | ||
21 | 20 | ||
22 | int build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event, | 21 | int build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event, |
23 | struct perf_sample *sample, struct perf_evsel *evsel, | 22 | struct perf_sample *sample, struct perf_evsel *evsel, |
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c index 81fc29ac798f..b4204b43ed58 100644 --- a/tools/perf/util/callchain.c +++ b/tools/perf/util/callchain.c | |||
@@ -621,14 +621,19 @@ enum match_result { | |||
621 | static enum match_result match_chain_srcline(struct callchain_cursor_node *node, | 621 | static enum match_result match_chain_srcline(struct callchain_cursor_node *node, |
622 | struct callchain_list *cnode) | 622 | struct callchain_list *cnode) |
623 | { | 623 | { |
624 | char *left = get_srcline(cnode->ms.map->dso, | 624 | char *left = NULL; |
625 | char *right = NULL; | ||
626 | enum match_result ret = MATCH_EQ; | ||
627 | int cmp; | ||
628 | |||
629 | if (cnode->ms.map) | ||
630 | left = get_srcline(cnode->ms.map->dso, | ||
625 | map__rip_2objdump(cnode->ms.map, cnode->ip), | 631 | map__rip_2objdump(cnode->ms.map, cnode->ip), |
626 | cnode->ms.sym, true, false); | 632 | cnode->ms.sym, true, false); |
627 | char *right = get_srcline(node->map->dso, | 633 | if (node->map) |
634 | right = get_srcline(node->map->dso, | ||
628 | map__rip_2objdump(node->map, node->ip), | 635 | map__rip_2objdump(node->map, node->ip), |
629 | node->sym, true, false); | 636 | node->sym, true, false); |
630 | enum match_result ret = MATCH_EQ; | ||
631 | int cmp; | ||
632 | 637 | ||
633 | if (left && right) | 638 | if (left && right) |
634 | cmp = strcmp(left, right); | 639 | cmp = strcmp(left, right); |
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c index a96a99d2369f..4e7ab611377a 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c | |||
@@ -248,6 +248,64 @@ bool dso__needs_decompress(struct dso *dso) | |||
248 | dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE_COMP; | 248 | dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE_COMP; |
249 | } | 249 | } |
250 | 250 | ||
251 | static int decompress_kmodule(struct dso *dso, const char *name, char *tmpbuf) | ||
252 | { | ||
253 | int fd = -1; | ||
254 | struct kmod_path m; | ||
255 | |||
256 | if (!dso__needs_decompress(dso)) | ||
257 | return -1; | ||
258 | |||
259 | if (kmod_path__parse_ext(&m, dso->long_name)) | ||
260 | return -1; | ||
261 | |||
262 | if (!m.comp) | ||
263 | goto out; | ||
264 | |||
265 | fd = mkstemp(tmpbuf); | ||
266 | if (fd < 0) { | ||
267 | dso->load_errno = errno; | ||
268 | goto out; | ||
269 | } | ||
270 | |||
271 | if (!decompress_to_file(m.ext, name, fd)) { | ||
272 | dso->load_errno = DSO_LOAD_ERRNO__DECOMPRESSION_FAILURE; | ||
273 | close(fd); | ||
274 | fd = -1; | ||
275 | } | ||
276 | |||
277 | out: | ||
278 | free(m.ext); | ||
279 | return fd; | ||
280 | } | ||
281 | |||
282 | int dso__decompress_kmodule_fd(struct dso *dso, const char *name) | ||
283 | { | ||
284 | char tmpbuf[] = KMOD_DECOMP_NAME; | ||
285 | int fd; | ||
286 | |||
287 | fd = decompress_kmodule(dso, name, tmpbuf); | ||
288 | unlink(tmpbuf); | ||
289 | return fd; | ||
290 | } | ||
291 | |||
292 | int dso__decompress_kmodule_path(struct dso *dso, const char *name, | ||
293 | char *pathname, size_t len) | ||
294 | { | ||
295 | char tmpbuf[] = KMOD_DECOMP_NAME; | ||
296 | int fd; | ||
297 | |||
298 | fd = decompress_kmodule(dso, name, tmpbuf); | ||
299 | if (fd < 0) { | ||
300 | unlink(tmpbuf); | ||
301 | return -1; | ||
302 | } | ||
303 | |||
304 | strncpy(pathname, tmpbuf, len); | ||
305 | close(fd); | ||
306 | return 0; | ||
307 | } | ||
308 | |||
251 | /* | 309 | /* |
252 | * Parses kernel module specified in @path and updates | 310 | * Parses kernel module specified in @path and updates |
253 | * @m argument like: | 311 | * @m argument like: |
@@ -335,6 +393,21 @@ int __kmod_path__parse(struct kmod_path *m, const char *path, | |||
335 | return 0; | 393 | return 0; |
336 | } | 394 | } |
337 | 395 | ||
396 | void dso__set_module_info(struct dso *dso, struct kmod_path *m, | ||
397 | struct machine *machine) | ||
398 | { | ||
399 | if (machine__is_host(machine)) | ||
400 | dso->symtab_type = DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE; | ||
401 | else | ||
402 | dso->symtab_type = DSO_BINARY_TYPE__GUEST_KMODULE; | ||
403 | |||
404 | /* _KMODULE_COMP should be next to _KMODULE */ | ||
405 | if (m->kmod && m->comp) | ||
406 | dso->symtab_type++; | ||
407 | |||
408 | dso__set_short_name(dso, strdup(m->name), true); | ||
409 | } | ||
410 | |||
338 | /* | 411 | /* |
339 | * Global list of open DSOs and the counter. | 412 | * Global list of open DSOs and the counter. |
340 | */ | 413 | */ |
@@ -381,7 +454,7 @@ static int do_open(char *name) | |||
381 | 454 | ||
382 | static int __open_dso(struct dso *dso, struct machine *machine) | 455 | static int __open_dso(struct dso *dso, struct machine *machine) |
383 | { | 456 | { |
384 | int fd; | 457 | int fd = -EINVAL; |
385 | char *root_dir = (char *)""; | 458 | char *root_dir = (char *)""; |
386 | char *name = malloc(PATH_MAX); | 459 | char *name = malloc(PATH_MAX); |
387 | 460 | ||
@@ -392,15 +465,30 @@ static int __open_dso(struct dso *dso, struct machine *machine) | |||
392 | root_dir = machine->root_dir; | 465 | root_dir = machine->root_dir; |
393 | 466 | ||
394 | if (dso__read_binary_type_filename(dso, dso->binary_type, | 467 | if (dso__read_binary_type_filename(dso, dso->binary_type, |
395 | root_dir, name, PATH_MAX)) { | 468 | root_dir, name, PATH_MAX)) |
396 | free(name); | 469 | goto out; |
397 | return -EINVAL; | ||
398 | } | ||
399 | 470 | ||
400 | if (!is_regular_file(name)) | 471 | if (!is_regular_file(name)) |
401 | return -EINVAL; | 472 | goto out; |
473 | |||
474 | if (dso__needs_decompress(dso)) { | ||
475 | char newpath[KMOD_DECOMP_LEN]; | ||
476 | size_t len = sizeof(newpath); | ||
477 | |||
478 | if (dso__decompress_kmodule_path(dso, name, newpath, len) < 0) { | ||
479 | fd = -dso->load_errno; | ||
480 | goto out; | ||
481 | } | ||
482 | |||
483 | strcpy(name, newpath); | ||
484 | } | ||
402 | 485 | ||
403 | fd = do_open(name); | 486 | fd = do_open(name); |
487 | |||
488 | if (dso__needs_decompress(dso)) | ||
489 | unlink(name); | ||
490 | |||
491 | out: | ||
404 | free(name); | 492 | free(name); |
405 | return fd; | 493 | return fd; |
406 | } | 494 | } |
diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h index 12350b171727..bd061ba7b47c 100644 --- a/tools/perf/util/dso.h +++ b/tools/perf/util/dso.h | |||
@@ -244,6 +244,12 @@ bool is_supported_compression(const char *ext); | |||
244 | bool is_kernel_module(const char *pathname, int cpumode); | 244 | bool is_kernel_module(const char *pathname, int cpumode); |
245 | bool decompress_to_file(const char *ext, const char *filename, int output_fd); | 245 | bool decompress_to_file(const char *ext, const char *filename, int output_fd); |
246 | bool dso__needs_decompress(struct dso *dso); | 246 | bool dso__needs_decompress(struct dso *dso); |
247 | int dso__decompress_kmodule_fd(struct dso *dso, const char *name); | ||
248 | int dso__decompress_kmodule_path(struct dso *dso, const char *name, | ||
249 | char *pathname, size_t len); | ||
250 | |||
251 | #define KMOD_DECOMP_NAME "/tmp/perf-kmod-XXXXXX" | ||
252 | #define KMOD_DECOMP_LEN sizeof(KMOD_DECOMP_NAME) | ||
247 | 253 | ||
248 | struct kmod_path { | 254 | struct kmod_path { |
249 | char *name; | 255 | char *name; |
@@ -259,6 +265,9 @@ int __kmod_path__parse(struct kmod_path *m, const char *path, | |||
259 | #define kmod_path__parse_name(__m, __p) __kmod_path__parse(__m, __p, true , false) | 265 | #define kmod_path__parse_name(__m, __p) __kmod_path__parse(__m, __p, true , false) |
260 | #define kmod_path__parse_ext(__m, __p) __kmod_path__parse(__m, __p, false, true) | 266 | #define kmod_path__parse_ext(__m, __p) __kmod_path__parse(__m, __p, false, true) |
261 | 267 | ||
268 | void dso__set_module_info(struct dso *dso, struct kmod_path *m, | ||
269 | struct machine *machine); | ||
270 | |||
262 | /* | 271 | /* |
263 | * The dso__data_* external interface provides following functions: | 272 | * The dso__data_* external interface provides following functions: |
264 | * dso__data_get_fd | 273 | * dso__data_get_fd |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index e4f7902d5afa..cda44b0e821c 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -273,8 +273,20 @@ struct perf_evsel *perf_evsel__new_cycles(void) | |||
273 | struct perf_evsel *evsel; | 273 | struct perf_evsel *evsel; |
274 | 274 | ||
275 | event_attr_init(&attr); | 275 | event_attr_init(&attr); |
276 | /* | ||
277 | * Unnamed union member, not supported as struct member named | ||
278 | * initializer in older compilers such as gcc 4.4.7 | ||
279 | * | ||
280 | * Just for probing the precise_ip: | ||
281 | */ | ||
282 | attr.sample_period = 1; | ||
276 | 283 | ||
277 | perf_event_attr__set_max_precise_ip(&attr); | 284 | perf_event_attr__set_max_precise_ip(&attr); |
285 | /* | ||
286 | * Now let the usual logic to set up the perf_event_attr defaults | ||
287 | * to kick in when we return and before perf_evsel__open() is called. | ||
288 | */ | ||
289 | attr.sample_period = 0; | ||
278 | 290 | ||
279 | evsel = perf_evsel__new(&attr); | 291 | evsel = perf_evsel__new(&attr); |
280 | if (evsel == NULL) | 292 | if (evsel == NULL) |
diff --git a/tools/perf/util/evsel_fprintf.c b/tools/perf/util/evsel_fprintf.c index e415aee6a245..583f3a602506 100644 --- a/tools/perf/util/evsel_fprintf.c +++ b/tools/perf/util/evsel_fprintf.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include "map.h" | 7 | #include "map.h" |
8 | #include "strlist.h" | 8 | #include "strlist.h" |
9 | #include "symbol.h" | 9 | #include "symbol.h" |
10 | #include "srcline.h" | ||
10 | 11 | ||
11 | static int comma_fprintf(FILE *fp, bool *first, const char *fmt, ...) | 12 | static int comma_fprintf(FILE *fp, bool *first, const char *fmt, ...) |
12 | { | 13 | { |
@@ -168,6 +169,38 @@ int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment, | |||
168 | if (!print_oneline) | 169 | if (!print_oneline) |
169 | printed += fprintf(fp, "\n"); | 170 | printed += fprintf(fp, "\n"); |
170 | 171 | ||
172 | if (symbol_conf.inline_name && node->map) { | ||
173 | struct inline_node *inode; | ||
174 | |||
175 | addr = map__rip_2objdump(node->map, node->ip), | ||
176 | inode = dso__parse_addr_inlines(node->map->dso, addr); | ||
177 | |||
178 | if (inode) { | ||
179 | struct inline_list *ilist; | ||
180 | |||
181 | list_for_each_entry(ilist, &inode->val, list) { | ||
182 | if (print_arrow) | ||
183 | printed += fprintf(fp, " <-"); | ||
184 | |||
185 | /* IP is same, just skip it */ | ||
186 | if (print_ip) | ||
187 | printed += fprintf(fp, "%c%16s", | ||
188 | s, ""); | ||
189 | if (print_sym) | ||
190 | printed += fprintf(fp, " %s", | ||
191 | ilist->funcname); | ||
192 | if (print_srcline) | ||
193 | printed += fprintf(fp, "\n %s:%d", | ||
194 | ilist->filename, | ||
195 | ilist->line_nr); | ||
196 | if (!print_oneline) | ||
197 | printed += fprintf(fp, "\n"); | ||
198 | } | ||
199 | |||
200 | inline_node__delete(inode); | ||
201 | } | ||
202 | } | ||
203 | |||
171 | if (symbol_conf.bt_stop_list && | 204 | if (symbol_conf.bt_stop_list && |
172 | node->sym && | 205 | node->sym && |
173 | strlist__has_entry(symbol_conf.bt_stop_list, | 206 | strlist__has_entry(symbol_conf.bt_stop_list, |
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 314a07151fb7..b5baff3007bb 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -841,7 +841,7 @@ static int write_group_desc(int fd, struct perf_header *h __maybe_unused, | |||
841 | 841 | ||
842 | /* | 842 | /* |
843 | * default get_cpuid(): nothing gets recorded | 843 | * default get_cpuid(): nothing gets recorded |
844 | * actual implementation must be in arch/$(ARCH)/util/header.c | 844 | * actual implementation must be in arch/$(SRCARCH)/util/header.c |
845 | */ | 845 | */ |
846 | int __weak get_cpuid(char *buffer __maybe_unused, size_t sz __maybe_unused) | 846 | int __weak get_cpuid(char *buffer __maybe_unused, size_t sz __maybe_unused) |
847 | { | 847 | { |
@@ -1469,8 +1469,16 @@ static int __event_process_build_id(struct build_id_event *bev, | |||
1469 | 1469 | ||
1470 | dso__set_build_id(dso, &bev->build_id); | 1470 | dso__set_build_id(dso, &bev->build_id); |
1471 | 1471 | ||
1472 | if (!is_kernel_module(filename, cpumode)) | 1472 | if (dso_type != DSO_TYPE_USER) { |
1473 | dso->kernel = dso_type; | 1473 | struct kmod_path m = { .name = NULL, }; |
1474 | |||
1475 | if (!kmod_path__parse_name(&m, filename) && m.kmod) | ||
1476 | dso__set_module_info(dso, &m, machine); | ||
1477 | else | ||
1478 | dso->kernel = dso_type; | ||
1479 | |||
1480 | free(m.name); | ||
1481 | } | ||
1474 | 1482 | ||
1475 | build_id__sprintf(dso->build_id, sizeof(dso->build_id), | 1483 | build_id__sprintf(dso->build_id, sizeof(dso->build_id), |
1476 | sbuild_id); | 1484 | sbuild_id); |
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index d97e014c3df3..5de2b86b9880 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
@@ -572,16 +572,7 @@ static struct dso *machine__findnew_module_dso(struct machine *machine, | |||
572 | if (dso == NULL) | 572 | if (dso == NULL) |
573 | goto out_unlock; | 573 | goto out_unlock; |
574 | 574 | ||
575 | if (machine__is_host(machine)) | 575 | dso__set_module_info(dso, m, machine); |
576 | dso->symtab_type = DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE; | ||
577 | else | ||
578 | dso->symtab_type = DSO_BINARY_TYPE__GUEST_KMODULE; | ||
579 | |||
580 | /* _KMODULE_COMP should be next to _KMODULE */ | ||
581 | if (m->kmod && m->comp) | ||
582 | dso->symtab_type++; | ||
583 | |||
584 | dso__set_short_name(dso, strdup(m->name), true); | ||
585 | dso__set_long_name(dso, strdup(filename), true); | 576 | dso__set_long_name(dso, strdup(filename), true); |
586 | } | 577 | } |
587 | 578 | ||
@@ -1218,10 +1209,12 @@ int machine__create_kernel_maps(struct machine *machine) | |||
1218 | */ | 1209 | */ |
1219 | map_groups__fixup_end(&machine->kmaps); | 1210 | map_groups__fixup_end(&machine->kmaps); |
1220 | 1211 | ||
1221 | if (machine__get_running_kernel_start(machine, &name, &addr)) { | 1212 | if (!machine__get_running_kernel_start(machine, &name, &addr)) { |
1222 | } else if (maps__set_kallsyms_ref_reloc_sym(machine->vmlinux_maps, name, addr)) { | 1213 | if (name && |
1223 | machine__destroy_kernel_maps(machine); | 1214 | maps__set_kallsyms_ref_reloc_sym(machine->vmlinux_maps, name, addr)) { |
1224 | return -1; | 1215 | machine__destroy_kernel_maps(machine); |
1216 | return -1; | ||
1217 | } | ||
1225 | } | 1218 | } |
1226 | 1219 | ||
1227 | return 0; | 1220 | return 0; |
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 84e7e698411e..a2670e9d652d 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
@@ -619,7 +619,7 @@ static int post_process_probe_trace_point(struct probe_trace_point *tp, | |||
619 | struct map *map, unsigned long offs) | 619 | struct map *map, unsigned long offs) |
620 | { | 620 | { |
621 | struct symbol *sym; | 621 | struct symbol *sym; |
622 | u64 addr = tp->address + tp->offset - offs; | 622 | u64 addr = tp->address - offs; |
623 | 623 | ||
624 | sym = map__find_symbol(map, addr); | 624 | sym = map__find_symbol(map, addr); |
625 | if (!sym) | 625 | if (!sym) |
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index 9d92af7d0718..40de3cb40d21 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c | |||
@@ -1219,7 +1219,7 @@ static int python_generate_script(struct pevent *pevent, const char *outfile) | |||
1219 | fprintf(ofp, "# be retrieved using Python functions of the form " | 1219 | fprintf(ofp, "# be retrieved using Python functions of the form " |
1220 | "common_*(context).\n"); | 1220 | "common_*(context).\n"); |
1221 | 1221 | ||
1222 | fprintf(ofp, "# See the perf-trace-python Documentation for the list " | 1222 | fprintf(ofp, "# See the perf-script-python Documentation for the list " |
1223 | "of available functions.\n\n"); | 1223 | "of available functions.\n\n"); |
1224 | 1224 | ||
1225 | fprintf(ofp, "import os\n"); | 1225 | fprintf(ofp, "import os\n"); |
diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c index df051a52393c..ebc88a74e67b 100644 --- a/tools/perf/util/srcline.c +++ b/tools/perf/util/srcline.c | |||
@@ -56,7 +56,10 @@ static int inline_list__append(char *filename, char *funcname, int line_nr, | |||
56 | } | 56 | } |
57 | } | 57 | } |
58 | 58 | ||
59 | list_add_tail(&ilist->list, &node->val); | 59 | if (callchain_param.order == ORDER_CALLEE) |
60 | list_add_tail(&ilist->list, &node->val); | ||
61 | else | ||
62 | list_add(&ilist->list, &node->val); | ||
60 | 63 | ||
61 | return 0; | 64 | return 0; |
62 | } | 65 | } |
@@ -200,12 +203,14 @@ static void addr2line_cleanup(struct a2l_data *a2l) | |||
200 | 203 | ||
201 | #define MAX_INLINE_NEST 1024 | 204 | #define MAX_INLINE_NEST 1024 |
202 | 205 | ||
203 | static void inline_list__reverse(struct inline_node *node) | 206 | static int inline_list__append_dso_a2l(struct dso *dso, |
207 | struct inline_node *node) | ||
204 | { | 208 | { |
205 | struct inline_list *ilist, *n; | 209 | struct a2l_data *a2l = dso->a2l; |
210 | char *funcname = a2l->funcname ? strdup(a2l->funcname) : NULL; | ||
211 | char *filename = a2l->filename ? strdup(a2l->filename) : NULL; | ||
206 | 212 | ||
207 | list_for_each_entry_safe_reverse(ilist, n, &node->val, list) | 213 | return inline_list__append(filename, funcname, a2l->line, node, dso); |
208 | list_move_tail(&ilist->list, &node->val); | ||
209 | } | 214 | } |
210 | 215 | ||
211 | static int addr2line(const char *dso_name, u64 addr, | 216 | static int addr2line(const char *dso_name, u64 addr, |
@@ -230,36 +235,36 @@ static int addr2line(const char *dso_name, u64 addr, | |||
230 | 235 | ||
231 | bfd_map_over_sections(a2l->abfd, find_address_in_section, a2l); | 236 | bfd_map_over_sections(a2l->abfd, find_address_in_section, a2l); |
232 | 237 | ||
233 | if (a2l->found && unwind_inlines) { | 238 | if (!a2l->found) |
239 | return 0; | ||
240 | |||
241 | if (unwind_inlines) { | ||
234 | int cnt = 0; | 242 | int cnt = 0; |
235 | 243 | ||
244 | if (node && inline_list__append_dso_a2l(dso, node)) | ||
245 | return 0; | ||
246 | |||
236 | while (bfd_find_inliner_info(a2l->abfd, &a2l->filename, | 247 | while (bfd_find_inliner_info(a2l->abfd, &a2l->filename, |
237 | &a2l->funcname, &a2l->line) && | 248 | &a2l->funcname, &a2l->line) && |
238 | cnt++ < MAX_INLINE_NEST) { | 249 | cnt++ < MAX_INLINE_NEST) { |
239 | 250 | ||
240 | if (node != NULL) { | 251 | if (node != NULL) { |
241 | if (inline_list__append(strdup(a2l->filename), | 252 | if (inline_list__append_dso_a2l(dso, node)) |
242 | strdup(a2l->funcname), | ||
243 | a2l->line, node, | ||
244 | dso) != 0) | ||
245 | return 0; | 253 | return 0; |
254 | // found at least one inline frame | ||
255 | ret = 1; | ||
246 | } | 256 | } |
247 | } | 257 | } |
258 | } | ||
248 | 259 | ||
249 | if ((node != NULL) && | 260 | if (file) { |
250 | (callchain_param.order != ORDER_CALLEE)) { | 261 | *file = a2l->filename ? strdup(a2l->filename) : NULL; |
251 | inline_list__reverse(node); | 262 | ret = *file ? 1 : 0; |
252 | } | ||
253 | } | 263 | } |
254 | 264 | ||
255 | if (a2l->found && a2l->filename) { | 265 | if (line) |
256 | *file = strdup(a2l->filename); | ||
257 | *line = a2l->line; | 266 | *line = a2l->line; |
258 | 267 | ||
259 | if (*file) | ||
260 | ret = 1; | ||
261 | } | ||
262 | |||
263 | return ret; | 268 | return ret; |
264 | } | 269 | } |
265 | 270 | ||
@@ -278,8 +283,6 @@ void dso__free_a2l(struct dso *dso) | |||
278 | static struct inline_node *addr2inlines(const char *dso_name, u64 addr, | 283 | static struct inline_node *addr2inlines(const char *dso_name, u64 addr, |
279 | struct dso *dso) | 284 | struct dso *dso) |
280 | { | 285 | { |
281 | char *file = NULL; | ||
282 | unsigned int line = 0; | ||
283 | struct inline_node *node; | 286 | struct inline_node *node; |
284 | 287 | ||
285 | node = zalloc(sizeof(*node)); | 288 | node = zalloc(sizeof(*node)); |
@@ -291,7 +294,7 @@ static struct inline_node *addr2inlines(const char *dso_name, u64 addr, | |||
291 | INIT_LIST_HEAD(&node->val); | 294 | INIT_LIST_HEAD(&node->val); |
292 | node->addr = addr; | 295 | node->addr = addr; |
293 | 296 | ||
294 | if (!addr2line(dso_name, addr, &file, &line, dso, TRUE, node)) | 297 | if (!addr2line(dso_name, addr, NULL, NULL, dso, TRUE, node)) |
295 | goto out_free_inline_node; | 298 | goto out_free_inline_node; |
296 | 299 | ||
297 | if (list_empty(&node->val)) | 300 | if (list_empty(&node->val)) |
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index e7ee47f7377a..502505cf236a 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c | |||
@@ -637,43 +637,6 @@ static int dso__swap_init(struct dso *dso, unsigned char eidata) | |||
637 | return 0; | 637 | return 0; |
638 | } | 638 | } |
639 | 639 | ||
640 | static int decompress_kmodule(struct dso *dso, const char *name, | ||
641 | enum dso_binary_type type) | ||
642 | { | ||
643 | int fd = -1; | ||
644 | char tmpbuf[] = "/tmp/perf-kmod-XXXXXX"; | ||
645 | struct kmod_path m; | ||
646 | |||
647 | if (type != DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP && | ||
648 | type != DSO_BINARY_TYPE__GUEST_KMODULE_COMP && | ||
649 | type != DSO_BINARY_TYPE__BUILD_ID_CACHE) | ||
650 | return -1; | ||
651 | |||
652 | if (type == DSO_BINARY_TYPE__BUILD_ID_CACHE) | ||
653 | name = dso->long_name; | ||
654 | |||
655 | if (kmod_path__parse_ext(&m, name) || !m.comp) | ||
656 | return -1; | ||
657 | |||
658 | fd = mkstemp(tmpbuf); | ||
659 | if (fd < 0) { | ||
660 | dso->load_errno = errno; | ||
661 | goto out; | ||
662 | } | ||
663 | |||
664 | if (!decompress_to_file(m.ext, name, fd)) { | ||
665 | dso->load_errno = DSO_LOAD_ERRNO__DECOMPRESSION_FAILURE; | ||
666 | close(fd); | ||
667 | fd = -1; | ||
668 | } | ||
669 | |||
670 | unlink(tmpbuf); | ||
671 | |||
672 | out: | ||
673 | free(m.ext); | ||
674 | return fd; | ||
675 | } | ||
676 | |||
677 | bool symsrc__possibly_runtime(struct symsrc *ss) | 640 | bool symsrc__possibly_runtime(struct symsrc *ss) |
678 | { | 641 | { |
679 | return ss->dynsym || ss->opdsec; | 642 | return ss->dynsym || ss->opdsec; |
@@ -705,9 +668,11 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name, | |||
705 | int fd; | 668 | int fd; |
706 | 669 | ||
707 | if (dso__needs_decompress(dso)) { | 670 | if (dso__needs_decompress(dso)) { |
708 | fd = decompress_kmodule(dso, name, type); | 671 | fd = dso__decompress_kmodule_fd(dso, name); |
709 | if (fd < 0) | 672 | if (fd < 0) |
710 | return -1; | 673 | return -1; |
674 | |||
675 | type = dso->symtab_type; | ||
711 | } else { | 676 | } else { |
712 | fd = open(name, O_RDONLY); | 677 | fd = open(name, O_RDONLY); |
713 | if (fd < 0) { | 678 | if (fd < 0) { |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 8f2b068ff756..e7a98dbd2aed 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -1562,10 +1562,6 @@ int dso__load(struct dso *dso, struct map *map) | |||
1562 | if (!runtime_ss && syms_ss) | 1562 | if (!runtime_ss && syms_ss) |
1563 | runtime_ss = syms_ss; | 1563 | runtime_ss = syms_ss; |
1564 | 1564 | ||
1565 | if (syms_ss && syms_ss->type == DSO_BINARY_TYPE__BUILD_ID_CACHE) | ||
1566 | if (dso__build_id_is_kmod(dso, name, PATH_MAX)) | ||
1567 | kmod = true; | ||
1568 | |||
1569 | if (syms_ss) | 1565 | if (syms_ss) |
1570 | ret = dso__load_sym(dso, map, syms_ss, runtime_ss, kmod); | 1566 | ret = dso__load_sym(dso, map, syms_ss, runtime_ss, kmod); |
1571 | else | 1567 | else |
diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c index f90e11a555b2..7755a5e0fe5e 100644 --- a/tools/perf/util/unwind-libdw.c +++ b/tools/perf/util/unwind-libdw.c | |||
@@ -39,6 +39,14 @@ static int __report_module(struct addr_location *al, u64 ip, | |||
39 | return 0; | 39 | return 0; |
40 | 40 | ||
41 | mod = dwfl_addrmodule(ui->dwfl, ip); | 41 | mod = dwfl_addrmodule(ui->dwfl, ip); |
42 | if (mod) { | ||
43 | Dwarf_Addr s; | ||
44 | |||
45 | dwfl_module_info(mod, NULL, &s, NULL, NULL, NULL, NULL, NULL); | ||
46 | if (s != al->map->start) | ||
47 | mod = 0; | ||
48 | } | ||
49 | |||
42 | if (!mod) | 50 | if (!mod) |
43 | mod = dwfl_report_elf(ui->dwfl, dso->short_name, | 51 | mod = dwfl_report_elf(ui->dwfl, dso->short_name, |
44 | dso->long_name, -1, al->map->start, | 52 | dso->long_name, -1, al->map->start, |
@@ -168,12 +176,24 @@ frame_callback(Dwfl_Frame *state, void *arg) | |||
168 | { | 176 | { |
169 | struct unwind_info *ui = arg; | 177 | struct unwind_info *ui = arg; |
170 | Dwarf_Addr pc; | 178 | Dwarf_Addr pc; |
179 | bool isactivation; | ||
171 | 180 | ||
172 | if (!dwfl_frame_pc(state, &pc, NULL)) { | 181 | if (!dwfl_frame_pc(state, &pc, NULL)) { |
173 | pr_err("%s", dwfl_errmsg(-1)); | 182 | pr_err("%s", dwfl_errmsg(-1)); |
174 | return DWARF_CB_ABORT; | 183 | return DWARF_CB_ABORT; |
175 | } | 184 | } |
176 | 185 | ||
186 | // report the module before we query for isactivation | ||
187 | report_module(pc, ui); | ||
188 | |||
189 | if (!dwfl_frame_pc(state, &pc, &isactivation)) { | ||
190 | pr_err("%s", dwfl_errmsg(-1)); | ||
191 | return DWARF_CB_ABORT; | ||
192 | } | ||
193 | |||
194 | if (!isactivation) | ||
195 | --pc; | ||
196 | |||
177 | return entry(pc, ui) || !(--ui->max_stack) ? | 197 | return entry(pc, ui) || !(--ui->max_stack) ? |
178 | DWARF_CB_ABORT : DWARF_CB_OK; | 198 | DWARF_CB_ABORT : DWARF_CB_OK; |
179 | } | 199 | } |
@@ -220,7 +240,7 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg, | |||
220 | 240 | ||
221 | err = dwfl_getthread_frames(ui->dwfl, thread->tid, frame_callback, ui); | 241 | err = dwfl_getthread_frames(ui->dwfl, thread->tid, frame_callback, ui); |
222 | 242 | ||
223 | if (err && !ui->max_stack) | 243 | if (err && ui->max_stack != max_stack) |
224 | err = 0; | 244 | err = 0; |
225 | 245 | ||
226 | /* | 246 | /* |
diff --git a/tools/perf/util/unwind-libunwind-local.c b/tools/perf/util/unwind-libunwind-local.c index f8455bed6e65..672c2ada9357 100644 --- a/tools/perf/util/unwind-libunwind-local.c +++ b/tools/perf/util/unwind-libunwind-local.c | |||
@@ -692,6 +692,17 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb, | |||
692 | 692 | ||
693 | while (!ret && (unw_step(&c) > 0) && i < max_stack) { | 693 | while (!ret && (unw_step(&c) > 0) && i < max_stack) { |
694 | unw_get_reg(&c, UNW_REG_IP, &ips[i]); | 694 | unw_get_reg(&c, UNW_REG_IP, &ips[i]); |
695 | |||
696 | /* | ||
697 | * Decrement the IP for any non-activation frames. | ||
698 | * this is required to properly find the srcline | ||
699 | * for caller frames. | ||
700 | * See also the documentation for dwfl_frame_pc(), | ||
701 | * which this code tries to replicate. | ||
702 | */ | ||
703 | if (unw_is_signal_frame(&c) <= 0) | ||
704 | --ips[i]; | ||
705 | |||
695 | ++i; | 706 | ++i; |
696 | } | 707 | } |
697 | 708 | ||
diff --git a/tools/power/acpi/.gitignore b/tools/power/acpi/.gitignore new file mode 100644 index 000000000000..cba3d994995c --- /dev/null +++ b/tools/power/acpi/.gitignore | |||
@@ -0,0 +1,4 @@ | |||
1 | acpidbg | ||
2 | acpidump | ||
3 | ec | ||
4 | include | ||
diff --git a/tools/testing/selftests/bpf/bpf_endian.h b/tools/testing/selftests/bpf/bpf_endian.h index 19d0604f8694..487cbfb89beb 100644 --- a/tools/testing/selftests/bpf/bpf_endian.h +++ b/tools/testing/selftests/bpf/bpf_endian.h | |||
@@ -1,23 +1,42 @@ | |||
1 | #ifndef __BPF_ENDIAN__ | 1 | #ifndef __BPF_ENDIAN__ |
2 | #define __BPF_ENDIAN__ | 2 | #define __BPF_ENDIAN__ |
3 | 3 | ||
4 | #include <asm/byteorder.h> | 4 | #include <linux/swab.h> |
5 | 5 | ||
6 | #if __BYTE_ORDER == __LITTLE_ENDIAN | 6 | /* LLVM's BPF target selects the endianness of the CPU |
7 | # define __bpf_ntohs(x) __builtin_bswap16(x) | 7 | * it compiles on, or the user specifies (bpfel/bpfeb), |
8 | # define __bpf_htons(x) __builtin_bswap16(x) | 8 | * respectively. The used __BYTE_ORDER__ is defined by |
9 | #elif __BYTE_ORDER == __BIG_ENDIAN | 9 | * the compiler, we cannot rely on __BYTE_ORDER from |
10 | # define __bpf_ntohs(x) (x) | 10 | * libc headers, since it doesn't reflect the actual |
11 | # define __bpf_htons(x) (x) | 11 | * requested byte order. |
12 | * | ||
13 | * Note, LLVM's BPF target has different __builtin_bswapX() | ||
14 | * semantics. It does map to BPF_ALU | BPF_END | BPF_TO_BE | ||
15 | * in bpfel and bpfeb case, which means below, that we map | ||
16 | * to cpu_to_be16(). We could use it unconditionally in BPF | ||
17 | * case, but better not rely on it, so that this header here | ||
18 | * can be used from application and BPF program side, which | ||
19 | * use different targets. | ||
20 | */ | ||
21 | #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ | ||
22 | # define __bpf_ntohs(x) __builtin_bswap16(x) | ||
23 | # define __bpf_htons(x) __builtin_bswap16(x) | ||
24 | # define __bpf_constant_ntohs(x) ___constant_swab16(x) | ||
25 | # define __bpf_constant_htons(x) ___constant_swab16(x) | ||
26 | #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ | ||
27 | # define __bpf_ntohs(x) (x) | ||
28 | # define __bpf_htons(x) (x) | ||
29 | # define __bpf_constant_ntohs(x) (x) | ||
30 | # define __bpf_constant_htons(x) (x) | ||
12 | #else | 31 | #else |
13 | # error "Fix your __BYTE_ORDER?!" | 32 | # error "Fix your compiler's __BYTE_ORDER__?!" |
14 | #endif | 33 | #endif |
15 | 34 | ||
16 | #define bpf_htons(x) \ | 35 | #define bpf_htons(x) \ |
17 | (__builtin_constant_p(x) ? \ | 36 | (__builtin_constant_p(x) ? \ |
18 | __constant_htons(x) : __bpf_htons(x)) | 37 | __bpf_constant_htons(x) : __bpf_htons(x)) |
19 | #define bpf_ntohs(x) \ | 38 | #define bpf_ntohs(x) \ |
20 | (__builtin_constant_p(x) ? \ | 39 | (__builtin_constant_p(x) ? \ |
21 | __constant_ntohs(x) : __bpf_ntohs(x)) | 40 | __bpf_constant_ntohs(x) : __bpf_ntohs(x)) |
22 | 41 | ||
23 | #endif | 42 | #endif /* __BPF_ENDIAN__ */ |
diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c index 3773562056da..0ff8c55c0464 100644 --- a/tools/testing/selftests/bpf/test_verifier.c +++ b/tools/testing/selftests/bpf/test_verifier.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #define MAX_NR_MAPS 4 | 49 | #define MAX_NR_MAPS 4 |
50 | 50 | ||
51 | #define F_NEEDS_EFFICIENT_UNALIGNED_ACCESS (1 << 0) | 51 | #define F_NEEDS_EFFICIENT_UNALIGNED_ACCESS (1 << 0) |
52 | #define F_LOAD_WITH_STRICT_ALIGNMENT (1 << 1) | ||
52 | 53 | ||
53 | struct bpf_test { | 54 | struct bpf_test { |
54 | const char *descr; | 55 | const char *descr; |
@@ -2615,6 +2616,30 @@ static struct bpf_test tests[] = { | |||
2615 | .prog_type = BPF_PROG_TYPE_SCHED_CLS, | 2616 | .prog_type = BPF_PROG_TYPE_SCHED_CLS, |
2616 | }, | 2617 | }, |
2617 | { | 2618 | { |
2619 | "direct packet access: test17 (pruning, alignment)", | ||
2620 | .insns = { | ||
2621 | BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, | ||
2622 | offsetof(struct __sk_buff, data)), | ||
2623 | BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, | ||
2624 | offsetof(struct __sk_buff, data_end)), | ||
2625 | BPF_LDX_MEM(BPF_W, BPF_REG_7, BPF_REG_1, | ||
2626 | offsetof(struct __sk_buff, mark)), | ||
2627 | BPF_MOV64_REG(BPF_REG_0, BPF_REG_2), | ||
2628 | BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 14), | ||
2629 | BPF_JMP_IMM(BPF_JGT, BPF_REG_7, 1, 4), | ||
2630 | BPF_JMP_REG(BPF_JGT, BPF_REG_0, BPF_REG_3, 1), | ||
2631 | BPF_STX_MEM(BPF_W, BPF_REG_0, BPF_REG_0, -4), | ||
2632 | BPF_MOV64_IMM(BPF_REG_0, 0), | ||
2633 | BPF_EXIT_INSN(), | ||
2634 | BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 1), | ||
2635 | BPF_JMP_A(-6), | ||
2636 | }, | ||
2637 | .errstr = "misaligned packet access off 2+15+-4 size 4", | ||
2638 | .result = REJECT, | ||
2639 | .prog_type = BPF_PROG_TYPE_SCHED_CLS, | ||
2640 | .flags = F_LOAD_WITH_STRICT_ALIGNMENT, | ||
2641 | }, | ||
2642 | { | ||
2618 | "helper access to packet: test1, valid packet_ptr range", | 2643 | "helper access to packet: test1, valid packet_ptr range", |
2619 | .insns = { | 2644 | .insns = { |
2620 | BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, | 2645 | BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, |
@@ -3341,6 +3366,70 @@ static struct bpf_test tests[] = { | |||
3341 | .prog_type = BPF_PROG_TYPE_SCHED_CLS | 3366 | .prog_type = BPF_PROG_TYPE_SCHED_CLS |
3342 | }, | 3367 | }, |
3343 | { | 3368 | { |
3369 | "alu ops on ptr_to_map_value_or_null, 1", | ||
3370 | .insns = { | ||
3371 | BPF_MOV64_IMM(BPF_REG_1, 10), | ||
3372 | BPF_STX_MEM(BPF_DW, BPF_REG_10, BPF_REG_1, -8), | ||
3373 | BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), | ||
3374 | BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8), | ||
3375 | BPF_LD_MAP_FD(BPF_REG_1, 0), | ||
3376 | BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, | ||
3377 | BPF_FUNC_map_lookup_elem), | ||
3378 | BPF_MOV64_REG(BPF_REG_4, BPF_REG_0), | ||
3379 | BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, -2), | ||
3380 | BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 2), | ||
3381 | BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 1), | ||
3382 | BPF_ST_MEM(BPF_DW, BPF_REG_4, 0, 0), | ||
3383 | BPF_EXIT_INSN(), | ||
3384 | }, | ||
3385 | .fixup_map1 = { 4 }, | ||
3386 | .errstr = "R4 invalid mem access", | ||
3387 | .result = REJECT, | ||
3388 | .prog_type = BPF_PROG_TYPE_SCHED_CLS | ||
3389 | }, | ||
3390 | { | ||
3391 | "alu ops on ptr_to_map_value_or_null, 2", | ||
3392 | .insns = { | ||
3393 | BPF_MOV64_IMM(BPF_REG_1, 10), | ||
3394 | BPF_STX_MEM(BPF_DW, BPF_REG_10, BPF_REG_1, -8), | ||
3395 | BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), | ||
3396 | BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8), | ||
3397 | BPF_LD_MAP_FD(BPF_REG_1, 0), | ||
3398 | BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, | ||
3399 | BPF_FUNC_map_lookup_elem), | ||
3400 | BPF_MOV64_REG(BPF_REG_4, BPF_REG_0), | ||
3401 | BPF_ALU64_IMM(BPF_AND, BPF_REG_4, -1), | ||
3402 | BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 1), | ||
3403 | BPF_ST_MEM(BPF_DW, BPF_REG_4, 0, 0), | ||
3404 | BPF_EXIT_INSN(), | ||
3405 | }, | ||
3406 | .fixup_map1 = { 4 }, | ||
3407 | .errstr = "R4 invalid mem access", | ||
3408 | .result = REJECT, | ||
3409 | .prog_type = BPF_PROG_TYPE_SCHED_CLS | ||
3410 | }, | ||
3411 | { | ||
3412 | "alu ops on ptr_to_map_value_or_null, 3", | ||
3413 | .insns = { | ||
3414 | BPF_MOV64_IMM(BPF_REG_1, 10), | ||
3415 | BPF_STX_MEM(BPF_DW, BPF_REG_10, BPF_REG_1, -8), | ||
3416 | BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), | ||
3417 | BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8), | ||
3418 | BPF_LD_MAP_FD(BPF_REG_1, 0), | ||
3419 | BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, | ||
3420 | BPF_FUNC_map_lookup_elem), | ||
3421 | BPF_MOV64_REG(BPF_REG_4, BPF_REG_0), | ||
3422 | BPF_ALU64_IMM(BPF_LSH, BPF_REG_4, 1), | ||
3423 | BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 1), | ||
3424 | BPF_ST_MEM(BPF_DW, BPF_REG_4, 0, 0), | ||
3425 | BPF_EXIT_INSN(), | ||
3426 | }, | ||
3427 | .fixup_map1 = { 4 }, | ||
3428 | .errstr = "R4 invalid mem access", | ||
3429 | .result = REJECT, | ||
3430 | .prog_type = BPF_PROG_TYPE_SCHED_CLS | ||
3431 | }, | ||
3432 | { | ||
3344 | "invalid memory access with multiple map_lookup_elem calls", | 3433 | "invalid memory access with multiple map_lookup_elem calls", |
3345 | .insns = { | 3434 | .insns = { |
3346 | BPF_MOV64_IMM(BPF_REG_1, 10), | 3435 | BPF_MOV64_IMM(BPF_REG_1, 10), |
@@ -3660,6 +3749,72 @@ static struct bpf_test tests[] = { | |||
3660 | .errstr = "invalid bpf_context access", | 3749 | .errstr = "invalid bpf_context access", |
3661 | }, | 3750 | }, |
3662 | { | 3751 | { |
3752 | "leak pointer into ctx 1", | ||
3753 | .insns = { | ||
3754 | BPF_MOV64_IMM(BPF_REG_0, 0), | ||
3755 | BPF_STX_MEM(BPF_DW, BPF_REG_1, BPF_REG_0, | ||
3756 | offsetof(struct __sk_buff, cb[0])), | ||
3757 | BPF_LD_MAP_FD(BPF_REG_2, 0), | ||
3758 | BPF_STX_XADD(BPF_DW, BPF_REG_1, BPF_REG_2, | ||
3759 | offsetof(struct __sk_buff, cb[0])), | ||
3760 | BPF_EXIT_INSN(), | ||
3761 | }, | ||
3762 | .fixup_map1 = { 2 }, | ||
3763 | .errstr_unpriv = "R2 leaks addr into mem", | ||
3764 | .result_unpriv = REJECT, | ||
3765 | .result = ACCEPT, | ||
3766 | }, | ||
3767 | { | ||
3768 | "leak pointer into ctx 2", | ||
3769 | .insns = { | ||
3770 | BPF_MOV64_IMM(BPF_REG_0, 0), | ||
3771 | BPF_STX_MEM(BPF_DW, BPF_REG_1, BPF_REG_0, | ||
3772 | offsetof(struct __sk_buff, cb[0])), | ||
3773 | BPF_STX_XADD(BPF_DW, BPF_REG_1, BPF_REG_10, | ||
3774 | offsetof(struct __sk_buff, cb[0])), | ||
3775 | BPF_EXIT_INSN(), | ||
3776 | }, | ||
3777 | .errstr_unpriv = "R10 leaks addr into mem", | ||
3778 | .result_unpriv = REJECT, | ||
3779 | .result = ACCEPT, | ||
3780 | }, | ||
3781 | { | ||
3782 | "leak pointer into ctx 3", | ||
3783 | .insns = { | ||
3784 | BPF_MOV64_IMM(BPF_REG_0, 0), | ||
3785 | BPF_LD_MAP_FD(BPF_REG_2, 0), | ||
3786 | BPF_STX_MEM(BPF_DW, BPF_REG_1, BPF_REG_2, | ||
3787 | offsetof(struct __sk_buff, cb[0])), | ||
3788 | BPF_EXIT_INSN(), | ||
3789 | }, | ||
3790 | .fixup_map1 = { 1 }, | ||
3791 | .errstr_unpriv = "R2 leaks addr into ctx", | ||
3792 | .result_unpriv = REJECT, | ||
3793 | .result = ACCEPT, | ||
3794 | }, | ||
3795 | { | ||
3796 | "leak pointer into map val", | ||
3797 | .insns = { | ||
3798 | BPF_MOV64_REG(BPF_REG_6, BPF_REG_1), | ||
3799 | BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0), | ||
3800 | BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), | ||
3801 | BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8), | ||
3802 | BPF_LD_MAP_FD(BPF_REG_1, 0), | ||
3803 | BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, | ||
3804 | BPF_FUNC_map_lookup_elem), | ||
3805 | BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 3), | ||
3806 | BPF_MOV64_IMM(BPF_REG_3, 0), | ||
3807 | BPF_STX_MEM(BPF_DW, BPF_REG_0, BPF_REG_3, 0), | ||
3808 | BPF_STX_XADD(BPF_DW, BPF_REG_0, BPF_REG_6, 0), | ||
3809 | BPF_MOV64_IMM(BPF_REG_0, 0), | ||
3810 | BPF_EXIT_INSN(), | ||
3811 | }, | ||
3812 | .fixup_map1 = { 4 }, | ||
3813 | .errstr_unpriv = "R6 leaks addr into mem", | ||
3814 | .result_unpriv = REJECT, | ||
3815 | .result = ACCEPT, | ||
3816 | }, | ||
3817 | { | ||
3663 | "helper access to map: full range", | 3818 | "helper access to map: full range", |
3664 | .insns = { | 3819 | .insns = { |
3665 | BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), | 3820 | BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), |
@@ -4937,7 +5092,149 @@ static struct bpf_test tests[] = { | |||
4937 | .fixup_map_in_map = { 3 }, | 5092 | .fixup_map_in_map = { 3 }, |
4938 | .errstr = "R1 type=map_value_or_null expected=map_ptr", | 5093 | .errstr = "R1 type=map_value_or_null expected=map_ptr", |
4939 | .result = REJECT, | 5094 | .result = REJECT, |
4940 | } | 5095 | }, |
5096 | { | ||
5097 | "ld_abs: check calling conv, r1", | ||
5098 | .insns = { | ||
5099 | BPF_MOV64_REG(BPF_REG_6, BPF_REG_1), | ||
5100 | BPF_MOV64_IMM(BPF_REG_1, 0), | ||
5101 | BPF_LD_ABS(BPF_W, -0x200000), | ||
5102 | BPF_MOV64_REG(BPF_REG_0, BPF_REG_1), | ||
5103 | BPF_EXIT_INSN(), | ||
5104 | }, | ||
5105 | .errstr = "R1 !read_ok", | ||
5106 | .result = REJECT, | ||
5107 | }, | ||
5108 | { | ||
5109 | "ld_abs: check calling conv, r2", | ||
5110 | .insns = { | ||
5111 | BPF_MOV64_REG(BPF_REG_6, BPF_REG_1), | ||
5112 | BPF_MOV64_IMM(BPF_REG_2, 0), | ||
5113 | BPF_LD_ABS(BPF_W, -0x200000), | ||
5114 | BPF_MOV64_REG(BPF_REG_0, BPF_REG_2), | ||
5115 | BPF_EXIT_INSN(), | ||
5116 | }, | ||
5117 | .errstr = "R2 !read_ok", | ||
5118 | .result = REJECT, | ||
5119 | }, | ||
5120 | { | ||
5121 | "ld_abs: check calling conv, r3", | ||
5122 | .insns = { | ||
5123 | BPF_MOV64_REG(BPF_REG_6, BPF_REG_1), | ||
5124 | BPF_MOV64_IMM(BPF_REG_3, 0), | ||
5125 | BPF_LD_ABS(BPF_W, -0x200000), | ||
5126 | BPF_MOV64_REG(BPF_REG_0, BPF_REG_3), | ||
5127 | BPF_EXIT_INSN(), | ||
5128 | }, | ||
5129 | .errstr = "R3 !read_ok", | ||
5130 | .result = REJECT, | ||
5131 | }, | ||
5132 | { | ||
5133 | "ld_abs: check calling conv, r4", | ||
5134 | .insns = { | ||
5135 | BPF_MOV64_REG(BPF_REG_6, BPF_REG_1), | ||
5136 | BPF_MOV64_IMM(BPF_REG_4, 0), | ||
5137 | BPF_LD_ABS(BPF_W, -0x200000), | ||
5138 | BPF_MOV64_REG(BPF_REG_0, BPF_REG_4), | ||
5139 | BPF_EXIT_INSN(), | ||
5140 | }, | ||
5141 | .errstr = "R4 !read_ok", | ||
5142 | .result = REJECT, | ||
5143 | }, | ||
5144 | { | ||
5145 | "ld_abs: check calling conv, r5", | ||
5146 | .insns = { | ||
5147 | BPF_MOV64_REG(BPF_REG_6, BPF_REG_1), | ||
5148 | BPF_MOV64_IMM(BPF_REG_5, 0), | ||
5149 | BPF_LD_ABS(BPF_W, -0x200000), | ||
5150 | BPF_MOV64_REG(BPF_REG_0, BPF_REG_5), | ||
5151 | BPF_EXIT_INSN(), | ||
5152 | }, | ||
5153 | .errstr = "R5 !read_ok", | ||
5154 | .result = REJECT, | ||
5155 | }, | ||
5156 | { | ||
5157 | "ld_abs: check calling conv, r7", | ||
5158 | .insns = { | ||
5159 | BPF_MOV64_REG(BPF_REG_6, BPF_REG_1), | ||
5160 | BPF_MOV64_IMM(BPF_REG_7, 0), | ||
5161 | BPF_LD_ABS(BPF_W, -0x200000), | ||
5162 | BPF_MOV64_REG(BPF_REG_0, BPF_REG_7), | ||
5163 | BPF_EXIT_INSN(), | ||
5164 | }, | ||
5165 | .result = ACCEPT, | ||
5166 | }, | ||
5167 | { | ||
5168 | "ld_ind: check calling conv, r1", | ||
5169 | .insns = { | ||
5170 | BPF_MOV64_REG(BPF_REG_6, BPF_REG_1), | ||
5171 | BPF_MOV64_IMM(BPF_REG_1, 1), | ||
5172 | BPF_LD_IND(BPF_W, BPF_REG_1, -0x200000), | ||
5173 | BPF_MOV64_REG(BPF_REG_0, BPF_REG_1), | ||
5174 | BPF_EXIT_INSN(), | ||
5175 | }, | ||
5176 | .errstr = "R1 !read_ok", | ||
5177 | .result = REJECT, | ||
5178 | }, | ||
5179 | { | ||
5180 | "ld_ind: check calling conv, r2", | ||
5181 | .insns = { | ||
5182 | BPF_MOV64_REG(BPF_REG_6, BPF_REG_1), | ||
5183 | BPF_MOV64_IMM(BPF_REG_2, 1), | ||
5184 | BPF_LD_IND(BPF_W, BPF_REG_2, -0x200000), | ||
5185 | BPF_MOV64_REG(BPF_REG_0, BPF_REG_2), | ||
5186 | BPF_EXIT_INSN(), | ||
5187 | }, | ||
5188 | .errstr = "R2 !read_ok", | ||
5189 | .result = REJECT, | ||
5190 | }, | ||
5191 | { | ||
5192 | "ld_ind: check calling conv, r3", | ||
5193 | .insns = { | ||
5194 | BPF_MOV64_REG(BPF_REG_6, BPF_REG_1), | ||
5195 | BPF_MOV64_IMM(BPF_REG_3, 1), | ||
5196 | BPF_LD_IND(BPF_W, BPF_REG_3, -0x200000), | ||
5197 | BPF_MOV64_REG(BPF_REG_0, BPF_REG_3), | ||
5198 | BPF_EXIT_INSN(), | ||
5199 | }, | ||
5200 | .errstr = "R3 !read_ok", | ||
5201 | .result = REJECT, | ||
5202 | }, | ||
5203 | { | ||
5204 | "ld_ind: check calling conv, r4", | ||
5205 | .insns = { | ||
5206 | BPF_MOV64_REG(BPF_REG_6, BPF_REG_1), | ||
5207 | BPF_MOV64_IMM(BPF_REG_4, 1), | ||
5208 | BPF_LD_IND(BPF_W, BPF_REG_4, -0x200000), | ||
5209 | BPF_MOV64_REG(BPF_REG_0, BPF_REG_4), | ||
5210 | BPF_EXIT_INSN(), | ||
5211 | }, | ||
5212 | .errstr = "R4 !read_ok", | ||
5213 | .result = REJECT, | ||
5214 | }, | ||
5215 | { | ||
5216 | "ld_ind: check calling conv, r5", | ||
5217 | .insns = { | ||
5218 | BPF_MOV64_REG(BPF_REG_6, BPF_REG_1), | ||
5219 | BPF_MOV64_IMM(BPF_REG_5, 1), | ||
5220 | BPF_LD_IND(BPF_W, BPF_REG_5, -0x200000), | ||
5221 | BPF_MOV64_REG(BPF_REG_0, BPF_REG_5), | ||
5222 | BPF_EXIT_INSN(), | ||
5223 | }, | ||
5224 | .errstr = "R5 !read_ok", | ||
5225 | .result = REJECT, | ||
5226 | }, | ||
5227 | { | ||
5228 | "ld_ind: check calling conv, r7", | ||
5229 | .insns = { | ||
5230 | BPF_MOV64_REG(BPF_REG_6, BPF_REG_1), | ||
5231 | BPF_MOV64_IMM(BPF_REG_7, 1), | ||
5232 | BPF_LD_IND(BPF_W, BPF_REG_7, -0x200000), | ||
5233 | BPF_MOV64_REG(BPF_REG_0, BPF_REG_7), | ||
5234 | BPF_EXIT_INSN(), | ||
5235 | }, | ||
5236 | .result = ACCEPT, | ||
5237 | }, | ||
4941 | }; | 5238 | }; |
4942 | 5239 | ||
4943 | static int probe_filter_length(const struct bpf_insn *fp) | 5240 | static int probe_filter_length(const struct bpf_insn *fp) |
@@ -5059,9 +5356,9 @@ static void do_test_single(struct bpf_test *test, bool unpriv, | |||
5059 | 5356 | ||
5060 | do_test_fixup(test, prog, map_fds); | 5357 | do_test_fixup(test, prog, map_fds); |
5061 | 5358 | ||
5062 | fd_prog = bpf_load_program(prog_type ? : BPF_PROG_TYPE_SOCKET_FILTER, | 5359 | fd_prog = bpf_verify_program(prog_type ? : BPF_PROG_TYPE_SOCKET_FILTER, |
5063 | prog, prog_len, "GPL", 0, bpf_vlog, | 5360 | prog, prog_len, test->flags & F_LOAD_WITH_STRICT_ALIGNMENT, |
5064 | sizeof(bpf_vlog)); | 5361 | "GPL", 0, bpf_vlog, sizeof(bpf_vlog)); |
5065 | 5362 | ||
5066 | expected_ret = unpriv && test->result_unpriv != UNDEF ? | 5363 | expected_ret = unpriv && test->result_unpriv != UNDEF ? |
5067 | test->result_unpriv : test->result; | 5364 | test->result_unpriv : test->result; |
diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc b/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc new file mode 100644 index 000000000000..f4d1ff785d67 --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc | |||
@@ -0,0 +1,21 @@ | |||
1 | #!/bin/sh | ||
2 | # description: Register/unregister many kprobe events | ||
3 | |||
4 | # ftrace fentry skip size depends on the machine architecture. | ||
5 | # Currently HAVE_KPROBES_ON_FTRACE defined on x86 and powerpc | ||
6 | case `uname -m` in | ||
7 | x86_64|i[3456]86) OFFS=5;; | ||
8 | ppc*) OFFS=4;; | ||
9 | *) OFFS=0;; | ||
10 | esac | ||
11 | |||
12 | echo "Setup up to 256 kprobes" | ||
13 | grep t /proc/kallsyms | cut -f3 -d" " | grep -v .*\\..* | \ | ||
14 | head -n 256 | while read i; do echo p ${i}+${OFFS} ; done > kprobe_events ||: | ||
15 | |||
16 | echo 1 > events/kprobes/enable | ||
17 | echo 0 > events/kprobes/enable | ||
18 | echo > kprobe_events | ||
19 | echo "Waiting for unoptimizing & freeing" | ||
20 | sleep 5 | ||
21 | echo "Done" | ||
diff --git a/tools/testing/selftests/ntb/ntb_test.sh b/tools/testing/selftests/ntb/ntb_test.sh index a676d3eefefb..13f5198ba0ee 100755 --- a/tools/testing/selftests/ntb/ntb_test.sh +++ b/tools/testing/selftests/ntb/ntb_test.sh | |||
@@ -305,7 +305,7 @@ function perf_test() | |||
305 | echo "Running remote perf test $WITH DMA" | 305 | echo "Running remote perf test $WITH DMA" |
306 | write_file "" $REMOTE_PERF/run | 306 | write_file "" $REMOTE_PERF/run |
307 | echo -n " " | 307 | echo -n " " |
308 | read_file $LOCAL_PERF/run | 308 | read_file $REMOTE_PERF/run |
309 | echo " Passed" | 309 | echo " Passed" |
310 | 310 | ||
311 | _modprobe -r ntb_perf | 311 | _modprobe -r ntb_perf |
diff --git a/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c b/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c index d9c49f41515e..e79ccd6aada1 100644 --- a/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c +++ b/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c | |||
@@ -42,12 +42,12 @@ int test_body(void) | |||
42 | printf("Check DSCR TM context switch: "); | 42 | printf("Check DSCR TM context switch: "); |
43 | fflush(stdout); | 43 | fflush(stdout); |
44 | for (;;) { | 44 | for (;;) { |
45 | rv = 1; | ||
46 | asm __volatile__ ( | 45 | asm __volatile__ ( |
47 | /* set a known value into the DSCR */ | 46 | /* set a known value into the DSCR */ |
48 | "ld 3, %[dscr1];" | 47 | "ld 3, %[dscr1];" |
49 | "mtspr %[sprn_dscr], 3;" | 48 | "mtspr %[sprn_dscr], 3;" |
50 | 49 | ||
50 | "li %[rv], 1;" | ||
51 | /* start and suspend a transaction */ | 51 | /* start and suspend a transaction */ |
52 | "tbegin.;" | 52 | "tbegin.;" |
53 | "beq 1f;" | 53 | "beq 1f;" |