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 Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EB038C54E67 for ; Tue, 26 Mar 2024 14:35:53 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 97666407B9; Tue, 26 Mar 2024 14:35:53 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 7aWb3X1M_0NE; Tue, 26 Mar 2024 14:35:52 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org B3AEF407F7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1711463752; bh=oXBFibEBiPM4VCyCNwTgs7WkYgc3NnouQzCupROCtGM=; h=Date:From:To:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=k2S6tAkqlq43wZ0FmubM1cD3Lkqr1sSmVIo/kjnIFHFziM9zHqbto+8gjubdnRofz LKKF+/vrchu8Uqv7He0T5xU5PWa/LTMVe7Da7YO5fodfss7lv9XlU18pYG1Que6Rno I/A+LVDFrQAKA9Q/aZEVijdfhPXFfDyXYCzl+8k4NU4qL/OQSwfLZG70qdsGs9JcnF OUTFKaWtW4fsbkWbTIQmHOTnMT9fRNdYi1tZ5pfEcPXr4djIwqJ40JXDABDCBOv1VF SPYek+hQBlypkoeKURxIl7swCvCXPdXVtb1ANklxuUfK+6fx48WNQgFuwveRCppXT5 CR16nN9mNbNgA== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id B3AEF407F7; Tue, 26 Mar 2024 14:35:52 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 8BE761BF4E2 for ; Tue, 26 Mar 2024 14:35:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 77CA56082F for ; Tue, 26 Mar 2024 14:35:51 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id uuEZotZP3eRN for ; Tue, 26 Mar 2024 14:35:50 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=139.178.84.217; helo=dfw.source.kernel.org; envelope-from=horms@kernel.org; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org B70E7607B9 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org B70E7607B9 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by smtp3.osuosl.org (Postfix) with ESMTPS id B70E7607B9 for ; Tue, 26 Mar 2024 14:35:50 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id D23116122C; Tue, 26 Mar 2024 14:35:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67517C433F1; Tue, 26 Mar 2024 14:35:46 +0000 (UTC) Date: Tue, 26 Mar 2024 14:35:44 +0000 From: Simon Horman To: Bjorn Helgaas Message-ID: <20240326143544.GY403975@kernel.org> References: <20240325222951.1460656-1-helgaas@kernel.org> <20240325222951.1460656-2-helgaas@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240325222951.1460656-2-helgaas@kernel.org> X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711463749; bh=Ni4Cb8d+9/UtZWDS1MJ8TsKOaKB5beJmlBXXrWRHe/I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ljOk2w0Zq6ZBjwoNgc5qsqetXQWZmTaojsWyb4v2XxO43hoAfYg8lGvzDZDaieq/F Dw6U/mn3/Cr60E3fGpxQ96TdizogFMEn4pserO15OvwzLFRz+U6mHZFLTVv2qOcEJg lbpFSXHuUX3JdnzuFEXUt5TJhX+4SfVBhgcHosNerAhkIGwtMINQqM5dNASgF4guHv +diZgWE7Ecr4m5YEgNirWGkme+EArfZw9tEg25ZDGVzPxqpDfmXb8rNgTQ4tCZzo+9 mwv0xDYZyGHfagGaScGs9ry9dDrnxjcD5bYe6AICWUKg1LNCPyGOlYD7do/3vHYhi7 fzJMSBkVa99nw== X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=none dis=none) header.from=kernel.org X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=ljOk2w0Z Subject: Re: [Intel-wired-lan] [PATCH 1/3] e1000e: Remove redundant runtime resume for ethtool_ops X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Konstantin Khlebnikov , Sasha Neftin , intel-wired-lan@lists.osuosl.org, "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, Bjorn Helgaas , Eric Dumazet , Tony Nguyen , netdev@vger.kernel.org, Zheng Yan , Jakub Kicinski , Paolo Abeni , "David S . Miller" , Heiner Kallweit Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" On Mon, Mar 25, 2024 at 05:29:49PM -0500, Bjorn Helgaas wrote: > From: Bjorn Helgaas > > e60b22c5b7e5 ("e1000e: fix accessing to suspended device") added > ethtool_ops.begin() and .complete(), which used pm_runtime_get_sync() to > resume suspended devices before any ethtool_ops callback and allow suspend > after it completed. > > 3ef672ab1862 ("e1000e: ethtool unnecessarily takes device out of RPM > suspend") removed ethtool_ops.begin() and .complete() and instead did > pm_runtime_get_sync() only in the individual ethtool_ops callbacks that > access device registers. > > Subsequently, f32a21376573 ("ethtool: runtime-resume netdev parent before > ethtool ioctl ops") added pm_runtime_get_sync() in the dev_ethtool() path, > so the device is resumed before *any* ethtool_ops callback, as it was > before 3ef672ab1862. > > Remove most runtime resumes from ethtool_ops, which are now redundant > because the resume has already been done by dev_ethtool(). This is > essentially a revert of 3ef672ab1862 ("e1000e: ethtool unnecessarily takes > device out of RPM suspend"). > > There are a couple subtleties: > > - Prior to 3ef672ab1862, the device was resumed only for the duration of > a single ethtool callback. 3ef672ab1862 changed e1000_set_phys_id() so > the device was resumed for ETHTOOL_ID_ACTIVE and remained resumed until > a subsequent callback for ETHTOOL_ID_INACTIVE. Preserve that part of > 3ef672ab1862 so the device will not be runtime suspended while in the > ETHTOOL_ID_ACTIVE state. > > - 3ef672ab1862 added "if (!pm_runtime_suspended())" in before reading the > STATUS register in e1000_get_settings(). This was racy and is now > unnecessary because dev_ethtool() has resumed the device already, so > revert that. > > Signed-off-by: Bjorn Helgaas Reviewed-by: Simon Horman From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F240713BC3B; Tue, 26 Mar 2024 14:35:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711463750; cv=none; b=dQmxNnaNAicA0kpoQDcTTnVlKPl+78r+nfoFz43spgfhnrwr6/9XxGLQG/YECgh7rTSPalZqpzIanqfbGBPY1gc8xKfUueQ00gNlWVclR1YodRcI9qTOd/8OYRHRtZhZ7HP2O2iBP6MQfSJHNRjO2RSotx0zxGKZUf6OB7yh9Y8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711463750; c=relaxed/simple; bh=Ni4Cb8d+9/UtZWDS1MJ8TsKOaKB5beJmlBXXrWRHe/I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=R/EwqO4bVoy570OXruyjwfceJU/Hcx3reSec+LguVAcuusTTPOIrbtxW5sQtANHa6UjtGl9bBdvFpxpXOtms4sZeXN3LcF6ya9sJ5QvhqNuBt0mP7PlaSXIb43K5aEBAjfP8GCNDPcn9zh0EXcCEP2BBK/wYMepKHfamCSz1+1Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ljOk2w0Z; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ljOk2w0Z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67517C433F1; Tue, 26 Mar 2024 14:35:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711463749; bh=Ni4Cb8d+9/UtZWDS1MJ8TsKOaKB5beJmlBXXrWRHe/I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ljOk2w0Zq6ZBjwoNgc5qsqetXQWZmTaojsWyb4v2XxO43hoAfYg8lGvzDZDaieq/F Dw6U/mn3/Cr60E3fGpxQ96TdizogFMEn4pserO15OvwzLFRz+U6mHZFLTVv2qOcEJg lbpFSXHuUX3JdnzuFEXUt5TJhX+4SfVBhgcHosNerAhkIGwtMINQqM5dNASgF4guHv +diZgWE7Ecr4m5YEgNirWGkme+EArfZw9tEg25ZDGVzPxqpDfmXb8rNgTQ4tCZzo+9 mwv0xDYZyGHfagGaScGs9ry9dDrnxjcD5bYe6AICWUKg1LNCPyGOlYD7do/3vHYhi7 fzJMSBkVa99nw== Date: Tue, 26 Mar 2024 14:35:44 +0000 From: Simon Horman To: Bjorn Helgaas Cc: Jesse Brandeburg , Tony Nguyen , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Konstantin Khlebnikov , Zheng Yan , Sasha Neftin , "Rafael J . Wysocki" , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Helgaas Subject: Re: [PATCH 1/3] e1000e: Remove redundant runtime resume for ethtool_ops Message-ID: <20240326143544.GY403975@kernel.org> References: <20240325222951.1460656-1-helgaas@kernel.org> <20240325222951.1460656-2-helgaas@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240325222951.1460656-2-helgaas@kernel.org> On Mon, Mar 25, 2024 at 05:29:49PM -0500, Bjorn Helgaas wrote: > From: Bjorn Helgaas > > e60b22c5b7e5 ("e1000e: fix accessing to suspended device") added > ethtool_ops.begin() and .complete(), which used pm_runtime_get_sync() to > resume suspended devices before any ethtool_ops callback and allow suspend > after it completed. > > 3ef672ab1862 ("e1000e: ethtool unnecessarily takes device out of RPM > suspend") removed ethtool_ops.begin() and .complete() and instead did > pm_runtime_get_sync() only in the individual ethtool_ops callbacks that > access device registers. > > Subsequently, f32a21376573 ("ethtool: runtime-resume netdev parent before > ethtool ioctl ops") added pm_runtime_get_sync() in the dev_ethtool() path, > so the device is resumed before *any* ethtool_ops callback, as it was > before 3ef672ab1862. > > Remove most runtime resumes from ethtool_ops, which are now redundant > because the resume has already been done by dev_ethtool(). This is > essentially a revert of 3ef672ab1862 ("e1000e: ethtool unnecessarily takes > device out of RPM suspend"). > > There are a couple subtleties: > > - Prior to 3ef672ab1862, the device was resumed only for the duration of > a single ethtool callback. 3ef672ab1862 changed e1000_set_phys_id() so > the device was resumed for ETHTOOL_ID_ACTIVE and remained resumed until > a subsequent callback for ETHTOOL_ID_INACTIVE. Preserve that part of > 3ef672ab1862 so the device will not be runtime suspended while in the > ETHTOOL_ID_ACTIVE state. > > - 3ef672ab1862 added "if (!pm_runtime_suspended())" in before reading the > STATUS register in e1000_get_settings(). This was racy and is now > unnecessary because dev_ethtool() has resumed the device already, so > revert that. > > Signed-off-by: Bjorn Helgaas Reviewed-by: Simon Horman