rsxx: Moving pci_map_page to prevent overflow
PATCH v2 2/2 rsxx: Moving pci_map_page to prevent overflow
From: Philip J Kelleher <[email protected]>
The pci_map_page function has been moved into our issued workqueue to prevent an us running out of mappable addresses on non-HWWD PCIe x8 slots. The maximum amount that can possible be mapped at one time now is: 255 dmas X 4 dma channels X 4096 Bytes.
-------------------------------------------------------------------------------
drivers/block/rsxx/core.c +0 -5
@@ -749,10 +749,6 @@ static pci_ers_result_t rsxx_slot_reset( card->eeh_state =0 ; - st =rsxx_eeh_remap_dmas (card); -if (st) - goto failed_remap_dmas; -spin_lock_irqsave (&card->irq_lock, flags);if (card->n_targets &RSXX_MAX_TARGETS )rsxx_enable_ier_and_isr (card,CR_INTR_ALL_G );
@@ -779,7 +775,6 @@ static pci_ers_result_t rsxx_slot_reset(return PCI_ERS_RESULT_RECOVERED ; failed_hw_buffers_init: -failed_remap_dmas:for (i =0 ; i < card->n_targets; i++) {if (card->ctrl[i].status.buf) pci_free_consistent(card->dev,
drivers/block/rsxx/dma.c +27 -42
105 lines not on this page · raw message
Quoted 14 lines · Philip J. Kelleher
diff -uprN -X linux-block-vanilla/Documentation/dontdiff
linux-block-vanilla/drivers/block/rsxx/dma.clinux-block/drivers/block/rsxx/dma.cdrivers/block/rsxx/dma.c +7
-0@@ -433,6 +434,27 @@ static void rsxx_issue_dmas(struct rsxx_continue ; } +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
drivers/block/rsxx/dma.c static void rsxx_issue_dmas(struct rsxx_ · line 453
Quoted 10 lines
drivers/block/rsxx/dma.c +10
-0+* 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)) {
Do you also need to do a push_tracker here as well so you don't leak a tag? Why is this error case handled different compared to the dma_fault case earlier in this same function?
drivers/block/rsxx/dma.c static void rsxx_issue_dmas(struct rsxx_ · line 460
Quoted 7 lines
drivers/block/rsxx/dma.c +4
-0+kmem_cache_free (rsxx_dma_pool, dma); +return ; + } +set_tracker_dma (ctrl->trackers, tag, dma); hw_cmd_buf[ctrl->cmd.idx].command = dma->cmd; hw_cmd_buf[ctrl->cmd.idx].tag = tag;
-Brian
Signature · 3 lines
Brian King Power Linux I/O IBM Linux Technology Center