ia64/xen-unstable

changeset 8725:a12e08eb0209

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@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Wed Feb 01 15:01:04 2006 +0000 (2006-02-01)
parents a3fbce644bcc
children 0c94043f5c5b
files buildconfigs/linux-defconfig_xen0_x86_32 buildconfigs/linux-defconfig_xen0_x86_64 buildconfigs/linux-defconfig_xenU_x86_32 buildconfigs/linux-defconfig_xenU_x86_64 linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c
line diff
     1.1 --- a/buildconfigs/linux-defconfig_xen0_x86_32	Wed Feb 01 13:46:15 2006 +0000
     1.2 +++ b/buildconfigs/linux-defconfig_xen0_x86_32	Wed Feb 01 15:01:04 2006 +0000
     1.3 @@ -1228,7 +1228,7 @@ CONFIG_DETECT_SOFTLOCKUP=y
     1.4  CONFIG_DEBUG_BUGVERBOSE=y
     1.5  # CONFIG_DEBUG_INFO is not set
     1.6  # CONFIG_DEBUG_FS is not set
     1.7 -# CONFIG_FRAME_POINTER is not set
     1.8 +CONFIG_FRAME_POINTER=y
     1.9  CONFIG_EARLY_PRINTK=y
    1.10  # CONFIG_DEBUG_STACKOVERFLOW is not set
    1.11  # CONFIG_KPROBES is not set
     2.1 --- a/buildconfigs/linux-defconfig_xen0_x86_64	Wed Feb 01 13:46:15 2006 +0000
     2.2 +++ b/buildconfigs/linux-defconfig_xen0_x86_64	Wed Feb 01 15:01:04 2006 +0000
     2.3 @@ -1173,7 +1173,7 @@ CONFIG_DETECT_SOFTLOCKUP=y
     2.4  # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
     2.5  # CONFIG_DEBUG_KOBJECT is not set
     2.6  # CONFIG_DEBUG_FS is not set
     2.7 -# CONFIG_FRAME_POINTER is not set
     2.8 +CONFIG_FRAME_POINTER=y
     2.9  # CONFIG_CHECKING is not set
    2.10  # CONFIG_INIT_DEBUG is not set
    2.11  # CONFIG_KPROBES is not set
     3.1 --- a/buildconfigs/linux-defconfig_xenU_x86_32	Wed Feb 01 13:46:15 2006 +0000
     3.2 +++ b/buildconfigs/linux-defconfig_xenU_x86_32	Wed Feb 01 15:01:04 2006 +0000
     3.3 @@ -518,7 +518,7 @@ CONFIG_DETECT_SOFTLOCKUP=y
     3.4  CONFIG_DEBUG_BUGVERBOSE=y
     3.5  # CONFIG_DEBUG_INFO is not set
     3.6  # CONFIG_DEBUG_FS is not set
     3.7 -# CONFIG_FRAME_POINTER is not set
     3.8 +CONFIG_FRAME_POINTER=y
     3.9  CONFIG_EARLY_PRINTK=y
    3.10  # CONFIG_DEBUG_STACKOVERFLOW is not set
    3.11  # CONFIG_KPROBES is not set
     4.1 --- a/buildconfigs/linux-defconfig_xenU_x86_64	Wed Feb 01 13:46:15 2006 +0000
     4.2 +++ b/buildconfigs/linux-defconfig_xenU_x86_64	Wed Feb 01 15:01:04 2006 +0000
     4.3 @@ -895,7 +895,7 @@ CONFIG_DETECT_SOFTLOCKUP=y
     4.4  # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
     4.5  # CONFIG_DEBUG_KOBJECT is not set
     4.6  # CONFIG_DEBUG_FS is not set
     4.7 -# CONFIG_FRAME_POINTER is not set
     4.8 +CONFIG_FRAME_POINTER=y
     4.9  # CONFIG_INIT_DEBUG is not set
    4.10  # CONFIG_KPROBES is not set
    4.11  
     5.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c	Wed Feb 01 13:46:15 2006 +0000
     5.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c	Wed Feb 01 15:01:04 2006 +0000
     5.3 @@ -58,6 +58,7 @@
     5.4  #include <asm/uaccess.h>
     5.5  #include <asm/processor.h>
     5.6  #include <asm/timer.h>
     5.7 +#include <asm/sections.h>
     5.8  
     5.9  #include "mach_time.h"
    5.10  
    5.11 @@ -541,22 +542,33 @@ unsigned long long sched_clock(void)
    5.12  }
    5.13  
    5.14  #if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER)
    5.15 -#ifdef __x86_64__
    5.16 -#define REG_BP rbp
    5.17 -#else
    5.18 -#define REG_BP ebp
    5.19 -#endif
    5.20  unsigned long profile_pc(struct pt_regs *regs)
    5.21  {
    5.22  	unsigned long pc = instruction_pointer(regs);
    5.23  
    5.24 +#ifdef __x86_64__
    5.25 +	/* Assume the lock function has either no stack frame or only a single word.
    5.26 +	   This checks if the address on the stack looks like a kernel text address.
    5.27 +	   There is a small window for false hits, but in that case the tick
    5.28 +	   is just accounted to the spinlock function.
    5.29 +	   Better would be to write these functions in assembler again
    5.30 +	   and check exactly. */
    5.31 +	if (in_lock_functions(pc)) {
    5.32 +		char *v = *(char **)regs->rsp;
    5.33 +		if ((v >= _stext && v <= _etext) ||
    5.34 +			(v >= _sinittext && v <= _einittext) ||
    5.35 +			(v >= (char *)MODULES_VADDR  && v <= (char *)MODULES_END))
    5.36 +			return (unsigned long)v;
    5.37 +		return ((unsigned long *)regs->rsp)[1];
    5.38 +	}
    5.39 +#else
    5.40  	if (in_lock_functions(pc))
    5.41  		return *(unsigned long *)(regs->REG_BP + 4);
    5.42 +#endif
    5.43  
    5.44  	return pc;
    5.45  }
    5.46  EXPORT_SYMBOL(profile_pc);
    5.47 -#undef REG_BP
    5.48  #endif
    5.49  
    5.50  irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)