From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753484AbbLVHqp (ORCPT ); Tue, 22 Dec 2015 02:46:45 -0500 Received: from mx2.suse.de ([195.135.220.15]:43617 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752991AbbLVHqn (ORCPT ); Tue, 22 Dec 2015 02:46:43 -0500 Subject: Re: [PATCH v3 50/77] ncr5380: Change instance->host_lock to hostdata->lock To: Finn Thain , "James E.J. Bottomley" , Michael Schmitz , linux-m68k@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, "Martin K. Petersen" References: <20151222011737.980475848@telegraphics.com.au> <20151222011751.575811401@telegraphics.com.au> From: Hannes Reinecke Message-ID: <5678FFE1.10600@suse.de> Date: Tue, 22 Dec 2015 08:46:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <20151222011751.575811401@telegraphics.com.au> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/22/2015 02:18 AM, Finn Thain wrote: > NCR5380.c presently uses the instance->host_lock spin lock. Convert this > to a new spin lock that protects the NCR5380_hostdata struct. > > atari_NCR5380.c previously used local_irq_save/restore() rather than a > spin lock. Convert this to hostdata->lock in irq mode. For SMP platforms, > the interrupt handler now also acquires the spin lock. > > This brings all locking in the two core drivers into agreement. > > Adding this locking also means that a bunch of volatile qualifiers can be > removed from the members of the NCR5380_hostdata struct. This is done in > a subsequent patch. > > Proper locking will allow the abort handler to locate a command being > aborted. This is presently impossible if the abort handler is invoked when > the command has been moved from a queue to a pointer on the stack. (If > eh_abort_handler can't determine whether a command has been completed > or is still being processed then it can't decide whether to return > success or failure.) > > The hostdata spin lock is now held when calling NCR5380_select() and > NCR5380_information_transfer(). Where possible, the lock is dropped for > polling and PIO transfers. > > Clean up the now-redundant SELECT_ENABLE_REG writes, that used to provide > limited mutual exclusion between information_transfer() and reselect(). > > Accessing hostdata->connected without data races means taking the lock; > cleanup these accesses. > > The new spin lock falls away for m68k and other UP builds, so this should > have little impact there. In the SMP case the new lock should be > uncontested even when the SCSI bus is contested. > > Signed-off-by: Finn Thain > Reviewed-by: Hannes Reinecke Cheers, Hannes -- Dr. Hannes Reinecke zSeries & Storage hare@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)