Skip to contentSkip to conversation

rt2800usb: slow down TX status polling

PATCH In review Stanislaw Gruszka 4 participants 6 messages Oct 17, 2013 – Nov 20, 2013 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rt2800usb: slow down TX status polling

Polling TX statuses too frequently has two negative effects. First is randomly peek CPU usage, causing overall system functioning delays. Second bad effect is that device is not able to fill TX statuses in H/W register on some workloads and we get lot of timeouts like below:

ieee80211 phy4: rt2800usb_entry_txstatus_timeout: Warning - TX status timeout for entry 7 in queue 2 ieee80211 phy4: rt2800usb_entry_txstatus_timeout: Warning - TX status timeout for entry 7 in queue 2 ieee80211 phy4: rt2800usb_txdone: Warning - Got TX status for an empty queue 2, dropping

This not only cause flood of messages in dmesg, but also bad throughput, since rate scaling algorithm can not work optimally.

In the future, we should probably make polling interval be adjusted automatically, but for now just increase values, this make mentioned problems gone.

Resolve:
https://bugzilla.kernel.org/show_bug.cgi?id=62781

---
 drivers/net/wireless/rt2x00/rt2800usb.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/rt2x00/rt2800usb.c +4 -4
index 96677ce5..e095e61 100644
@@ -176,8 +176,8 @@ static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev,
 		queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work);
 
 	if (rt2800usb_txstatus_pending(rt2x00dev)) {
-		/* Read register after 250 us */
-		hrtimer_start(&rt2x00dev->txstatus_timer, ktime_set(0, 250000),
+		/* Read register after 1 ms */
+		hrtimer_start(&rt2x00dev->txstatus_timer, ktime_set(0, 1000000),
 			      HRTIMER_MODE_REL);
 		return false;
 	}
@@ -202,8 +202,8 @@ static void rt2800usb_async_read_tx_status(struct rt2x00_dev *rt2x00dev)
 	if (test_and_set_bit(TX_STATUS_READING, &rt2x00dev->flags))
 		return;
 
-	/* Read TX_STA_FIFO register after 500 us */
-	hrtimer_start(&rt2x00dev->txstatus_timer, ktime_set(0, 500000),
+	/* Read TX_STA_FIFO register after 2 ms */
+	hrtimer_start(&rt2x00dev->txstatus_timer, ktime_set(0, 2000000),
 		      HRTIMER_MODE_REL);
 }
 
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 41 lines · Stanislaw Gruszka

Polling TX statuses too frequently has two negative effects. First is randomly peek CPU usage, causing overall system functioning delays. Second bad effect is that device is not able to fill TX statuses in H/W register on some workloads and we get lot of timeouts like below:

ieee80211 phy4: rt2800usb_entry_txstatus_timeout: Warning - TX status timeout for entry 7 in queue 2 ieee80211 phy4: rt2800usb_entry_txstatus_timeout: Warning - TX status timeout for entry 7 in queue 2 ieee80211 phy4: rt2800usb_txdone: Warning - Got TX status for an empty queue 2, dropping

This not only cause flood of messages in dmesg, but also bad throughput, since rate scaling algorithm can not work optimally.

In the future, we should probably make polling interval be adjusted automatically, but for now just increase values, this make mentioned problems gone.

Resolve:
https://bugzilla.kernel.org/show_bug.cgi?id=62781

---
  drivers/net/wireless/rt2x00/rt2800usb.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/rt2x00/rt2800usb.c +2 -2
index 96677ce5..e095e61 100644
@@ -176,8 +176,8 @@ static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev,
  		queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work);
 
  	if (rt2800usb_txstatus_pending(rt2x00dev)) {
-		/* Read register after 250 us */
-		hrtimer_start(&rt2x00dev->txstatus_timer, ktime_set(0, 250000),
+		/* Read register after 1 ms */
+		hrtimer_start(&rt2x00dev->txstatus_timer, ktime_set(0, 1000000),
  			      HRTIMER_MODE_REL);
  		return false;
  	}

drivers/net/wireless/rt2x00/rt2800usb.c static void rt2800usb_async_read_tx_status(struct rt2x00_dev *rt2x00dev) · line 208

Quoted 9 lines
drivers/net/wireless/rt2x00/rt2800usb.c +2 -2
@@ -202,8 +202,8 @@ static void rt2800usb_async_read_tx_status(struct rt2x00_dev *rt2x00dev)
  	if (test_and_set_bit(TX_STATUS_READING, &rt2x00dev->flags))
  		return;
 
-	/* Read TX_STA_FIFO register after 500 us */
-	hrtimer_start(&rt2x00dev->txstatus_timer, ktime_set(0, 500000),
+	/* Read TX_STA_FIFO register after 2 ms */
+	hrtimer_start(&rt2x00dev->txstatus_timer, ktime_set(0, 2000000),
  		      HRTIMER_MODE_REL);
  }

I suggest getting rid of the magic numbers as long as you are making this change. A single define could handle the delay time for the two cases.

Larry

#2 lore raw
Quoted 3 lines · Larry Finger

I suggest getting rid of the magic numbers as long as you are making this change. A single define could handle the delay time for the two cases.

Thanks for sugestion Larry, though I do not see clear benefit of introduce define since those magic numbers are just time values expressed in nano seconds. Anyway patch with define added below. John can pick it, if he thinks it is better.

Stanislaw
---

Quoted 1 line

From 813e0bde7340bad7d3401c6aa2a3f8635ec49597 Mon Sep 17 00:00:00 2001

From: Stanislaw Gruszka <[email protected]>
Date: Fri, 18 Oct 2013 11:36:54 +0200
Subject: [PATCH] rt2800usb: slow down TX status polling

Polling TX statuses too frequently has two negative effects. First is randomly peek CPU usage, causing overall system functioning delays. Second bad effect is that device is not able to fill TX statuses in H/W register on some workloads and we get lot of timeouts like below:

ieee80211 phy4: rt2800usb_entry_txstatus_timeout: Warning - TX status timeout for entry 7 in queue 2 ieee80211 phy4: rt2800usb_entry_txstatus_timeout: Warning - TX status timeout for entry 7 in queue 2 ieee80211 phy4: rt2800usb_txdone: Warning - Got TX status for an empty queue 2, dropping

This not only cause flood of messages in dmesg, but also bad throughput, since rate scaling algorithm can not work optimally.

In the future, we should probably make polling interval be adjusted automatically, but for now just increase values, this make mentioned problems gone.

Resolve:
https://bugzilla.kernel.org/show_bug.cgi?id=62781

---
 drivers/net/wireless/rt2x00/rt2800usb.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/wireless/rt2x00/rt2800usb.c +8 -4
index 96677ce5..997df03 100644
@@ -148,6 +148,8 @@ static bool rt2800usb_txstatus_timeout(struct rt2x00_dev *rt2x00dev)
 	return false;
 }
 
+#define TXSTATUS_READ_INTERVAL 1000000
+
 static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev,
 						 int urb_status, u32 tx_status)
 {
@@ -176,8 +178,9 @@ static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev,
 		queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work);
 
 	if (rt2800usb_txstatus_pending(rt2x00dev)) {
-		/* Read register after 250 us */
-		hrtimer_start(&rt2x00dev->txstatus_timer, ktime_set(0, 250000),
+		/* Read register after 1 ms */
+		hrtimer_start(&rt2x00dev->txstatus_timer,
+			      ktime_set(0, TXSTATUS_READ_INTERVAL),
 			      HRTIMER_MODE_REL);
 		return false;
 	}
@@ -202,8 +205,9 @@ static void rt2800usb_async_read_tx_status(struct rt2x00_dev *rt2x00dev)
 	if (test_and_set_bit(TX_STATUS_READING, &rt2x00dev->flags))
 		return;
 
-	/* Read TX_STA_FIFO register after 500 us */
-	hrtimer_start(&rt2x00dev->txstatus_timer, ktime_set(0, 500000),
+	/* Read TX_STA_FIFO register after 2 ms */
+	hrtimer_start(&rt2x00dev->txstatus_timer,
+		      ktime_set(0, 2*TXSTATUS_READ_INTERVAL),
 		      HRTIMER_MODE_REL);
 }
 
Signature · 1 line
1.8.3.1
#3 lore raw
Quoted 33 lines · Stanislaw Gruszka
Quoted 3 lines · Larry Finger

I suggest getting rid of the magic numbers as long as you are making this change. A single define could handle the delay time for the two cases.

Thanks for sugestion Larry, though I do not see clear benefit of introduce define since those magic numbers are just time values expressed in nano seconds. Anyway patch with define added below. John can pick it, if he thinks it is better.

Stanislaw
---
From 813e0bde7340bad7d3401c6aa2a3f8635ec49597 Mon Sep 17 00:00:00 2001
From: Stanislaw Gruszka <[email protected]>
Date: Fri, 18 Oct 2013 11:36:54 +0200
Subject: [PATCH] rt2800usb: slow down TX status polling

Polling TX statuses too frequently has two negative effects. First is randomly peek CPU usage, causing overall system functioning delays. Second bad effect is that device is not able to fill TX statuses in H/W register on some workloads and we get lot of timeouts like below:

ieee80211 phy4: rt2800usb_entry_txstatus_timeout: Warning - TX status timeout for entry 7 in queue 2 ieee80211 phy4: rt2800usb_entry_txstatus_timeout: Warning - TX status timeout for entry 7 in queue 2 ieee80211 phy4: rt2800usb_txdone: Warning - Got TX status for an empty queue 2, dropping

This not only cause flood of messages in dmesg, but also bad throughput, since rate scaling algorithm can not work optimally.

In the future, we should probably make polling interval be adjusted automatically, but for now just increase values, this make mentioned problems gone.

Quoted 5 lines

Resolve:
https://bugzilla.kernel.org/show_bug.cgi?id=62781

I don't care which version gets picked. In both cases:

Quoted 42 lines
---
 drivers/net/wireless/rt2x00/rt2800usb.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/wireless/rt2x00/rt2800usb.c +8 -4
index 96677ce5..997df03 100644
@@ -148,6 +148,8 @@ static bool rt2800usb_txstatus_timeout(struct rt2x00_dev *rt2x00dev)
 	return false;
 }
 
+#define TXSTATUS_READ_INTERVAL 1000000
+
 static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev,
 						 int urb_status, u32 tx_status)
 {
@@ -176,8 +178,9 @@ static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev,
 		queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work);
 
 	if (rt2800usb_txstatus_pending(rt2x00dev)) {
-		/* Read register after 250 us */
-		hrtimer_start(&rt2x00dev->txstatus_timer, ktime_set(0, 250000),
+		/* Read register after 1 ms */
+		hrtimer_start(&rt2x00dev->txstatus_timer,
+			      ktime_set(0, TXSTATUS_READ_INTERVAL),
 			      HRTIMER_MODE_REL);
 		return false;
 	}
@@ -202,8 +205,9 @@ static void rt2800usb_async_read_tx_status(struct rt2x00_dev *rt2x00dev)
 	if (test_and_set_bit(TX_STATUS_READING, &rt2x00dev->flags))
 		return;
 
-	/* Read TX_STA_FIFO register after 500 us */
-	hrtimer_start(&rt2x00dev->txstatus_timer, ktime_set(0, 500000),
+	/* Read TX_STA_FIFO register after 2 ms */
+	hrtimer_start(&rt2x00dev->txstatus_timer,
+		      ktime_set(0, 2*TXSTATUS_READ_INTERVAL),
 		      HRTIMER_MODE_REL);
 }
 
Signature · 2 lines
---
Gertjan
#4 lore raw

Re: [rt2x00-users] [PATCH 3.12] rt2800usb: slow down TX statuspolling

Am Samstag, 19. Oktober 2013, 10:33:06 schrieb Gertjan van Wingerde:

Quoted 39 lines · Stanislaw Gruszka
Quoted 38 lines · Larry Finger
Quoted 3 lines

I suggest getting rid of the magic numbers as long as you are making this change. A single define could handle the delay time for the two cases.

Thanks for sugestion Larry, though I do not see clear benefit of introduce define since those magic numbers are just time values expressed in nano seconds. Anyway patch with define added below. John can pick it, if he thinks it is better.

Stanislaw
---
From 813e0bde7340bad7d3401c6aa2a3f8635ec49597 Mon Sep 17 00:00:00 2001
From: Stanislaw Gruszka <[email protected]>
Date: Fri, 18 Oct 2013 11:36:54 +0200
Subject: [PATCH] rt2800usb: slow down TX status polling

Polling TX statuses too frequently has two negative effects. First is randomly peek CPU usage, causing overall system functioning delays. Second bad effect is that device is not able to fill TX statuses in H/W register on some workloads and we get lot of timeouts like below:

ieee80211 phy4: rt2800usb_entry_txstatus_timeout: Warning - TX status timeout for entry 7 in queue 2 ieee80211 phy4:
rt2800usb_entry_txstatus_timeout: Warning - TX status timeout for entry 7 in queue 2 ieee80211 phy4: rt2800usb_txdone: Warning - Got TX status for an empty queue 2, dropping

This not only cause flood of messages in dmesg, but also bad throughput, since rate scaling algorithm can not work optimally.

In the future, we should probably make polling interval be adjusted automatically, but for now just increase values, this make mentioned problems gone.

Resolve:
https://bugzilla.kernel.org/show_bug.cgi?id=62781

Quoted 6 lines
Quoted 2 lines

I don't care which version gets picked. In both cases:

did this ever hit a stable queue?

Marc

#5 lore raw

Re: [rt2x00-users] [PATCH 3.12] rt2800usb: slow down TX statuspolling

Quoted 11 lines · Marc Dietrich
Quoted 9 lines
Quoted 5 lines

Resolve:
https://bugzilla.kernel.org/show_bug.cgi?id=62781

I don't care which version gets picked. In both cases:

did this ever hit a stable queue?

Not yet, it lend now in Linus' tree, should be queued to stable soon.

Stanislaw