Skip to content

Commit

Permalink
percpu: make percpu symbols in powerpc unique
Browse files Browse the repository at this point in the history
This patch updates percpu related symbols in powerpc such that percpu
symbols are unique and don't clash with local symbols.  This serves
two purposes of decreasing the possibility of global percpu symbol
collision and allowing dropping per_cpu__ prefix from percpu symbols.

* arch/powerpc/kernel/perf_callchain.c: s/callchain/cpu_perf_callchain/

* arch/powerpc/kernel/setup-common.c: s/pvr/cpu_pvr/

* arch/powerpc/platforms/pseries/dtl.c: s/dtl/cpu_dtl/

* arch/powerpc/platforms/cell/interrupt.c: s/iic/cpu_iic/

Partly based on Rusty Russell's "alloc_percpu: rename percpu vars
which cause name clashes" patch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@ozlabs.org
  • Loading branch information
Tejun Heo committed Oct 29, 2009
1 parent 0fe1e00 commit 6b7487f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion arch/powerpc/include/asm/smp.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extern void cpu_die(void);
extern void smp_send_debugger_break(int cpu);
extern void smp_message_recv(int);

DECLARE_PER_CPU(unsigned int, pvr);
DECLARE_PER_CPU(unsigned int, cpu_pvr);

#ifdef CONFIG_HOTPLUG_CPU
extern void fixup_irqs(cpumask_t map);
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/kernel/perf_callchain.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,11 +497,11 @@ static void perf_callchain_user_32(struct pt_regs *regs,
* Since we can't get PMU interrupts inside a PMU interrupt handler,
* we don't need separate irq and nmi entries here.
*/
static DEFINE_PER_CPU(struct perf_callchain_entry, callchain);
static DEFINE_PER_CPU(struct perf_callchain_entry, cpu_perf_callchain);

struct perf_callchain_entry *perf_callchain(struct pt_regs *regs)
{
struct perf_callchain_entry *entry = &__get_cpu_var(callchain);
struct perf_callchain_entry *entry = &__get_cpu_var(cpu_perf_callchain);

entry->nr = 0;

Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/kernel/setup-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ extern u32 cpu_temp_both(unsigned long cpu);
#endif /* CONFIG_TAU */

#ifdef CONFIG_SMP
DEFINE_PER_CPU(unsigned int, pvr);
DEFINE_PER_CPU(unsigned int, cpu_pvr);
#endif

static int show_cpuinfo(struct seq_file *m, void *v)
Expand Down Expand Up @@ -209,7 +209,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
}

#ifdef CONFIG_SMP
pvr = per_cpu(pvr, cpu_id);
pvr = per_cpu(cpu_pvr, cpu_id);
#else
pvr = mfspr(SPRN_PVR);
#endif
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ struct thread_info *current_set[NR_CPUS];

static void __devinit smp_store_cpu_info(int id)
{
per_cpu(pvr, id) = mfspr(SPRN_PVR);
per_cpu(cpu_pvr, id) = mfspr(SPRN_PVR);
}

static void __init smp_create_idle(unsigned int cpu)
Expand Down
14 changes: 7 additions & 7 deletions arch/powerpc/platforms/cell/interrupt.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct iic {
struct device_node *node;
};

static DEFINE_PER_CPU(struct iic, iic);
static DEFINE_PER_CPU(struct iic, cpu_iic);
#define IIC_NODE_COUNT 2
static struct irq_host *iic_host;

Expand Down Expand Up @@ -82,7 +82,7 @@ static void iic_unmask(unsigned int irq)

static void iic_eoi(unsigned int irq)
{
struct iic *iic = &__get_cpu_var(iic);
struct iic *iic = &__get_cpu_var(cpu_iic);
out_be64(&iic->regs->prio, iic->eoi_stack[--iic->eoi_ptr]);
BUG_ON(iic->eoi_ptr < 0);
}
Expand Down Expand Up @@ -146,7 +146,7 @@ static unsigned int iic_get_irq(void)
struct iic *iic;
unsigned int virq;

iic = &__get_cpu_var(iic);
iic = &__get_cpu_var(cpu_iic);
*(unsigned long *) &pending =
in_be64((u64 __iomem *) &iic->regs->pending_destr);
if (!(pending.flags & CBE_IIC_IRQ_VALID))
Expand All @@ -161,12 +161,12 @@ static unsigned int iic_get_irq(void)

void iic_setup_cpu(void)
{
out_be64(&__get_cpu_var(iic).regs->prio, 0xff);
out_be64(&__get_cpu_var(cpu_iic).regs->prio, 0xff);
}

u8 iic_get_target_id(int cpu)
{
return per_cpu(iic, cpu).target_id;
return per_cpu(cpu_iic, cpu).target_id;
}

EXPORT_SYMBOL_GPL(iic_get_target_id);
Expand All @@ -181,7 +181,7 @@ static inline int iic_ipi_to_irq(int ipi)

void iic_cause_IPI(int cpu, int mesg)
{
out_be64(&per_cpu(iic, cpu).regs->generate, (0xf - mesg) << 4);
out_be64(&per_cpu(cpu_iic, cpu).regs->generate, (0xf - mesg) << 4);
}

struct irq_host *iic_get_irq_host(int node)
Expand Down Expand Up @@ -348,7 +348,7 @@ static void __init init_one_iic(unsigned int hw_cpu, unsigned long addr,
/* XXX FIXME: should locate the linux CPU number from the HW cpu
* number properly. We are lucky for now
*/
struct iic *iic = &per_cpu(iic, hw_cpu);
struct iic *iic = &per_cpu(cpu_iic, hw_cpu);

iic->regs = ioremap(addr, sizeof(struct cbe_iic_thread_regs));
BUG_ON(iic->regs == NULL);
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/platforms/pseries/dtl.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct dtl {
int buf_entries;
u64 last_idx;
};
static DEFINE_PER_CPU(struct dtl, dtl);
static DEFINE_PER_CPU(struct dtl, cpu_dtl);

/*
* Dispatch trace log event mask:
Expand Down Expand Up @@ -261,7 +261,7 @@ static int dtl_init(void)

/* set up the per-cpu log structures */
for_each_possible_cpu(i) {
struct dtl *dtl = &per_cpu(dtl, i);
struct dtl *dtl = &per_cpu(cpu_dtl, i);
dtl->cpu = i;

rc = dtl_setup_file(dtl);
Expand Down

0 comments on commit 6b7487f

Please sign in to comment.