Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp749671ybj; Tue, 5 May 2020 07:03:42 -0700 (PDT) X-Google-Smtp-Source: APiQypLd+d+nX4o32FgHeoWWkIP/DzlOJtkqdpX8s1BHCCSYAhCjeAze2G0A69+xEot9J46brRme X-Received: by 2002:a17:906:17c5:: with SMTP id u5mr2776036eje.275.1588687422646; Tue, 05 May 2020 07:03:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588687422; cv=none; d=google.com; s=arc-20160816; b=km5SGXRsX9WQ5t20x7GUygDGDVLYV7BKPVqes6yz/K6+ghM0bFX6aedN8V0UrIxhB6 4n9kmoSf3u/QtAtkMhZxEMxh4MnHEH8qY5CYJQJ6mcjNnT9sU7HwQeymHk9qUiTHtzad IBVhM0BdFjhiyWlF4c2gRf9Nao0JCi3MAJeVYSvxa/QXZ/3nqwf8ZS8rWUowt2V7BG0q aQqvXAYHFUR3uf4SE6n4g1s2jBe/sKzZn+ODzXKYAK8Rm7f2mN4nHQH//uMVZd//MRwl E6/h3dD6OwroB2tazBjjAiq9HIJAmxEEZKEZJXgvH6/cud660Y4JxVbdNCft0YKPrpct USNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=aDTi/bV9Qw/AAvP5ur4Fj9XH9RI/wWMYaYctDSch/Po=; b=xegYy5v6lsTqeflxj80VkF6YQyzXQkCi89a+rvUXW2M06iDhJhvw11bWYWNVK7UoS6 x9gQU//xhqMNETP2yiBSSDo9Vkrmytl72irRHl6tFz0WhqbzJYU8av7z8XQYTqcZipqK 98hBPgPYmQTg6c4vBFw5IOUE98fP/I27pJBdtkBEZKgYX4we8T++g+IaiS8E8U30UAHt F3lhsRv7K1y/wcCerPWPh9rekHs8KzloEQMgNFtAqhB4c4+74o02fyYtRS2OQHqVxWUe LQWtKRP1N7qXhFH5BEomLg4f0tqiaI6C4PSu8WOms0KBzqhH8qml31EqvYQykG2/F38l Ww+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j18si1323699edj.12.2020.05.05.07.03.02; Tue, 05 May 2020 07:03:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729186AbgEEOAx convert rfc822-to-8bit (ORCPT + 99 others); Tue, 5 May 2020 10:00:53 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:55372 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728076AbgEEOAw (ORCPT ); Tue, 5 May 2020 10:00:52 -0400 Received: from mail-pj1-f69.google.com ([209.85.216.69]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jVy7u-0000Zb-Kh for linux-kernel@vger.kernel.org; Tue, 05 May 2020 14:00:50 +0000 Received: by mail-pj1-f69.google.com with SMTP id z22so2662559pjt.0 for ; Tue, 05 May 2020 07:00:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Tmt1kAkSNgDDA6SgCoiKzqt8Vdok8wOVXa0LwLlOOZU=; b=ZRiZnAUg21/NXnjd4IzOAc5NoPtLJ1xe/9fXEgAsoMgYtPhW8AxWsVDOONW0imkuBA NuzNn8KVyLtzt2Cl4FGAeROV11+7Ikmh+IpCm5XoDUZKlhMIE7Gh1DdtS6eRnx43MN2U sVuRILHMa0LbtHqdO1RwdePYa6ifEcuD/c8CtEYPh6wXV1BFMdUDbe9FKNtyueGnVyf6 B0BUSd7wFt3puYGQCA/hJDFtRIJrQ2mmZIngGJuN81JOTDuWkeNyqHGrpS+uQrvtx2+j 1lTftjH54NOij4YONR+5wUyrg8t9Kq7oA5pxysRABIyssOXAYbKm6ZFeE4vCG8dCenu7 f8hg== X-Gm-Message-State: AGi0PuaFmsrqbIg6NAE7QGnAsKcRQsn2jlZ+eJGYCUFQLj35MpDHoFOl MaPwuz4tv6H82fbCIfheRwOXuZrAhB9dRIhDuv8cKrYvvEOxt8vrjKnBkwYq6h6MQqx23jfn1Ec D1381EJLPZ0RsJ5cnD9mU4g8gMdUVNtQZAQn05yW2Xg== X-Received: by 2002:a17:902:ea86:: with SMTP id x6mr2988474plb.75.1588687248904; Tue, 05 May 2020 07:00:48 -0700 (PDT) X-Received: by 2002:a17:902:ea86:: with SMTP id x6mr2988449plb.75.1588687248460; Tue, 05 May 2020 07:00:48 -0700 (PDT) Received: from [192.168.1.208] (220-133-187-190.HINET-IP.hinet.net. [220.133.187.190]) by smtp.gmail.com with ESMTPSA id z60sm2236850pjj.14.2020.05.05.07.00.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 May 2020 07:00:47 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: [PATCH v2] PCI/ASPM: Enable ASPM for root complex <-> bridge <-> bridge case From: Kai-Heng Feng In-Reply-To: <20200505133812.GA353121@bjorn-Precision-5520> Date: Tue, 5 May 2020 22:00:44 +0800 Cc: Bjorn Helgaas , Heiner Kallweit , "Rafael J. Wysocki" , "David S. Miller" , Krzysztof Wilczynski , "open list:PCI SUBSYSTEM" , open list Content-Transfer-Encoding: 8BIT Message-Id: References: <20200505133812.GA353121@bjorn-Precision-5520> To: Bjorn Helgaas X-Mailer: Apple Mail (2.3608.80.23.2.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On May 5, 2020, at 21:38, Bjorn Helgaas wrote: > > On Tue, May 05, 2020 at 08:27:59PM +0800, Kai-Heng Feng wrote: >> The TI PCIe-to-PCI bridge prevents the Intel SoC from entering power >> state deeper than PC3 due to disabled ASPM, consumes lots of unnecessary >> power. On Windows ASPM L1 is enabled on the device and its upstream >> bridge, so it can make the Intel SoC reach PC8 or PC10 to save lots of >> power. > > The above is a benefit, but leading off with it suggests that this > change is specifically for that config, which it isn't. Yes, it applies all devices that meet the condition. > >> Currently, ASPM is disabled if downstream has bridge function. It was >> introduced by commit 7d715a6c1ae5 ("PCI: add PCI Express ASPM support"). >> The commit introduced PCIe ASPM support, but didn't explain why ASPM >> needs to be in that case. > > s/needs to be in that case/needs to be disabled in that case/ ? Yes indeed I missed that word... > >> So relax the condition a bit to let bridge which connects to root >> complex enables ASPM, instead of removing it completely, to avoid >> regression. > > If this is a regression, that means it used to work correctly. So are > you saying 7d715a6c1ae5^ works correctly? That seems doubtful since > 7d715a6c1ae5 appeared in v2.6.26 and added ASPM support in the first > place. Clearly I didn't express my intention well enough. What I meant was, we can either remove the "disable ASPM on bridge" case completely, or do what this patch does. > >> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=207571 >> Signed-off-by: Kai-Heng Feng >> --- >> drivers/pci/pcie/aspm.c | 14 ++++++++------ >> 1 file changed, 8 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c >> index 2378ed692534..af5e22d78101 100644 >> --- a/drivers/pci/pcie/aspm.c >> +++ b/drivers/pci/pcie/aspm.c >> @@ -629,13 +629,15 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist) >> /* Setup initial capable state. Will be updated later */ >> link->aspm_capable = link->aspm_support; >> /* >> - * If the downstream component has pci bridge function, don't >> - * do ASPM for now. > > I agree, that comment is missing the essential information about *why* > we don't do ASPM. Or missing a part to re-enable ASPM in later time. > >> + * If upstream bridge isn't connected to root complex and the >> + * downstream component has pci bridge function, don't do ASPM for now. > > But this comment just perpetuates it and makes the special case even > more special. I think we should either remove that special case > completely or figure out what the real issue is. I do prefer remote it completely, but I was afraid of introducing any regression so I just made the case more "special". > > I know we weren't always very good about computing the acceptable > latencies (and we still don't handle LTR correctly, though that's an > L1 Substates issue that wouldn't have applied in the 7d715a6c1ae5 > timeframe). Seems like Windows doesn't disable ASPM on bridge to bridge case, can we take the risk and remove the special case completely? Kai-Heng > >> */ >> - list_for_each_entry(child, &linkbus->devices, bus_list) { >> - if (pci_pcie_type(child) == PCI_EXP_TYPE_PCI_BRIDGE) { >> - link->aspm_disable = ASPM_STATE_ALL; >> - break; >> + if (parent->bus->parent) { >> + list_for_each_entry(child, &linkbus->devices, bus_list) { >> + if (pci_pcie_type(child) == PCI_EXP_TYPE_PCI_BRIDGE) { >> + link->aspm_disable = ASPM_STATE_ALL; >> + break; >> + } >> } >> } >> >> -- >> 2.17.1