From patchwork Thu Aug 20 09:20:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 265489 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=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 9B631C433E1 for ; Thu, 20 Aug 2020 12:11:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5729D207BB for ; Thu, 20 Aug 2020 12:11:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597925485; bh=C2iYf0ypaFI5ARPAfe2GCMFTbJDJ0PIUh6HCGhP0Q3U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=xwxvOR08cMuRe/GR4SN1zVPi+k0DJBwg+wVGTctsVr9aau2KjO6CgtjW06BMi8TpE sm23dOlJXhvtUYhsfY3XKJ99qnOOs6cT3YOaXtAuYBbDgDLdM0BARePBIqOUQO+qnC SeX+aIZniIlhdTVhdkjQAYBSD5+xBtOU0wmrZ61k= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730349AbgHTMKG (ORCPT ); Thu, 20 Aug 2020 08:10:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:41790 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730067AbgHTJ5y (ORCPT ); Thu, 20 Aug 2020 05:57:54 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 212F82173E; Thu, 20 Aug 2020 09:57:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597917473; bh=C2iYf0ypaFI5ARPAfe2GCMFTbJDJ0PIUh6HCGhP0Q3U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VNFC4JOr+EauFWi84clgxq8h/g20gZNHUxwFkW5Ie8kdDpuqA+DUOYV9C9bO9wg9/ LMkt+SAj5cEHOPIwzgU5PPxZiTBZyHa55cRlw5wSfG++jxd0A3Iq7BFz4QUC3Mg5uD 0Qd3HM+URHcI3NhTRl+tVHtrBiyHd6Tpn4xJvy/8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Thomas Gleixner , Ingo Molnar Subject: [PATCH 4.9 044/212] x86/i8259: Use printk_deferred() to prevent deadlock Date: Thu, 20 Aug 2020 11:20:17 +0200 Message-Id: <20200820091604.594853618@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091602.251285210@linuxfoundation.org> References: <20200820091602.251285210@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Thomas Gleixner commit bdd65589593edd79b6a12ce86b3b7a7c6dae5208 upstream. 0day reported a possible circular locking dependency: Chain exists of: &irq_desc_lock_class --> console_owner --> &port_lock_key Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&port_lock_key); lock(console_owner); lock(&port_lock_key); lock(&irq_desc_lock_class); The reason for this is a printk() in the i8259 interrupt chip driver which is invoked with the irq descriptor lock held, which reverses the lock operations vs. printk() from arbitrary contexts. Switch the printk() to printk_deferred() to avoid that. Reported-by: kernel test robot Signed-off-by: Thomas Gleixner Signed-off-by: Ingo Molnar Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/87365abt2v.fsf@nanos.tec.linutronix.de Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/i8259.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/kernel/i8259.c +++ b/arch/x86/kernel/i8259.c @@ -205,7 +205,7 @@ spurious_8259A_irq: * lets ACK and report it. [once per IRQ] */ if (!(spurious_irq_mask & irqmask)) { - printk(KERN_DEBUG + printk_deferred(KERN_DEBUG "spurious 8259A interrupt: IRQ%d.\n", irq); spurious_irq_mask |= irqmask; }