From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753507Ab1A0VQ2 (ORCPT ); Thu, 27 Jan 2011 16:16:28 -0500 Received: from caramon.arm.linux.org.uk ([78.32.30.218]:42231 "EHLO caramon.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752763Ab1A0VQ1 (ORCPT ); Thu, 27 Jan 2011 16:16:27 -0500 Date: Thu, 27 Jan 2011 21:15:56 +0000 From: Russell King - ARM Linux To: Alan Cox Cc: Saravana Kannan , Lorenzo Pieralisi , Vincent Guittot , linux-sh , Ben Herrenschmidt , Sascha Hauer , linux-kernel , Colin Cross , Ben Dooks , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Jeremy Kerr , linux-arm-kernel , Richard Zhao Subject: Re: Locking in the clk API Message-ID: <20110127211556.GD1597@n2100.arm.linux.org.uk> References: <4D386ABF.9060908@fluff.org> <20110120190822.GK6335@n2100.arm.linux.org.uk> <4D3932B4.8010904@codeaurora.org> <20110121094042.GD13235@n2100.arm.linux.org.uk> <4D40F5CC.6080809@codeaurora.org> <20110127085438.GA25239@n2100.arm.linux.org.uk> <4D41D5EC.6030405@codeaurora.org> <20110127204354.GB1597@n2100.arm.linux.org.uk> <20110127210729.79eef2c1@lxorguk.ukuu.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110127210729.79eef2c1@lxorguk.ukuu.org.uk> User-Agent: Mutt/1.5.19 (2009-01-05) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 27, 2011 at 09:07:29PM +0000, Alan Cox wrote: > > > For internal tree purposes, does .set_termios need to be atomic? Can it > > > grab mutexes instead of spinlock? > > > > I think I already answered that question above where I said "protect > > against the interrupt handler accessing the port->* stuff". > > I'm not sure you answered it correctly however as the locking nowdays is > a bit different. Oh, and the other bit to this is protecting the hardware against two concurrent accesses if that's what's required. Eg, 8250 having characters written to the 'transmit' register while DLAB is set, thereby corrupting the divisor being programmed into it. There's other UARTs which shouldn't have FIFOs loaded while the UART is disabled across an update. Can you guarantee without locks that writes to the UART registers by the interrupt handler won't happen while the .set_termios is reprogramming the UART?