netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] I/OAT fixes
@ 2008-11-07 11:45 Maciej Sosnowski
  2008-11-07 11:45 ` [PATCH 1/4] I/OAT: fix channel resources free for not allocated channels Maciej Sosnowski
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Maciej Sosnowski @ 2008-11-07 11:45 UTC (permalink / raw)
  To: dan.j.williams; +Cc: tom.s.picard, mark_rustad, linux-kernel, netdev, stable

This patch series contains couple of fixes for I/OAT DMA and DCA.

Maciej Sosnowski (3):
    I/OAT: fix channel resources free for not allocated channels
    I/OAT: fix dma_pin_iovec_pages() error handling
    I/OAT: fix async_tx.callback checking

Dan Williams (1):
    dca: fixup initialization dependency

 drivers/dca/dca-core.c |    2 +-
 drivers/dma/ioat_dma.c |   11 +++++++++--
 drivers/dma/iovlock.c  |   17 ++++++-----------
 3 files changed, 16 insertions(+), 14 deletions(-)

--
Maciej

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

* [PATCH 1/4] I/OAT: fix channel resources free for not allocated channels
  2008-11-07 11:45 [PATCH 0/4] I/OAT fixes Maciej Sosnowski
@ 2008-11-07 11:45 ` Maciej Sosnowski
  2008-11-07 11:46 ` [PATCH 2/4] I/OAT: fix dma_pin_iovec_pages() error handling Maciej Sosnowski
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Maciej Sosnowski @ 2008-11-07 11:45 UTC (permalink / raw)
  To: dan.j.williams; +Cc: tom.s.picard, mark_rustad, linux-kernel, netdev, stable

From: Maciej Sosnowski <maciej.sosnowski@intel.com>

If the ioatdma driver is loaded but not used it does not allocate descriptors.
Before it frees channel resources it should first be sure
that they have been previously allocated.

Cc: <stable@kernel.org>
Signed-off-by: Maciej Sosnowski <maciej.sosnowski@intel.com>
Tested-by: Tom Picard <tom.s.picard@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---

 drivers/dma/ioat_dma.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c
index b0438c4..687eef7 100644
--- a/drivers/dma/ioat_dma.c
+++ b/drivers/dma/ioat_dma.c
@@ -807,6 +807,12 @@ static void ioat_dma_free_chan_resources
 	struct ioat_desc_sw *desc, *_desc;
 	int in_use_descs = 0;
 
+	/* Before freeing channel resources first check 
+	 * if they have been previously allocated for this channel.
+	 */
+	if (ioat_chan->desccount == 0)
+		return;
+
 	tasklet_disable(&ioat_chan->cleanup_task);
 	ioat_dma_memcpy_cleanup(ioat_chan);
 
@@ -869,6 +875,7 @@ static void ioat_dma_free_chan_resources
 	ioat_chan->last_completion = ioat_chan->completion_addr = 0;
 	ioat_chan->pending = 0;
 	ioat_chan->dmacount = 0;
+	ioat_chan->desccount = 0;
 	ioat_chan->watchdog_completion = 0;
 	ioat_chan->last_compl_desc_addr_hw = 0;
 	ioat_chan->watchdog_tcp_cookie =


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

* [PATCH 2/4] I/OAT: fix dma_pin_iovec_pages() error handling
  2008-11-07 11:45 [PATCH 0/4] I/OAT fixes Maciej Sosnowski
  2008-11-07 11:45 ` [PATCH 1/4] I/OAT: fix channel resources free for not allocated channels Maciej Sosnowski
@ 2008-11-07 11:46 ` Maciej Sosnowski
  2008-11-07 11:46 ` [PATCH 3/4] I/OAT: fix async_tx.callback checking Maciej Sosnowski
  2008-11-07 11:47 ` [PATCH 4/4] dca: fixup initialization dependency Maciej Sosnowski
  3 siblings, 0 replies; 5+ messages in thread
From: Maciej Sosnowski @ 2008-11-07 11:46 UTC (permalink / raw)
  To: dan.j.williams; +Cc: tom.s.picard, mark_rustad, linux-kernel, netdev, stable

From: Maciej Sosnowski <maciej.sosnowski@intel.com>

Error handling needs to be modified in dma_pin_iovec_pages().
It should return NULL instead of ERR_PTR
(pinned_list is checked for NULL in tcp_recvmsg() to determine
if iovec pages have been successfully pinned down).
In case of error for the first iovec,
local_list->nr_iovecs needs to be initialized.

Cc: <stable@kernel.org>
Signed-off-by: Maciej Sosnowski <maciej.sosnowski@intel.com>
---

 drivers/dma/iovlock.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/dma/iovlock.c b/drivers/dma/iovlock.c
index e763d72..9f6fe46 100644
--- a/drivers/dma/iovlock.c
+++ b/drivers/dma/iovlock.c
@@ -55,7 +55,6 @@ struct dma_pinned_list *dma_pin_iovec_pa
 	int nr_iovecs = 0;
 	int iovec_len_used = 0;
 	int iovec_pages_used = 0;
-	long err;
 
 	/* don't pin down non-user-based iovecs */
 	if (segment_eq(get_fs(), KERNEL_DS))
@@ -72,23 +71,21 @@ struct dma_pinned_list *dma_pin_iovec_pa
 	local_list = kmalloc(sizeof(*local_list)
 		+ (nr_iovecs * sizeof (struct dma_page_list))
 		+ (iovec_pages_used * sizeof (struct page*)), GFP_KERNEL);
-	if (!local_list) {
-		err = -ENOMEM;
+	if (!local_list)
 		goto out;
-	}
 
 	/* list of pages starts right after the page list array */
 	pages = (struct page **) &local_list->page_list[nr_iovecs];
 
+	local_list->nr_iovecs = 0;
+
 	for (i = 0; i < nr_iovecs; i++) {
 		struct dma_page_list *page_list = &local_list->page_list[i];
 
 		len -= iov[i].iov_len;
 
-		if (!access_ok(VERIFY_WRITE, iov[i].iov_base, iov[i].iov_len)) {
-			err = -EFAULT;
+		if (!access_ok(VERIFY_WRITE, iov[i].iov_base, iov[i].iov_len))
 			goto unpin;
-		}
 
 		page_list->nr_pages = num_pages_spanned(&iov[i]);
 		page_list->base_address = iov[i].iov_base;
@@ -109,10 +106,8 @@ struct dma_pinned_list *dma_pin_iovec_pa
 			NULL);
 		up_read(&current->mm->mmap_sem);
 
-		if (ret != page_list->nr_pages) {
-			err = -ENOMEM;
+		if (ret != page_list->nr_pages)
 			goto unpin;
-		}
 
 		local_list->nr_iovecs = i + 1;
 	}
@@ -122,7 +117,7 @@ struct dma_pinned_list *dma_pin_iovec_pa
 unpin:
 	dma_unpin_iovec_pages(local_list);
 out:
-	return ERR_PTR(err);
+	return NULL;
 }
 
 void dma_unpin_iovec_pages(struct dma_pinned_list *pinned_list)


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

* [PATCH 3/4] I/OAT: fix async_tx.callback checking
  2008-11-07 11:45 [PATCH 0/4] I/OAT fixes Maciej Sosnowski
  2008-11-07 11:45 ` [PATCH 1/4] I/OAT: fix channel resources free for not allocated channels Maciej Sosnowski
  2008-11-07 11:46 ` [PATCH 2/4] I/OAT: fix dma_pin_iovec_pages() error handling Maciej Sosnowski
@ 2008-11-07 11:46 ` Maciej Sosnowski
  2008-11-07 11:47 ` [PATCH 4/4] dca: fixup initialization dependency Maciej Sosnowski
  3 siblings, 0 replies; 5+ messages in thread
From: Maciej Sosnowski @ 2008-11-07 11:46 UTC (permalink / raw)
  To: dan.j.williams; +Cc: tom.s.picard, mark_rustad, linux-kernel, netdev, stable

From: Maciej Sosnowski <maciej.sosnowski@intel.com>

async_tx.callback should be checked for the first
not the last descriptor in the chain.

Cc: <stable@kernel.org>
Signed-off-by: Maciej Sosnowski <maciej.sosnowski@intel.com>
---

 drivers/dma/ioat_dma.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c
index 687eef7..c5af17a 100644
--- a/drivers/dma/ioat_dma.c
+++ b/drivers/dma/ioat_dma.c
@@ -525,7 +525,7 @@ static dma_cookie_t ioat1_tx_submit(stru
 	}
 
 	hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS;
-	if (new->async_tx.callback) {
+	if (first->async_tx.callback) {
 		hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN;
 		if (first != new) {
 			/* move callback into to last desc */
@@ -617,7 +617,7 @@ static dma_cookie_t ioat2_tx_submit(stru
 	}
 
 	hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_CP_STS;
-	if (new->async_tx.callback) {
+	if (first->async_tx.callback) {
 		hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN;
 		if (first != new) {
 			/* move callback into to last desc */


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

* [PATCH 4/4] dca: fixup initialization dependency
  2008-11-07 11:45 [PATCH 0/4] I/OAT fixes Maciej Sosnowski
                   ` (2 preceding siblings ...)
  2008-11-07 11:46 ` [PATCH 3/4] I/OAT: fix async_tx.callback checking Maciej Sosnowski
@ 2008-11-07 11:47 ` Maciej Sosnowski
  3 siblings, 0 replies; 5+ messages in thread
From: Maciej Sosnowski @ 2008-11-07 11:47 UTC (permalink / raw)
  To: dan.j.williams; +Cc: tom.s.picard, mark_rustad, linux-kernel, netdev, stable

From: Dan Williams <dan.j.williams@intel.com>

Mark dca_init as a subsys_initcall since it needs to be ready to go
before dependent drivers start registering themselves.

Cc: <stable@kernel.org>
Reported-and-tested-by: Mark Rustad <mark_rustad@Xiotech.com>
Acked-by: Maciej Sosnowski <maciej.sosnowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---

 drivers/dca/dca-core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/dca/dca-core.c b/drivers/dca/dca-core.c
index ec249d2..d883e1b 100644
--- a/drivers/dca/dca-core.c
+++ b/drivers/dca/dca-core.c
@@ -270,6 +270,6 @@ static void __exit dca_exit(void)
 	dca_sysfs_exit();
 }
 
-module_init(dca_init);
+subsys_initcall(dca_init);
 module_exit(dca_exit);
 

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

end of thread, other threads:[~2008-11-07 11:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-07 11:45 [PATCH 0/4] I/OAT fixes Maciej Sosnowski
2008-11-07 11:45 ` [PATCH 1/4] I/OAT: fix channel resources free for not allocated channels Maciej Sosnowski
2008-11-07 11:46 ` [PATCH 2/4] I/OAT: fix dma_pin_iovec_pages() error handling Maciej Sosnowski
2008-11-07 11:46 ` [PATCH 3/4] I/OAT: fix async_tx.callback checking Maciej Sosnowski
2008-11-07 11:47 ` [PATCH 4/4] dca: fixup initialization dependency Maciej Sosnowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).