Received: by 2002:aa6:c429:0:b029:98:93ff:f56f with SMTP id g9csp3393968lkq; Mon, 23 Nov 2020 04:42:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJyzFAazPAl+IR1gZB47IfafUPwBBiy0hI2C7Om0iKxfo402Eq0k4hGKeXYUQD2X3SuzpNFd X-Received: by 2002:a17:907:396:: with SMTP id ss22mr29300101ejb.24.1606135351476; Mon, 23 Nov 2020 04:42:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606135351; cv=none; d=google.com; s=arc-20160816; b=LYSbZTOp8nkl/PV6tdl+wVbUusxPDQP30vXsE2kUvE6KOtz0ARc2pP6fJlyAH89wTA qVAI5PqUkI7/+4blyqVUbKhUC79U4WYxw2D8pUkWh9UtA6x63GAbE/8z9Pq+fektSJxc 0VEbKVAD1+QtmgniEgycsge+VyYdZhqULg8XcVysSlFXCP7ktpl9XB6TrIWBog27rbw0 g4POai96jekAh7ArDgP41WcS8Bv328cjrk1sagkN7t43Po717M5QyS3NlbVdNXNhLt1m nv4dIjSklqMVnqLih55Mw9F4n2Zl4sI5XriQFBGwkkZIJjhk4dkWuDZFpC9S4byCTOJ3 al2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JUNB9YaDJhJopm21UMjsrM9vINtl/HacFBz6JeYuF28=; b=u2dEdzcWxMtsEdsR9ed7+n279M1DrB8FiUVpl83MFVaAGkaxVYyDpEUJH6m0aJdNe1 dSdqJXh3aDf5nndO2x3pF+oTBTAE9WV4lLo0KBof/gp//KC/95ZDPQ0xAWQf33B9tX+D my4pOg5rg4cQK/HrRzPsstJYeXElw4cO6o8eC/0GMdAhZxPvtrFGgox9v1wZy+ulwkJu 3gvxkgPOKfQASlc5fi/PkhRGotzt9dYM0lcrcxletyPYxYW1im/SbwCoNDlQVthIHGjP e/Q4hpCrLsCaP0KHSrMY/U4BNoPJy5YQEX6c1xmxLkUfsur+ehWbEMChFo10mYgnpkGh 6asA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LGgh0OvY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hk6si6255578ejb.716.2020.11.23.04.42.08; Mon, 23 Nov 2020 04:42:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LGgh0OvY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731450AbgKWMev (ORCPT + 99 others); Mon, 23 Nov 2020 07:34:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:46552 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731436AbgKWMes (ORCPT ); Mon, 23 Nov 2020 07:34:48 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 5046720857; Mon, 23 Nov 2020 12:34:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606134887; bh=oWESSb/KESHk/7RZ6Qu/BgrRa8Q1K148M9X3dlhSkyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LGgh0OvYgN0DjDR8MSF25tVFei7NHRGp5qQyrf0WFni+5KPLB4vEprFNFOzojqBeT 9RCHzKYZg5EbMhvp6GSGsib6p3XbXzSIuVegW7osXtwKm0/o0MyVpy64xDjJCrQyQG 0ZcyOHe3E9hMljDQnieD7bxgPvvNNnAA8I4e4MN0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sven Van Asbroeck , Jakub Kicinski Subject: [PATCH 5.4 009/158] lan743x: prevent entire kernel HANG on open, for some platforms Date: Mon, 23 Nov 2020 13:20:37 +0100 Message-Id: <20201123121820.388363311@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121819.943135899@linuxfoundation.org> References: <20201123121819.943135899@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sven Van Asbroeck [ Upstream commit 796a2665ca3e91ebaba7222f76fd9a035714e2d8 ] On arm imx6, when opening the chip's netdev, the whole Linux kernel intermittently hangs/freezes. This is caused by a bug in the driver code which tests if pcie interrupts are working correctly, using the software interrupt: 1. open: enable the software interrupt 2. open: tell the chip to assert the software interrupt 3. open: wait for flag 4. ISR: acknowledge s/w interrupt, set flag 5. open: notice flag, disable the s/w interrupt, continue Unfortunately the ISR only acknowledges the s/w interrupt, but does not disable it. This will re-trigger the ISR in a tight loop. On some (lucky) platforms, open proceeds to disable the s/w interrupt even while the ISR is 'spinning'. On arm imx6, the spinning ISR does not allow open to proceed, resulting in a hung Linux kernel. Fix minimally by disabling the s/w interrupt in the ISR, which will prevent it from spinning. This won't break anything because the s/w interrupt is used as a one-shot interrupt. Note that this is a minimal fix, overlooking many possible cleanups, e.g.: - lan743x_intr_software_isr() is completely redundant and reads INT_STS twice for no apparent reason - disabling the s/w interrupt in lan743x_intr_test_isr() is now redundant, but harmless - waiting on software_isr_flag can be converted from a sleeping poll loop to wait_event_timeout() Fixes: 23f0703c125b ("lan743x: Add main source files for new lan743x driver") Tested-by: Sven Van Asbroeck # arm imx6 lan7430 Signed-off-by: Sven Van Asbroeck Link: https://lore.kernel.org/r/20201112204741.12375-1-TheSven73@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/microchip/lan743x_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/microchip/lan743x_main.c +++ b/drivers/net/ethernet/microchip/lan743x_main.c @@ -145,7 +145,8 @@ static void lan743x_intr_software_isr(vo int_sts = lan743x_csr_read(adapter, INT_STS); if (int_sts & INT_BIT_SW_GP_) { - lan743x_csr_write(adapter, INT_STS, INT_BIT_SW_GP_); + /* disable the interrupt to prevent repeated re-triggering */ + lan743x_csr_write(adapter, INT_EN_CLR, INT_BIT_SW_GP_); intr->software_isr_flag = 1; } }