mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 6/8] cciss: fix for DMA brokeness
@ 2005-09-09 22:09 mike.miller
  0 siblings, 0 replies; only message in thread
From: mike.miller @ 2005-09-09 22:09 UTC (permalink / raw)
  To: akpm, axboe; +Cc: linux-kernel, linux-scsi

Patch 6 of 8
The CCISS driver seems to loose track of DMA mappings
created by it's fill_cmd() routine.  Neither callers of this routine are
extracting the DMA address created in order to do the unmap.
Instead, they simply try to unmap 0x0.  It's easy to see this
problem on an x86_64 system when using the "swiotlb=force"
boot option.  In this case, the driver is leaking resources
of the swiotlb and not causing a sync of the bounce buffer.  Thanks

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
Signed-off-by: Mike Miller <mike.miller@hp.com>

 cciss.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
--------------------------------------------------------------------------------
diff -burNp lx2613-p004/drivers/block/cciss.c lx2613/drivers/block/cciss.c
--- lx2613-p004/drivers/block/cciss.c	2005-09-09 16:09:13.362617000 -0500
+++ lx2613/drivers/block/cciss.c	2005-09-09 16:14:54.116814816 -0500
@@ -1731,8 +1731,10 @@ case CMD_HARDWARE_ERR:
 		}
 	}	
 	/* unlock the buffers from DMA */
+	buff_dma_handle.val32.lower = c->SG[0].Addr.lower;
+	buff_dma_handle.val32.upper = c->SG[0].Addr.upper;
 	pci_unmap_single( h->pdev, (dma_addr_t) buff_dma_handle.val,
-			size, PCI_DMA_BIDIRECTIONAL);
+			c->SG[0].Len, PCI_DMA_BIDIRECTIONAL);
 	cmd_free(h, c, 0);
         return(return_status);
 
@@ -2013,8 +2015,10 @@ resend_cmd1:
 		
 cleanup1:	
 	/* unlock the data buffer from DMA */
+	buff_dma_handle.val32.lower = c->SG[0].Addr.lower;
+	buff_dma_handle.val32.upper = c->SG[0].Addr.upper;
 	pci_unmap_single(info_p->pdev, (dma_addr_t) buff_dma_handle.val,
-				size, PCI_DMA_BIDIRECTIONAL);
+				c->SG[0].Len, PCI_DMA_BIDIRECTIONAL);
 	cmd_free(info_p, c, 1);
 	return (status);
 } 
@@ -3097,9 +3101,10 @@ static void __devexit cciss_remove_one (
 	/* remove it from the disk list */
 	for (j = 0; j < NWD; j++) {
 		struct gendisk *disk = hba[i]->gendisk[j];
-		if (disk->flags & GENHD_FL_UP)
-			blk_cleanup_queue(disk->queue);
+		if (disk->flags & GENHD_FL_UP) {
 			del_gendisk(disk);
+			blk_cleanup_queue(disk->queue);
+		}
 	}
 
 	pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof(CommandList_struct),

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-09-09 22:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-09 22:09 [PATCH 6/8] cciss: fix for DMA brokeness mike.miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®