From patchwork Mon Apr 14 16:23:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 28335 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B58DB20534 for ; Mon, 14 Apr 2014 16:25:14 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id va2sf15835885obc.1 for ; Mon, 14 Apr 2014 09:25:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=OF/y0S6GAZoEyUj5/Dy6wQKNsRSZ7jRO5E7x40Ssosc=; b=cbkYAUkpiVI6T3eUl7r7hFZh71jcP7LN4iAy24b4SLPJOZwHthNoUGeIsY/HqxMX9A XfqueC0FrVOKd1mFY85EfPPVbki1SrvaYOpsEyMpsrMbprjAV6FJbjs22Ncs7XXOwn1p mVKmxxqupl04rcleGD9cfACEF8h0orw5Aw+aMwqIAx+w7yxASh31IyJK9rA4JMTGfSt8 Ef4X5btDnDozjEhFfoweo1Yun9bUDFJRBJNxA0kUB6DS8oNuT7dBjSJzfU9JquEk1fAX ep0GElVjoalZX9bpr85qTCsLmWWblYFXeYvgRn7HRUPqwy0Teoi6ffDbhrdGh8DH7ST4 ak3w== X-Gm-Message-State: ALoCoQlC9K2BD62rdnbzidmRW3meAIzgH28sYhdoQnmrEla5eWHQJqeFeZO6pqRsi7FAlWzitxjQ X-Received: by 10.50.108.47 with SMTP id hh15mr7972778igb.3.1397492714225; Mon, 14 Apr 2014 09:25:14 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.83.115 with SMTP id i106ls2397390qgd.97.gmail; Mon, 14 Apr 2014 09:25:14 -0700 (PDT) X-Received: by 10.52.37.196 with SMTP id a4mr1852284vdk.33.1397492713989; Mon, 14 Apr 2014 09:25:13 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id eb17si2832459veb.22.2014.04.14.09.25.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 14 Apr 2014 09:25:13 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id il7so7677394vcb.18 for ; Mon, 14 Apr 2014 09:25:13 -0700 (PDT) X-Received: by 10.221.4.66 with SMTP id ob2mr1940760vcb.28.1397492713902; Mon, 14 Apr 2014 09:25:13 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp162725vcb; Mon, 14 Apr 2014 09:25:13 -0700 (PDT) X-Received: by 10.68.143.196 with SMTP id sg4mr3112666pbb.155.1397492712347; Mon, 14 Apr 2014 09:25:12 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3si9150226paw.45.2014.04.14.09.25.11; Mon, 14 Apr 2014 09:25:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755357AbaDNQYx (ORCPT + 26 others); Mon, 14 Apr 2014 12:24:53 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:33641 "EHLO mail-pb0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754839AbaDNQYt (ORCPT ); Mon, 14 Apr 2014 12:24:49 -0400 Received: by mail-pb0-f45.google.com with SMTP id uo5so8398796pbc.18 for ; Mon, 14 Apr 2014 09:24:48 -0700 (PDT) X-Received: by 10.68.99.194 with SMTP id es2mr45128941pbb.100.1397492688241; Mon, 14 Apr 2014 09:24:48 -0700 (PDT) Received: from localhost ([122.167.126.16]) by mx.google.com with ESMTPSA id ss2sm82503548pab.8.2014.04.14.09.24.44 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 14 Apr 2014 09:24:46 -0700 (PDT) From: Viresh Kumar To: tglx@linutronix.de Cc: linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, fweisbec@gmail.com, Arvind.Chauhan@arm.com, linaro-networking@linaro.org, Viresh Kumar Subject: [PATCH 06/38] tick: create tick_get_cpu_device() to get tick_cpu_device on this cpu Date: Mon, 14 Apr 2014 21:53:28 +0530 Message-Id: X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , We are accessing &__get_cpu_var(tick_cpu_device) at several places in kernel. Lets create another routine tick_get_cpu_device() which would return tick_cpu_device for this-cpu. Signed-off-by: Viresh Kumar --- include/linux/tick.h | 5 +++++ kernel/hrtimer.c | 2 +- kernel/time/tick-broadcast.c | 4 ++-- kernel/time/tick-common.c | 8 ++++---- kernel/time/tick-oneshot.c | 8 ++++---- kernel/time/tick-sched.c | 2 +- 6 files changed, 17 insertions(+), 12 deletions(-) diff --git a/include/linux/tick.h b/include/linux/tick.h index 45e1331..98065e5 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -92,6 +92,11 @@ static inline struct tick_device *tick_get_device(int cpu) return &per_cpu(tick_cpu_device, cpu); } +static inline struct tick_device *tick_get_cpu_device(void) +{ + return &__get_cpu_var(tick_cpu_device); +} + # ifdef CONFIG_HIGH_RES_TIMERS extern int tick_init_highres(void); extern int tick_program_event(ktime_t expires, int force); diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index d55092c..393f422 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -1403,7 +1403,7 @@ static void __hrtimer_peek_ahead_timers(void) if (!hrtimer_hres_active()) return; - td = &__get_cpu_var(tick_cpu_device); + td = tick_get_cpu_device(); if (td && td->evtdev) hrtimer_interrupt(td->evtdev); } diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index eb0479a..1597d03 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -235,7 +235,7 @@ int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu) #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST int tick_receive_broadcast(void) { - struct tick_device *td = this_cpu_ptr(&tick_cpu_device); + struct tick_device *td = tick_get_cpu_device(); struct clock_event_device *evt = td->evtdev; if (!evt) @@ -550,7 +550,7 @@ int tick_resume_broadcast_oneshot(struct clock_event_device *bc) void tick_check_oneshot_broadcast_this_cpu(void) { if (cpumask_test_cpu(smp_processor_id(), tick_broadcast_oneshot_mask)) { - struct tick_device *td = &__get_cpu_var(tick_cpu_device); + struct tick_device *td = tick_get_cpu_device(); /* * We might be in the middle of switching over from diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index c7859b7..b4fdb28 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c @@ -58,7 +58,7 @@ int tick_do_timer_cpu __read_mostly = TICK_DO_TIMER_BOOT; */ int tick_is_oneshot_available(void) { - struct clock_event_device *dev = __this_cpu_read(tick_cpu_device.evtdev); + struct clock_event_device *dev = tick_get_cpu_device()->evtdev; if (!dev || !(dev->features & CLOCK_EVT_FEAT_ONESHOT)) return 0; @@ -219,7 +219,7 @@ static void tick_setup_device(struct tick_device *td, void tick_install_replacement(struct clock_event_device *newdev) { - struct tick_device *td = &__get_cpu_var(tick_cpu_device); + struct tick_device *td = tick_get_cpu_device(); int cpu = smp_processor_id(); clockevents_exchange_device(td->evtdev, newdev); @@ -369,14 +369,14 @@ void tick_shutdown(unsigned int *cpup) void tick_suspend(void) { - struct tick_device *td = &__get_cpu_var(tick_cpu_device); + struct tick_device *td = tick_get_cpu_device(); clockevents_shutdown(td->evtdev); } void tick_resume(void) { - struct tick_device *td = &__get_cpu_var(tick_cpu_device); + struct tick_device *td = tick_get_cpu_device(); int broadcast = tick_resume_broadcast(); clockevents_set_mode(td->evtdev, CLOCK_EVT_MODE_RESUME); diff --git a/kernel/time/tick-oneshot.c b/kernel/time/tick-oneshot.c index e04d5a0..6a531ec 100644 --- a/kernel/time/tick-oneshot.c +++ b/kernel/time/tick-oneshot.c @@ -26,7 +26,7 @@ */ int tick_program_event(ktime_t expires, int force) { - struct clock_event_device *dev = __this_cpu_read(tick_cpu_device.evtdev); + struct clock_event_device *dev = tick_get_cpu_device()->evtdev; return clockevents_program_event(dev, expires, force); } @@ -36,7 +36,7 @@ int tick_program_event(ktime_t expires, int force) */ void tick_resume_oneshot(void) { - struct clock_event_device *dev = __this_cpu_read(tick_cpu_device.evtdev); + struct clock_event_device *dev = tick_get_cpu_device()->evtdev; clockevents_set_mode(dev, CLOCK_EVT_MODE_ONESHOT); clockevents_program_event(dev, ktime_get(), true); @@ -59,7 +59,7 @@ void tick_setup_oneshot(struct clock_event_device *newdev, */ int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *)) { - struct tick_device *td = &__get_cpu_var(tick_cpu_device); + struct tick_device *td = tick_get_cpu_device(); struct clock_event_device *dev = td->evtdev; if (!dev || !(dev->features & CLOCK_EVT_FEAT_ONESHOT) || @@ -96,7 +96,7 @@ int tick_oneshot_mode_active(void) int ret; local_irq_save(flags); - ret = __this_cpu_read(tick_cpu_device.mode) == TICKDEV_MODE_ONESHOT; + ret = tick_get_cpu_device()->mode == TICKDEV_MODE_ONESHOT; local_irq_restore(flags); return ret; diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index d48d648..649b920 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -533,7 +533,7 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts, unsigned long seq, last_jiffies, next_jiffies, delta_jiffies; ktime_t last_update, expires, ret = { .tv64 = 0 }; unsigned long rcu_delta_jiffies; - struct clock_event_device *dev = __get_cpu_var(tick_cpu_device).evtdev; + struct clock_event_device *dev = tick_get_cpu_device()->evtdev; u64 time_delta; time_delta = timekeeping_max_deferment();