final PCI patches for 2.6.26
Subsystems (3)
PATCH 1/1 final PCI patches for 2.6.26
Some of these may not have seen review on linux-pci, so I'm sending them out for comment before I send Linus the pull request.
Any comments/objections?
The biggest patch by far is the resource_wc stuff; it should have been pushed earlier, but for some reason I thought Ingo & co. were going to do that...
Thanks,
Jesse
commit a123c3d9643464c56417680536ed9515f15cffa1
Author: Yinghai Lu <[email protected]> Date: Mon May 12 21:21:05 2008 +0200
PCI: use dev_to_node in pci_call_probe
to make sure get one online node.
drivers/pci/pci-driver.c +1 -1
@@ -181,7 +181,7 @@ static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev,any need to change it. */ struct mempolicy *oldpol;cpumask_t oldmask = current->cpus_allowed; -int node =pcibus_to_node (dev->bus); +int node =dev_to_node (&dev->dev);if (node >=0 ) {node_to_cpumask_ptr (nodecpumask, node);
commit d99f75679d17ada3e90a04c50605f90a6a590e45
Author: Miquel van Smoorenburg <[email protected]> Date: Thu Jun 5 18:14:44 2008 +0200
x86/PCI: pci-dma.c: don't always add __GFP_NORETRY to gfp
Currently arch/x86/kernel/pci-dma.c always adds __GFP_NORETRY to the allocation flags, because it wants to be reasonably sure not to deadlock when calling alloc_pages().
But really that should only be done in two cases:
- when allocating memory in the lower 16 MB DMA zone.
If there's no free memory there, waiting or OOM killing is of no use
- when optimistically trying an allocation in the DMA32 zone when dma_mask < DMA_32BIT_MASK hoping that the allocation happens to fall within the limits of the dma_mask
Also blindly adding __GFP_NORETRY to the the gfp variable might not be a good idea since we then also use it when calling dma_ops->alloc_coherent(). Clearing it might also not be a good idea, dma_alloc_coherent()'s caller might have set it on purpose. The gfp variable should not be clobbered.
[ [email protected]: converted to delta patch ontop of previous version. ]
arch/x86/kernel/pci-dma.c +10 -3
@@ -378,6 +378,7 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,struct page *page;unsigned long dma_mask =0 ;dma_addr_t bus; +int noretry =0 ;/* ignore region specifiers */ gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32);
@@ -397,19 +398,25 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,if (dev->dma_mask ==NULL )return NULL ; +/* Don't invoke OOM killer or retry in lower 16MB DMA zone */ +if (gfp & __GFP_DMA) + noretry =1 ; +#ifdef CONFIG_X86_64 /* Why <=? Even when the mask is smaller than 4GB it is often larger than 16MB and in this case we have a chance of finding fitting memory in the next higher zone first. If not retry with true GFP_DMA. -AK */ -if (dma_mask <=DMA_32BIT_MASK && !(gfp &GFP_DMA )) +if (dma_mask <=DMA_32BIT_MASK && !(gfp &GFP_DMA )) { gfp |=GFP_DMA32 ; +if (dma_mask <DMA_32BIT_MASK ) + noretry =1 ; + }#endif again: -/* Don't invoke OOM killer or retry in lower 16MB DMA zone */ page =dma_alloc_pages (dev, - (gfp &GFP_DMA ) ? gfp | __GFP_NORETRY : gfp,get_order (size)); + noretry ? gfp | __GFP_NORETRY : gfp,get_order (size));if (page ==NULL )return NULL ;
commit 7a7d16722262b50fb8433d1340153bceabf84af2
Author: Miquel van Smoorenburg <[email protected]> Date: Wed May 28 10:31:25 2008 +0200
x86/PCI: pci-dma.c: use __GFP_NO_OOM instead of __GFP_NORETRY
On Wed, 2008-05-28 at 04:47 +0200, Andi Kleen wrote:
> > So... why not just remove the setting of __GFP_NORETRY? Why is it > > wrong to oom-kill things in this case?
>
> When the 16MB zone overflows (which can be common in some workloads) > calling the OOM killer is pretty useless because it has barely any > real user data [only exception would be the "only 16MB" case Alan > mentioned]. Killing random processes in this case is bad.
>
> I think for 16MB __GFP_NORETRY is ok because there should be
> nothing freeable in there so looping is useless. Only exception would be the > "only 16MB total" case again but I'm not sure 2.6 supports that at all > on x86.
>
> On the other hand d_a_c() does more allocations than just 16MB, especially > on 64bit and the other zones need different strategies.
Okay, so how about this then ?
arch/x86/kernel/pci-dma.c +3 -4
@@ -397,9 +397,6 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,if (dev->dma_mask ==NULL )return NULL ; -/* Don't invoke OOM killer */ - gfp |= __GFP_NORETRY; -#ifdef CONFIG_X86_64 /* Why <=? Even when the mask is smaller than 4GB it is often larger than 16MB and in this case we have a chance of
@@ -410,7 +407,9 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,#endif again: - page =dma_alloc_pages (dev, gfp,get_order (size)); +/* Don't invoke OOM killer or retry in lower 16MB DMA zone */ + page =dma_alloc_pages (dev, + (gfp &GFP_DMA ) ? gfp | __GFP_NORETRY : gfp,get_order (size));if (page ==NULL )return NULL ;
commit db80e22298e1c774d7d59ee7ba622abd6248f8a5
Author: Jesse Barnes <[email protected]> Date: Thu Jun 12 12:39:32 2008 -0700
PCI: fixup write combine comment in pci_mmap_resource
Now that we can actually do write combining properly, there's no need to have the FIXME.
drivers/pci/pci-sysfs.c +0 -1
@@ -492,7 +492,6 @@ pci_mmap_legacy_mem(struct kobject *kobj, struct bin_attribute *attr,* @write_combine: 1 for write_combine mapping * * Use the regular PCI mapping routines to map a PCI resource into userspace. -* FIXME: write combining? maybe automatic for prefetchable regions? */ static int pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
commit 3361cb322a7aee901b7cb478c3bec65b8f2e7695
Author: [email protected] <[email protected]> Date: Tue Mar 18 17:00:22 2008 -0700
x86: PAT export resource_wc in pci sysfs
For the ranges with IORESOURCE_PREFETCH, export a new resource_wc interface in pci /sysfs along with resource (which is uncached).
Documentation/filesystems/sysfs-pci.txt +1 -0
@@ -36,6 +36,7 @@ files, each with their own function. local_cpus nearby CPU mask (cpumask, ro) resource PCI resource host addresses (ascii, ro) resource0..N PCI resource N, if present (binary, mmap) + resource0_wc..N_wc PCI WC map resource N, if prefetchable (binary, mmap) rom PCI ROM resource, if present (binary, ro) subsystem_device PCI subsystem device (ascii, ro) subsystem_vendor PCI subsystem vendor (ascii, ro)
drivers/pci/pci-sysfs.c +62 -22
122 lines not on this page · raw message
include/linux/pci.h +1 -0
@@ -206,6 +206,7 @@ struct pci_dev {struct bin_attribute *rom_attr;/* attribute descriptor for sysfs ROM entry */ int rom_attr_enabled;/* has display of the rom attribute been enabled? */ struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE ];/* sysfs file for resources */ +struct bin_attribute *res_attr_wc[DEVICE_COUNT_RESOURCE ];/* sysfs file for WC mapping of
resources */
#ifdef CONFIG_PCI_MSI
struct list_head msi_list;
#endif
Quoted 8 lines · Jesse Barnes
Some of these may not have seen review on linux-pci, so I'm sending them out for comment before I send Linus the pull request.
Any comments/objections?
The biggest patch by far is the
resource_wcstuff; it should have been pushed earlier, but for some reason I thought Ingo & co. were going to do that...
Quoted 6 lines
Thanks,
Jessecommit
a123c3d9643464c56417680536ed9515f15cffa1Author: Yinghai Lu <[email protected]> Date: Mon May 12 21:21:05 2008 +0200
Although I quite appreciate the addition of patches, IMO it would be easier to read if the patch descriptions and patches were not mixed together.
Most 'git pull' things I've seen include a changeset summary (shortlog) and cumulative patch, when its a single email. Sometimes (i.e. GregKH and a few others) the individual patches are posted in separate emails.
Either way, it saves one from having to wade through a long email, just to get an idea of the sum total of the changes...
Regards,
Jeff
Quoted 17 lines · Jeff Garzik
Quoted 9 lines · Jesse Barnes
Some of these may not have seen review on linux-pci, so I'm sending them out for comment before I send Linus the pull request.
Any comments/objections?
The biggest patch by far is the
resource_wcstuff; it should have been pushed earlier, but for some reason I thought Ingo & co. were going to do that...Quoted 6 lines
Thanks,
Jessecommit
a123c3d9643464c56417680536ed9515f15cffa1Author: Yinghai Lu <[email protected]> Date: Mon May 12 21:21:05 2008 +0200
Quoted 7 lines
Although I quite appreciate the addition of patches, IMO it would be easier to read if the patch descriptions and patches were not mixed together.
Most 'git pull' things I've seen include a changeset summary (shortlog) and cumulative patch, when its a single email. Sometimes (i.e. GregKH and a few others) the individual patches are posted in separate emails.
Right, I probably should have used one of the git mail scripts... but this wasn't a real git pull request either, more of a "hey please sanity check this" type thing. I figured in this case keeping the changelogs was important, but didn't want to spam people with a bunch of messages when the total size really wasn't that big...
Jesse
Hi Jesse,
Quoted 5 lines · Jesse Barnes
Right, I probably should have used one of the git mail scripts... but this wasn't a real git pull request either, more of a "hey please sanity check this" type thing. I figured in this case keeping the changelogs was important, but didn't want to spam people with a bunch of messages when the total size really wasn't that big...
A bunch of THREADED messages are quite easy to skip (single keystroke for me).
So just use one of those git mail scripts, which can do threading and everyone is happy.
Best Regards
Ingo Oeser, wading through lkml since >10 years.