From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937385AbdAEWAD (ORCPT ); Thu, 5 Jan 2017 17:00:03 -0500 Received: from imap.thunk.org ([74.207.234.97]:44794 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761412AbdAEV74 (ORCPT ); Thu, 5 Jan 2017 16:59:56 -0500 Date: Thu, 5 Jan 2017 16:59:40 -0500 From: "Theodore Ts'o" To: Thadeu Lima de Souza Cascardo Cc: One Thousand Gnomes , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org, Russell King Subject: Re: [PATCH] serial/8250: remove comment about schedule_timeout Message-ID: <20170105215940.nzezqi5qmubaw56x@thunk.org> Mail-Followup-To: Theodore Ts'o , Thadeu Lima de Souza Cascardo , One Thousand Gnomes , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org, Russell King References: <20170105154840.24795-1-cascardo@canonical.com> <20170105164016.79c6e594@lxorguk.ukuu.org.uk> <20170105171744.qgax752sxcwqod2w@calabresa> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170105171744.qgax752sxcwqod2w@calabresa> User-Agent: NeoMutt/20161126 (1.7.1) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 05, 2017 at 03:17:45PM -0200, Thadeu Lima de Souza Cascardo wrote: > Okay. At first, I wanted to simply use msleep there, then realized there > was the spinlock. I thought I got a good writeup of the history that was > not in git yet, maybe we should just add a better comment and more > details in the commit log. How about this as the comment? Could you look at fixing this, instead? I was taking a look at the code, and it so very.... 1990's. It looks like it was written during the days before SMP, and then locking was smashed in a very blunt-force way ---- probably because that's how it happened. :-) What we should **really** be doing with autoconfiguration, is instead of using the spinlock to prevent it from being accessed, is to lock out any attempt to transmit from the top-half, and remove it from the linked list of ports to prevent the interrupt handler from accessing it, make sure that any active interrupt handler has exited (and you can use the spinlock for the preceeding bits), but then we can safely do the autoconfiguration without having the deal with the spinlock at all, afterwards. It should't be *that* hard to just fix it for real. Cheers, - Ted