Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1236802pxu; Mon, 23 Nov 2020 15:34:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJxVSWCtXimkZLnheGwQC9WExFoHLt1lL2f0s3ya/k1yZmitEI80kHni9X/XDb3FQfYoCaKd X-Received: by 2002:a17:906:af69:: with SMTP id os9mr1764998ejb.180.1606174452674; Mon, 23 Nov 2020 15:34:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606174452; cv=none; d=google.com; s=arc-20160816; b=hD4qAqQGkl+L4hLr/psw36iBNBoUVY71UnmnajXbyswbtuVuzlnVBWma0eQOEuxW7T NkZPBxEWrWvm7q8/A/r17BQzoaIyiTrRc9hXCkYB3rQDyMsvvmrJCt9Y8SY/riot/qF5 3Yf5qW6fN54mWxmpvWlqcE9FbQjq0bicJriNrCVH8a/ZWtfdMWgAaiDzytrgZHM2AFP4 xo+L1LjgSZxbZSLZC/FSHctkrvhoMM7UzvgH/ZrC5ch4mJBU9eFt7XzIk3u8gWLAR7DN nKcrIVr5jeVLxJOP4ZvLIsMmK7Mf7KbJzFBY9yLZj5ai3SXVir4ZY3WNDWA8+vorOwj0 ROEg== 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=cf+0Jotkr6YwzhcgBtmC4hOMoymLqvQmaXywIrxYwcKHtR33684DG8s7Jzgoy7vU+O QHksfz7ep6tAavPw0iGVLNMNALECHTdH+GpEnPG6/QFqOVrBxn0lwFm+q7FS2IbMxHm7 CjLiHU2QH07Vj8DZxsn37L1lY4RyeTgHyS6MsoSDMX/zda6EqutU24CYqRQZ4bsTtz5e 6zMMH7cDEnVXKa1PeEV7b3dw4QEbnD6rMsvcRKKKBFumu86ItNu930jRoKs+qW3mRR0G EzQOqKYjocpJ4l7JslJI576q9Qda8AZdHoD0mf4ZaUqsSBgZvB0NArXJPSS9p1nIV8JR oCNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zai45BnD; 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 ce25si8202133edb.301.2020.11.23.15.33.50; Mon, 23 Nov 2020 15:34:12 -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=zai45BnD; 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 S1730814AbgKWMbG (ORCPT + 99 others); Mon, 23 Nov 2020 07:31:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:41870 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730799AbgKWMa7 (ORCPT ); Mon, 23 Nov 2020 07:30:59 -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 1E43220728; Mon, 23 Nov 2020 12:30:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606134658; bh=oWESSb/KESHk/7RZ6Qu/BgrRa8Q1K148M9X3dlhSkyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zai45BnD8cd3HRYWnouPTR0NguEVxX34Q8/IO3RTdSnpbQZCCQ1RpI0dyRUMc/RB6 JNl4mGmBcZVoP/F7VUlZeJyfXTwvONaKIPirXQvxUT8QS2cyb9rgYvoOfK+VF7QmQ3 dT5kGGoBr2OcMQ7EOUUHoUPkTJTsw2C98ZGBYFZ4= 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 4.19 07/91] lan743x: prevent entire kernel HANG on open, for some platforms Date: Mon, 23 Nov 2020 13:21:27 +0100 Message-Id: <20201123121809.660731035@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121809.285416732@linuxfoundation.org> References: <20201123121809.285416732@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; } }