Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5314609rwd; Mon, 5 Jun 2023 01:31:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ45MRJhSNg3ffe+1BQZVqvABeTaeZZunLX4wHm2OePw5KDDjBaBN4w7LE1WlgYd24OHJTac X-Received: by 2002:a05:6a20:4390:b0:105:dafa:fec2 with SMTP id i16-20020a056a20439000b00105dafafec2mr1855162pzl.53.1685953916565; Mon, 05 Jun 2023 01:31:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685953916; cv=none; d=google.com; s=arc-20160816; b=TtwA/Im1huGFWb6DZ7PY/0Tig0mjVboBzKTuMqJseHBcquIGReAcKhhDeI+dTLwXhl 8uTkqrxmYuXyq+xpwuHPQ+wvx8EWKRId6h/Bdc7GxHVOUyl1Ej/Kq2YhDsKF6fN6FbDd a2w7+bmqtgmH3NiQ8x0skAKDxooIpLilV1HXW9MN/q2jQ+YdvRTMRDT3swEIKOoDVBKd lES3m49v/fLsbz9iMSTC2e79r8VcK7ivKnKJwf1QuyuMWwoNk9dDRV7AmVdrzmhFfiDm JjHLYAYDUrgUhInqNFOIoesYxC081lsaweScPE7HCVhua6AFk7h1u82Rlbri7GJoYoTX Oyfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=w/vz4qy3Kc7GOpDb+K0VZMneVYxuO4mipxqG9LguKK8=; b=bZMHEcycjsIUN89570EZAXbGfqRUAfpyPIID5fLOGVTe0mK/bq/hcBODmKqWowJxCR 3wS8acMnbPa+S8bXqd7UGr1rsjFa4+YiX+saeomlpoYWA9Yc7qAGYzMYqN8x/5GLeK5t nppKzvmTzDqfPAHIDYSYCR7gDZBbM91vcA3uOxYy9iswpGxFidl0q/i/laXA86MBsJJX QNSSCn5XZ2E8CdvzVWpbX+HpoAwAM4fCj276gmo5ZLAjc+GTHObrVggqb/8F99Oao4tG K5sqsPUbE3EsZ8E9EYJZNQ4pv4fcoP2uZv+UKhPwSuWrROMq+bP7hpzEQ6iU7yibXAX2 Q6gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=lQXJHQdW; 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=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m5-20020a170902db0500b0019e57f5a5aesi5323534plx.567.2023.06.05.01.31.43; Mon, 05 Jun 2023 01:31:56 -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=@canonical.com header.s=20210705 header.b=lQXJHQdW; 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=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229780AbjFEIZv (ORCPT + 99 others); Mon, 5 Jun 2023 04:25:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229639AbjFEIZu (ORCPT ); Mon, 5 Jun 2023 04:25:50 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05287B7 for ; Mon, 5 Jun 2023 01:25:46 -0700 (PDT) Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 3F4B33F03D for ; Mon, 5 Jun 2023 08:25:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1685953545; bh=w/vz4qy3Kc7GOpDb+K0VZMneVYxuO4mipxqG9LguKK8=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=lQXJHQdWxiAUtX8//YuXiJod2Y9mAZaTY22VEoNDePKm31+8wZLkJNnWaEGl2STaU qTe0lRkI6py8cedsKN9vleECcGnyh4K+uzcTqHKjVwqhp2UfRrDyAN9pH/Oqy+U0K2 HpKf/HONW+PUsQsz7CBOZReRL2/391QMl9Mrr0LuMgnbu5IbwJ/S3W/MRR6YM1METd GOBiWk10G/QBMQXb/r5fQBT+VLSNHB47gokw11neitRE7hDbV3WaR3/iqHcuj3kiT6 +XPGiqjPBOofdDqjT+ssr8sD4AT3igCbERR26/s6QgWd3gvRLk8tm+JmiLyqs+g4Lc PL2s1uX/0jS2g== Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-75d53bab5a9so124317785a.2 for ; Mon, 05 Jun 2023 01:25:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685953544; x=1688545544; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w/vz4qy3Kc7GOpDb+K0VZMneVYxuO4mipxqG9LguKK8=; b=E14aqg/YbehHGRZq9Gs7Nx9p+EIHgtE51Z6lHOY1EkgDpBfQE4APWMTKMloyz+1I0/ eelqfB/TszwcLd/ERafRTBFHIp8/AEnfzz4vVSLdwW56BEP7l5lfkLeoTX21CZVGpvS/ 4aiqE8rc83N0di7/iGdJjL2bCUIiV/MA0Q5kWtQvr793C997DxDs0gLJF8GDpbnfx+16 w2CUWgKi4XUS80WjryvJC1xxb17tsvyXQpGSTEQ34W2eEnZ+sFsQPq0QHgapaZxSUn+j eU53KjtEBQ0rOmLdnTVn30oBIChRQWSqD2b9L6OG3D8rDkZdRbFMsHpuGrWRkaj2YwR/ sgYQ== X-Gm-Message-State: AC+VfDw7Qiz8nPLYLw3oopbiry6txYdxs+4A20BG9kJmE5idK+wJA/EA BrBuxynoRPkBS9uiNdpw8EIeyGM4x1MFtz+KOCGvxPgoo4UWDeV/hoX6QP+PL+x2ubfOrHSXsHq LZ1EIImyc7THEt/eQ1MrA4uJHfdbufYa56f0O0dIdFNp78VkPyIBhB93Ecg== X-Received: by 2002:a05:620a:678b:b0:75e:b9b8:ab57 with SMTP id rr11-20020a05620a678b00b0075eb9b8ab57mr1321523qkn.70.1685953544344; Mon, 05 Jun 2023 01:25:44 -0700 (PDT) X-Received: by 2002:a05:620a:678b:b0:75e:b9b8:ab57 with SMTP id rr11-20020a05620a678b00b0075eb9b8ab57mr1321510qkn.70.1685953544065; Mon, 05 Jun 2023 01:25:44 -0700 (PDT) MIME-Version: 1.0 References: <20230601162537.1163270-1-kai.heng.feng@canonical.com> <269262acfcce8eb1b85ee1fe3424a5ef2991f481.camel@gmail.com> <577f38ed-8532-c32e-07bd-4a3b384d5fe8@molgen.mpg.de> In-Reply-To: <577f38ed-8532-c32e-07bd-4a3b384d5fe8@molgen.mpg.de> From: Kai-Heng Feng Date: Mon, 5 Jun 2023 16:25:32 +0800 Message-ID: Subject: Re: [Intel-wired-lan] [PATCH] e1000e: Use PME poll to circumvent unreliable ACPI wake To: Paul Menzel Cc: Alexander H Duyck , linux-pm@vger.kernel.org, intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org, Eric Dumazet , Jesse Brandeburg , Tony Nguyen , netdev@vger.kernel.org, Jakub Kicinski , Paolo Abeni , "David S. Miller" , linux-pci@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Hi Paul, On Fri, Jun 2, 2023 at 4:43=E2=80=AFPM Paul Menzel = wrote: > > [Cc: linux-pci@vger.kernel.org] > > Dear Kai, > > > Thank you for your patch. > > Am 02.06.23 um 03:46 schrieb Kai-Heng Feng: > > On Fri, Jun 2, 2023 at 4:24=E2=80=AFAM Alexander H Duyck wrote: > >> > >> On Fri, 2023-06-02 at 00:25 +0800, Kai-Heng Feng wrote: > >>> On some I219 devices, ethernet cable plugging detection only works on= ce > >>> from PCI D3 state. Subsequent cable plugging does set PME bit correct= ly, > >>> but device still doesn't get woken up. > > Could you please add the list of all the devices with the firmware > version, you know this problem exists on? Please also add the URLs of > the bug reports at the end of the commit message. Firmware do you mean the firmware on I219 device, or BIOS? > > Is that problem logged somehow? Could a log message be added first? There's nothing gets logged. When this happens the ACPI GPE is dead silent. > > >> Do we have a root cause on why things don't get woken up? This seems > >> like an issue where something isn't getting reset after the first > >> wakeup and so future ones are blocked. > > > > No we don't know the root cause. > > I guess the D3 wake isn't really tested under Windows because I219 > > doesn't use runtime D3 on Windows. > > How do you know? Where you able to look at the Microsoft Windows driver > source code? Device Manager shows the current PCI state. > > >>> Since I219 connects to the root complex directly, it relies on platfo= rm > >>> firmware (ACPI) to wake it up. In this case, the GPE from _PRW only > >>> works for first cable plugging but fails to notify the driver for > >>> subsequent plugging events. > >>> > >>> The issue was originally found on CNP, but the same issue can be foun= d > >>> on ADL too. So workaround the issue by continuing use PME poll after > > The verb is spelled with a space: work around. Sure, will change it. > > >>> first ACPI wake. As PME poll is always used, the runtime suspend > >>> restriction for CNP can also be removed. > > When was that restriction for CNP added? The restriction for CNP+ was introduced by commit 459d69c407f9 ("e1000e: Disable runtime PM on CNP+") and modified by 3335369bad99 ("e1000e: Remove the runtime suspend restriction on CNP+"). > > >>> Signed-off-by: Kai-Heng Feng > >>> --- > >>> drivers/net/ethernet/intel/e1000e/netdev.c | 4 +++- > >>> 1 file changed, 3 insertions(+), 1 deletion(-) > >>> > >>> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net= /ethernet/intel/e1000e/netdev.c > >>> index bd7ef59b1f2e..f0e48f2bc3a2 100644 > >>> --- a/drivers/net/ethernet/intel/e1000e/netdev.c > >>> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c > >>> @@ -7021,6 +7021,8 @@ static __maybe_unused int e1000e_pm_runtime_res= ume(struct device *dev) > >>> struct e1000_adapter *adapter =3D netdev_priv(netdev); > >>> int rc; > >>> > >>> + pdev->pme_poll =3D true; > >>> + > >>> rc =3D __e1000_resume(pdev); > >>> if (rc) > >>> return rc; > >> > >> Doesn't this enable this too broadly. I know there are a number of > >> devices that run under the e1000e and I would imagine that we don't > >> want them all running with "pme_poll =3D true" do we? > > > > Whack a mole isn't scaling, either. > > The generation between CNP and ADL are probably affected too. > > > >> It seems like at a minimum we should only be setting this for specific > >> platofrms or devices instead of on all of them. > >> > >> Also this seems like something we should be setting on the suspend sid= e > >> since it seems to be cleared in the wakeup calls. > > > > pme_poll gets cleared on wakeup, and once it's cleared the device will > > be removed from pci_pme_list. > > > > To prevent that, reset pme_poll to true immediately on runtime resume. > > > >> Lastly I am not sure the first one is necessarily succeeding. You migh= t > >> want to check the status of pme_poll before you run your first test. > >> From what I can tell it looks like the initial state is true in > >> pci_pm_init. If so it might be getting cleared after the first wakeup > >> which is what causes your issues. > > > > That's by design. pme_poll gets cleared when the hardware is capable > > to signal wakeup via PME# or ACPI GPE. For detected hardwares, the > > pme_poll will never be cleared. > > So this becomes tricky for the issue, since the ACPI GPE works for > > just one time, but never again. > > > >>> @@ -7682,7 +7684,7 @@ static int e1000_probe(struct pci_dev *pdev, co= nst struct pci_device_id *ent) > >>> > >>> dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_SMART_PREPARE); > >>> > >>> - if (pci_dev_run_wake(pdev) && hw->mac.type !=3D e1000_pch_cnp) > >>> + if (pci_dev_run_wake(pdev)) > >>> pm_runtime_put_noidle(&pdev->dev); > >>> > >>> return 0; > >> > >> I assume this is the original workaround that was put in to address > >> this issue. Perhaps you should add a Fixes tag to this to identify > >> which workaround this patch is meant to be replacing. > > > > Another possibility is to remove runtime power management completely. > > I wonder why Windows keep the device at D0 all the time? > > Who knows how to contact Intel=E2=80=99s driver developers for Microsoft = Windows? Probably this mailing list? > > > Can Linux align with Windows? > > Before deciding this, the power usage in the different states should be > measured. The power usage doesn't matter if the device can't function properly. Kai-Heng > > > Kind regards, > > Paul