Re: [PATCH v9 2/4] PCI: Disable PCIe Relaxed Ordering if unsupported
From: Ding Tianhong
Date: Wed Aug 09 2017 - 09:31:22 EST
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 <dingtianhong@xxxxxxxxxx>
>> Acked-by: Alexander Duyck <alexander.h.duyck@xxxxxxxxx>
>> Acked-by: Ashok Raj <ashok.raj@xxxxxxxxx>
>> ---
>> 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@xxxxxxxxxxxxxxxxxxx
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
> .
>