From patchwork Tue Mar 31 15:19:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 46597 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 87254216E5 for ; Tue, 31 Mar 2015 15:20:06 +0000 (UTC) Received: by wgtj4 with SMTP id j4sf4451859wgt.0 for ; Tue, 31 Mar 2015 08:20:05 -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=DjvrG5CY1dl4u2LiaxXz+7FCWkoomenbiytT3W+XyxE=; b=VIWLepqQtGIh8N5Ul0PivnA4KZUKZ1BbY35a6cqXpm9nfQvCEEEYJs+0aGr5ccCw+L JyE6jgN353Z8Q+IBbLlE2suCBRrxWPvfwPxhAQMuceZu5ywYkRhC3Rz196NP4qimiGgx Y+j3HnwFng41M6zP2rJUemNhxAT3IPtzVIBOu36PH1a3kfBY0xmyGYDnu9UyKQBn942X KQCg4AzZricmEDmot7fhVz3BzIerHlMv5zmTG+EZYme9fqOQJPNkg71C2Sgy8BR2zBJN /m9e4l4Qjl4ZUZknGPKQ3QLO/AfWgaJnOJLXqPp1T+mOtI6VLuF5OPhTq7eeY7iV4E1s sd3w== X-Gm-Message-State: ALoCoQnyOONcEzAa8UG2mciMI3w9eG5+NpQ5sFDcpJPZ5dsq6MKD3YwIkjtLiX+N8lzT9IMES7pb X-Received: by 10.112.125.67 with SMTP id mo3mr8343856lbb.6.1427815205717; Tue, 31 Mar 2015 08:20:05 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.28.100 with SMTP id a4ls698550lah.23.gmail; Tue, 31 Mar 2015 08:20:05 -0700 (PDT) X-Received: by 10.152.120.202 with SMTP id le10mr30845023lab.115.1427815205528; Tue, 31 Mar 2015 08:20:05 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id eo7si9369405lac.118.2015.03.31.08.20.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Mar 2015 08:20:05 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbdc10 with SMTP id c10so14960914lbd.2 for ; Tue, 31 Mar 2015 08:20:05 -0700 (PDT) X-Received: by 10.152.28.5 with SMTP id x5mr30752776lag.112.1427815205218; Tue, 31 Mar 2015 08:20:05 -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.112.57.201 with SMTP id k9csp51963lbq; Tue, 31 Mar 2015 08:20:04 -0700 (PDT) X-Received: by 10.68.57.170 with SMTP id j10mr19308625pbq.89.1427815201854; Tue, 31 Mar 2015 08:20:01 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g4si19870056pdd.111.2015.03.31.08.20.00; Tue, 31 Mar 2015 08:20:01 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932346AbbCaPT4 (ORCPT + 27 others); Tue, 31 Mar 2015 11:19:56 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:35966 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932298AbbCaPTu (ORCPT ); Tue, 31 Mar 2015 11:19:50 -0400 Received: by padcy3 with SMTP id cy3so22565860pad.3 for ; Tue, 31 Mar 2015 08:19:50 -0700 (PDT) X-Received: by 10.70.55.65 with SMTP id q1mr69801843pdp.35.1427815189910; Tue, 31 Mar 2015 08:19:49 -0700 (PDT) Received: from localhost ([122.167.118.120]) by mx.google.com with ESMTPSA id v8sm6367340pdq.61.2015.03.31.08.19.48 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 31 Mar 2015 08:19:49 -0700 (PDT) From: Viresh Kumar To: Ingo Molnar , Peter Zijlstra , Thomas Gleixner Cc: linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, Viresh Kumar Subject: [PATCH V2 3/3] timer: Further simplify SMP and HOTPLUG logic Date: Tue, 31 Mar 2015 20:49:02 +0530 Message-Id: X-Mailer: git-send-email 2.3.0.rc0.44.ga94655d 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=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) 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: , From: Peter Zijlstra Remove one CONFIG_HOTPLUG_CPU #ifdef in trade for introducing one CONFIG_SMP #ifdef. The CONFIG_SMP ifdef avoids declaring the per-cpu __tvec_bases storage on UP systems since they already have boot_tvec_bases. Also (re)add a runtime check on the base alignment -- for the paranoid amongst us :-) Cc: Thomas Gleixner Cc: linaro-kernel@lists.linaro.org Cc: Ingo Molnar Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Viresh Kumar --- kernel/time/timer.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 1feb9c7035c0..aa03ac8c8d98 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -101,7 +101,9 @@ struct tvec_base { */ struct tvec_base boot_tvec_bases; EXPORT_SYMBOL(boot_tvec_bases); +#ifdef CONFIG_SMP static DEFINE_PER_CPU(struct tvec_base, __tvec_bases); +#endif static DEFINE_PER_CPU(struct tvec_base *, tvec_bases) = &boot_tvec_bases; @@ -1591,12 +1593,10 @@ static void migrate_timers(int cpu) spin_unlock_irq(&new_base->lock); put_cpu_var(tvec_bases); } -#endif /* CONFIG_HOTPLUG_CPU */ static int timer_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu) { -#ifdef CONFIG_HOTPLUG_CPU switch (action) { case CPU_DEAD: case CPU_DEAD_FROZEN: @@ -1605,18 +1605,17 @@ static int timer_cpu_notify(struct notifier_block *self, default: break; } -#endif + return NOTIFY_OK; } - -static struct notifier_block timers_nb = { - .notifier_call = timer_cpu_notify, -}; +#endif /* CONFIG_HOTPLUG_CPU */ static void __init init_timer_cpu(struct tvec_base *base, int cpu) { int j; + BUG_ON(base != tbase_get_base(base)); + base->cpu = cpu; per_cpu(tvec_bases, cpu) = base; spin_lock_init(&base->lock); @@ -1643,8 +1642,10 @@ static void __init init_timer_cpus(void) for_each_possible_cpu(cpu) { if (cpu == local_cpu) base = &boot_tvec_bases; +#ifdef CONFIG_SMP else base = per_cpu_ptr(&__tvec_bases, cpu); +#endif init_timer_cpu(base, cpu); } @@ -1657,7 +1658,7 @@ void __init init_timers(void) init_timer_cpus(); init_timer_stats(); - register_cpu_notifier(&timers_nb); + cpu_notifier(timer_cpu_notify, 0); open_softirq(TIMER_SOFTIRQ, run_timer_softirq); }