Extend support for PM_TRACE to include x86_64
Subsystems (4)
PATCH 1/1 Extend support for PM_TRACE to include x86_64
Hi.
This patch adds support for PM_TRACE for the x86_64 architecture. Thanks to Linus for help with my asm ignorance.
Please apply.
arch/x86_64/kernel/vmlinux.lds.S | 7 +++++++ drivers/base/power/trace.c | 4 +++- include/asm-i386/resume-trace.h | 21 +++++++++++++++++++++ include/asm-x86_64/resume-trace.h | 21 +++++++++++++++++++++ include/linux/resume-trace.h | 19 ++----------------- kernel/power/Kconfig | 2 +- scripts/kconfig/mconf |binary 7 files changed, 55 insertions(+), 19 deletions(-)
arch/x86_64/kernel/vmlinux.lds.S +7 -0
@@ -54,6 +54,13 @@ SECTIONS BUG_TABLE + . = ALIGN(4); + .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { + __tracedata_start = .; + *(.tracedata) + __tracedata_end = .; + } + . = ALIGN(PAGE_SIZE); /* Align data segment to page size boundary */ /* Data */ .data : AT(ADDR(.data) - LOAD_OFFSET) {
drivers/base/power/trace.c +3 -1
@@ -142,6 +142,7 @@ void set_trace_device(struct device *dev { dev_hash_value =hash_string (DEVSEED , dev->bus_id,DEVHASH ); } +EXPORT_SYMBOL (set_trace_device);/* * We could just take the "tracedata" index into the .tracedata
@@ -162,6 +163,7 @@ void generate_resume_trace(void *traceda file_hash_value =hash_string (lineno, file,FILEHASH );set_magic_time (user_hash_value, file_hash_value, dev_hash_value); } +EXPORT_SYMBOL (generate_resume_trace);extern char __tracedata_start, __tracedata_end;static int show_file_hash (unsigned int value)
@@ -170,7 +172,7 @@ static int show_file_hash(unsigned int vchar *tracedata; match =0 ; -for (tracedata = &__tracedata_start ; tracedata < &__tracedata_end ; tracedata +=6 ) { +for (tracedata = &__tracedata_start ; tracedata < &__tracedata_end ; tracedata +=2 +sizeof (unsigned long )) {unsigned short lineno = *(unsigned short *)tracedata;const char *file = *(const char **)(tracedata +2 );unsigned int hash =hash_string (lineno, file,FILEHASH );
include/asm-i386/resume-trace.h +21 -0
@@ -0,0 +1,21 @@ +#ifndef ARCH_RESUME_TRACE_H +#define ARCH_RESUME_TRACE_H + +#ifdef CONFIG_PM_TRACE +#define TRACE_RESUME (user) do { \ + if (pm_trace_enabled) { \ + void *tracedata; \ + asm volatile("movl $1f,%0\n" \ + ".section .tracedata,\"a\"\n" \ + "1:\t.word %c1\n" \ + "\t.long %c2\n" \ + ".previous" \ + :"=r" (tracedata) \ + : "i" (__LINE__), "i" (__FILE__)); \ + generate_resume_trace(tracedata, user); \ + } \ +} while (0) +#else +#define TRACE_RESUME (user) do { } while (0) +#endif +#endif
include/asm-x86_64/resume-trace.h +21 -0
@@ -0,0 +1,21 @@ +#ifndef ARCH_RESUME_TRACE_H +#define ARCH_RESUME_TRACE_H + +#ifdef CONFIG_PM_TRACE +#define TRACE_RESUME (user) do { \ + if (pm_trace_enabled) { \ + void *tracedata; \ + asm volatile("movq $1f,%0\n" \ + ".section .tracedata,\"a\"\n" \ + "1:\t.word %c1\n" \ + "\t.quad %c2\n" \ + ".previous" \ + :"=r" (tracedata) \ + : "i" (__LINE__), "i" (__FILE__)); \ + generate_resume_trace(tracedata, user); \ + } \ +} while (0) +#else +#define TRACE_RESUME (user) do { } while (0) +#endif +#endif
include/linux/resume-trace.h +2 -17
@@ -1,6 +1,8 @@#ifndef RESUME_TRACE_H #define RESUME_TRACE_H +#include <asm/resume-trace.h> +#ifdef CONFIG_PM_TRACE extern int pm_trace_enabled;
@@ -10,25 +12,8 @@ extern void set_trace_device(struct deviextern void generate_resume_trace (void *tracedata,unsigned int user);#define TRACE_DEVICE (dev) set_trace_device(dev) -#define TRACE_RESUME (user) do { \ - if (pm_trace_enabled) { \ - void *tracedata; \ - asm volatile("movl $1f,%0\n" \ - ".section .tracedata,\"a\"\n" \ - "1:\t.word %c1\n" \ - "\t.long %c2\n" \ - ".previous" \ - :"=r" (tracedata) \ - : "i" (__LINE__), "i" (__FILE__)); \ - generate_resume_trace(tracedata, user); \ - } \ -} while (0) -#else -#define TRACE_DEVICE (dev) do { } while (0) -#define TRACE_RESUME (dev) do { } while (0) -#endif #endif
kernel/power/Kconfig +1 -1
@@ -50,7 +50,7 @@ config DISABLE_CONSOLE_SUSPEND config PM_TRACE bool "Suspend/resume event tracing" - depends on PM && PM_DEBUG && X86_32 && EXPERIMENTAL + depends on PM && PM_DEBUG && (X86_32 || X86_64) && EXPERIMENTAL default n ---help--- This enables some cheesy code to save the last PM event point in the
Hi,
Quoted 4 lines · Nigel Cunningham
Hi.
This patch adds support for
PM_TRACEfor thex86_64architecture. Thanks to Linus for help with my asm ignorance.
It has been for quite some time on my todo list. Thanks for doing it.
Greetings,
Rafael
Signature · 3 lines
If you don't have the time to read, you don't have the time or the tools to write. - Stephen King
Quoted 8 lines · On Mon, 15 Jan 2007 22:04:58 +1100 Nigel Cunningham wrote:
Hi.
This patch adds support for
PM_TRACEfor thex86_64architecture. Thanks to Linus for help with my asm ignorance.Please apply.
Signed-off-by Nigel Cunningham <[email protected]>
Goody. Thanks.
Quoted 7 lines
arch/x86_64/kernel/vmlinux.lds.S | 7 +++++++ drivers/base/power/trace.c | 4 +++- include/asm-i386/resume-trace.h | 21 +++++++++++++++++++++ include/asm-x86_64/resume-trace.h | 21 +++++++++++++++++++++ include/linux/resume-trace.h | 19 ++----------------- kernel/power/Kconfig | 2 +-
scripts/kconfig/mconf|binary
Hm, looks like several scripts/kconfig/* binary files need to be added to dontdiff.
kernel/power/Kconfig config DISABLE_CONSOLE_SUSPEND · line 53
Quoted 11 lines
7 files changed, 55 insertions(+), 19 deletions(-)diff -ruNp 930-PM_TRACE.patch-old/kernel/power/Kconfig 930-PM_TRACE.patch-new/kernel/power/Kconfig
kernel/power/Kconfig +1
-1@@ -50,7 +50,7 @@ config DISABLE_CONSOLE_SUSPEND config PM_TRACE bool "Suspend/resume event tracing" - depends on PM && PM_DEBUG && X86_32 && EXPERIMENTAL + depends on PM && PM_DEBUG && (X86_32 || X86_64) && EXPERIMENTAL
That's just
depends on PM && PM_DEBUG && X86 && EXPERIMENTAL
or maybe even:
depends on PM_DEBUG && X86 && EXPERIMENTAL
since PM_DEBUG depends on PM.
Anyway, X86 means X86_32 or X86_64.
kernel/power/Kconfig config DISABLE_CONSOLE_SUSPEND · line 56
Quoted 3 lines
kernel/power/Kconfig +0
-0default n ---help--- This enables some cheesy code to save the last PM event point in the
---
~Randy
Hi!
Quoted 6 lines
This patch adds support for
PM_TRACEfor thex86_64architecture. Thanks to Linus for help with my asm ignorance.Please apply.
Signed-off-by Nigel Cunningham <[email protected]>
Ack, looks nice to me. i386 code does not belong to generic headers, anyway...
Pavel
Quoted 160 lines
arch/x86_64/kernel/vmlinux.lds.S | 7 +++++++ drivers/base/power/trace.c | 4 +++- include/asm-i386/resume-trace.h | 21 +++++++++++++++++++++ include/asm-x86_64/resume-trace.h | 21 +++++++++++++++++++++ include/linux/resume-trace.h | 19 ++----------------- kernel/power/Kconfig | 2 +- scripts/kconfig/mconf |binary 7 files changed, 55 insertions(+), 19 deletions(-)diff -ruNp
930-PM_TRACE.patch-old/arch/x86_64/kernel/vmlinux.lds.S930-PM_TRACE.patch-new/arch/x86_64/kernel/vmlinux.lds.Sarch/x86_64/kernel/vmlinux.lds.S +7
-0@@ -54,6 +54,13 @@ SECTIONS BUG_TABLE + . = ALIGN(4); + .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { + __tracedata_start = .; + *(.tracedata) + __tracedata_end = .; + } + . = ALIGN(PAGE_SIZE); /* Align data segment to page size boundary */ /* Data */ .data : AT(ADDR(.data) - LOAD_OFFSET) {diff -ruNp
930-PM_TRACE.patch-old/drivers/base/power/trace.c930-PM_TRACE.patch-new/drivers/base/power/trace.cdrivers/base/power/trace.c +3
-1@@ -142,6 +142,7 @@ void set_trace_device(struct device *dev { dev_hash_value =hash_string (DEVSEED , dev->bus_id,DEVHASH ); } +EXPORT_SYMBOL (set_trace_device);/* * We could just take the "tracedata" index into the .tracedata @@ -162,6 +163,7 @@ void generate_resume_trace(void *traceda file_hash_value =hash_string (lineno, file,FILEHASH );set_magic_time (user_hash_value, file_hash_value, dev_hash_value); } +EXPORT_SYMBOL (generate_resume_trace);extern char __tracedata_start, __tracedata_end;static int show_file_hash (unsigned int value)@@ -170,7 +172,7 @@ static int show_file_hash(unsigned int vchar *tracedata; match =0 ; -for (tracedata = &__tracedata_start ; tracedata < &__tracedata_end ; tracedata +=6 ) { +for (tracedata = &__tracedata_start ; tracedata < &__tracedata_end ; tracedata +=2 +sizeof (unsigned long )) {unsigned short lineno = *(unsigned short *)tracedata;const char *file = *(const char **)(tracedata +2 );unsigned int hash =hash_string (lineno, file,FILEHASH );diff -ruNp
930-PM_TRACE.patch-old/include/asm-i386/resume-trace.h930-PM_TRACE.patch-new/include/asm-i386/resume-trace.hinclude/asm-i386/resume-trace.h +21
-0@@ -0,0 +1,21 @@ +#ifndef ARCH_RESUME_TRACE_H +#define ARCH_RESUME_TRACE_H + +#ifdef CONFIG_PM_TRACE +#define TRACE_RESUME (user) do { \ + if (pm_trace_enabled) { \ + void *tracedata; \ + asm volatile("movl $1f,%0\n" \ + ".section .tracedata,\"a\"\n" \ + "1:\t.word %c1\n" \ + "\t.long %c2\n" \ + ".previous" \ + :"=r" (tracedata) \ + : "i" (__LINE__), "i" (__FILE__)); \ + generate_resume_trace(tracedata, user); \ + } \ +} while (0) +#else +#define TRACE_RESUME (user) do { } while (0) +#endif +#endif diff -ruNp
930-PM_TRACE.patch-old/include/asm-x86_64/resume-trace.h930-PM_TRACE.patch-new/include/asm-x86_64/resume-trace.hinclude/asm-x86_64/resume-trace.h +21
-0@@ -0,0 +1,21 @@ +#ifndef ARCH_RESUME_TRACE_H +#define ARCH_RESUME_TRACE_H + +#ifdef CONFIG_PM_TRACE +#define TRACE_RESUME (user) do { \ + if (pm_trace_enabled) { \ + void *tracedata; \ + asm volatile("movq $1f,%0\n" \ + ".section .tracedata,\"a\"\n" \ + "1:\t.word %c1\n" \ + "\t.quad %c2\n" \ + ".previous" \ + :"=r" (tracedata) \ + : "i" (__LINE__), "i" (__FILE__)); \ + generate_resume_trace(tracedata, user); \ + } \ +} while (0) +#else +#define TRACE_RESUME (user) do { } while (0) +#endif +#endif diff -ruNp
930-PM_TRACE.patch-old/include/linux/resume-trace.h930-PM_TRACE.patch-new/include/linux/resume-trace.hinclude/linux/resume-trace.h +2
-17@@ -1,6 +1,8 @@#ifndef RESUME_TRACE_H #define RESUME_TRACE_H +#include <asm/resume-trace.h> +#ifdef CONFIG_PM_TRACE extern int pm_trace_enabled;@@ -10,25 +12,8 @@ extern void set_trace_device(struct deviextern void generate_resume_trace (void *tracedata,unsigned int user);#define TRACE_DEVICE (dev) set_trace_device(dev) -#define TRACE_RESUME (user) do { \ - if (pm_trace_enabled) { \ - void *tracedata; \ - asm volatile("movl $1f,%0\n" \ - ".section .tracedata,\"a\"\n" \ - "1:\t.word %c1\n" \ - "\t.long %c2\n" \ - ".previous" \ - :"=r" (tracedata) \ - : "i" (__LINE__), "i" (__FILE__)); \ - generate_resume_trace(tracedata, user); \ - } \ -} while (0) -#else -#define TRACE_DEVICE (dev) do { } while (0) -#define TRACE_RESUME (dev) do { } while (0) -#endif #endif diff -ruNp 930-PM_TRACE.patch-old/kernel/power/Kconfig 930-PM_TRACE.patch-new/kernel/power/Kconfig
kernel/power/Kconfig +1
-2@@ -50,7 +50,7 @@ config DISABLE_CONSOLE_SUSPEND config PM_TRACE bool "Suspend/resume event tracing" - depends on PM && PM_DEBUG && X86_32 && EXPERIMENTAL + depends on PM && PM_DEBUG && (X86_32 || X86_64) && EXPERIMENTAL default n ---help--- This enables some cheesy code to save the last PM event point in the -To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html