From: Brian King <brking@linux.vnet.ibm.com>
To: "Philip J. Kelleher" <pjk1939@linux.vnet.ibm.com>
Cc: axboe@kernel.dk, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] rsxx: Moving pci_map_page to prevent overflow
Date: Tue, 03 Sep 2013 16:08:36 -0500 [thread overview]
Message-ID: <52264FD4.1090809@linux.vnet.ibm.com> (raw)
In-Reply-To: <20130827225924.GC7368@oc6784271780.ibm.com>
On 08/27/2013 05:59 PM, Philip J. Kelleher wrote:
> diff -uprN -X linux-block-vanilla/Documentation/dontdiff linux-block-vanilla/drivers/block/rsxx/dma.c linux-block/drivers/block/rsxx/dma.c
> --- linux-block-vanilla/drivers/block/rsxx/dma.c 2013-08-12 15:22:18.612863489 -0500
> +++ linux-block/drivers/block/rsxx/dma.c 2013-08-12 15:23:22.158858765 -0500
> @@ -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
> + * 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?
> + 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
--
Brian King
Power Linux I/O
IBM Linux Technology Center
prev parent reply other threads:[~2013-09-03 21:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-27 22:59 [PATCH v2 2/2] rsxx: Moving pci_map_page to prevent overflow Philip J. Kelleher
2013-09-03 21:08 ` Brian King [this message]
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=52264FD4.1090809@linux.vnet.ibm.com \
--to=brking@linux.vnet.ibm.com \
--cc=axboe@kernel.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=pjk1939@linux.vnet.ibm.com \
/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