Skip to contentSkip to conversation

I/OAT updates for 2.6.22

GIT PULL Chris Leech 2 participants 3 messages May 2, 2007

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

The following changes since commit dc87c3985e9b442c60994308a96f887579addc39:
Linus Torvalds (1):
libata: honour host controllers that want just one host

are found in the git repository at:

git://lost.foo-projects.org/~cleech/linux-2.6

Andrew Morton (1):
I/OAT: warning fix

Chris Leech (6):
ioatdma: Push pending transactions to hardware more frequently
ioatdma: Remove the wrappers around read(bwl)/write(bwl) in ioatdma
ioatdma: Remove the use of writeq from the ioatdma driver I/OAT: Add documentation for the tcp_dma_copybreak sysctl I/OAT: Add entries to MAINTAINERS for the DMA memcpy subsystem and ioatdma I/OAT: Only offload copies for TCP when there will be a context switch

Dan Aloni (1):
I/OAT: fix I/OAT for kexec

Jeff Garzik (1):
drivers/dma: handle sysfs errors

 Documentation/networking/ip-sysctl.txt |    6 ++
 MAINTAINERS                            |   12 +++
 drivers/dma/dmaengine.c                |   22 ++++++-
 drivers/dma/ioatdma.c                  |   81 ++++++++++++----------
 drivers/dma/ioatdma_io.h               |  118 --------------------------------
 net/ipv4/tcp.c                         |   26 +++++--
 6 files changed, 100 insertions(+), 165 deletions(-)
 delete mode 100644 drivers/dma/ioatdma_io.h

commit 3d89ce83ead8eed2d638f5563af7f88c1ebd9acf

Author: Dan Aloni <da\[email protected]>
Date:   Wed May 2 15:25:13 2007 -0700

I/OAT: fix I/OAT for kexec

Under kexec, I/OAT initialization breaks over busy resources because the previous kernel did not release them.

I'm not sure this fix can be considered a complete one but it works for me.
I guess something similar to the *_remove method should occur there..

drivers/dma/ioatdma.c +13 -0
index cbf93ca..1d259e5 100644
@@ -41,6 +41,7 @@
 
 /* internal functions */
 static int __devinit ioat_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
+static void ioat_shutdown(struct pci_dev *pdev);
 static void __devexit ioat_remove(struct pci_dev *pdev);
 
 static int enumerate_dma_channels(struct ioat_device *device)
@@ -557,6 +558,7 @@ static struct pci_driver ioat_pci_drv = {
 	.name 	= "ioatdma",
 	.id_table = ioat_pci_tbl,
 	.probe	= ioat_probe,
+	.shutdown = ioat_shutdown,
 	.remove	= __devexit_p(ioat_remove),
 };
 
@@ -781,9 +783,20 @@ err_request_regions:
 err_set_dma_mask:
 	pci_disable_device(pdev);
 err_enable_device:
+
+	printk(KERN_ERR "Intel(R) I/OAT DMA Engine initialization failed\n");
+
 	return err;
 }
 
+static void ioat_shutdown(struct pci_dev *pdev)
+{
+	struct ioat_device *device;
+	device = pci_get_drvdata(pdev);
+
+	dma_async_device_unregister(&device->common);
+}
+
 static void __devexit ioat_remove(struct pci_dev *pdev)
 {
 	struct ioat_device *device;

commit 65e6d03f6c1bec1607febe9dfdc8a99b572b882f

Author: Andrew Morton <[email protected]>
Date:   Wed May 2 15:25:12 2007 -0700

I/OAT: warning fix
net/ipv4/tcp.c: In function 'tcp_recvmsg':
net/ipv4/tcp.c:1111: warning: unused variable 'available'

net/ipv4/tcp.c +16 -10
index e97b45a..9dfa2b6 100644
@@ -1113,7 +1113,6 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
 	long timeo;
 	struct task_struct *user_recv = NULL;
 	int copied_early = 0;
-	int available = 0;
 	struct sk_buff *skb;
 
 	lock_sock(sk);
@@ -1142,15 +1141,22 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
 	tp->ucopy.dma_chan = NULL;
 	preempt_disable();
 	skb = skb_peek_tail(&sk->sk_receive_queue);
-	if (skb)
-		available = TCP_SKB_CB(skb)->seq + skb->len - (*seq);
-	if ((available < target) &&
-	    (len > sysctl_tcp_dma_copybreak) && !(flags & MSG_PEEK) &&
-	    !sysctl_tcp_low_latency && __get_cpu_var(softnet_data).net_dma) {
-		preempt_enable_no_resched();
-		tp->ucopy.pinned_list = dma_pin_iovec_pages(msg->msg_iov, len);
-	} else
-		preempt_enable_no_resched();
+	{
+		int available = 0;
+
+		if (skb)
+			available = TCP_SKB_CB(skb)->seq + skb->len - (*seq);
+		if ((available < target) &&
+		    (len > sysctl_tcp_dma_copybreak) && !(flags & MSG_PEEK) &&
+		    !sysctl_tcp_low_latency &&
+		    __get_cpu_var(softnet_data).net_dma) {
+			preempt_enable_no_resched();
+			tp->ucopy.pinned_list =
+					dma_pin_iovec_pages(msg->msg_iov, len);
+		} else {
+			preempt_enable_no_resched();
+		}
+	}
 #endif
 
 	do {

commit a199d97c5171b50b7568c1250d803b60700ff1f5

Author: Chris Leech <[email protected]>
Date:   Wed May 2 15:25:12 2007 -0700

I/OAT: Only offload copies for TCP when there will be a context switch The performance wins come with having the DMA copy engine doing the copies in parallel with the context switch. If there is enough data ready on the socket at recv time just use a regular copy.

net/ipv4/tcp.c +7 -3
index d6e4886..e97b45a 100644
@@ -1113,6 +1113,8 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
 	long timeo;
 	struct task_struct *user_recv = NULL;
 	int copied_early = 0;
+	int available = 0;
+	struct sk_buff *skb;
 
 	lock_sock(sk);
 
@@ -1139,7 +1141,11 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
 #ifdef CONFIG_NET_DMA
 	tp->ucopy.dma_chan = NULL;
 	preempt_disable();
-	if ((len > sysctl_tcp_dma_copybreak) && !(flags & MSG_PEEK) &&
+	skb = skb_peek_tail(&sk->sk_receive_queue);
+	if (skb)
+		available = TCP_SKB_CB(skb)->seq + skb->len - (*seq);
+	if ((available < target) &&
+	    (len > sysctl_tcp_dma_copybreak) && !(flags & MSG_PEEK) &&
 	    !sysctl_tcp_low_latency && __get_cpu_var(softnet_data).net_dma) {
 		preempt_enable_no_resched();
 		tp->ucopy.pinned_list = dma_pin_iovec_pages(msg->msg_iov, len);
@@ -1148,7 +1154,6 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
 #endif
 
 	do {
-		struct sk_buff *skb;
 		u32 offset;
 
 		/* Are we at urgent data? Stop if we have read anything or have SIGURG pending. */
@@ -1436,7 +1441,6 @@ skip_copy:
 
 #ifdef CONFIG_NET_DMA
 	if (tp->ucopy.dma_chan) {
-		struct sk_buff *skb;
 		dma_cookie_t done, used;
 
 		dma_async_memcpy_issue_pending(tp->ucopy.dma_chan);

commit 67819adf8c0277b9bb6fc5e134e27d5a4337f1c4

Author: Chris Leech <[email protected]>
Date:   Wed May 2 15:25:12 2007 -0700

I/OAT: Add entries to MAINTAINERS for the DMA memcpy subsystem and ioatdma

MAINTAINERS +12 -0
index af1c792..0bc6ab8 100644
@@ -1186,6 +1186,12 @@ M:	[email protected]
 L:	[email protected]
 S:	Maintained
 
+DMA GENERIC MEMCPY SUBSYSTEM
+P:	Chris Leech
+M:	[email protected]
+L:	[email protected]
+S:	Maintained
+
 DOCBOOK FOR DOCUMENTATION
 P:	Randy Dunlap
 M:	[email protected]
@@ -1791,6 +1797,12 @@ P:	Tigran Aivazian
 M:	[email protected]
 S:	Maintained
 
+INTEL I/OAT DMA DRIVER
+P:	Chris Leech
+M:	[email protected]
+L:	[email protected]
+S:	Supported
+
 INTEL IXP4XX RANDOM NUMBER GENERATOR SUPPORT
 P:	Deepak Saxena
 M:	[email protected]

commit b083c113825d8a8c90bd91a8ac5fb6e1c5164434

Author: Chris Leech <[email protected]>
Date:   Wed May 2 15:25:12 2007 -0700

I/OAT: Add documentation for the tcp_dma_copybreak sysctl

Documentation/networking/ip-sysctl.txt +6 -0
index af6a63a..8f6067e 100644
@@ -433,6 +433,12 @@ tcp_workaround_signed_windows - BOOLEAN
 	not receive a window scaling option from them.
 	Default: 0
 
+tcp_dma_copybreak - INTEGER
+	Lower limit, in bytes, of the size of socket reads that will be
+	offloaded to a DMA copy engine, if one is present in the system
+	and CONFIG_NET_DMA is enabled.
+	Default: 4096
+
 CIPSOv4 Variables:
 
 cipso_cache_enable - BOOLEAN

commit 8fcb5f5d7b7babe0085495133cb1f32a2e720e9d

Author: Chris Leech <[email protected]>
Date:   Wed May 2 15:25:11 2007 -0700

ioatdma: Remove the use of writeq from the ioatdma driver There's only one now anyway, and it's not in a performance path, so make it behave the same on 32-bit and 64-bit CPUs.

drivers/dma/ioatdma.c +4 -6
index ec11131..cbf93ca 100644
@@ -608,13 +608,11 @@ static void ioat_start_null_desc(struct ioat_dma_chan *ioat_chan)
 	list_add_tail(&desc->node, &ioat_chan->used_desc);
 	spin_unlock_bh(&ioat_chan->desc_lock);
 
-#if (BITS_PER_LONG == 64)
-	writeq(desc->phys, ioat_chan->reg_base + IOAT_CHAINADDR_OFFSET);
-#else
-	writel((u32) desc->phys,
+	writel(((u64) desc->phys) & 0x00000000FFFFFFFF,
 	       ioat_chan->reg_base + IOAT_CHAINADDR_OFFSET_LOW);
-	writel(0, ioat_chan->reg_base + IOAT_CHAINADDR_OFFSET_HIGH);
-#endif
+	writel(((u64) desc->phys) >> 32,
+	       ioat_chan->reg_base + IOAT_CHAINADDR_OFFSET_HIGH);
+
 	writeb(IOAT_CHANCMD_START, ioat_chan->reg_base + IOAT_CHANCMD_OFFSET);
 }
 

commit 2f380fbb2757ef96eab0a508e373fe3ed34c7595

Author: Chris Leech <[email protected]>
Date:   Wed May 2 15:25:11 2007 -0700

ioatdma: Remove the wrappers around read(bwl)/write(bwl) in ioatdma

drivers/dma/ioatdma.c +28 -32

155 lines not on this page · raw message

drivers/dma/ioatdma_io.h deleted +0 -118

118 lines not on this page · raw message

commit 4baad80867cd378a6211388eb588bc12b504fb5c

Author: Jeff Garzik <[email protected]>
Date:   Wed May 2 15:25:11 2007 -0700

drivers/dma: handle sysfs errors

From: Jeff Garzik <[email protected]>

drivers/dma/dmaengine.c +20 -2
index 322ee29..828310d 100644
@@ -316,7 +316,7 @@ EXPORT_SYMBOL(dma_async_client_chan_request);
 int dma_async_device_register(struct dma_device *device)
 {
 	static int id;
-	int chancnt = 0;
+	int chancnt = 0, rc;
 	struct dma_chan* chan;
 
 	if (!device)
@@ -338,8 +338,15 @@ int dma_async_device_register(struct dma_device *device)
 		snprintf(chan->class_dev.class_id, BUS_ID_SIZE, "dma%dchan%d",
 		         device->dev_id, chan->chan_id);
 
+		rc = class_device_register(&chan->class_dev);
+		if (rc) {
+			chancnt--;
+			free_percpu(chan->local);
+			chan->local = NULL;
+			goto err_out;
+		}
+
 		kref_get(&device->refcount);
-		class_device_register(&chan->class_dev);
 	}
 
 	mutex_lock(&dma_list_mutex);
@@ -349,6 +356,17 @@ int dma_async_device_register(struct dma_device *device)
 	dma_chans_rebalance();
 
 	return 0;
+
+err_out:
+	list_for_each_entry(chan, &device->channels, device_node) {
+		if (chan->local == NULL)
+			continue;
+		kref_put(&device->refcount, dma_async_device_cleanup);
+		class_device_unregister(&chan->class_dev);
+		chancnt--;
+		free_percpu(chan->local);
+	}
+	return rc;
 }
 EXPORT_SYMBOL(dma_async_device_register);
 

commit 7e690b9c312f5eb3b058584db59d1621068bcf7c

Author: Chris Leech <[email protected]>
Date:   Wed May 2 15:24:45 2007 -0700

ioatdma: Push pending transactions to hardware more frequently Every 20 descriptors turns out to be to few append commands with newer/faster CPUs. Pushing every 4 still cuts down on MMIO writes to an acceptable level without letting the DMA engine run out of work.

drivers/dma/ioatdma.c +2 -2
index 8e87261..0f77a9d 100644
@@ -310,7 +310,7 @@ static dma_cookie_t do_ioat_dma_memcpy(struct ioat_dma_chan *ioat_chan,
 	list_splice_init(&new_chain, ioat_chan->used_desc.prev);
 
 	ioat_chan->pending += desc_count;
-	if (ioat_chan->pending >= 20) {
+	if (ioat_chan->pending >= 4) {
 		append = 1;
 		ioat_chan->pending = 0;
 	}
@@ -818,7 +818,7 @@ static void __devexit ioat_remove(struct pci_dev *pdev)
 }
 
 /* MODULE API */
-MODULE_VERSION("1.7");
+MODULE_VERSION("1.9");
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Intel Corporation");
 
maintainer
#1 lore raw

Chrstopher, I really really would like you to post these patches early and often to [email protected] especially because you are touching the TCP code.

You aren't doing this, for several rounds, and just submitting your stuff directly to Linus, Andrew, and lkml, and it's starting to annoy me greatly.

Thanks in advance.

#2 lore raw
Quoted 4 lines · David Miller

Chrstopher, I really really would like you to post these patches early and often to [email protected] especially because you are touching the TCP code.

You're right, I should have sent this to netdev as well. I'm Sorry.

As for early and often, I have posted all of these patches to netdev, and made suggested changes, and re-posted.

And when I have other networking changes, you can bet they'll get sent to netdev for review first before I think about asking that they be included.

Quoted 3 lines

You aren't doing this, for several rounds, and just submitting your stuff directly to Linus, Andrew, and lkml, and it's starting to annoy me greatly.

For several rounds, I've been posting patches that go nowhere. I honestly don't care if they go straight to Linus, through you, or through Andrew.

- Chris