Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933806AbdDFHRI (ORCPT ); Thu, 6 Apr 2017 03:17:08 -0400 Received: from gate.crashing.org ([63.228.1.57]:38792 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933084AbdDFHRC (ORCPT ); Thu, 6 Apr 2017 03:17:02 -0400 Message-ID: <1491462988.4166.104.camel@kernel.crashing.org> Subject: Re: tty crash in tty_ldisc_receive_buf() From: Benjamin Herrenschmidt To: Michael Neuling , Al Viro , johan Hovold , Peter Hurley , Wang YanQing , Alexander Popov , Rob Herring Cc: Mikulas Patocka , Dmitry Vyukov , LKML Date: Thu, 06 Apr 2017 17:16:28 +1000 In-Reply-To: <1491462281.2815.47.camel@neuling.org> References: <1491462281.2815.47.camel@neuling.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6 (3.22.6-1.fc25) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 865 Lines: 20 On Thu, 2017-04-06 at 17:04 +1000, Michael Neuling wrote: > We see this usually on boot but can also see it if we kill a getty attached to > tty (which is then respawned by systemd).  It seems like we are flushing data to > a tty at the same time as it's being torn down and restarted. > > I did try the below patch which avoids the crash but locks up one of the CPUs. I > guess the data never gets flushed if we say nothing is processed. > > This is on powerpc but has also been reported by parisc. > > I'm not at all familiar with the tty layer and looking at the locks, mutexes, > semaphores and reference counting in there scares the hell out of me.  > > If anyone has an idea, I'm happy to try a patch. Note that we noticed one path that called reinit without the ldisc lock held for writing, we added that, but it didn't fix the problem. Cheers, Ben.