Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752631AbdHINbU (ORCPT ); Wed, 9 Aug 2017 09:31:20 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:2602 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752330AbdHINbS (ORCPT ); Wed, 9 Aug 2017 09:31:18 -0400 Subject: Re: [PATCH v9 2/4] PCI: Disable PCIe Relaxed Ordering if unsupported To: Bjorn Helgaas References: <1501917313-9812-1-git-send-email-dingtianhong@huawei.com> <1501917313-9812-3-git-send-email-dingtianhong@huawei.com> <20170809022239.GP16580@bhelgaas-glaptop.roam.corp.google.com> CC: , , , , , , , , , , , , , , , , , , , , , , , , From: Ding Tianhong Message-ID: Date: Wed, 9 Aug 2017 21:23:58 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20170809022239.GP16580@bhelgaas-glaptop.roam.corp.google.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.23.32] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.598B0D00.0057,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: e2902469591c932284d92faa657dcb40 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2552 Lines: 77 Hi Bjorn: On 2017/8/9 10:22, Bjorn Helgaas wrote: > On Sat, Aug 05, 2017 at 03:15:11PM +0800, Ding Tianhong wrote: >> When bit4 is set in the PCIe Device Control register, it indicates >> whether the device is permitted to use relaxed ordering. >> On some platforms using relaxed ordering can have performance issues or >> due to erratum can cause data-corruption. In such cases devices must avoid >> using relaxed ordering. >> >> This patch checks if there is any node in the hierarchy that indicates that >> using relaxed ordering is not safe. > > I think you only check the devices between the root port and the > target device. For example, you don't check siblings or cousins of > the target device. > OK, update the description. >> In such cases the patch turns off the >> relaxed ordering by clearing the eapability for this device. > > s/eapability/capability/ > >> And if the >> device is probably running in a guest machine, we should do nothing. > > I don't know what this sentence means. "Probably running in a guest > machine" doesn't really make sense, and there's nothing in your patch > that explicitly checks for being in a guest machine. > Alex noticed that we should do nothing if in the virtual machine because the Root Complex is NULL at that time, so I think this word should be more clearly here. >> Signed-off-by: Ding Tianhong >> Acked-by: Alexander Duyck >> Acked-by: Ashok Raj >> --- >> drivers/pci/pci.c | 29 +++++++++++++++++++++++++++++ >> drivers/pci/probe.c | 37 +++++++++++++++++++++++++++++++++++++ >> include/linux/pci.h | 2 ++ >> 3 files changed, 68 insertions(+) >> >> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c >> index af0cc34..4f9d7c1 100644 >> --- a/drivers/pci/pci.c >> +++ b/drivers/pci/pci.c >> @@ -4854,6 +4854,35 @@ int pcie_set_mps(struct pci_dev *dev, int mps) >> EXPORT_SYMBOL(pcie_set_mps); >> >> /** >> + * pcie_clear_relaxed_ordering - clear PCI Express relaxed ordering bit >> + * @dev: PCI device to query >> + * >> + * If possible clear relaxed ordering > > Why "If possible"? The bit is required to be RW or hardwired to zero, > so PCI_EXP_DEVCTL_RELAX_EN should *always* be zero when this returns. > OK >> + */ >> +int pcie_clear_relaxed_ordering(struct pci_dev *dev) >> +{ ... >> >> _______________________________________________ >> linux-arm-kernel mailing list >> linux-arm-kernel@lists.infradead.org >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel > > . >