Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 24665
b: refs/heads/master
c: 15e812a
h: refs/heads/master
i:
  24663: 069521f
v: v3
  • Loading branch information
Anton Blanchard authored and Paul Mackerras committed Mar 29, 2006
1 parent 6529489 commit 5a1334d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 45 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fa465f8c7008c6cab32b05f3f1af57f7c86e8873
refs/heads/master: 15e812ad849e142e3dfc984d33c4d8042389f148
7 changes: 0 additions & 7 deletions trunk/arch/powerpc/oprofile/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,10 @@ static int op_powerpc_create_files(struct super_block *sb, struct dentry *root)

oprofilefs_create_ulong(sb, root, "enable_kernel", &sys.enable_kernel);
oprofilefs_create_ulong(sb, root, "enable_user", &sys.enable_user);
#ifdef CONFIG_PPC64
oprofilefs_create_ulong(sb, root, "backtrace_spinlocks",
&sys.backtrace_spinlocks);
#endif

/* Default to tracing both kernel and user */
sys.enable_kernel = 1;
sys.enable_user = 1;
#ifdef CONFIG_PPC64
sys.backtrace_spinlocks = 0;
#endif

return 0;
}
Expand Down
43 changes: 9 additions & 34 deletions trunk/arch/powerpc/oprofile/op_model_power4.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,14 @@ static unsigned long reset_value[OP_MAX_COUNTER];

static int oprofile_running;
static int mmcra_has_sihv;
/* Unfortunately these bits vary between CPUs */
static unsigned long mmcra_sihv = MMCRA_SIHV;
static unsigned long mmcra_sipr = MMCRA_SIPR;

/* mmcr values are set in power4_reg_setup, used in power4_cpu_setup */
static u32 mmcr0_val;
static u64 mmcr1_val;
static u32 mmcra_val;

/*
* Since we do not have an NMI, backtracing through spinlocks is
* only a best guess. In light of this, allow it to be disabled at
* runtime.
*/
static int backtrace_spinlocks;
static u64 mmcra_val;

static void power4_reg_setup(struct op_counter_config *ctr,
struct op_system_config *sys,
Expand All @@ -63,8 +59,6 @@ static void power4_reg_setup(struct op_counter_config *ctr,
mmcr1_val = sys->mmcr1;
mmcra_val = sys->mmcra;

backtrace_spinlocks = sys->backtrace_spinlocks;

for (i = 0; i < cur_cpu_spec->num_pmcs; ++i)
reset_value[i] = 0x80000000UL - ctr[i].count;

Expand Down Expand Up @@ -197,25 +191,6 @@ static void __attribute_used__ kernel_unknown_bucket(void)
{
}

static unsigned long check_spinlock_pc(struct pt_regs *regs,
unsigned long profile_pc)
{
unsigned long pc = instruction_pointer(regs);

/*
* If both the SIAR (sampled instruction) and the perfmon exception
* occurred in a spinlock region then we account the sample to the
* calling function. This isnt 100% correct, we really need soft
* IRQ disable so we always get the perfmon exception at the
* point at which the SIAR is set.
*/
if (backtrace_spinlocks && in_lock_functions(pc) &&
in_lock_functions(profile_pc))
return regs->link;
else
return profile_pc;
}

/*
* On GQ and newer the MMCRA stores the HV and PR bits at the time
* the SIAR was sampled. We use that to work out if the SIAR was sampled in
Expand All @@ -228,17 +203,17 @@ static unsigned long get_pc(struct pt_regs *regs)

/* Cant do much about it */
if (!mmcra_has_sihv)
return check_spinlock_pc(regs, pc);
return pc;

mmcra = mfspr(SPRN_MMCRA);

/* Were we in the hypervisor? */
if (firmware_has_feature(FW_FEATURE_LPAR) && (mmcra & MMCRA_SIHV))
if (firmware_has_feature(FW_FEATURE_LPAR) && (mmcra & mmcra_sihv))
/* function descriptor madness */
return *((unsigned long *)hypervisor_bucket);

/* We were in userspace, nothing to do */
if (mmcra & MMCRA_SIPR)
if (mmcra & mmcra_sipr)
return pc;

#ifdef CONFIG_PPC_RTAS
Expand All @@ -257,7 +232,7 @@ static unsigned long get_pc(struct pt_regs *regs)
/* function descriptor madness */
return *((unsigned long *)kernel_unknown_bucket);

return check_spinlock_pc(regs, pc);
return pc;
}

static int get_kernel(unsigned long pc)
Expand All @@ -268,7 +243,7 @@ static int get_kernel(unsigned long pc)
is_kernel = is_kernel_addr(pc);
} else {
unsigned long mmcra = mfspr(SPRN_MMCRA);
is_kernel = ((mmcra & MMCRA_SIPR) == 0);
is_kernel = ((mmcra & mmcra_sipr) == 0);
}

return is_kernel;
Expand Down
3 changes: 0 additions & 3 deletions trunk/include/asm-powerpc/oprofile_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ struct op_system_config {
#endif
unsigned long enable_kernel;
unsigned long enable_user;
#ifdef CONFIG_PPC64
unsigned long backtrace_spinlocks;
#endif
};

/* Per-arch configuration */
Expand Down

0 comments on commit 5a1334d

Please sign in to comment.