Commit 2113f469 authored by Alex Shi's avatar Alex Shi Committed by Konrad Rzeszutek Wilk

xen: use this_cpu_xxx replace percpu_xxx funcs

percpu_xxx funcs are duplicated with this_cpu_xxx funcs, so replace them
for further code clean up.

I don't know much of xen code. But, since the code is in x86 architecture,
the percpu_xxx is exactly same as this_cpu_xxx serials functions. So, the
change is safe.
Signed-off-by: default avatarAlex Shi <alex.shi@intel.com>
Acked-by: default avatarChristoph Lameter <cl@gentwo.org>
Acked-by: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
parent cd9db80e
...@@ -777,11 +777,11 @@ static DEFINE_PER_CPU(unsigned long, xen_cr0_value); ...@@ -777,11 +777,11 @@ static DEFINE_PER_CPU(unsigned long, xen_cr0_value);
static unsigned long xen_read_cr0(void) static unsigned long xen_read_cr0(void)
{ {
unsigned long cr0 = percpu_read(xen_cr0_value); unsigned long cr0 = this_cpu_read(xen_cr0_value);
if (unlikely(cr0 == 0)) { if (unlikely(cr0 == 0)) {
cr0 = native_read_cr0(); cr0 = native_read_cr0();
percpu_write(xen_cr0_value, cr0); this_cpu_write(xen_cr0_value, cr0);
} }
return cr0; return cr0;
...@@ -791,7 +791,7 @@ static void xen_write_cr0(unsigned long cr0) ...@@ -791,7 +791,7 @@ static void xen_write_cr0(unsigned long cr0)
{ {
struct multicall_space mcs; struct multicall_space mcs;
percpu_write(xen_cr0_value, cr0); this_cpu_write(xen_cr0_value, cr0);
/* Only pay attention to cr0.TS; everything else is /* Only pay attention to cr0.TS; everything else is
ignored. */ ignored. */
......
...@@ -26,7 +26,7 @@ static unsigned long xen_save_fl(void) ...@@ -26,7 +26,7 @@ static unsigned long xen_save_fl(void)
struct vcpu_info *vcpu; struct vcpu_info *vcpu;
unsigned long flags; unsigned long flags;
vcpu = percpu_read(xen_vcpu); vcpu = this_cpu_read(xen_vcpu);
/* flag has opposite sense of mask */ /* flag has opposite sense of mask */
flags = !vcpu->evtchn_upcall_mask; flags = !vcpu->evtchn_upcall_mask;
...@@ -50,7 +50,7 @@ static void xen_restore_fl(unsigned long flags) ...@@ -50,7 +50,7 @@ static void xen_restore_fl(unsigned long flags)
make sure we're don't switch CPUs between getting the vcpu make sure we're don't switch CPUs between getting the vcpu
pointer and updating the mask. */ pointer and updating the mask. */
preempt_disable(); preempt_disable();
vcpu = percpu_read(xen_vcpu); vcpu = this_cpu_read(xen_vcpu);
vcpu->evtchn_upcall_mask = flags; vcpu->evtchn_upcall_mask = flags;
preempt_enable_no_resched(); preempt_enable_no_resched();
...@@ -72,7 +72,7 @@ static void xen_irq_disable(void) ...@@ -72,7 +72,7 @@ static void xen_irq_disable(void)
make sure we're don't switch CPUs between getting the vcpu make sure we're don't switch CPUs between getting the vcpu
pointer and updating the mask. */ pointer and updating the mask. */
preempt_disable(); preempt_disable();
percpu_read(xen_vcpu)->evtchn_upcall_mask = 1; this_cpu_read(xen_vcpu)->evtchn_upcall_mask = 1;
preempt_enable_no_resched(); preempt_enable_no_resched();
} }
PV_CALLEE_SAVE_REGS_THUNK(xen_irq_disable); PV_CALLEE_SAVE_REGS_THUNK(xen_irq_disable);
...@@ -86,7 +86,7 @@ static void xen_irq_enable(void) ...@@ -86,7 +86,7 @@ static void xen_irq_enable(void)
the caller is confused and is trying to re-enable interrupts the caller is confused and is trying to re-enable interrupts
on an indeterminate processor. */ on an indeterminate processor. */
vcpu = percpu_read(xen_vcpu); vcpu = this_cpu_read(xen_vcpu);
vcpu->evtchn_upcall_mask = 0; vcpu->evtchn_upcall_mask = 0;
/* Doesn't matter if we get preempted here, because any /* Doesn't matter if we get preempted here, because any
......
...@@ -1071,14 +1071,14 @@ static void drop_other_mm_ref(void *info) ...@@ -1071,14 +1071,14 @@ static void drop_other_mm_ref(void *info)
struct mm_struct *mm = info; struct mm_struct *mm = info;
struct mm_struct *active_mm; struct mm_struct *active_mm;
active_mm = percpu_read(cpu_tlbstate.active_mm); active_mm = this_cpu_read(cpu_tlbstate.active_mm);
if (active_mm == mm && percpu_read(cpu_tlbstate.state) != TLBSTATE_OK) if (active_mm == mm && this_cpu_read(cpu_tlbstate.state) != TLBSTATE_OK)
leave_mm(smp_processor_id()); leave_mm(smp_processor_id());
/* If this cpu still has a stale cr3 reference, then make sure /* If this cpu still has a stale cr3 reference, then make sure
it has been flushed. */ it has been flushed. */
if (percpu_read(xen_current_cr3) == __pa(mm->pgd)) if (this_cpu_read(xen_current_cr3) == __pa(mm->pgd))
load_cr3(swapper_pg_dir); load_cr3(swapper_pg_dir);
} }
...@@ -1185,17 +1185,17 @@ static void __init xen_pagetable_setup_done(pgd_t *base) ...@@ -1185,17 +1185,17 @@ static void __init xen_pagetable_setup_done(pgd_t *base)
static void xen_write_cr2(unsigned long cr2) static void xen_write_cr2(unsigned long cr2)
{ {
percpu_read(xen_vcpu)->arch.cr2 = cr2; this_cpu_read(xen_vcpu)->arch.cr2 = cr2;
} }
static unsigned long xen_read_cr2(void) static unsigned long xen_read_cr2(void)
{ {
return percpu_read(xen_vcpu)->arch.cr2; return this_cpu_read(xen_vcpu)->arch.cr2;
} }
unsigned long xen_read_cr2_direct(void) unsigned long xen_read_cr2_direct(void)
{ {
return percpu_read(xen_vcpu_info.arch.cr2); return this_cpu_read(xen_vcpu_info.arch.cr2);
} }
static void xen_flush_tlb(void) static void xen_flush_tlb(void)
...@@ -1278,12 +1278,12 @@ static void xen_flush_tlb_others(const struct cpumask *cpus, ...@@ -1278,12 +1278,12 @@ static void xen_flush_tlb_others(const struct cpumask *cpus,
static unsigned long xen_read_cr3(void) static unsigned long xen_read_cr3(void)
{ {
return percpu_read(xen_cr3); return this_cpu_read(xen_cr3);
} }
static void set_current_cr3(void *v) static void set_current_cr3(void *v)
{ {
percpu_write(xen_current_cr3, (unsigned long)v); this_cpu_write(xen_current_cr3, (unsigned long)v);
} }
static void __xen_write_cr3(bool kernel, unsigned long cr3) static void __xen_write_cr3(bool kernel, unsigned long cr3)
...@@ -1306,7 +1306,7 @@ static void __xen_write_cr3(bool kernel, unsigned long cr3) ...@@ -1306,7 +1306,7 @@ static void __xen_write_cr3(bool kernel, unsigned long cr3)
xen_extend_mmuext_op(&op); xen_extend_mmuext_op(&op);
if (kernel) { if (kernel) {
percpu_write(xen_cr3, cr3); this_cpu_write(xen_cr3, cr3);
/* Update xen_current_cr3 once the batch has actually /* Update xen_current_cr3 once the batch has actually
been submitted. */ been submitted. */
...@@ -1322,7 +1322,7 @@ static void xen_write_cr3(unsigned long cr3) ...@@ -1322,7 +1322,7 @@ static void xen_write_cr3(unsigned long cr3)
/* Update while interrupts are disabled, so its atomic with /* Update while interrupts are disabled, so its atomic with
respect to ipis */ respect to ipis */
percpu_write(xen_cr3, cr3); this_cpu_write(xen_cr3, cr3);
__xen_write_cr3(true, cr3); __xen_write_cr3(true, cr3);
......
...@@ -47,7 +47,7 @@ static inline void xen_mc_issue(unsigned mode) ...@@ -47,7 +47,7 @@ static inline void xen_mc_issue(unsigned mode)
xen_mc_flush(); xen_mc_flush();
/* restore flags saved in xen_mc_batch */ /* restore flags saved in xen_mc_batch */
local_irq_restore(percpu_read(xen_mc_irq_flags)); local_irq_restore(this_cpu_read(xen_mc_irq_flags));
} }
/* Set up a callback to be called when the current batch is flushed */ /* Set up a callback to be called when the current batch is flushed */
......
...@@ -76,7 +76,7 @@ static void __cpuinit cpu_bringup(void) ...@@ -76,7 +76,7 @@ static void __cpuinit cpu_bringup(void)
xen_setup_cpu_clockevents(); xen_setup_cpu_clockevents();
set_cpu_online(cpu, true); set_cpu_online(cpu, true);
percpu_write(cpu_state, CPU_ONLINE); this_cpu_write(cpu_state, CPU_ONLINE);
wmb(); wmb();
/* We can take interrupts now: we're officially "up". */ /* We can take interrupts now: we're officially "up". */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment