Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp5806196rwb; Wed, 9 Aug 2023 09:18:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH4QYldwUJ6Ta/usL0EdGiK3htGyIV7KU/fMV+bb12FJ5hMF56WT6/PwbKw09LBfg3Zu+kJ X-Received: by 2002:aa7:d745:0:b0:51d:9ddf:f0f6 with SMTP id a5-20020aa7d745000000b0051d9ddff0f6mr2522370eds.36.1691597939479; Wed, 09 Aug 2023 09:18:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691597939; cv=none; d=google.com; s=arc-20160816; b=MAUecG+9XRAFAGhcuPdqisbUNQrYiKKN0Rj9mpLSRxL0s3GBUZACx+ILINxa/D1BVd STVxpCTyWALdZQpy2bkXZWhxUD2Xp4RhrzWeKoiJm/8pQJEDLERvBqkNOQVx6W5JUmay kybvDL0gvtS7e2L/hN4Q+dLLqG7JQYYdcdvSyY795uSNwvtjE5cVqpxTjo87NraZJpBH Pgc81j+YAxAhPfQxydNDHnCQ4XAMJU678E7Rdd+u81UX5k5uIjeOO4MZmaOEcBzD9SPy yb/MaWaXV4Wq7w860x4gzONK20N9CAzEG8fsoOEG0LBqO62oyDBVJZtKTCoyp7Y7WOUY ORwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=IvGzFVP5SQwSC9rGu9WLVcEiDDZIn4yvZiZN1ERf4Ug=; fh=X/TZBY6ZryWhJSytDd2zKmPVYexUr+GuVV1MQa18EgM=; b=IKrWJIDiRL9lyAceBGOYvyllRn1r01dcQKv8eEoqcBkjOdtSkxqmlS4LZUJJqg3Ky/ ywqB56Y3VFJgG/xlC0TZfOINZmqWZ2W1Xsj8Llj/Sv1Vae7Si5uN/JXyO7xB5ErtjYr0 nh0cDLXUFsYnRRjdEkvxdK8BkI0SCkbX+Obj7SFaRGUgGWLl05LBQthiHfRllS4ro+dm j/ErA2y7Ua/wbrQdXrwfVL01PtRVNJVlH2bDB9h2xheCjk1xo5NamLCQsUMZZWcjB3I2 y93UL3jygdDsMjU49/3HuMxLk5wzCSZz9lWBSpkeWnf1hUTS0BggvpQMFu4rsydm1JI8 +xEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=FoHqy7Rk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e6-20020a50ec86000000b005222d54d570si9190946edr.406.2023.08.09.09.18.34; Wed, 09 Aug 2023 09:18:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=FoHqy7Rk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233336AbjHIPgw (ORCPT + 99 others); Wed, 9 Aug 2023 11:36:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230340AbjHIPgi (ORCPT ); Wed, 9 Aug 2023 11:36:38 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61DD635AE; Wed, 9 Aug 2023 08:36:06 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-686efa1804eso5078445b3a.3; Wed, 09 Aug 2023 08:36:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691595329; x=1692200129; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=IvGzFVP5SQwSC9rGu9WLVcEiDDZIn4yvZiZN1ERf4Ug=; b=FoHqy7RkWcAoLCzcl9xmRGPvWfsrJK8FWyXmnpbSA53y4WapOColhNjTmv+rbtvMYD paTn3K3IFBktLPu4XQy9OzoqtXn6ucYa0+m2wOBo76GlfecgmYBlZMs4oGJ47e5Qo15z +2yAiXkpjecu0sQzZwJgQSLtYrAbYtk9RVNT61WdS2lmQTGx1OcsQJIWMWH72bz0mtwe J2VcJTNLvE50pwL4UIbQ1QlMqP9xPzSgPl66rC9k8CSgV2KBB+LxeR20Ms3TwG63JToA NLeMgBbouWrr7RoT1zKv7e0/6/uXdpM/s62fm+/P2hyJxpKSR55DbLehjqrLv/J6K6E2 F8xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691595329; x=1692200129; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IvGzFVP5SQwSC9rGu9WLVcEiDDZIn4yvZiZN1ERf4Ug=; b=K5vLgQnHl2qdex8H72R6lNIA5k2Y8S6IvE0Qy3ftv+5dZ0oExnUo56MN9BM6bAeOVb 4XU2XTCu53Taki01AlV4R2rNIbr+CVuAHGI9/4n/+VbXDvk6qqK2JVkXGYjR5oNqq7EF mT5wQHBNSHFSldQ2o8Y7QXEWCmmN4musdJ27eSvgxYI9Hk2RwDsFH5JkjNcWlQZML0yT r6CfrT/KUpwGDW+LlOrhtOQ9o6nZSPBI7fCOeRuJ0tyxSiQOZKaA5utTDoclidthtOuL lJX0r2V9WxUw84qBFrDz9GA8dPKrVo5eJ8hsjr8sggMLw9CxYXI/HVzG6SSFSQqB7Or4 Xphg== X-Gm-Message-State: AOJu0YwfmMtehxKQwQsvRqXtTVXdjz6UK6B6/OR+9IkzaYzP0PyPZKiU J5Y3Da7rz3vh4pQvkaUND2Q= X-Received: by 2002:a17:903:1cd:b0:1b8:41d4:89f with SMTP id e13-20020a17090301cd00b001b841d4089fmr2943008plh.4.1691595329075; Wed, 09 Aug 2023 08:35:29 -0700 (PDT) Received: from ?IPV6:2600:8802:b00:4a48:3c29:7d43:1531:9375? ([2600:8802:b00:4a48:3c29:7d43:1531:9375]) by smtp.gmail.com with ESMTPSA id v3-20020a170902d68300b001b86dd825e7sm11370829ply.108.2023.08.09.08.35.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Aug 2023 08:35:28 -0700 (PDT) Message-ID: <50f0b253-8eae-a4bd-0c5d-d23b020ce8df@gmail.com> Date: Wed, 9 Aug 2023 08:35:24 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH] net: phy: Don't disable irqs on shutdown if WoL is enabled To: Vladimir Oltean , =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= Cc: Ioana Ciornei , "Russell King (Oracle)" , Andrew Lunn , Heiner Kallweit , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Ioana Ciornei , Andre Edich , Antoine Tenart , Baruch Siach , Christophe Leroy , Divya Koppera , Hauke Mehrtens , Jerome Brunet , Kavya Sree Kotagiri , Linus Walleij , Marco Felsch , Marek Vasut , Martin Blumenstingl , Mathias Kresin , Maxim Kochetkov , Michael Walle , Neil Armstrong , Nisar Sayed , Oleksij Rempel , Philippe Schenker , Willy Liu , Yuiko Oshino References: <20230809135702.4dencx4ikij7d33y@skbuf> Content-Language: en-US From: Florian Fainelli In-Reply-To: <20230809135702.4dencx4ikij7d33y@skbuf> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/9/2023 6:58 AM, Vladimir Oltean wrote: > Hi Uwe, > > (I hope the threading won't be broken) > > On Fri, Aug 04, 2023 at 09:17:57AM +0200, Uwe Kleine-König wrote: >> Most PHYs signal WoL using an interrupt. So disabling interrupts breaks >> WoL at least on PHYs covered by the marvell driver. So skip disabling >> irqs on shutdown if WoL is enabled. >> >> While at it also explain the motivation that irqs are disabled at all. >> >> Fixes: e2f016cf7751 ("net: phy: add a shutdown procedure") >> Signed-off-by: Uwe Kleine-König >> --- >> Hello, >> >> while I'm not sure that disabling interrupts is a good idea in general, >> this change at least should fix the WoL case. Note that this change is >> only compile tested as next doesn't boot on my test machine (because of >> https://git.kernel.org/linus/b3574f579ece24439c90e9a179742c61205fbcfa) >> and 6.1 (which is the other kernel I have running) doesn't know about >> .wol_enabled. I don't want to delay this fix until I bisected this new >> issue. >> >> Assuming this patch is eligible for backporting to stable, maybe point >> out that it depends on v6.5-rc1~163^2~286^2~2 ("net: phy: Allow drivers >> to always call into ->suspend()"). Didn't try to backport that. >> >> Best regards >> Uwe >> >> drivers/net/phy/phy_device.c | 9 +++++++++ >> 1 file changed, 9 insertions(+) >> >> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c >> index 61921d4dbb13..6d1526bdd1d7 100644 >> --- a/drivers/net/phy/phy_device.c >> +++ b/drivers/net/phy/phy_device.c >> @@ -3340,6 +3340,15 @@ static void phy_shutdown(struct device *dev) >> if (phydev->state == PHY_READY || !phydev->attached_dev) >> return; >> >> + /* Most phys signal WoL via the irq line. So for these irqs shouldn't be >> + * disabled. >> + */ >> + if (phydev->wol_enabled) >> + return; >> + >> + /* On shutdown disable irqs to prevent an irq storm on systems where the >> + * irq line is shared by several devices. >> + */ >> phy_disable_interrupts(phydev); >> } >> >> -- >> 2.40.1 >> >> > > I think the idea is not bad and something along these lines might be the > way to go, but I don't think it works (as currently implemented, and > tested by me, prints below). > > Upon a quick search, phydev->wol_enabled is only set from phy_suspend(), > and phy_suspend() isn't invoked from the ethnl_set_wol() call stack. You are right, this was an ill advised suggestion from my side here. In principle however we need to have something like this in the shutdown routine to have this patch work: struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL }; struct net_device *netdev = phydev->attached_dev; int ret; phy_ethtool_get_wol(phydev, &wol); phydev->wol_enabled = wol.wolopts || (netdev && netdev->wol_enabled); if (!phydev->wol_enabled) return; this does make me wonder whether Uwe tested with a prior system suspend/resume cycle before shutting down? -- Florian