From patchwork Mon Feb 8 18:16:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 378899 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FF30C4332B for ; Mon, 8 Feb 2021 18:18:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B6D1760232 for ; Mon, 8 Feb 2021 18:18:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232719AbhBHSSO (ORCPT ); Mon, 8 Feb 2021 13:18:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235365AbhBHSRB (ORCPT ); Mon, 8 Feb 2021 13:17:01 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61A87C06178B; Mon, 8 Feb 2021 10:16:21 -0800 (PST) From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1612808179; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=h9RwiLyf2em69GyCK8lGeGYJ1Y/gUkmVKaMZzVQiryk=; b=y+Frn1ImupaWzvVR+wH4xQRp9VnHJ3v9rZv+STLcPwAzxSvaXv7c7gS4TWzjgtdpqF9Qof 1MDgJUzb8tMYMkmSQdEFOYw4oArMW9+02S43byFHBkj99gBogFB1xiEKua4A0mQ8vbNP8T 9eX8RZyb+fg2dCDGwK4B7jBklRJAxPPk3tvG0rYhfxGhyhQA+fSKkFu2Wdp6P15mIJKN/y 2pwU2ylr+LSfuHO/QmpYXHyEzvBbVM86154AkPF0LhBWfIVP33S6loRaLxf4fkEVLjx7P0 F6bUZ1AEq+6SmPhwAfo2EEGOv3GoOOcQcbXS7nkr/Drv4p8CGbcsK3S0k6OAAQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1612808179; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=h9RwiLyf2em69GyCK8lGeGYJ1Y/gUkmVKaMZzVQiryk=; b=qaAt72MKc5g9qCDVwucweGQmqiexkXwYZexT4piTNB2oaUo5QNxcEK8YojDS5PaLHNHu2y s1sG7qfg+l5vZpCQ== To: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Jiri Slaby , Thomas Gleixner , "Ahmed S. Darwish" , Sebastian Andrzej Siewior Subject: [PATCH 1/2] vt_ioctl: Remove in_interrupt() check Date: Mon, 8 Feb 2021 19:16:14 +0100 Message-Id: <20210208181615.381861-2-bigeasy@linutronix.de> In-Reply-To: <20210208181615.381861-1-bigeasy@linutronix.de> References: <20210208181615.381861-1-bigeasy@linutronix.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org From: "Ahmed S. Darwish" reset_vc() uses a "!in_interrupt()" conditional before resetting the palettes, which is a blocking operation. Since commit 8b6312f4dcc1e ("[PATCH] vt: refactor console SAK processing") all calls are invoked from a workqueue process context, with the blocking console lock always acquired. Remove the "!in_interrupt()" check. Signed-off-by: Ahmed S. Darwish Signed-off-by: Sebastian Andrzej Siewior --- drivers/tty/vt/vt_ioctl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c index 4a4cbd4a5f37a..89aeaf3c1bca6 100644 --- a/drivers/tty/vt/vt_ioctl.c +++ b/drivers/tty/vt/vt_ioctl.c @@ -930,8 +930,7 @@ void reset_vc(struct vc_data *vc) put_pid(vc->vt_pid); vc->vt_pid = NULL; vc->vt_newvt = -1; - if (!in_interrupt()) /* Via keyboard.c:SAK() - akpm */ - reset_palette(vc); + reset_palette(vc); } void vc_SAK(struct work_struct *work) From patchwork Mon Feb 8 18:16:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 379723 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D01B8C433E0 for ; Mon, 8 Feb 2021 18:18:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8021864E37 for ; Mon, 8 Feb 2021 18:18:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233220AbhBHSSS (ORCPT ); Mon, 8 Feb 2021 13:18:18 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:38264 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233050AbhBHSRB (ORCPT ); Mon, 8 Feb 2021 13:17:01 -0500 From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1612808179; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aAOeh/UEafg/7gs/6xSxr5aMoL1OxSaiaEyaby4zaA0=; b=a99/7wx7a7ID2VNjNLv6GCMy7CYRqlCCtMIP6ebPLplD1Q91Jel7Am7hvv7fCzs+St+nl2 oQVAFWhjDmkNBlHWE1u4XkJjaQJi58+o22vTiY07Fl9o/TwOM3i9S6oQ4zDaS3aNhodZ2R Z4f9xevrol/vjfSJ+w5qKc9hSs7iOqlXL7GiYJ3fA+3ujfEfA9sPjCYJV3HtrUdn1/DW4e rZ/FTZbpfcXWERon29ty8s/ejy3zP0zD6aAFrqudLMdAkQZwYNyG5iRamYTnTHGOF8yWFj /3q2Znn3j9RV/wpuNfQw0+eV0iHdjLx5Vv09pgxVxghMRHyXA8Zk4o9Dpimgzw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1612808179; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aAOeh/UEafg/7gs/6xSxr5aMoL1OxSaiaEyaby4zaA0=; b=nVAmg5IRmzl8yx2pVLIe6R42U/H9cKeUXUejA9xeYSzQuhFChvI7oAYss9M4PONHRczzsN 3gq3m6BYoxerwZBQ== To: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Jiri Slaby , Thomas Gleixner , "Ahmed S. Darwish" , Sebastian Andrzej Siewior Subject: [PATCH 2/2] serial: core: Remove BUG_ON(in_interrupt()) check Date: Mon, 8 Feb 2021 19:16:15 +0100 Message-Id: <20210208181615.381861-3-bigeasy@linutronix.de> In-Reply-To: <20210208181615.381861-1-bigeasy@linutronix.de> References: <20210208181615.381861-1-bigeasy@linutronix.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org From: "Ahmed S. Darwish" The usage of in_interrupt() in drivers is phased out for various reasons. In both exported functions where BUG_ON(in_interrupt()) is invoked, there is a mutex_lock() afterwards. mutex_lock() contains a might_sleep() which will already trigger a stack trace if the target functions is called from atomic context. Remove the BUG_ON() and add a "Context: " in the kernel-doc instead. Signed-off-by: Ahmed S. Darwish Signed-off-by: Sebastian Andrzej Siewior --- drivers/tty/serial/serial_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 7dacdb6a85345..62dc7b5cd60c6 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -2848,6 +2848,8 @@ static const struct attribute_group tty_dev_attr_group = { * @drv: pointer to the uart low level driver structure for this port * @uport: uart port structure to use for this port. * + * Context: task context, might sleep + * * This allows the driver to register its own uart_port structure * with the core driver. The main purpose is to allow the low * level uart drivers to expand uart_port, rather than having yet @@ -2861,8 +2863,6 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport) struct device *tty_dev; int num_groups; - BUG_ON(in_interrupt()); - if (uport->line >= drv->nr) return -EINVAL; @@ -2951,6 +2951,8 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport) * @drv: pointer to the uart low level driver structure for this port * @uport: uart port structure for this port * + * Context: task context, might sleep + * * This unhooks (and hangs up) the specified port structure from the * core driver. No further calls will be made to the low-level code * for this port. @@ -2963,8 +2965,6 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *uport) struct tty_struct *tty; int ret = 0; - BUG_ON(in_interrupt()); - mutex_lock(&port_mutex); /*