Re: [guv v2 23/31] tile: Replace __get_cpu_var uses
From: Chris Metcalf
Date: Wed Aug 28 2013 - 13:19:48 EST
On 8/27/2013 10:48 AM, Christoph Lameter wrote:
> On Mon, 26 Aug 2013, Chris Metcalf wrote:
>> > The rest is fine. Would it make more sense for me to fold all these
>> > changes into the tile tree and just have it meet in linux-next? There
>> > are certainly a bunch of other changes staged there which likely also
>> > include more uses of __get_cpu_var...
> Yes. Please stage this patch for the next merge window.
Taken into the tile tree, with one extra change; in arch/tile/kernel/messaging.c, using "__this_cpu_read(msg_state)" generated warnings ("'pscr_ret__.opaque[1u]' is used uninitialized in this function", etc), since msg_state is a struct, so I changed it to be "*__this_cpu_ptr(&msg_state)". Interrupts are disabled here so preemption is not a concern.
In addition, I applied the following commit to clean up the remaining uses that are currently only being carried in the linux-tile tree.
commit db4dd3097952d2fd20e61f820dbb757ba871302d
Author: Chris Metcalf <cmetcalf@xxxxxxxxxx>
Date: Wed Aug 28 12:01:44 2013 -0400
tile: remove newer uses of __get_cpu_var
See commit eb1fe08d458f for the first round.
Signed-off-by: Chris Metcalf <cmetcalf@xxxxxxxxxx>
diff --git a/arch/tile/kernel/kprobes.c b/arch/tile/kernel/kprobes.c
index 1129f52..27cdcac 100644
--- a/arch/tile/kernel/kprobes.c
+++ b/arch/tile/kernel/kprobes.c
@@ -159,7 +159,7 @@ static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb)
static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb)
{
- __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp;
+ __this_cpu_write(current_kprobe, kcb->prev_kprobe.kp);
kcb->kprobe_status = kcb->prev_kprobe.status;
kcb->kprobe_saved_pc = kcb->prev_kprobe.saved_pc;
}
@@ -167,7 +167,7 @@ static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb)
static void __kprobes set_current_kprobe(struct kprobe *p, struct pt_regs *regs,
struct kprobe_ctlblk *kcb)
{
- __get_cpu_var(current_kprobe) = p;
+ __this_cpu_write(current_kprobe, p);
kcb->kprobe_saved_pc = regs->pc;
}
@@ -228,7 +228,7 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
ret = 1;
goto no_kprobe;
}
- p = __get_cpu_var(current_kprobe);
+ p = __this_cpu_read(current_kprobe);
if (p->break_handler && p->break_handler(p, regs))
goto ss_probe;
}
diff --git a/arch/tile/kernel/time.c b/arch/tile/kernel/time.c
index a7a41a1..30c2c34 100644
--- a/arch/tile/kernel/time.c
+++ b/arch/tile/kernel/time.c
@@ -286,7 +286,7 @@ static int _set_clock_rate_barrier;
static int _set_clock_rate(void *arg)
{
struct _set_clock_rate_args *args = arg;
- struct clock_event_device *evt = &__get_cpu_var(tile_timer);
+ struct clock_event_device *evt = get_cpu_ptr(&tile_timer);
/*
* Only one CPU needs to change the timekeeping parameters and
--
Chris Metcalf, Tilera Corp.
http://www.tilera.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/