From patchwork Fri Jul 1 20:47:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Wunner X-Patchwork-Id: 12903768 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84112C433EF for ; Fri, 1 Jul 2022 20:48:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229968AbiGAUsA (ORCPT ); Fri, 1 Jul 2022 16:48:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229570AbiGAUsA (ORCPT ); Fri, 1 Jul 2022 16:48:00 -0400 Received: from mailout3.hostsharing.net (mailout3.hostsharing.net [IPv6:2a01:4f8:150:2161:1:b009:f236:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8EBD5C977; Fri, 1 Jul 2022 13:47:57 -0700 (PDT) Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL TLS DV RSA Mixed SHA256 2020 CA-1" (verified OK)) by mailout3.hostsharing.net (Postfix) with ESMTPS id C8CAD102DFB85; Fri, 1 Jul 2022 22:47:55 +0200 (CEST) Received: from localhost (unknown [89.246.108.87]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by h08.hostsharing.net (Postfix) with ESMTPSA id 6FC6861A6B50; Fri, 1 Jul 2022 22:47:55 +0200 (CEST) X-Mailbox-Line: From c45e311ac5b95798fe7cddd7bb834c5df83bb97e Mon Sep 17 00:00:00 2001 Message-Id: From: Lukas Wunner Date: Fri, 1 Jul 2022 22:47:50 +0200 Subject: [PATCH net-next v2 0/3] Deadlock no more in LAN95xx To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: netdev@vger.kernel.org, linux-usb@vger.kernel.org, Steve Glendinning , UNGLinuxDriver@microchip.com, Oliver Neukum , Andre Edich , Oleksij Rempel , Oleksij Rempel , Martyn Welch , Gabriel Hojda , Christoph Fritz , Lino Sanfilippo , Philipp Rosenberger , Marek Szyprowski , Ferry Toth , Andrew Lunn , Alan Stern Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Second attempt at fixing a runtime resume deadlock in the LAN95xx USB driver: In short, the driver isn't using the "nopm" register accessors in portions of its runtime resume path, causing a deadlock. I'm fixing that by auto-detecting whether nopm accessors shall be used, instead of having to explicitly call them wherever it's necessary. As a byproduct, code size shrinks significantly (see diffstat below). Back in April I submitted a first attempt which was rejected by Alan Stern: https://lore.kernel.org/all/6710d8c18ff54139cdc538763ba544187c5a0cee.1651041411.git.lukas@wunner.de/ That approach only detected whether a PM callback is running concurrently, not whether the access is performed by the PM callback. I've come up with a different approach which should resolve the objection (see patch [1/3]). Thanks! Lukas Wunner (3): usbnet: smsc95xx: Fix deadlock on runtime resume usbnet: smsc95xx: Clean up nopm handling usbnet: smsc95xx: Clean up unnecessary BUG_ON() upon register access drivers/net/usb/smsc95xx.c | 202 ++++++++++++++++--------------------- 1 file changed, 86 insertions(+), 116 deletions(-)