Skip to content

Commit

Permalink
[PATCH] x86_64: Fix a race in the free_iommu path
Browse files Browse the repository at this point in the history
We do this by removing a micro-optimization that tries to avoid grabbing
the iommu_bitmap_lock spinlock and using a bus-locked operation.

This still races with other simultaneous alloc_iommu or free_iommu(size >
1) which both use bus-unlocked operations.

The end result of this race is eventually ending up with an
iommu_gart_bitmap that has bits errornously set all over, making large
contiguous iommu space allocations fail with 'PCI-DMA: Out of IOMMU space'.

Signed-off-by: Mike Waychison <mikew@google.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Mike Waychison authored and Linus Torvalds committed Apr 22, 2006
1 parent ddbe3ee commit 5b20192
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions arch/x86_64/kernel/pci-gart.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ static unsigned long alloc_iommu(int size)
static void free_iommu(unsigned long offset, int size)
{
unsigned long flags;
if (size == 1) {
clear_bit(offset, iommu_gart_bitmap);
return;
}
spin_lock_irqsave(&iommu_bitmap_lock, flags);
__clear_bit_string(iommu_gart_bitmap, offset, size);
spin_unlock_irqrestore(&iommu_bitmap_lock, flags);
Expand Down

0 comments on commit 5b20192

Please sign in to comment.