diff options
author | Nigel Cunningham <nigel@nigel.suspend2.net> | 2007-07-21 11:10:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-21 21:37:10 -0400 |
commit | 44bf4cea43816d43deab73c1c16361e899996eaa (patch) | |
tree | 7ed3e6672f6abe3a68a79c77a7af125d0e0dab21 | |
parent | 9ef231a436fddb34d806f599c97b479691b3c38b (diff) |
x86: PM_TRACE support
Signed-off-by: Nigel Cunningham <nigel@nigel.suspend2.net>
Cc: Randy Dunlap <rdunlap@xenotime.net>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Pavel Machek <pavel@ucw.cz>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/x86_64/kernel/vmlinux.lds.S | 7 | ||||
-rw-r--r-- | drivers/base/power/trace.c | 5 | ||||
-rw-r--r-- | include/asm-i386/resume-trace.h | 13 | ||||
-rw-r--r-- | include/asm-x86_64/resume-trace.h | 13 | ||||
-rw-r--r-- | include/linux/resume-trace.h | 19 | ||||
-rw-r--r-- | kernel/power/Kconfig | 2 |
6 files changed, 43 insertions, 16 deletions
diff --git a/arch/x86_64/kernel/vmlinux.lds.S b/arch/x86_64/kernel/vmlinux.lds.S index c2d5a840cb1a..8778848000c2 100644 --- a/arch/x86_64/kernel/vmlinux.lds.S +++ b/arch/x86_64/kernel/vmlinux.lds.S | |||
@@ -54,6 +54,13 @@ SECTIONS | |||
54 | 54 | ||
55 | RODATA | 55 | RODATA |
56 | 56 | ||
57 | . = ALIGN(4); | ||
58 | .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { | ||
59 | __tracedata_start = .; | ||
60 | *(.tracedata) | ||
61 | __tracedata_end = .; | ||
62 | } | ||
63 | |||
57 | . = ALIGN(PAGE_SIZE); /* Align data segment to page size boundary */ | 64 | . = ALIGN(PAGE_SIZE); /* Align data segment to page size boundary */ |
58 | /* Data */ | 65 | /* Data */ |
59 | .data : AT(ADDR(.data) - LOAD_OFFSET) { | 66 | .data : AT(ADDR(.data) - LOAD_OFFSET) { |
diff --git a/drivers/base/power/trace.c b/drivers/base/power/trace.c index a9ab30fefffc..2b0c601e422e 100644 --- a/drivers/base/power/trace.c +++ b/drivers/base/power/trace.c | |||
@@ -142,6 +142,7 @@ void set_trace_device(struct device *dev) | |||
142 | { | 142 | { |
143 | dev_hash_value = hash_string(DEVSEED, dev->bus_id, DEVHASH); | 143 | dev_hash_value = hash_string(DEVSEED, dev->bus_id, DEVHASH); |
144 | } | 144 | } |
145 | EXPORT_SYMBOL(set_trace_device); | ||
145 | 146 | ||
146 | /* | 147 | /* |
147 | * We could just take the "tracedata" index into the .tracedata | 148 | * We could just take the "tracedata" index into the .tracedata |
@@ -162,6 +163,7 @@ void generate_resume_trace(void *tracedata, unsigned int user) | |||
162 | file_hash_value = hash_string(lineno, file, FILEHASH); | 163 | file_hash_value = hash_string(lineno, file, FILEHASH); |
163 | set_magic_time(user_hash_value, file_hash_value, dev_hash_value); | 164 | set_magic_time(user_hash_value, file_hash_value, dev_hash_value); |
164 | } | 165 | } |
166 | EXPORT_SYMBOL(generate_resume_trace); | ||
165 | 167 | ||
166 | extern char __tracedata_start, __tracedata_end; | 168 | extern char __tracedata_start, __tracedata_end; |
167 | static int show_file_hash(unsigned int value) | 169 | static int show_file_hash(unsigned int value) |
@@ -170,7 +172,8 @@ static int show_file_hash(unsigned int value) | |||
170 | char *tracedata; | 172 | char *tracedata; |
171 | 173 | ||
172 | match = 0; | 174 | match = 0; |
173 | for (tracedata = &__tracedata_start ; tracedata < &__tracedata_end ; tracedata += 6) { | 175 | for (tracedata = &__tracedata_start ; tracedata < &__tracedata_end ; |
176 | tracedata += 2 + sizeof(unsigned long)) { | ||
174 | unsigned short lineno = *(unsigned short *)tracedata; | 177 | unsigned short lineno = *(unsigned short *)tracedata; |
175 | const char *file = *(const char **)(tracedata + 2); | 178 | const char *file = *(const char **)(tracedata + 2); |
176 | unsigned int hash = hash_string(lineno, file, FILEHASH); | 179 | unsigned int hash = hash_string(lineno, file, FILEHASH); |
diff --git a/include/asm-i386/resume-trace.h b/include/asm-i386/resume-trace.h new file mode 100644 index 000000000000..ec9cfd656230 --- /dev/null +++ b/include/asm-i386/resume-trace.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #define TRACE_RESUME(user) do { \ | ||
2 | if (pm_trace_enabled) { \ | ||
3 | void *tracedata; \ | ||
4 | asm volatile("movl $1f,%0\n" \ | ||
5 | ".section .tracedata,\"a\"\n" \ | ||
6 | "1:\t.word %c1\n" \ | ||
7 | "\t.long %c2\n" \ | ||
8 | ".previous" \ | ||
9 | :"=r" (tracedata) \ | ||
10 | : "i" (__LINE__), "i" (__FILE__)); \ | ||
11 | generate_resume_trace(tracedata, user); \ | ||
12 | } \ | ||
13 | } while (0) | ||
diff --git a/include/asm-x86_64/resume-trace.h b/include/asm-x86_64/resume-trace.h new file mode 100644 index 000000000000..34bf998fdf62 --- /dev/null +++ b/include/asm-x86_64/resume-trace.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #define TRACE_RESUME(user) do { \ | ||
2 | if (pm_trace_enabled) { \ | ||
3 | void *tracedata; \ | ||
4 | asm volatile("movq $1f,%0\n" \ | ||
5 | ".section .tracedata,\"a\"\n" \ | ||
6 | "1:\t.word %c1\n" \ | ||
7 | "\t.quad %c2\n" \ | ||
8 | ".previous" \ | ||
9 | :"=r" (tracedata) \ | ||
10 | : "i" (__LINE__), "i" (__FILE__)); \ | ||
11 | generate_resume_trace(tracedata, user); \ | ||
12 | } \ | ||
13 | } while (0) | ||
diff --git a/include/linux/resume-trace.h b/include/linux/resume-trace.h index 81e9299ca148..f3f4f28c6960 100644 --- a/include/linux/resume-trace.h +++ b/include/linux/resume-trace.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define RESUME_TRACE_H | 2 | #define RESUME_TRACE_H |
3 | 3 | ||
4 | #ifdef CONFIG_PM_TRACE | 4 | #ifdef CONFIG_PM_TRACE |
5 | #include <asm/resume-trace.h> | ||
5 | 6 | ||
6 | extern int pm_trace_enabled; | 7 | extern int pm_trace_enabled; |
7 | 8 | ||
@@ -9,20 +10,10 @@ struct device; | |||
9 | extern void set_trace_device(struct device *); | 10 | extern void set_trace_device(struct device *); |
10 | extern void generate_resume_trace(void *tracedata, unsigned int user); | 11 | extern void generate_resume_trace(void *tracedata, unsigned int user); |
11 | 12 | ||
12 | #define TRACE_DEVICE(dev) set_trace_device(dev) | 13 | #define TRACE_DEVICE(dev) do { \ |
13 | #define TRACE_RESUME(user) do { \ | 14 | if (pm_trace_enabled) \ |
14 | if (pm_trace_enabled) { \ | 15 | set_trace_device(dev); \ |
15 | void *tracedata; \ | 16 | } while(0) |
16 | asm volatile("movl $1f,%0\n" \ | ||
17 | ".section .tracedata,\"a\"\n" \ | ||
18 | "1:\t.word %c1\n" \ | ||
19 | "\t.long %c2\n" \ | ||
20 | ".previous" \ | ||
21 | :"=r" (tracedata) \ | ||
22 | : "i" (__LINE__), "i" (__FILE__)); \ | ||
23 | generate_resume_trace(tracedata, user); \ | ||
24 | } \ | ||
25 | } while (0) | ||
26 | 17 | ||
27 | #else | 18 | #else |
28 | 19 | ||
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig index 7358609e4735..c1a106d87d90 100644 --- a/kernel/power/Kconfig +++ b/kernel/power/Kconfig | |||
@@ -57,7 +57,7 @@ config DISABLE_CONSOLE_SUSPEND | |||
57 | 57 | ||
58 | config PM_TRACE | 58 | config PM_TRACE |
59 | bool "Suspend/resume event tracing" | 59 | bool "Suspend/resume event tracing" |
60 | depends on PM_DEBUG && X86_32 && EXPERIMENTAL | 60 | depends on PM_DEBUG && X86 && EXPERIMENTAL |
61 | default n | 61 | default n |
62 | ---help--- | 62 | ---help--- |
63 | This enables some cheesy code to save the last PM event point in the | 63 | This enables some cheesy code to save the last PM event point in the |