Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932385AbbEUWJi (ORCPT ); Thu, 21 May 2015 18:09:38 -0400 Received: from www.linutronix.de ([62.245.132.108]:40417 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754853AbbEUWJe (ORCPT ); Thu, 21 May 2015 18:09:34 -0400 Date: Fri, 22 May 2015 00:09:42 +0200 (CEST) From: Thomas Gleixner To: Ezequiel Garcia cc: linux-kernel@vger.kernel.org, linux-mips@linux-mips.org, Daniel Lezcano , devicetree@vger.kernel.org, Andrew Bresticker , James Hartley , James Hogan , Damien.Horsley@imgtec.com, Govindraj.Raja@imgtec.com Subject: Re: [PATCH 6/7] clocksource: Add Pistachio clocksource-only driver In-Reply-To: <555E55F4.2060500@imgtec.com> Message-ID: References: <1432244260-14908-1-git-send-email-ezequiel.garcia@imgtec.com> <1432244506-15388-1-git-send-email-ezequiel.garcia@imgtec.com> <555E55F4.2060500@imgtec.com> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1050 Lines: 29 On Thu, 21 May 2015, Ezequiel Garcia wrote: > On 05/21/2015 07:00 PM, Thomas Gleixner wrote: > > On Thu, 21 May 2015, Ezequiel Garcia wrote: > >> +static cycle_t clocksource_read_cycles(struct clocksource *cs) > >> +{ > >> + u32 counter, overflw; > >> + unsigned long flags; > >> + > >> + raw_spin_lock_irqsave(&lock, flags); > > > > Hmm. Is that lock really necessary to read that counter? The > > clocksource is global. And if its actually used for timekeeping, the > > lock can get heavy contended. > > > > Yup, it is really (and sadly) necessary. The kernel hangs up completely > without it when the counter is accesed by more than one CPU. > > Apparently, those two timer registers overflow and counter must be read > atomically. Welcome to the wonderful world of useless timer hardware. tglx -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/