mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: mike.miller@hp.com
To: akpm@osdl.org, axboe@suse.de
Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: [PATCH 6/8] cciss: fix for DMA brokeness
Date: Fri, 9 Sep 2005 17:09:38 -0500	[thread overview]
Message-ID: <20050909220938.GF4616@beardog.cca.cpqcorp.net> (raw)

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),

                 reply	other threads:[~2005-09-09 22:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050909220938.GF4616@beardog.cca.cpqcorp.net \
    --to=mike.miller@hp.com \
    --cc=akpm@osdl.org \
    --cc=axboe@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mikem@beardog.cca.cpqcorp.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®