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 X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 7AA93C43381 for ; Tue, 22 Dec 2020 09:04:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 28C4722AAE for ; Tue, 22 Dec 2020 09:04:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726275AbgLVJEV (ORCPT ); Tue, 22 Dec 2020 04:04:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725870AbgLVJEU (ORCPT ); Tue, 22 Dec 2020 04:04:20 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67FD6C0613D3; Tue, 22 Dec 2020 01:03:40 -0800 (PST) From: "Ahmed S. Darwish" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1608627819; 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; bh=0ES2PlYDmko1HTT00LSO1TZ78tyDlcM6xeI3B3a+bN4=; b=3hDUpSrKwbtOOHW3+jq6KVsCFYMK50VLQloRviEgK7eV309RAGZRkCy1VZ/uWuEZBAeRX8 08z1rvtjriOE2+A6L/EPS0FSv4YjlDr52ZC9gBVEfDBRPrnUlSWGbZqdkc6G0RBLeMjP6V 9U8ltKK093G1AVil/IPRf4P5XrlFM1QSysrT3ePvDQHjUHu5aT2gVG32v8zCHFwmrUq4m/ 9DgvMuqPSscyWDgG6/LavBgndl+J59DdkQxILypXl0yC5JVV3N0xfyKVGseAY9vQdBdOwl btFZjDOWpPMNjzn/BmNOvB4mlVCXdmXcA77tXeL5GflLg61TdgQ9B87EqnNijw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1608627819; 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; bh=0ES2PlYDmko1HTT00LSO1TZ78tyDlcM6xeI3B3a+bN4=; b=wSxySbnLNSr5FgxI/gZpGwc2AnBYHlgYcAOhAMFWUpgrHB8ataqaEO3M5dEvdrERo9/8gA wdtl2wrwPo4+lkAQ== To: Michael Grzeschik , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org Cc: LKML , Thomas Gleixner , "Sebastian A. Siewior" , "Ahmed S. Darwish" Subject: [RFC PATCH 0/1] net: arcnet: Fix RESET sequence Date: Tue, 22 Dec 2020 10:03:37 +0100 Message-Id: <20201222090338.186503-1-a.darwish@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Folks, At drivers/net/arcnet/arcnet.c, there is: irqreturn_t arcnet_interrupt(int irq, void *dev_id) { ... if (status & RESETflag) { arcnet_close(dev); arcnet_open(dev); } ... } struct net_device_ops arcnet_netdev_ops = { .ndo_open = arcnet_open, .ndo_stop = arcnet_close, ... }; which is wrong, in many ways: 1) In general, interrupt handlers should never call ->ndo_stop() and ->ndo_open() functions. They are usually full of blocking calls and other methods that are expected to be called only from drivers init/exit code paths. 2) arcnet_close() contains a del_timer_sync(). If the irq handler interrupts the to-be-deleted timer then call del_timer_sync(), it will just loop forever. 3) arcnet_close() also calls tasklet_kill(), which has a warning if called from irq context. 4) For device reset, the sequence "arcnet_close(); arcnet_open();" is not complete. Some children arcnet drivers have special init/exit code sequences, which then embed a call to arcnet_open() and arcnet_close() accordingly. Check drivers/net/arcnet/com20020.c. Included is an RFC patch to fix the points above: if the RESET flag is encountered, a workqueue is scheduled to run the generic reset sequence. Note: Only compile-tested, as I do not have the hardware in question. Thanks, 8<-------------- Ahmed S. Darwish (1): net: arcnet: Fix RESET flag handling drivers/net/arcnet/arc-rimi.c | 4 +- drivers/net/arcnet/arcdevice.h | 6 +++ drivers/net/arcnet/arcnet.c | 69 +++++++++++++++++++++++++++++-- drivers/net/arcnet/com20020-isa.c | 4 +- drivers/net/arcnet/com20020-pci.c | 2 +- drivers/net/arcnet/com20020_cs.c | 2 +- drivers/net/arcnet/com90io.c | 4 +- drivers/net/arcnet/com90xx.c | 4 +- 8 files changed, 81 insertions(+), 14 deletions(-) base-commit: 2c85ebc57b3e1817b6ce1a6b703928e113a90442 -- 2.29.2