Magellan Linux

Contents of /trunk/kernel26-magellan/patches-2.6.16-r12/0105-2.6.16.12-race-free_iommu_patch.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 72 - (show annotations) (download)
Mon Jun 5 09:25:38 2006 UTC (17 years, 10 months ago) by niro
File size: 1397 byte(s)
ver bump to 2.6.16-r12:
- updated to linux-2.6.16.19
- updated to ck11

1 From: Mike Waychison <mikew@google.com>
2 Date: Fri, 21 Apr 2006 07:43:25 +0000 (+0200)
3 Subject: [PATCH] x86_64: Fix a race in the free_iommu path.
4 X-Git-Url: http://www.kernel.org/git/?p=linux/kernel/git/stable/linux-2.6.16.y.git;a=commitdiff;h=c89ce82c2d942daacc7d7f5d3efafe7dba70bd23
5
6 [PATCH] x86_64: Fix a race in the free_iommu path.
7
8 We do this by removing a micro-optimization that tries to avoid grabbing
9 the iommu_bitmap_lock spinlock and using a bus-locked operation.
10
11 This still races with other simultaneous alloc_iommu or free_iommu(size
12 > 1) which both use bus-unlocked operations.
13
14 The end result of this race is eventually ending
15 up with an iommu_gart_bitmap that has bits errornously set all over,
16 making large contiguous iommu space allocations fail with 'PCI-DMA:
17 Out of IOMMU space'.
18
19 Signed-off-by: Mike Waychison <mikew@google.com>
20 Signed-off-by: Andi Kleen <ak@suse.de>
21 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
22 ---
23
24 --- a/arch/x86_64/kernel/pci-gart.c
25 +++ b/arch/x86_64/kernel/pci-gart.c
26 @@ -114,10 +114,6 @@ static unsigned long alloc_iommu(int siz
27 static void free_iommu(unsigned long offset, int size)
28 {
29 unsigned long flags;
30 - if (size == 1) {
31 - clear_bit(offset, iommu_gart_bitmap);
32 - return;
33 - }
34 spin_lock_irqsave(&iommu_bitmap_lock, flags);
35 __clear_bit_string(iommu_gart_bitmap, offset, size);
36 spin_unlock_irqrestore(&iommu_bitmap_lock, flags);