From patchwork Wed Jun 1 10:03:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 839872 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p51Ci3NL013256 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 1 Jun 2011 12:44:29 GMT Received: from canuck.infradead.org ([134.117.69.58]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QRj23-0003Fq-S9; Wed, 01 Jun 2011 10:52:11 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QRiGe-000289-8R; Wed, 01 Jun 2011 10:03:12 +0000 Received: from galois.linutronix.de ([2001:470:1f0b:1c35:abcd:42:0:1]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QRiGb-00027p-4I for linux-arm-kernel@lists.infradead.org; Wed, 01 Jun 2011 10:03:09 +0000 Received: from localhost ([127.0.0.1]) by Galois.linutronix.de with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1QRiGW-0000gO-Os; Wed, 01 Jun 2011 12:03:04 +0200 Date: Wed, 1 Jun 2011 12:03:03 +0200 (CEST) From: Thomas Gleixner To: Russell King - ARM Linux Subject: Re: [PATCH 3/3] mach-u300: cleanup clockevent code In-Reply-To: <20110601092229.GE3660@n2100.arm.linux.org.uk> Message-ID: References: <1306876145-6778-1-git-send-email-linus.walleij@stericsson.com> <20110601092229.GE3660@n2100.arm.linux.org.uk> User-Agent: Alpine 2.02 (LFD 1266 2009-07-14) MIME-Version: 1.0 X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1, SHORTCIRCUIT=-0.0001 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110601_060309_607673_704B32FC X-CRM114-Status: GOOD ( 14.08 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: Linus Walleij , Lee Jones , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 01 Jun 2011 12:44:29 +0000 (UTC) On Wed, 1 Jun 2011, Russell King - ARM Linux wrote: > On Wed, Jun 01, 2011 at 10:34:46AM +0200, Thomas Gleixner wrote: > > But yeah, we can make it conditional for SMP and simply set > > cpumask_of(0) in the UP case. > > Or cpumask_of(smp_processor_id()) which would also cover the non-CPU0 boot > cases (provided its called on the boot CPU.) Something like the below should work for both UP and SMP diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index c027d4f..739801b 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c @@ -173,6 +173,12 @@ static void clockevents_notify_released(void) } } +#ifdef CONFIG_SMP +# define CPU_MASK_CHECK(x) WARN_ON(!x) +#else +# define CPU_MASK_CHECK(x) (!x) +#endif + /** * clockevents_register_device - register a clock event device * @dev: device to register @@ -182,7 +188,8 @@ void clockevents_register_device(struct clock_event_device *dev) unsigned long flags; BUG_ON(dev->mode != CLOCK_EVT_MODE_UNUSED); - BUG_ON(!dev->cpumask); + if (CPU_MASK_CHECK(dev->cpumask)) + dev->cpumask = cpumask_of(smp_processor_id()); raw_spin_lock_irqsave(&clockevents_lock, flags);