From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tycho Andersen Subject: Re: [PATCH v4] uart: fix race between uart_put_char() and uart_shutdown() Date: Fri, 13 Jul 2018 08:01:42 -0600 Message-ID: <20180713140142.GH13192@cisco.cisco.com> References: <20180706212220.GC3583@cisco.lan> <20180711160744.32074-1-tycho@tycho.ws> <20180712150438.GF22502@kroah.com> <20180712150822.GC13192@cisco.cisco.com> <20180712154015.GC13114@kroah.com> <20180712181846.GD13192@cisco.cisco.com> <20180712182545.GA30099@kroah.com> <20180712183001.GE13192@cisco.cisco.com> <20180713092828.GA6589@kroah.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20180713092828.GA6589@kroah.com> Sender: linux-kernel-owner@vger.kernel.org To: Greg Kroah-Hartman Cc: Jiri Slaby , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Serge E . Hallyn" List-Id: linux-serial@vger.kernel.org On Fri, Jul 13, 2018 at 11:28:28AM +0200, Greg Kroah-Hartman wrote: > On Thu, Jul 12, 2018 at 12:30:01PM -0600, Tycho Andersen wrote: > > On Thu, Jul 12, 2018 at 08:25:45PM +0200, Greg Kroah-Hartman wrote: > > > On Thu, Jul 12, 2018 at 12:18:46PM -0600, Tycho Andersen wrote: > > > > On Thu, Jul 12, 2018 at 05:40:15PM +0200, Greg Kroah-Hartman wrote: > > > > > On Thu, Jul 12, 2018 at 09:08:22AM -0600, Tycho Andersen wrote: > > > > > > On Thu, Jul 12, 2018 at 05:04:38PM +0200, Greg Kroah-Hartman wrote: > > > > > > > On Wed, Jul 11, 2018 at 10:07:44AM -0600, Tycho Andersen wrote: > > > > > > > > + if (uport) > > > > > > > > + spin_lock_irqsave(&uport->lock, flags); > > > > > > > > > > > > > > That's the same thing as just calling uart_port_lock(), why aren't you > > > > > > > doing that? > > > > > > > > > > > > Because the compiler can't seem to "see" through the macros/ref calls, > > > > > > and I get the warning I mentioned here if I use them: > > > > > > > > > > > > https://lkml.org/lkml/2018/7/6/840 > > > > > > > > > > What horrible version of gcc are you using that give you that? Don't > > > > > open-code things just because of a broken compiler. > > > > > > > > I've tried with both 7.3.0 and 5.4.0. I think the reason we see this > > > > here but not elsewhere in the file is because there's an actual > > > > function call (free_page()) in the critical section. > > > > > > > > If we move that out, something like the below patch, it all works for > > > > me. > > > > > > Ick. Which version of this series had the problem? Let me test it out > > > here... > > > > v3, if you remove the initialization of flags from both functions you > > should see it. > > Ok, I tried v3 out and yes, you are right, removing the "= 0" causes gcc > to complain. The compiler is being dumb here, so I'll just leave it > as-is. I've queued up the v3 version now, thanks for sticking with > this. Great, thanks! Tycho