diff options
author | Ingo Molnar <mingo@kernel.org> | 2012-04-13 03:50:21 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2012-04-13 03:50:21 -0400 |
commit | 659c36fcda403013a01b85da07cf2d9711e6d6c7 (patch) | |
tree | ece2e7d0e2c19ea5a3d0ec172ad0b81a8a19021d /include/linux/kernel.h | |
parent | 9521d830b6341d1887dcfc2aebde23fbfa5f1473 (diff) | |
parent | 5a7ed29c7572d00a75e8c4529e30c5ac2ef82271 (diff) |
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Fixes and improvements for perf/core:
. Overhaul the tools/ makefiles, gluing them to the top level Makefile, from
Borislav Petkov.
. Move the UI files from tools/perf/util/ui/ to tools/perf/ui/. Also move
the GTK+ browser to tools/perf/ui/gtk/, from Namhyung Kim.
. Only fallback to sw cycles counter on ENOENT for the hw cycles, from
Robert Richter
. Trivial fixes from Robert Richter
. Handle the autogenerated bison/flex files better, from Namhyung and Jiri Olsa.
. Navigate jump instructions in the annotate browser, just press enter or ->,
still needs support for a jump navigation history, i.e. to go back.
. Search string in the annotate browser: same keys as vim:
/ forward
n next backward/forward
? backward
. Clarify number of events/samples in the report header, from Ashay Rane
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r-- | include/linux/kernel.h | 100 |
1 files changed, 28 insertions, 72 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index e8343422240a..92c10262d346 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/printk.h> | 20 | #include <linux/printk.h> |
21 | #include <linux/dynamic_debug.h> | 21 | #include <linux/dynamic_debug.h> |
22 | #include <asm/byteorder.h> | 22 | #include <asm/byteorder.h> |
23 | #include <asm/bug.h> | ||
24 | 23 | ||
25 | #define USHRT_MAX ((u16)(~0U)) | 24 | #define USHRT_MAX ((u16)(~0U)) |
26 | #define SHRT_MAX ((s16)(USHRT_MAX>>1)) | 25 | #define SHRT_MAX ((s16)(USHRT_MAX>>1)) |
@@ -85,6 +84,19 @@ | |||
85 | } \ | 84 | } \ |
86 | ) | 85 | ) |
87 | 86 | ||
87 | /* | ||
88 | * Multiplies an integer by a fraction, while avoiding unnecessary | ||
89 | * overflow or loss of precision. | ||
90 | */ | ||
91 | #define mult_frac(x, numer, denom)( \ | ||
92 | { \ | ||
93 | typeof(x) quot = (x) / (denom); \ | ||
94 | typeof(x) rem = (x) % (denom); \ | ||
95 | (quot * (numer)) + ((rem * (numer)) / (denom)); \ | ||
96 | } \ | ||
97 | ) | ||
98 | |||
99 | |||
88 | #define _RET_IP_ (unsigned long)__builtin_return_address(0) | 100 | #define _RET_IP_ (unsigned long)__builtin_return_address(0) |
89 | #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; }) | 101 | #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; }) |
90 | 102 | ||
@@ -299,6 +311,8 @@ extern long long simple_strtoll(const char *,char **,unsigned int); | |||
299 | #define strict_strtoull kstrtoull | 311 | #define strict_strtoull kstrtoull |
300 | #define strict_strtoll kstrtoll | 312 | #define strict_strtoll kstrtoll |
301 | 313 | ||
314 | extern int num_to_str(char *buf, int size, unsigned long long num); | ||
315 | |||
302 | /* lib/printf utilities */ | 316 | /* lib/printf utilities */ |
303 | 317 | ||
304 | extern __printf(2, 3) int sprintf(char *buf, const char * fmt, ...); | 318 | extern __printf(2, 3) int sprintf(char *buf, const char * fmt, ...); |
@@ -315,10 +329,10 @@ extern __printf(2, 3) | |||
315 | char *kasprintf(gfp_t gfp, const char *fmt, ...); | 329 | char *kasprintf(gfp_t gfp, const char *fmt, ...); |
316 | extern char *kvasprintf(gfp_t gfp, const char *fmt, va_list args); | 330 | extern char *kvasprintf(gfp_t gfp, const char *fmt, va_list args); |
317 | 331 | ||
318 | extern int sscanf(const char *, const char *, ...) | 332 | extern __scanf(2, 3) |
319 | __attribute__ ((format (scanf, 2, 3))); | 333 | int sscanf(const char *, const char *, ...); |
320 | extern int vsscanf(const char *, const char *, va_list) | 334 | extern __scanf(2, 0) |
321 | __attribute__ ((format (scanf, 2, 0))); | 335 | int vsscanf(const char *, const char *, va_list); |
322 | 336 | ||
323 | extern int get_option(char **str, int *pint); | 337 | extern int get_option(char **str, int *pint); |
324 | extern char *get_options(const char *str, int nints, int *ints); | 338 | extern char *get_options(const char *str, int nints, int *ints); |
@@ -414,16 +428,10 @@ extern int __must_check hex2bin(u8 *dst, const char *src, size_t count); | |||
414 | * Most likely, you want to use tracing_on/tracing_off. | 428 | * Most likely, you want to use tracing_on/tracing_off. |
415 | */ | 429 | */ |
416 | #ifdef CONFIG_RING_BUFFER | 430 | #ifdef CONFIG_RING_BUFFER |
417 | void tracing_on(void); | ||
418 | void tracing_off(void); | ||
419 | /* trace_off_permanent stops recording with no way to bring it back */ | 431 | /* trace_off_permanent stops recording with no way to bring it back */ |
420 | void tracing_off_permanent(void); | 432 | void tracing_off_permanent(void); |
421 | int tracing_is_on(void); | ||
422 | #else | 433 | #else |
423 | static inline void tracing_on(void) { } | ||
424 | static inline void tracing_off(void) { } | ||
425 | static inline void tracing_off_permanent(void) { } | 434 | static inline void tracing_off_permanent(void) { } |
426 | static inline int tracing_is_on(void) { return 0; } | ||
427 | #endif | 435 | #endif |
428 | 436 | ||
429 | enum ftrace_dump_mode { | 437 | enum ftrace_dump_mode { |
@@ -433,6 +441,10 @@ enum ftrace_dump_mode { | |||
433 | }; | 441 | }; |
434 | 442 | ||
435 | #ifdef CONFIG_TRACING | 443 | #ifdef CONFIG_TRACING |
444 | void tracing_on(void); | ||
445 | void tracing_off(void); | ||
446 | int tracing_is_on(void); | ||
447 | |||
436 | extern void tracing_start(void); | 448 | extern void tracing_start(void); |
437 | extern void tracing_stop(void); | 449 | extern void tracing_stop(void); |
438 | extern void ftrace_off_permanent(void); | 450 | extern void ftrace_off_permanent(void); |
@@ -517,6 +529,11 @@ static inline void tracing_start(void) { } | |||
517 | static inline void tracing_stop(void) { } | 529 | static inline void tracing_stop(void) { } |
518 | static inline void ftrace_off_permanent(void) { } | 530 | static inline void ftrace_off_permanent(void) { } |
519 | static inline void trace_dump_stack(void) { } | 531 | static inline void trace_dump_stack(void) { } |
532 | |||
533 | static inline void tracing_on(void) { } | ||
534 | static inline void tracing_off(void) { } | ||
535 | static inline int tracing_is_on(void) { return 0; } | ||
536 | |||
520 | static inline int | 537 | static inline int |
521 | trace_printk(const char *fmt, ...) | 538 | trace_printk(const char *fmt, ...) |
522 | { | 539 | { |
@@ -662,67 +679,6 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { } | |||
662 | const typeof( ((type *)0)->member ) *__mptr = (ptr); \ | 679 | const typeof( ((type *)0)->member ) *__mptr = (ptr); \ |
663 | (type *)( (char *)__mptr - offsetof(type,member) );}) | 680 | (type *)( (char *)__mptr - offsetof(type,member) );}) |
664 | 681 | ||
665 | #ifdef __CHECKER__ | ||
666 | #define BUILD_BUG_ON_NOT_POWER_OF_2(n) | ||
667 | #define BUILD_BUG_ON_ZERO(e) (0) | ||
668 | #define BUILD_BUG_ON_NULL(e) ((void*)0) | ||
669 | #define BUILD_BUG_ON(condition) | ||
670 | #define BUILD_BUG() (0) | ||
671 | #else /* __CHECKER__ */ | ||
672 | |||
673 | /* Force a compilation error if a constant expression is not a power of 2 */ | ||
674 | #define BUILD_BUG_ON_NOT_POWER_OF_2(n) \ | ||
675 | BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0)) | ||
676 | |||
677 | /* Force a compilation error if condition is true, but also produce a | ||
678 | result (of value 0 and type size_t), so the expression can be used | ||
679 | e.g. in a structure initializer (or where-ever else comma expressions | ||
680 | aren't permitted). */ | ||
681 | #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) | ||
682 | #define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); })) | ||
683 | |||
684 | /** | ||
685 | * BUILD_BUG_ON - break compile if a condition is true. | ||
686 | * @condition: the condition which the compiler should know is false. | ||
687 | * | ||
688 | * If you have some code which relies on certain constants being equal, or | ||
689 | * other compile-time-evaluated condition, you should use BUILD_BUG_ON to | ||
690 | * detect if someone changes it. | ||
691 | * | ||
692 | * The implementation uses gcc's reluctance to create a negative array, but | ||
693 | * gcc (as of 4.4) only emits that error for obvious cases (eg. not arguments | ||
694 | * to inline functions). So as a fallback we use the optimizer; if it can't | ||
695 | * prove the condition is false, it will cause a link error on the undefined | ||
696 | * "__build_bug_on_failed". This error message can be harder to track down | ||
697 | * though, hence the two different methods. | ||
698 | */ | ||
699 | #ifndef __OPTIMIZE__ | ||
700 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) | ||
701 | #else | ||
702 | extern int __build_bug_on_failed; | ||
703 | #define BUILD_BUG_ON(condition) \ | ||
704 | do { \ | ||
705 | ((void)sizeof(char[1 - 2*!!(condition)])); \ | ||
706 | if (condition) __build_bug_on_failed = 1; \ | ||
707 | } while(0) | ||
708 | #endif | ||
709 | |||
710 | /** | ||
711 | * BUILD_BUG - break compile if used. | ||
712 | * | ||
713 | * If you have some code that you expect the compiler to eliminate at | ||
714 | * build time, you should use BUILD_BUG to detect if it is | ||
715 | * unexpectedly used. | ||
716 | */ | ||
717 | #define BUILD_BUG() \ | ||
718 | do { \ | ||
719 | extern void __build_bug_failed(void) \ | ||
720 | __linktime_error("BUILD_BUG failed"); \ | ||
721 | __build_bug_failed(); \ | ||
722 | } while (0) | ||
723 | |||
724 | #endif /* __CHECKER__ */ | ||
725 | |||
726 | /* Trap pasters of __FUNCTION__ at compile-time */ | 682 | /* Trap pasters of __FUNCTION__ at compile-time */ |
727 | #define __FUNCTION__ (__func__) | 683 | #define __FUNCTION__ (__func__) |
728 | 684 | ||