pci cacheline size / latency oddness.
During boot of todays -git, I noticed this..
PCI: Setting latency timer of device 0000:00:1d.7 to 64
after boot, lspci shows..
00:1d.7 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB2 EHCI Controller (rev 02) (prog-if 20 [EHCI])
Subsystem: Dell: Unknown device 0169
Flags: bus master, medium devsel, latency 0, IRQ 201
^^
It also complains about..
PCI: cache line size of 128 is not supported by device 0000:00:1d.7
x86-64 doesn't have an arch override for pci_cache_line_size, so it ends up at L1_CACHE_BYTES >> 2, which is 128 if you build x86-64 kernels with CONFIG_GENERIC_CPU or CONFIG_MPSC This means we will do the wrong thing on AMD machines which have
64 byte cachelines. I saw this problem however on an em64t box.
Would it make sense to shift >> once more if it fails, and retry with a smaller size perhaps ?
Dave
Quoted 10 lines · Dave Jones
During boot of todays -git, I noticed this..
PCI: Setting latency timer of device 0000:00:1d.7 to 64
after boot, lspci shows..
00:1d.7 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB2 EHCI Controller (rev 02) (prog-if 20 [EHCI])
Subsystem: Dell: Unknown device 0169
Flags: bus master, medium devsel, latency 0, IRQ 201^^
Probably the hardware doesn't want you to set it, similar to what I describe in the following:
Quoted 3 lines
It also complains about..
PCI: cache line size of 128 is not supported by device 0000:00:1d.7
This message means that it couldn't set the cacheline size at all. Most likely it is either zero, or hardcoded in the silicon. Has very little to do with the platform, and more to do with the device.
Quoted 7 lines
x86-64 doesn't have an arch override for
pci_cache_line_size, so it ends up atL1_CACHE_BYTES>> 2, which is 128 if you build x86-64 kernels withCONFIG_GENERIC_CPUorCONFIG_MPSCThis means we will do the wrong thing on AMD machines which have
64 byte cachelines. I saw this problem however on an em64t box.
Would it make sense to shift >> once more if it fails, and retry with a smaller size perhaps ?
Too big is far better than too small.
Jeff
Quoted 2 lines · Dave Jones
This means we will do the wrong thing on AMD machines which have 64 byte cachelines.
pcibios_init (in i386/pci/common.c, which is linked in by X86_64 PCI code) seems to do this
if (c->x86 >= 6 && c->x86_vendor == X86_VENDOR_AMD)
pci_cache_line_size = 64 >> 2; /* K7 & K8 */
Is it correct to expect all AMD k7/8 machines to have 16 as cache line size - I thought 64 was more appropriate?
On my Athlon64 laptop, all PCI devices end up having 0 latency.
Quoted 1 line
x86-64 doesn't have an arch override for
pci_cache_line_size
I am trying to fix it up - What's the right way to override it in x86_64 code? Just initialize it to 64 may be?
Parag
Quoted 13 lines · Dave Jones
During boot of todays -git, I noticed this..
PCI: Setting latency timer of device 0000:00:1d.7 to 64
after boot, lspci shows..
00:1d.7 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB2 EHCI Controller (rev 02) (prog-if 20 [EHCI])
Subsystem: Dell: Unknown device 0169
Flags: bus master, medium devsel, latency 0, IRQ 201^^It also complains about..
Quoted 7 lines
PCI: cache line size of 128 is not supported by device 0000:00:1d.7
x86-64 doesn't have an arch override for
pci_cache_line_size, so it ends up atL1_CACHE_BYTES>> 2, which is 128 if you build x86-64 kernels withCONFIG_GENERIC_CPUorCONFIG_MPSCThis means we will do the wrong thing on AMD machines which have
64 byte cachelines. I saw this problem however on an em64t box.
We should be running arch/i386/pci/common.c:pcibios_init As far as I can see that should do the right thing on x86-64 too.
Quoted 2 lines
Would it make sense to shift >> once more if it fails, and retry with a smaller size perhaps ?
Not sure how much sense it makes to configure a PCI device to a smaller cache line size than true. Best probably to leave it alone in this case.
-Andi
Quoted 4 lines · Parag Warudkar
Quoted 2 lines · Dave Jones
This means we will do the wrong thing on AMD machines which have 64 byte cachelines.
Quoted 8 lines
pcibios_init(ini386/pci/common.c, which is linked in byX86_64PCI code) seems to do thisif (
c->x86>= 6 &&c->x86_vendor==X86_VENDOR_AMD)pci_cache_line_size = 64 >> 2; /* K7 & K8 */Is it correct to expect all AMD k7/8 machines to have 16 as cache line size - I thought 64 was more appropriate?
iirc the pci cache line register takes a value shifted left by 2 bits.
And yes all K7/K8 machines have 64byte cache lines.
Quoted 1 line
On my Athlon64 laptop, all PCI devices end up having 0 latency.
That has nothing to do with the cache line size.
Quoted 5 lines
Quoted 2 lines
x86-64 doesn't have an arch override for
pci_cache_line_sizeI am trying to fix it up - What's the right way to override it in
x86_64code? Just initialize it to 64 may be?
I don't think there is anything to fix.
-Andi