2009-02-19 22:42:31 is it a bug at l1_data_sram_init ?
lights joy (CHINA)
Message: 69664
I'm using 08r1.5-rc3 kernel with smp patch, but the kernel crack at l1_data_sram_init function:
void __init l1_data_sram_init(void)
{
unsigned int cpu;
#if L1_DATA_A_LENGTH != 0
printk(KERN_INFO "Blackfin DATA_A SRAM: %d KB\n",
L1_DATA_A_LENGTH >> 10);
for (cpu = 0; cpu < NR_CPUS; ++cpu) {
memset(&per_cpu(l1sram, cpu).l1_data_A_sram, 0x00,
sizeof(per_cpu(l1sram, cpu).l1_data_A_sram));
per_cpu(l1sram, cpu).l1_data_A_sram[0].paddr = (void *)get_l1_data_a_start_cpu(cpu) +
0x2000/*(_ebss_l1 - _sdata_l1)*/;
per_cpu(l1sram, cpu).l1_data_A_sram[0].size = L1_DATA_A_LENGTH - 0x2000/*(_ebss_l1 - _sdata_l1)*/;
per_cpu(l1sram, cpu).l1_data_A_sram[0].flag = SRAM_SLT_FREE;
}
#endif
#if L1_DATA_B_LENGTH != 0
printk(KERN_INFO "Blackfin DATA_B SRAM: %d KB\n",
L1_DATA_B_LENGTH >> 10);
for (cpu = 0; cpu < NR_CPUS; ++cpu) {
memset(&per_cpu(l1sram, cpu).l1_data_B_sram, 0x00, sizeof(per_cpu(l1sram, cpu).l1_data_B_sram));
per_cpu(l1sram, cpu).l1_data_B_sram[0].paddr = (void *)get_l1_data_b_start_cpu(cpu)+0x2000/*(_ebss_b_l1 - _sdata_b_l1)*/;
per_cpu(l1sram, cpu).l1_data_B_sram[0].size = L1_DATA_B_LENGTH-0x2000/*(_ebss_b_l1 - _sdata_b_l1)*/;
per_cpu(l1sram, cpu).l1_data_B_sram[0].flag = SRAM_SLT_FREE;
}
#endif
/* mutex initialize */
spin_lock_init(&per_cpu(l1sram, cpu).l1_data_sram_lock);
}
the last line:
spin_lock_init(&per_cpu(l1sram, cpu).l1_data_sram_lock);
when kernel runs to here, the cpu variable's value is 2, but
unsigned long __per_cpu_offset[NR_CPUS] __read_mostly;
where NR_CPUS is defined as 2.
so the reference to __per_cpu_offset[2] is illegal.
is this a BUG?