Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932896AbdCUSpe (ORCPT ); Tue, 21 Mar 2017 14:45:34 -0400 Received: from smtprelay0056.hostedemail.com ([216.40.44.56]:57224 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757994AbdCUSoy (ORCPT ); Tue, 21 Mar 2017 14:44:54 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:3138:3139:3140:3141:3142:3353:3622:3865:3867:3868:3870:3871:4250:4321:5007:6119:6261:7576:7875:7901:10004:10400:10450:10455:10848:10967:11026:11232:11658:11914:12043:12438:12555:12663:12740:12760:12895:12986:13019:13439:14096:14097:14181:14659:14721:19904:19999:21080:21451:30054:30062:30070:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: twig34_8101011a1ac2d X-Filterd-Recvd-Size: 3014 Date: Tue, 21 Mar 2017 14:44:37 -0400 From: Steven Rostedt To: Cc: , , , , Patrice Chotard , Greg Kroah-Hartman , Jiri Slaby Subject: Re: [PATCH RT] tty: serial: st-asc: Make the locking RT aware Message-ID: <20170321144437.569440c2@vmware.local.home> In-Reply-To: <1490112340-29772-1-git-send-email-lionel.debieve@st.com> References: <1490112340-29772-1-git-send-email-lionel.debieve@st.com> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1963 Lines: 65 On Tue, 21 Mar 2017 17:05:40 +0100 wrote: > From: Lionel Debieve > > The lock is a sleeping lock and local_irq_save() is not the > standard implementation now. Working for both -RT and non > RT. If this is for both RT and non RT then the patch subject should just be [PATCH] and not [PATCH RT] as the latter tells upstream folks not to bother. > > Signed-off-by: Lionel Debieve > --- > drivers/tty/serial/st-asc.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c > index 379e5bd..1815423 100644 > --- a/drivers/tty/serial/st-asc.c > +++ b/drivers/tty/serial/st-asc.c > @@ -803,13 +803,12 @@ static void asc_console_write(struct console > *co, const char *s, unsigned count) int locked = 1; > u32 intenable; > > - local_irq_save(flags); > if (port->sysrq) > locked = 0; /* asc_interrupt has already claimed the > lock */ else if (oops_in_progress) > - locked = spin_trylock(&port->lock); > + locked = spin_trylock_irqsave(&port->lock, flags); > else > - spin_lock(&port->lock); > + spin_lock_irqsave(&port->lock, flags); > > /* > * Disable interrupts so we don't get the IRQ line bouncing I'm nervous about the above comment, which in full is: /* * Disable interrupts so we don't get the IRQ line bouncing * up and down while interrupts are disabled. */ I'm not sure if disabling interrupts helps on an SMP system. This patch does change what happens when port->sysrq is set. But I'm not sure we care. -- Steve > @@ -827,8 +826,7 @@ static void asc_console_write(struct console *co, > const char *s, unsigned count) asc_out(port, ASC_INTEN, intenable); > > if (locked) > - spin_unlock(&port->lock); > - local_irq_restore(flags); > + spin_unlock_irqrestore(&port->lock, flags); > } > > static int asc_console_setup(struct console *co, char *options)