public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] rsxx: Kernel Panic caused by mapping Discards.
@ 2013-09-28  0:26 Philip J. Kelleher
  2013-09-28  2:44 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Philip J. Kelleher @ 2013-09-28  0:26 UTC (permalink / raw)
  To: axboe; +Cc: linux-kernel, brking

From: Philip J Kelleher <pjk1939@linux.vnet.ibm.com>

This fixes a kernel panic injected by commit id
8d26750143341831bc312f61c5ed141eeb75b8d0 where discards
are getting mapped through the pci_map_page function call.

The driver will now start verifying that a dma is not a
discard before issuing a the pci_map_page function call.

Also, we are updating the driver version.

Signed-off-by: Philip J Kelleher <pjk1939@linux.vnet.ibm.com>
-------------------------------------------------------------------------------

diff -uprN -X linux-2.6.32-420.el6-vanilla/Documentation/dontdiff linux-2.6.32-420.el6-vanilla/drivers/block/rsxx/dma.c linux-2.6.32-420.el6/drivers/block/rsxx/dma.c
--- linux-2.6.32-420.el6-vanilla/drivers/block/rsxx/dma.c	2013-09-23 09:15:30.000000000 -0500
+++ linux-2.6.32-420.el6/drivers/block/rsxx/dma.c	2013-09-26 15:12:16.471465749 -0500
@@ -434,26 +434,29 @@ static void rsxx_issue_dmas(struct rsxx_
 			continue;
 		}
 
-		if (dma->cmd == HW_CMD_BLK_WRITE)
-			dir = PCI_DMA_TODEVICE;
-		else
-			dir = PCI_DMA_FROMDEVICE;
+		if (dma->cmd != HW_CMD_BLK_DISCARD) {
+			if (dma->cmd == HW_CMD_BLK_WRITE)
+				dir = PCI_DMA_TODEVICE;
+			else
+				dir = PCI_DMA_FROMDEVICE;
 
-		/*
-		 * The function pci_map_page is placed here because we can
-		 * only, by design, issue up to 255 commands to the hardware
-		 * at one time per DMA channel. So the maximum amount of mapped
-		 * memory would be 255 * 4 channels * 4096 Bytes which is less
-		 * than 2GB, the limit of a x8 Non-HWWD PCIe slot. This way the
-		 * pci_map_page function should never fail because of a
-		 * lack of mappable memory.
-		 */
-		dma->dma_addr = pci_map_page(ctrl->card->dev, dma->page,
-				     dma->pg_off, dma->sub_page.cnt << 9, dir);
-		if (pci_dma_mapping_error(ctrl->card->dev, dma->dma_addr)) {
-			push_tracker(ctrl->trackers, tag);
-			rsxx_complete_dma(ctrl, dma, DMA_CANCELLED);
-			continue;
+			/*
+			 * The function pci_map_page is placed here because we
+			 * can only, by design, issue up to 255 commands to the
+			 * hardware at one time per DMA channel. So the maximum
+			 * amount of mapped memory would be 255 * 4 channels *
+			 * 4096 Bytes which is less than 2GB, the limit of a x8
+			 * Non-HWWD PCIe slot. This way the pci_map_page
+			 * function should never fail because of a lack of
+			 * mappable memory.
+			 */
+			dma->dma_addr = pci_map_page(ctrl->card->dev, dma->page,
+					dma->pg_off, dma->sub_page.cnt << 9, dir);
+			if (pci_dma_mapping_error(ctrl->card->dev, dma->dma_addr)) {
+				push_tracker(ctrl->trackers, tag);
+				rsxx_complete_dma(ctrl, dma, DMA_CANCELLED);
+				continue;
+			}
 		}
 
 		set_tracker_dma(ctrl->trackers, tag, dma);
diff -uprN -X linux-2.6.32-420.el6-vanilla/Documentation/dontdiff linux-2.6.32-420.el6-vanilla/drivers/block/rsxx/rsxx_priv.h linux-2.6.32-420.el6/drivers/block/rsxx/rsxx_priv.h
--- linux-2.6.32-420.el6-vanilla/drivers/block/rsxx/rsxx_priv.h	2013-09-23 09:15:30.000000000 -0500
+++ linux-2.6.32-420.el6/drivers/block/rsxx/rsxx_priv.h	2013-09-26 15:24:14.185459296 -0500
@@ -52,7 +52,7 @@ struct proc_cmd;
 #define RS70_PCI_REV_SUPPORTED	4
 
 #define DRIVER_NAME "rsxx"
-#define DRIVER_VERSION "4.0"
+#define DRIVER_VERSION "4.0.1.2498"
 
 /* Block size is 4096 */
 #define RSXX_HW_BLK_SHIFT		12


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-09-28  2:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-28  0:26 [PATCH 1/1] rsxx: Kernel Panic caused by mapping Discards Philip J. Kelleher
2013-09-28  2:44 ` Jens Axboe

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