From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A035CC433F5 for ; Mon, 2 May 2022 11:48:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384817AbiEBLwW (ORCPT ); Mon, 2 May 2022 07:52:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229651AbiEBLwU (ORCPT ); Mon, 2 May 2022 07:52:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92534167D4; Mon, 2 May 2022 04:48:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2D83461216; Mon, 2 May 2022 11:48:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BA1EC385A4; Mon, 2 May 2022 11:48:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651492129; bh=Q/Dwiz7iDgoIpV/c4fgjsYyhGcgio6QJN9349xFIIes=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=LcpF+LDS2Amjh/S9E3y1f4npeLGj9+v6LLbQN6K43SuwbTsU7+htBpA3Hg43E6yHw kZGBYVpM5dZmmCWlPUeAyXMGcCEd38aXCM5JwimdilO7dgoR/RS9Ki8tBscks+Bnmh CFaQd4iQJl9Cay6eC1nQGcEGtY7fUls8wDkVv5Eeco648KrHZb2UZL7vpxwCZCcCe0 dPV6bWVqnRel5ReSPpjrmnnRkNUfx1i5h2HuuFxFjSUUwg4AhmC1bzaGLjIFeFCCSm SWyq39aiC4XvbLX2Oou8w6ojJ3XMqFwycdGWHzyn2H5LXIoDotqv1btABjRpRH0Thd Bn0N8pAse3KoQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nlUXn-008PI4-4z; Mon, 02 May 2022 12:48:47 +0100 Date: Mon, 02 May 2022 12:48:46 +0100 Message-ID: <87bkwgi28x.wl-maz@kernel.org> From: Marc Zyngier To: Thomas Pfaff Cc: Thomas Gleixner , , Subject: Re: [PATCH v3] irq/core: synchronize irq_thread startup In-Reply-To: <552fe7b4-9224-b183-bb87-a8f36d335690@pcs.com> References: <552fe7b4-9224-b183-bb87-a8f36d335690@pcs.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: tpfaff@pcs.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 02 May 2022 12:28:29 +0100, Thomas Pfaff wrote: > > From: Thomas Pfaff > > While running > "while /bin/true; do setserial /dev/ttyS0 uart none; > setserial /dev/ttyS0 uart 16550A; done" > on a kernel with threaded irqs, setserial is hung after some calls. > > setserial opens the device, this will install an irq handler if the uart is > not none, followed by TIOCGSERIAL and TIOCSSERIAL ioctls. > Then the device is closed. On close, synchronize_irq() is called by > serial_core. > > If the close comes too fast, the irq_thread does not really start, > it is terminated immediately without going into irq_thread(). > But an interrupt might already been handled by > irq_default_primary_handler(), going to __irq_wake_thread() and > incrementing threads_active. > If this happens, synchronize_irq() will hang forever, because the > irq_thread is already dead, and threads_active will never be decremented. > > The fix is to make sure that the irq_thread is really started > during __setup_irq(). > > Signed-off-by: Thomas Pfaff Reviewed-by: Marc Zyngier M. -- Without deviation from the norm, progress is not possible.