Commit 646a3df8 authored by Hirokazu Takata's avatar Hirokazu Takata Committed by Linus Torvalds

[PATCH] m32r: update for profiling

  This patch is for profiling support. 
  profile_tick() is used instead of m32r_do_profile().

	* arch/m32r/kernel/smp.c
	(smp_local_timer_interrupt): Change profile API, use profile_tick()
	instead of m32r_do_profile().

	* arch/m32r/kernel/time.c: ditto.

	* include/asm-m32r/hw_irq.h (m32r_do_profile): Removed.

	* include/asm-m32r/ptrace.h (profile_pc): Add profile_pc() macro.
Signed-off-by: default avatarHirokazu Takata <takata@linux-m32r.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8704cc2f
/* /*
* linux/arch/m32r/kernel/smp.c * linux/arch/m32r/kernel/smp.c
* orig : i386 2.4.10
* *
* MITSUBISHI M32R SMP support routines. * M32R SMP support routines.
* *
* Copyright (c) 2001, 2002 Hitoshi Yamamoto * Copyright (c) 2001, 2002 Hitoshi Yamamoto
* *
...@@ -14,8 +13,6 @@ ...@@ -14,8 +13,6 @@
* later. * later.
*/ */
/* $Id$ */
#undef DEBUG_SMP #undef DEBUG_SMP
#include <linux/irq.h> #include <linux/irq.h>
...@@ -23,6 +20,7 @@ ...@@ -23,6 +20,7 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/profile.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <asm/pgalloc.h> #include <asm/pgalloc.h>
...@@ -109,7 +107,7 @@ static void send_IPI_mask(cpumask_t, int, int); ...@@ -109,7 +107,7 @@ static void send_IPI_mask(cpumask_t, int, int);
unsigned long send_IPI_mask_phys(cpumask_t, int, int); unsigned long send_IPI_mask_phys(cpumask_t, int, int);
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
/* Rescheduling request Routins */ /* Rescheduling request Routines */
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
/*==========================================================================* /*==========================================================================*
...@@ -750,7 +748,7 @@ void smp_local_timer_interrupt(struct pt_regs *regs) ...@@ -750,7 +748,7 @@ void smp_local_timer_interrupt(struct pt_regs *regs)
* useful with a profiling multiplier != 1 * useful with a profiling multiplier != 1
*/ */
m32r_do_profile(regs); profile_tick(CPU_PROFILING, regs);
if (--per_cpu(prof_counter, cpu_id) <= 0) { if (--per_cpu(prof_counter, cpu_id) <= 0) {
/* /*
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
* Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org> * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>
*/ */
/* $Id$ */
#undef DEBUG_TIMER #undef DEBUG_TIMER
#include <linux/config.h> #include <linux/config.h>
...@@ -29,6 +27,7 @@ ...@@ -29,6 +27,7 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/profile.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/m32r.h> #include <asm/m32r.h>
...@@ -243,7 +242,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -243,7 +242,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
write_sequnlock(&xtime_lock); write_sequnlock(&xtime_lock);
#ifndef CONFIG_SMP #ifndef CONFIG_SMP
m32r_do_profile(regs); profile_tick(CPU_PROFILING, regs);
#endif #endif
return IRQ_HANDLED; return IRQ_HANDLED;
......
#ifndef _ASM_M32R_HW_IRQ_H #ifndef _ASM_M32R_HW_IRQ_H
#define _ASM_M32R_HW_IRQ_H #define _ASM_M32R_HW_IRQ_H
/* $Id$ */ static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i)
#include <linux/profile.h>
#include <linux/sched.h>
#include <asm/sections.h>
static __inline__ void hw_resend_irq(struct hw_interrupt_type *h,
unsigned int i)
{ {
/* Nothing to do */ /* Nothing to do */
} }
static __inline__ void m32r_do_profile (struct pt_regs *regs)
{
unsigned long pc = regs->bpc;
profile_hook(regs);
if (user_mode(regs))
return;
if (!prof_buffer)
return;
pc -= (unsigned long) &_stext;
pc >>= prof_shift;
/*
* Don't ignore out-of-bounds PC values silently,
* put them into the last histogram slot, so if
* present, they will show up as a sharp peak.
*/
if (pc > prof_len - 1)
pc = prof_len - 1;
atomic_inc((atomic_t *)&prof_buffer[pc]);
}
#endif /* _ASM_M32R_HW_IRQ_H */ #endif /* _ASM_M32R_HW_IRQ_H */
#ifndef _M32R_PTRACE_H #ifndef _ASM_M32R_PTRACE_H
#define _M32R_PTRACE_H #define _ASM_M32R_PTRACE_H
/* $Id$ */
/* /*
* linux/include/asm-m32r/ptrace.h
*
* This file is subject to the terms and conditions of the GNU General Public * This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive * License. See the file "COPYING" in the main directory of this archive
* for more details. * for more details.
* *
* Copyright (C) 2001, 2002, 2004 Hirokazu Takata * M32R version:
* Copyright (C) 2001-2002, 2004 Hirokazu Takata <takata at linux-m32r.org>
*/ */
#include <linux/config.h> #include <linux/config.h>
...@@ -153,6 +154,7 @@ struct pt_regs { ...@@ -153,6 +154,7 @@ struct pt_regs {
#endif #endif
#define instruction_pointer(regs) ((regs)->bpc) #define instruction_pointer(regs) ((regs)->bpc)
#define profile_pc(regs) instruction_pointer(regs)
extern void show_regs(struct pt_regs *); extern void show_regs(struct pt_regs *);
...@@ -160,4 +162,4 @@ extern void withdraw_debug_trap(struct pt_regs *regs); ...@@ -160,4 +162,4 @@ extern void withdraw_debug_trap(struct pt_regs *regs);
#endif /* __KERNEL */ #endif /* __KERNEL */
#endif /* _M32R_PTRACE_H */ #endif /* _ASM_M32R_PTRACE_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment