diff options
author | Takashi Iwai <tiwai@suse.de> | 2018-01-05 12:52:19 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2018-01-05 12:52:19 -0500 |
commit | 2c82e8ea942dc80350a62a719159ea522e0758af (patch) | |
tree | 25ee879a57832485fa2730e1d20d545208a85d2a /tools/perf | |
parent | 7a0a87160a1dc09220ec485b31d0f82f687a053f (diff) | |
parent | b762408d596c9c6861bf9b0d7208a63b1a4b4b8d (diff) |
Merge tag 'asoc-v4.16' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next
ASoC: Updates for v4.16
Quite a big update here, mostly in new device support and some big
updates for older drivers too. The main core work continues to be
Morimoto-san's efforts on modernising drivers to use the component
layer.
- Lots more updates from Morimoto-san to move more things into the
component level.
- Large cleanups of some of the TI CODEC drivers from Andrew F. Davis.
- Even more quirks and cleanups of quirks for x86 systems.
- Refactoring of the Freescale SSI driver from Nicolin Chen in
preparation for some more substantive improvements which are
currently in review.
- New drivers for Allwinner A83T, Maxim MAX89373, SocioNext UiniPhier
EVEA Tempo Semiconductor TSCS42xx and TI PCM816x, TAS5722 and TAS6424
devices.
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/Makefile.config | 9 | ||||
-rw-r--r-- | tools/perf/arch/s390/include/perf_regs.h | 2 | ||||
-rwxr-xr-x | tools/perf/check-headers.sh | 1 | ||||
-rw-r--r-- | tools/perf/jvmti/jvmti_agent.c | 16 | ||||
-rw-r--r-- | tools/perf/jvmti/jvmti_agent.h | 7 | ||||
-rw-r--r-- | tools/perf/jvmti/libjvmti.c | 147 |
6 files changed, 140 insertions, 42 deletions
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index ed65e82f034e..0294bfb6c5f8 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config | |||
@@ -188,9 +188,7 @@ ifdef PYTHON_CONFIG | |||
188 | PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) | 188 | PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) |
189 | PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil | 189 | PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil |
190 | PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) | 190 | PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) |
191 | ifeq ($(CC_NO_CLANG), 1) | 191 | PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS)) |
192 | PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS)) | ||
193 | endif | ||
194 | FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) | 192 | FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) |
195 | endif | 193 | endif |
196 | 194 | ||
@@ -576,14 +574,15 @@ ifndef NO_GTK2 | |||
576 | endif | 574 | endif |
577 | endif | 575 | endif |
578 | 576 | ||
579 | |||
580 | ifdef NO_LIBPERL | 577 | ifdef NO_LIBPERL |
581 | CFLAGS += -DNO_LIBPERL | 578 | CFLAGS += -DNO_LIBPERL |
582 | else | 579 | else |
583 | PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) | 580 | PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) |
584 | PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) | 581 | PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) |
585 | PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) | 582 | PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) |
586 | PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` | 583 | PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null) |
584 | PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS)) | ||
585 | PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS)) | ||
587 | FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) | 586 | FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) |
588 | 587 | ||
589 | ifneq ($(feature-libperl), 1) | 588 | ifneq ($(feature-libperl), 1) |
diff --git a/tools/perf/arch/s390/include/perf_regs.h b/tools/perf/arch/s390/include/perf_regs.h index d2df54a6bc5a..bcfbaed78cc2 100644 --- a/tools/perf/arch/s390/include/perf_regs.h +++ b/tools/perf/arch/s390/include/perf_regs.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
6 | #include <../../../../arch/s390/include/uapi/asm/perf_regs.h> | 6 | #include <asm/perf_regs.h> |
7 | 7 | ||
8 | void perf_regs_load(u64 *regs); | 8 | void perf_regs_load(u64 *regs); |
9 | 9 | ||
diff --git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh index 6db9d809fe97..3e64f10b6d66 100755 --- a/tools/perf/check-headers.sh +++ b/tools/perf/check-headers.sh | |||
@@ -21,6 +21,7 @@ arch/x86/include/asm/cpufeatures.h | |||
21 | arch/arm/include/uapi/asm/perf_regs.h | 21 | arch/arm/include/uapi/asm/perf_regs.h |
22 | arch/arm64/include/uapi/asm/perf_regs.h | 22 | arch/arm64/include/uapi/asm/perf_regs.h |
23 | arch/powerpc/include/uapi/asm/perf_regs.h | 23 | arch/powerpc/include/uapi/asm/perf_regs.h |
24 | arch/s390/include/uapi/asm/perf_regs.h | ||
24 | arch/x86/include/uapi/asm/perf_regs.h | 25 | arch/x86/include/uapi/asm/perf_regs.h |
25 | arch/x86/include/uapi/asm/kvm.h | 26 | arch/x86/include/uapi/asm/kvm.h |
26 | arch/x86/include/uapi/asm/kvm_perf.h | 27 | arch/x86/include/uapi/asm/kvm_perf.h |
diff --git a/tools/perf/jvmti/jvmti_agent.c b/tools/perf/jvmti/jvmti_agent.c index cf36de7ea255..0c6d1002b524 100644 --- a/tools/perf/jvmti/jvmti_agent.c +++ b/tools/perf/jvmti/jvmti_agent.c | |||
@@ -384,13 +384,13 @@ jvmti_write_code(void *agent, char const *sym, | |||
384 | } | 384 | } |
385 | 385 | ||
386 | int | 386 | int |
387 | jvmti_write_debug_info(void *agent, uint64_t code, const char *file, | 387 | jvmti_write_debug_info(void *agent, uint64_t code, |
388 | jvmti_line_info_t *li, int nr_lines) | 388 | int nr_lines, jvmti_line_info_t *li, |
389 | const char * const * file_names) | ||
389 | { | 390 | { |
390 | struct jr_code_debug_info rec; | 391 | struct jr_code_debug_info rec; |
391 | size_t sret, len, size, flen; | 392 | size_t sret, len, size, flen = 0; |
392 | uint64_t addr; | 393 | uint64_t addr; |
393 | const char *fn = file; | ||
394 | FILE *fp = agent; | 394 | FILE *fp = agent; |
395 | int i; | 395 | int i; |
396 | 396 | ||
@@ -405,7 +405,9 @@ jvmti_write_debug_info(void *agent, uint64_t code, const char *file, | |||
405 | return -1; | 405 | return -1; |
406 | } | 406 | } |
407 | 407 | ||
408 | flen = strlen(file) + 1; | 408 | for (i = 0; i < nr_lines; ++i) { |
409 | flen += strlen(file_names[i]) + 1; | ||
410 | } | ||
409 | 411 | ||
410 | rec.p.id = JIT_CODE_DEBUG_INFO; | 412 | rec.p.id = JIT_CODE_DEBUG_INFO; |
411 | size = sizeof(rec); | 413 | size = sizeof(rec); |
@@ -421,7 +423,7 @@ jvmti_write_debug_info(void *agent, uint64_t code, const char *file, | |||
421 | * file[] : source file name | 423 | * file[] : source file name |
422 | */ | 424 | */ |
423 | size += nr_lines * sizeof(struct debug_entry); | 425 | size += nr_lines * sizeof(struct debug_entry); |
424 | size += flen * nr_lines; | 426 | size += flen; |
425 | rec.p.total_size = size; | 427 | rec.p.total_size = size; |
426 | 428 | ||
427 | /* | 429 | /* |
@@ -452,7 +454,7 @@ jvmti_write_debug_info(void *agent, uint64_t code, const char *file, | |||
452 | if (sret != 1) | 454 | if (sret != 1) |
453 | goto error; | 455 | goto error; |
454 | 456 | ||
455 | sret = fwrite_unlocked(fn, flen, 1, fp); | 457 | sret = fwrite_unlocked(file_names[i], strlen(file_names[i]) + 1, 1, fp); |
456 | if (sret != 1) | 458 | if (sret != 1) |
457 | goto error; | 459 | goto error; |
458 | } | 460 | } |
diff --git a/tools/perf/jvmti/jvmti_agent.h b/tools/perf/jvmti/jvmti_agent.h index fe32d8344a82..6ed82f6c06dd 100644 --- a/tools/perf/jvmti/jvmti_agent.h +++ b/tools/perf/jvmti/jvmti_agent.h | |||
@@ -14,6 +14,7 @@ typedef struct { | |||
14 | unsigned long pc; | 14 | unsigned long pc; |
15 | int line_number; | 15 | int line_number; |
16 | int discrim; /* discriminator -- 0 for now */ | 16 | int discrim; /* discriminator -- 0 for now */ |
17 | jmethodID methodID; | ||
17 | } jvmti_line_info_t; | 18 | } jvmti_line_info_t; |
18 | 19 | ||
19 | void *jvmti_open(void); | 20 | void *jvmti_open(void); |
@@ -22,11 +23,9 @@ int jvmti_write_code(void *agent, char const *symbol_name, | |||
22 | uint64_t vma, void const *code, | 23 | uint64_t vma, void const *code, |
23 | const unsigned int code_size); | 24 | const unsigned int code_size); |
24 | 25 | ||
25 | int jvmti_write_debug_info(void *agent, | 26 | int jvmti_write_debug_info(void *agent, uint64_t code, int nr_lines, |
26 | uint64_t code, | ||
27 | const char *file, | ||
28 | jvmti_line_info_t *li, | 27 | jvmti_line_info_t *li, |
29 | int nr_lines); | 28 | const char * const * file_names); |
30 | 29 | ||
31 | #if defined(__cplusplus) | 30 | #if defined(__cplusplus) |
32 | } | 31 | } |
diff --git a/tools/perf/jvmti/libjvmti.c b/tools/perf/jvmti/libjvmti.c index c62c9fc9a525..6add3e982614 100644 --- a/tools/perf/jvmti/libjvmti.c +++ b/tools/perf/jvmti/libjvmti.c | |||
@@ -47,6 +47,7 @@ do_get_line_numbers(jvmtiEnv *jvmti, void *pc, jmethodID m, jint bci, | |||
47 | tab[lines].pc = (unsigned long)pc; | 47 | tab[lines].pc = (unsigned long)pc; |
48 | tab[lines].line_number = loc_tab[i].line_number; | 48 | tab[lines].line_number = loc_tab[i].line_number; |
49 | tab[lines].discrim = 0; /* not yet used */ | 49 | tab[lines].discrim = 0; /* not yet used */ |
50 | tab[lines].methodID = m; | ||
50 | lines++; | 51 | lines++; |
51 | } else { | 52 | } else { |
52 | break; | 53 | break; |
@@ -125,6 +126,99 @@ get_line_numbers(jvmtiEnv *jvmti, const void *compile_info, jvmti_line_info_t ** | |||
125 | return JVMTI_ERROR_NONE; | 126 | return JVMTI_ERROR_NONE; |
126 | } | 127 | } |
127 | 128 | ||
129 | static void | ||
130 | copy_class_filename(const char * class_sign, const char * file_name, char * result, size_t max_length) | ||
131 | { | ||
132 | /* | ||
133 | * Assume path name is class hierarchy, this is a common practice with Java programs | ||
134 | */ | ||
135 | if (*class_sign == 'L') { | ||
136 | int j, i = 0; | ||
137 | char *p = strrchr(class_sign, '/'); | ||
138 | if (p) { | ||
139 | /* drop the 'L' prefix and copy up to the final '/' */ | ||
140 | for (i = 0; i < (p - class_sign); i++) | ||
141 | result[i] = class_sign[i+1]; | ||
142 | } | ||
143 | /* | ||
144 | * append file name, we use loops and not string ops to avoid modifying | ||
145 | * class_sign which is used later for the symbol name | ||
146 | */ | ||
147 | for (j = 0; i < (max_length - 1) && file_name && j < strlen(file_name); j++, i++) | ||
148 | result[i] = file_name[j]; | ||
149 | |||
150 | result[i] = '\0'; | ||
151 | } else { | ||
152 | /* fallback case */ | ||
153 | size_t file_name_len = strlen(file_name); | ||
154 | strncpy(result, file_name, file_name_len < max_length ? file_name_len : max_length); | ||
155 | } | ||
156 | } | ||
157 | |||
158 | static jvmtiError | ||
159 | get_source_filename(jvmtiEnv *jvmti, jmethodID methodID, char ** buffer) | ||
160 | { | ||
161 | jvmtiError ret; | ||
162 | jclass decl_class; | ||
163 | char *file_name = NULL; | ||
164 | char *class_sign = NULL; | ||
165 | char fn[PATH_MAX]; | ||
166 | size_t len; | ||
167 | |||
168 | ret = (*jvmti)->GetMethodDeclaringClass(jvmti, methodID, &decl_class); | ||
169 | if (ret != JVMTI_ERROR_NONE) { | ||
170 | print_error(jvmti, "GetMethodDeclaringClass", ret); | ||
171 | return ret; | ||
172 | } | ||
173 | |||
174 | ret = (*jvmti)->GetSourceFileName(jvmti, decl_class, &file_name); | ||
175 | if (ret != JVMTI_ERROR_NONE) { | ||
176 | print_error(jvmti, "GetSourceFileName", ret); | ||
177 | return ret; | ||
178 | } | ||
179 | |||
180 | ret = (*jvmti)->GetClassSignature(jvmti, decl_class, &class_sign, NULL); | ||
181 | if (ret != JVMTI_ERROR_NONE) { | ||
182 | print_error(jvmti, "GetClassSignature", ret); | ||
183 | goto free_file_name_error; | ||
184 | } | ||
185 | |||
186 | copy_class_filename(class_sign, file_name, fn, PATH_MAX); | ||
187 | len = strlen(fn); | ||
188 | *buffer = malloc((len + 1) * sizeof(char)); | ||
189 | if (!*buffer) { | ||
190 | print_error(jvmti, "GetClassSignature", ret); | ||
191 | ret = JVMTI_ERROR_OUT_OF_MEMORY; | ||
192 | goto free_class_sign_error; | ||
193 | } | ||
194 | strcpy(*buffer, fn); | ||
195 | ret = JVMTI_ERROR_NONE; | ||
196 | |||
197 | free_class_sign_error: | ||
198 | (*jvmti)->Deallocate(jvmti, (unsigned char *)class_sign); | ||
199 | free_file_name_error: | ||
200 | (*jvmti)->Deallocate(jvmti, (unsigned char *)file_name); | ||
201 | |||
202 | return ret; | ||
203 | } | ||
204 | |||
205 | static jvmtiError | ||
206 | fill_source_filenames(jvmtiEnv *jvmti, int nr_lines, | ||
207 | const jvmti_line_info_t * line_tab, | ||
208 | char ** file_names) | ||
209 | { | ||
210 | int index; | ||
211 | jvmtiError ret; | ||
212 | |||
213 | for (index = 0; index < nr_lines; ++index) { | ||
214 | ret = get_source_filename(jvmti, line_tab[index].methodID, &(file_names[index])); | ||
215 | if (ret != JVMTI_ERROR_NONE) | ||
216 | return ret; | ||
217 | } | ||
218 | |||
219 | return JVMTI_ERROR_NONE; | ||
220 | } | ||
221 | |||
128 | static void JNICALL | 222 | static void JNICALL |
129 | compiled_method_load_cb(jvmtiEnv *jvmti, | 223 | compiled_method_load_cb(jvmtiEnv *jvmti, |
130 | jmethodID method, | 224 | jmethodID method, |
@@ -135,16 +229,18 @@ compiled_method_load_cb(jvmtiEnv *jvmti, | |||
135 | const void *compile_info) | 229 | const void *compile_info) |
136 | { | 230 | { |
137 | jvmti_line_info_t *line_tab = NULL; | 231 | jvmti_line_info_t *line_tab = NULL; |
232 | char ** line_file_names = NULL; | ||
138 | jclass decl_class; | 233 | jclass decl_class; |
139 | char *class_sign = NULL; | 234 | char *class_sign = NULL; |
140 | char *func_name = NULL; | 235 | char *func_name = NULL; |
141 | char *func_sign = NULL; | 236 | char *func_sign = NULL; |
142 | char *file_name= NULL; | 237 | char *file_name = NULL; |
143 | char fn[PATH_MAX]; | 238 | char fn[PATH_MAX]; |
144 | uint64_t addr = (uint64_t)(uintptr_t)code_addr; | 239 | uint64_t addr = (uint64_t)(uintptr_t)code_addr; |
145 | jvmtiError ret; | 240 | jvmtiError ret; |
146 | int nr_lines = 0; /* in line_tab[] */ | 241 | int nr_lines = 0; /* in line_tab[] */ |
147 | size_t len; | 242 | size_t len; |
243 | int output_debug_info = 0; | ||
148 | 244 | ||
149 | ret = (*jvmti)->GetMethodDeclaringClass(jvmti, method, | 245 | ret = (*jvmti)->GetMethodDeclaringClass(jvmti, method, |
150 | &decl_class); | 246 | &decl_class); |
@@ -158,6 +254,19 @@ compiled_method_load_cb(jvmtiEnv *jvmti, | |||
158 | if (ret != JVMTI_ERROR_NONE) { | 254 | if (ret != JVMTI_ERROR_NONE) { |
159 | warnx("jvmti: cannot get line table for method"); | 255 | warnx("jvmti: cannot get line table for method"); |
160 | nr_lines = 0; | 256 | nr_lines = 0; |
257 | } else if (nr_lines > 0) { | ||
258 | line_file_names = malloc(sizeof(char*) * nr_lines); | ||
259 | if (!line_file_names) { | ||
260 | warnx("jvmti: cannot allocate space for line table method names"); | ||
261 | } else { | ||
262 | memset(line_file_names, 0, sizeof(char*) * nr_lines); | ||
263 | ret = fill_source_filenames(jvmti, nr_lines, line_tab, line_file_names); | ||
264 | if (ret != JVMTI_ERROR_NONE) { | ||
265 | warnx("jvmti: fill_source_filenames failed"); | ||
266 | } else { | ||
267 | output_debug_info = 1; | ||
268 | } | ||
269 | } | ||
161 | } | 270 | } |
162 | } | 271 | } |
163 | 272 | ||
@@ -181,33 +290,14 @@ compiled_method_load_cb(jvmtiEnv *jvmti, | |||
181 | goto error; | 290 | goto error; |
182 | } | 291 | } |
183 | 292 | ||
184 | /* | 293 | copy_class_filename(class_sign, file_name, fn, PATH_MAX); |
185 | * Assume path name is class hierarchy, this is a common practice with Java programs | 294 | |
186 | */ | ||
187 | if (*class_sign == 'L') { | ||
188 | int j, i = 0; | ||
189 | char *p = strrchr(class_sign, '/'); | ||
190 | if (p) { | ||
191 | /* drop the 'L' prefix and copy up to the final '/' */ | ||
192 | for (i = 0; i < (p - class_sign); i++) | ||
193 | fn[i] = class_sign[i+1]; | ||
194 | } | ||
195 | /* | ||
196 | * append file name, we use loops and not string ops to avoid modifying | ||
197 | * class_sign which is used later for the symbol name | ||
198 | */ | ||
199 | for (j = 0; i < (PATH_MAX - 1) && file_name && j < strlen(file_name); j++, i++) | ||
200 | fn[i] = file_name[j]; | ||
201 | fn[i] = '\0'; | ||
202 | } else { | ||
203 | /* fallback case */ | ||
204 | strcpy(fn, file_name); | ||
205 | } | ||
206 | /* | 295 | /* |
207 | * write source line info record if we have it | 296 | * write source line info record if we have it |
208 | */ | 297 | */ |
209 | if (jvmti_write_debug_info(jvmti_agent, addr, fn, line_tab, nr_lines)) | 298 | if (output_debug_info) |
210 | warnx("jvmti: write_debug_info() failed"); | 299 | if (jvmti_write_debug_info(jvmti_agent, addr, nr_lines, line_tab, (const char * const *) line_file_names)) |
300 | warnx("jvmti: write_debug_info() failed"); | ||
211 | 301 | ||
212 | len = strlen(func_name) + strlen(class_sign) + strlen(func_sign) + 2; | 302 | len = strlen(func_name) + strlen(class_sign) + strlen(func_sign) + 2; |
213 | { | 303 | { |
@@ -223,6 +313,13 @@ error: | |||
223 | (*jvmti)->Deallocate(jvmti, (unsigned char *)class_sign); | 313 | (*jvmti)->Deallocate(jvmti, (unsigned char *)class_sign); |
224 | (*jvmti)->Deallocate(jvmti, (unsigned char *)file_name); | 314 | (*jvmti)->Deallocate(jvmti, (unsigned char *)file_name); |
225 | free(line_tab); | 315 | free(line_tab); |
316 | while (line_file_names && (nr_lines > 0)) { | ||
317 | if (line_file_names[nr_lines - 1]) { | ||
318 | free(line_file_names[nr_lines - 1]); | ||
319 | } | ||
320 | nr_lines -= 1; | ||
321 | } | ||
322 | free(line_file_names); | ||
226 | } | 323 | } |
227 | 324 | ||
228 | static void JNICALL | 325 | static void JNICALL |