Skip to content

Commit 718340f

Browse files
Graf Yangvapier
authored andcommitted
Blackfin: rewrite resync_core_{i,d}cache() SMP logic to avoid per_cpu data
This functions are implicitly called by core functions like cpu_relax(), and since those functions may be called early on before common code has initialized the per-cpu data area, we need to tweak the stats gathering. Now the statistics are maintained in common bss which makes these funcs safe to use as soon as the C runtime env is setup. Signed-off-by: Graf Yang <graf.yang@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
1 parent 6c2b707 commit 718340f

4 files changed

Lines changed: 13 additions & 6 deletions

File tree

‎arch/blackfin/include/asm/cpu.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ struct blackfin_cpudata {
1717
struct task_struct *idle;
1818
unsigned int imemctl;
1919
unsigned int dmemctl;
20-
unsigned long dcache_invld_count;
21-
unsigned long icache_invld_count;
2220
};
2321

2422
DECLARE_PER_CPU(struct blackfin_cpudata, cpu_data);

‎arch/blackfin/include/asm/smp.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ struct corelock_slot {
2424
};
2525
extern struct corelock_slot corelock;
2626

27+
#ifdef __ARCH_SYNC_CORE_ICACHE
28+
extern unsigned long icache_invld_count[NR_CPUS];
29+
#endif
30+
#ifdef __ARCH_SYNC_CORE_DCACHE
31+
extern unsigned long dcache_invld_count[NR_CPUS];
32+
#endif
33+
2734
void smp_icache_flush_range_others(unsigned long start,
2835
unsigned long end);
2936
#ifdef CONFIG_HOTPLUG_CPU

‎arch/blackfin/kernel/setup.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,10 +1239,10 @@ static int show_cpuinfo(struct seq_file *m, void *v)
12391239
dsup_banks, BFIN_DSUBBANKS, BFIN_DWAYS,
12401240
BFIN_DLINES);
12411241
#ifdef __ARCH_SYNC_CORE_DCACHE
1242-
seq_printf(m, "SMP Dcache Flushes\t: %lu\n\n", cpudata->dcache_invld_count);
1242+
seq_printf(m, "SMP Dcache Flushes\t: %lu\n\n", dcache_invld_count[cpu_num]);
12431243
#endif
12441244
#ifdef __ARCH_SYNC_CORE_ICACHE
1245-
seq_printf(m, "SMP Icache Flushes\t: %lu\n\n", cpudata->icache_invld_count);
1245+
seq_printf(m, "SMP Icache Flushes\t: %lu\n\n", icache_invld_count[cpu_num]);
12461246
#endif
12471247

12481248
if (cpu_num != num_possible_cpus() - 1)

‎arch/blackfin/mach-common/smp.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,24 +474,26 @@ void smp_icache_flush_range_others(unsigned long start, unsigned long end)
474474
EXPORT_SYMBOL_GPL(smp_icache_flush_range_others);
475475

476476
#ifdef __ARCH_SYNC_CORE_ICACHE
477+
unsigned long icache_invld_count[NR_CPUS];
477478
void resync_core_icache(void)
478479
{
479480
unsigned int cpu = get_cpu();
480481
blackfin_invalidate_entire_icache();
481-
++per_cpu(cpu_data, cpu).icache_invld_count;
482+
icache_invld_count[cpu]++;
482483
put_cpu();
483484
}
484485
EXPORT_SYMBOL(resync_core_icache);
485486
#endif
486487

487488
#ifdef __ARCH_SYNC_CORE_DCACHE
489+
unsigned long dcache_invld_count[NR_CPUS];
488490
unsigned long barrier_mask __attribute__ ((__section__(".l2.bss")));
489491

490492
void resync_core_dcache(void)
491493
{
492494
unsigned int cpu = get_cpu();
493495
blackfin_invalidate_entire_dcache();
494-
++per_cpu(cpu_data, cpu).dcache_invld_count;
496+
dcache_invld_count[cpu]++;
495497
put_cpu();
496498
}
497499
EXPORT_SYMBOL(resync_core_dcache);

0 commit comments

Comments
 (0)