WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Proper fix for profile_pc on x86_64.

# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID a12e08eb0209f54b299c17f14ca6aec908d6fae8
# Parent  a3fbce644bcc4247f535b62590d30905c5f9c88e
Proper fix for profile_pc on x86_64.
Also enable CONFIG_FRAME_POINTER for dom0 and domU kernels.

Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>

diff -r a3fbce644bcc -r a12e08eb0209 buildconfigs/linux-defconfig_xen0_x86_32
--- a/buildconfigs/linux-defconfig_xen0_x86_32  Wed Feb  1 13:46:15 2006
+++ b/buildconfigs/linux-defconfig_xen0_x86_32  Wed Feb  1 15:01:04 2006
@@ -1228,7 +1228,7 @@
 CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_INFO is not set
 # CONFIG_DEBUG_FS is not set
-# CONFIG_FRAME_POINTER is not set
+CONFIG_FRAME_POINTER=y
 CONFIG_EARLY_PRINTK=y
 # CONFIG_DEBUG_STACKOVERFLOW is not set
 # CONFIG_KPROBES is not set
diff -r a3fbce644bcc -r a12e08eb0209 buildconfigs/linux-defconfig_xen0_x86_64
--- a/buildconfigs/linux-defconfig_xen0_x86_64  Wed Feb  1 13:46:15 2006
+++ b/buildconfigs/linux-defconfig_xen0_x86_64  Wed Feb  1 15:01:04 2006
@@ -1173,7 +1173,7 @@
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
 # CONFIG_DEBUG_KOBJECT is not set
 # CONFIG_DEBUG_FS is not set
-# CONFIG_FRAME_POINTER is not set
+CONFIG_FRAME_POINTER=y
 # CONFIG_CHECKING is not set
 # CONFIG_INIT_DEBUG is not set
 # CONFIG_KPROBES is not set
diff -r a3fbce644bcc -r a12e08eb0209 buildconfigs/linux-defconfig_xenU_x86_32
--- a/buildconfigs/linux-defconfig_xenU_x86_32  Wed Feb  1 13:46:15 2006
+++ b/buildconfigs/linux-defconfig_xenU_x86_32  Wed Feb  1 15:01:04 2006
@@ -518,7 +518,7 @@
 CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_INFO is not set
 # CONFIG_DEBUG_FS is not set
-# CONFIG_FRAME_POINTER is not set
+CONFIG_FRAME_POINTER=y
 CONFIG_EARLY_PRINTK=y
 # CONFIG_DEBUG_STACKOVERFLOW is not set
 # CONFIG_KPROBES is not set
diff -r a3fbce644bcc -r a12e08eb0209 buildconfigs/linux-defconfig_xenU_x86_64
--- a/buildconfigs/linux-defconfig_xenU_x86_64  Wed Feb  1 13:46:15 2006
+++ b/buildconfigs/linux-defconfig_xenU_x86_64  Wed Feb  1 15:01:04 2006
@@ -895,7 +895,7 @@
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
 # CONFIG_DEBUG_KOBJECT is not set
 # CONFIG_DEBUG_FS is not set
-# CONFIG_FRAME_POINTER is not set
+CONFIG_FRAME_POINTER=y
 # CONFIG_INIT_DEBUG is not set
 # CONFIG_KPROBES is not set
 
diff -r a3fbce644bcc -r a12e08eb0209 
linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c  Wed Feb  1 13:46:15 2006
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c  Wed Feb  1 15:01:04 2006
@@ -58,6 +58,7 @@
 #include <asm/uaccess.h>
 #include <asm/processor.h>
 #include <asm/timer.h>
+#include <asm/sections.h>
 
 #include "mach_time.h"
 
@@ -541,22 +542,33 @@
 }
 
 #if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER)
+unsigned long profile_pc(struct pt_regs *regs)
+{
+       unsigned long pc = instruction_pointer(regs);
+
 #ifdef __x86_64__
-#define REG_BP rbp
+       /* Assume the lock function has either no stack frame or only a single 
word.
+          This checks if the address on the stack looks like a kernel text 
address.
+          There is a small window for false hits, but in that case the tick
+          is just accounted to the spinlock function.
+          Better would be to write these functions in assembler again
+          and check exactly. */
+       if (in_lock_functions(pc)) {
+               char *v = *(char **)regs->rsp;
+               if ((v >= _stext && v <= _etext) ||
+                       (v >= _sinittext && v <= _einittext) ||
+                       (v >= (char *)MODULES_VADDR  && v <= (char 
*)MODULES_END))
+                       return (unsigned long)v;
+               return ((unsigned long *)regs->rsp)[1];
+       }
 #else
-#define REG_BP ebp
-#endif
-unsigned long profile_pc(struct pt_regs *regs)
-{
-       unsigned long pc = instruction_pointer(regs);
-
        if (in_lock_functions(pc))
                return *(unsigned long *)(regs->REG_BP + 4);
+#endif
 
        return pc;
 }
 EXPORT_SYMBOL(profile_pc);
-#undef REG_BP
 #endif
 
 irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Proper fix for profile_pc on x86_64., Xen patchbot -unstable <=