検索条件
全2件
(1/1ページ)
_GLOBAL(__setup_cpu_e500v1) _GLOBAL(__setup_cpu_e500v2) mflr r4 bl __e500_icache_setup bl __e500_dcache_setup bl __setup_e500_ivors mtlr r4 blr
/* Adjust or setup IVORs for e500v1/v2 */ _GLOBAL(__setup_e500_ivors) li r3,DebugCrit@l mtspr SPRN_IVOR15,r3 li r3,SPEUnavailable@l mtspr SPRN_IVOR32,r3 li r3,SPEFloatingPointData@l mtspr SPRN_IVOR33,r3 li r3,SPEFloatingPointRound@l mtspr SPRN_IVOR34,r3 li r3,PerformanceMonitor@l mtspr SPRN_IVOR35,r3 sync blr
/* Performance Monitor */ EXCEPTION(0x2060, PerformanceMonitor, performance_monitor_exception, EXC_XFER_STD)
void performance_monitor_exception(struct pt_regs *regs)
{
perf_irq(regs);
}
int reserve_pmc_hardware(perf_irq_t new_perf_irq)
static void op_handle_interrupt(struct pt_regs *regs)
{
model->handle_interrupt(regs, ctr);
}
初期化処理で、ハンドルを奪う。
static int op_powerpc_setup(void)
{
/* Grab the hardware */
err = reserve_pmc_hardware(op_handle_interrupt);
driver登録時点で、以下の初期化が行われている。int __init oprofile_arch_init(struct oprofile_operations *ops) case PPC_OPROFILE_FSL_EMB: model = &op_model_fsl_emb;
static void fsl_emb_handle_interrupt(struct pt_regs *regs, struct op_counter_config *ctr)oprofile_add_ext_sample()でイベント登録。
static inline void
__oprofile_add_ext_sample(unsigned long pc, struct pt_regs * const regs,
unsigned long event, int is_kernel)
{
struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(op_cpu_buffer);
unsigned long backtrace = oprofile_backtrace_depth;
/*
* if log_sample() fail we can't backtrace since we lost the
* source of this event
*/
if (!log_sample(cpu_buf, pc, backtrace, is_kernel, event))
/* failed */
return;
if (!backtrace)
return;
oprofile_begin_trace(cpu_buf);
oprofile_ops.backtrace(regs, backtrace);
oprofile_end_trace(cpu_buf);
}
void oprofile_add_ext_sample(unsigned long pc, struct pt_regs * const regs,
unsigned long event, int is_kernel)
{
__oprofile_add_ext_sample(pc, regs, event, is_kernel);
}
static const char *softirq_names [] =
{
[HI_SOFTIRQ] = "high",
[SCHED_SOFTIRQ] = "sched",
[TIMER_SOFTIRQ] = "timer",
[NET_TX_SOFTIRQ] = "net-tx",
[NET_RX_SOFTIRQ] = "net-rx",
[BLOCK_SOFTIRQ] = "block",
[BLOCK_IOPOLL_SOFTIRQ]= "block-iopoll",
[TASKLET_SOFTIRQ] = "tasklet",
[HRTIMER_SOFTIRQ] = "hrtimer",
[RCU_SOFTIRQ] = "rcu",
};
static struct notifier_block __cpuinitdata cpu_nfb = {
.notifier_call = cpu_callback
};
static __init int spawn_ksoftirqd(void)
{
void *cpu = (void *)(long)smp_processor_id();
int err = cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu);
BUG_ON(err == NOTIFY_BAD);
cpu_callback(&cpu_nfb, CPU_ONLINE, cpu);
register_cpu_notifier(&cpu_nfb);
return 0;
}
early_initcall(spawn_ksoftirqd);
展開すると以下イメージで処理される。
cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu);
for (i = 0; i < NR_SOFTIRQS; i++) {
per_cpu(ksoftirqd, hotcpu)[i].nr = i;
per_cpu(ksoftirqd, hotcpu)[i].cpu = hotcpu;
per_cpu(ksoftirqd, hotcpu)[i].tsk = NULL;
}
for (i = 0; i < NR_SOFTIRQS; i++) {
p = kthread_create(run_ksoftirqd,
&per_cpu(ksoftirqd, hotcpu)[i],
"sirq-%s/%d", softirq_names[i],
hotcpu);
if (IS_ERR(p)) {
printk("ksoftirqd %d for %i failed\n", i,
hotcpu);
return NOTIFY_BAD;
}
kthread_bind(p, hotcpu);
per_cpu(ksoftirqd, hotcpu)[i].tsk = p;
}
cpu_callback(&cpu_nfb, CPU_ONLINE, cpu);
for (i = 0; i < NR_SOFTIRQS; i++) {
param.sched_priority = MAX_RT_PRIO-1;
p = per_cpu(ksoftirqd, hotcpu)[i].tsk;
sched_setscheduler(p, SCHED_FIFO, ¶m);
per_cpu(ksoftirqd, hotcpu)[i].tsk = NULL;
kthread_stop(p);
}
takeover_tasklets(hotcpu);