Skip to content

PCI: revert to allocating bottom-up, avoid E820 areas

Bjorn Helgaas linux-acpi lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest9 patches 10 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9Revert "PCI: fix pci_bus_alloc_resource() hang, prefer positive decode"drivers/pci/bus.c+21 -490 replies
2/9Revert "x86: allocate space within a region top-down"arch/x86/kernel/setup.c+0 -10 replies
3/9Revert "x86/PCI: allocate space from the end of a region, not the beginning"arch/x86/pci/i386.c+6 -110 replies
4/9Revert "PCI: allocate bus resources from the top down"drivers/pci/bus.c+5 -480 replies
5/9Revert "resources: support allocating space within a region from the top down"Documentation/kernel-parameters.txt include/linux/ioport.h kernel/resource.c+4 -1000 replies
6/9resources: add arch hook for preventing allocation in reserved areasinclude/linux/ioport.h kernel/resource.c+7 -03 replies
7/9x86: avoid low BIOS area when allocating address spacearch/x86/kernel/Makefile arch/x86/kernel/resource.c arch/x86/pci/i386.c+12 -30 replies
8/9x86: avoid E820 regions when allocating address spacearch/x86/kernel/resource.c+37 -12 replies
9/9x86: avoid high BIOS area when allocating address spacearch/x86/include/asm/e820.h arch/x86/kernel/resource.c+5 -10 replies

Reviews trailers per patch

None of the 9 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchH. Peter Anvin
SeriesA-b
1/9
2/9
3/9
4/9
5/9
6/9
7/9
8/9
9/9

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/9] PCI: revert to allocating bottom-up, avoid E820 areas

[This is 2.6.37 material]

In 2.6.34 and later, we automatically use "pci=use_crs" on recent (2008 or newer) machines, which means we assign PCI resources from the host bridge windows described by ACPI _CRS.

In many cases, _CRS claims the windows are bigger than they really are, e.g., they may overlap system memory, ROM, or other ACPI devices.

Linux allocates PCI memory bottom-up, ignores most ACPI devices, and does an incomplete job of avoiding E820 reserved areas, which caused problems like
https://bugzilla.kernel.org/show_bug.cgi?id=16228 .

As far as I can tell, Windows deals with this situation by removing all ACPI resources and allocating the remaining space top-down.

I tried to make Linux allocate top-down as well, but since we don't have a good mechanism for avoiding the ACPI devices that clutter the top of memory, we tripped over several of those, which resulted in these regressions:

    https://bugzilla.kernel.org/show_bug.cgi?id=23132 (Dell 1545)
    https://bugzilla.kernel.org/show_bug.cgi?id=23332 (HP nx6325)
    https://bugzilla.kernel.org/show_bug.cgi?id=23542 (HP 2530p)
    https://bugzilla.kernel.org/show_bug.cgi?id=23802 (PCI / TPM conflict)

So I think the best band-aid for now is to revert to bottom-up allocation and do a better job of avoiding E820 reserved areas. Obviously, it's not complete because we could still trip over ACPI devices (as in 23802), but that's a problem we've always had and it's not as likely if we go bottom-up.

Patches 1-5 of this series are straight reverts ("git revert -n") of these patches which were merged in 2.6.37-rc1:

82e3e76 PCI: fix pci_bus_alloc_resource() hang, prefer positive decode 1af3c2e x86: allocate space within a region top-down
dc9887d x86/PCI: allocate space from the end of a region, not the beginning b126b47 PCI: allocate bus resources from the top down
e7f8567 resources: support allocating space within a region from the top down

Patches 6-9 add the ability to avoid E820 regions and the top 2MB below 4GB. The last patch (avoid top 2MB) is not strictly necessary in that it doesn't fix any current issues I'm aware of.

Bjorn
---

Bjorn Helgaas (9):
Revert "PCI: fix pci_bus_alloc_resource() hang, prefer positive decode" Revert "x86: allocate space within a region top-down"
Revert "x86/PCI: allocate space from the end of a region, not the beginning" Revert "PCI: allocate bus resources from the top down"
Revert "resources: support allocating space within a region from the top down"
resources: add arch hook for preventing allocation in reserved areas
x86: avoid low BIOS area when allocating address space
x86: avoid E820 regions when allocating address space
x86: avoid high BIOS area when allocating address space

 Documentation/kernel-parameters.txt |    5 --
 arch/x86/include/asm/e820.h         |    3 +
 arch/x86/kernel/Makefile            |    1 
 arch/x86/kernel/resource.c          |   48 ++++++++++++++++
 arch/x86/kernel/setup.c             |    1 
 arch/x86/pci/i386.c                 |   18 ++----
 drivers/pci/bus.c                   |   81 ++-------------------------
 include/linux/ioport.h              |    2 -
 kernel/resource.c                   |  104 +++--------------------------------
 9 files changed, 73 insertions(+), 190 deletions(-)
 create mode 100644 arch/x86/kernel/resource.c