diff mbox

[04/23] rt2x00: Make rt2x00_queue_entry_for_each more flexible

Message ID 201104301601.15558.IvDoorn@gmail.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Ivo van Doorn April 30, 2011, 2:01 p.m. UTC
Hi,

> >> My colleague just tested this patch set and found out that the in
> >> question makes our 400MHz ARM cpu board with ralink usb dongle non
> >> functional due to high cpu consumption.  it seems for us that exiting
> >> from function every time it finds an entry is too expensive on systems
> >> slower than PCs.
> > 
> > Interesting, I would suspected the patch to reduce the CPU consumption
> > rather then increasing it. I can do some testing regarding this looping
> > during the weekend, but I haven't seen high CPU consumption on my
> > system during my last test. However I wasn't testing on an embedded system...
> > 
> >> To verify our thought, we changed the source code as the patch below.
> >> What we intended to do with this change is to continue processing all
> >> entry without breaking semantics.
> >>
> >> With the patch below our board seem to work fine again, but not sure
> >> exactly why it takes so much time to check the list again.  We are not
> >> against the idea of the patch at all.  We just want to ask you guys
> >> how we should go to track this problem. it might be the slow usb?
> > 
> > Could you try use debugfs and see if some queue and packet counters
> > of mac80211/rt2x00 show excessive values?
> > 
> > Have you been running the test with powersaving enabled or disabled?
> > 
> 
> Yeah, I had the same impression as Ivo, that it should save CPU cycles,
> especially since the patch was submitted by Helmut, who is very keen
> on saving CPU cycles, as he tests on an embedded (PCI-based) platform as
> well.
> 
> But, if this proves to not be useful for now, then we should revert the
> entire patch, as the patch proposed simply negates the intended behavior
> and leaves a mess.
> 
> I believe the offending patch was preparation for another patch which so
> far has not materialized in a usable form, so there should be no harm in
> reverting the offending patch.

I've have a different idea, after a discussion with Helmut, I had changed his
original patch. But I think below patch should resolve the issue as well.

Yasushi, can you please test this patch.

Thanks,

Ivo
--
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Yasushi SHOJI May 2, 2011, 1:33 p.m. UTC | #1
Hi Ivo,

At Sat, 30 Apr 2011 16:01:14 +0200,
Ivo van Doorn wrote:
>
> I've have a different idea, after a discussion with Helmut, I had changed his
> original patch. But I think below patch should resolve the issue as well.
>
> Yasushi, can you please test this patch.

We've tried your patch and the result is not as good as the original.
before we go into our test description, let me correct and add to my
previous comment:

 - CPU consumption was not an issue (sorry for wrong info. my bad)
 -- but network throughput performance is bad
 - USB controller on the CPU is not fast
 -- max throughput for USB memory read is about 50 Mbps on our test
 -- max client mode transfer rate is about 20 Mbps (at best)

all test is done on our Freescale i.MX25[1] ARM based board,
Armadillo-440[2], a440 for short, and using HostAP[3] and netpipe[4].
As you can see, we are using the board as an access point instead of
client mode.  this might have some impacts.

here is the summary of the test result we did:

               |ping pc -> a440    |netpipe
    -----------+-------------------+--------------------------------------
    original   |a few ms           |starts at a few Mbps to 18 Mbps
    flexible   |fast for small,    |error and exit on large packets
               |not work for large |
    ours       |a few ms           |starts at a few Mbps to 18 Mbps (same as orig)
    ivo's      |tens of ms         |works but less than 1.0 Mbps throughput

here "original" means 7dab73b37[5], just before flexible patch.
flexible is 10e11568ca[6].  ours is the patch I sent in the previous
mail[7], ivo's is s/true/false/ on rt2x00usb.c[8].

detailed test result is at the end of this email.

BTW, we are in the big holiday week[10] right now.  so please bear
with us. we might not reply promptly.

[1]:http://www.freescale.com/webapp/sps/site/overview.jsp?code=IMX25_FAMILY
[2]:http://www.atmark-techno.com/products/armadillo/a440/specs
[3]:http://hostap.epitest.fi/
[4]:http://www.scl.ameslab.gov/netpipe/

[5]:http://git.kernel.org/?p=linux/kernel/git/ivd/rt2x00.git;a=commit;h=7dab73b37f5e8885cb73efd25e73861f9b4f0246
[6]:http://git.kernel.org/?p=linux/kernel/git/ivd/rt2x00.git;a=commit;h=10e11568ca8b8a15f7478f6a4ceebabcbdba1018
[7]:http://article.gmane.org/gmane.linux.kernel.wireless.general/68843
[8]:http://article.gmane.org/gmane.linux.kernel.wireless.general/68987

[10]:http://en.wikipedia.org/wiki/Golden_Week_%28Japan%29

-------- detailed test results --------

flexible
========

right after windows client connected to the board with WPA2(AES)
----------------------------------------------------------------
$ cat /sys/kernel/debug/ieee80211/phy0/rt2800usb/queue/queue                    
qid     flags           count   limit   length  index   dma done        done    
14      0x00000001      61      128     128     61      61              61      
0       0x00000001      49      64      1       50      49              49      
1       0x00000001      0       64      0       0       0               0       
2       0x00000001      0       64      0       0       0               0       
3       0x00000001      0       64      0       0       0               0       
16      0x00000001      0       8       0       0       0               0       

right after four pings from windows client
------------------------------------------
$ cat /sys/kernel/debug/ieee80211/phy0/rt2800usb/queue/queue                    
qid     flags           count   limit   length  index   dma done        done    
14      0x00000001      226     128     128     98      98              98      
0       0x00000001      201     64      0       9       9               9       
1       0x00000001      0       64      0       0       0               0       
2       0x00000001      0       64      0       0       0               0       
3       0x00000001      0       64      0       0       0               0       
16      0x00000001      0       8       0       0       0               0       

NetPIPE
-------
$ NPtcp -h 192.168.40.101
  0:       1 bytes      3 times -->      0.01 Mbps in     814.67 usec           
  1:       2 bytes    122 times -->      0.00 Mbps in   10791.37 usec           
  2:       3 bytes      9 times -->      0.03 Mbps in     729.17 usec           
  3:       4 bytes     91 times --> 
(stopped...)



flexible + ivo patch
====================

right after windows client connected to the board with WPA2(AES)
----------------------------------------------------------------
$ cat /sys/kernel/debug/ieee80211/phy0/rt2800usb/queue/queue                    
qid     flags           count   limit   length  index   dma done        done    
14      0x00000001      83      128     128     83      83              83      
0       0x00000001      57      64      1       58      57              57      
1       0x00000001      0       64      0       0       0               0       
2       0x00000001      0       64      0       0       0               0       
3       0x00000001      0       64      0       0       0               0       
16      0x00000001      0       8       0       0       0               0       

right after four pings from windows client
------------------------------------------
$ cat /sys/kernel/debug/ieee80211/phy0/rt2800usb/queue/queue                    
qid     flags           count   limit   length  index   dma done        done    
14      0x00000001      173     128     128     45      45              45      
0       0x00000001      148     64      1       21      20              20      
1       0x00000001      0       64      0       0       0               0       
2       0x00000001      0       64      0       0       0               0       
3       0x00000001      0       64      0       0       0               0       
16      0x00000001      0       8       0       0       0               0       

NetPIPE
-------
$ NPtcp -h 192.168.40.101
  0:       1 bytes      3 times -->      0.00 Mbps in   83008.00 usec           
  1:       2 bytes      3 times -->      0.00 Mbps in   33693.33 usec           
  2:       3 bytes      3 times -->      0.00 Mbps in  240411.83 usec           
  3:       4 bytes      3 times -->      0.00 Mbps in   47299.17 usec           
  4:       6 bytes      3 times -->      0.00 Mbps in  179131.50 usec           
  5:       8 bytes      3 times -->      0.04 Mbps in    1588.50 usec           
  6:      12 bytes     39 times -->      0.02 Mbps in    3682.92 usec           
  7:      13 bytes     11 times -->      0.14 Mbps in     719.14 usec           
  8:      16 bytes     64 times -->      0.02 Mbps in    7699.98 usec           
  9:      19 bytes      7 times -->      0.20 Mbps in     735.07 usec           
 10:      21 bytes     85 times -->      0.02 Mbps in    6706.57 usec           
 11:      24 bytes      9 times -->      0.00 Mbps in  141140.44 usec           
 12:      27 bytes      3 times -->      0.00 Mbps in  166763.17 usec           
 13:      29 bytes      3 times -->      0.29 Mbps in     764.00 usec           
 14:      32 bytes     63 times -->      0.32 Mbps in     772.13 usec           
 15:      35 bytes     68 times -->      0.06 Mbps in    4222.35 usec           
 16:      45 bytes     13 times -->      0.48 Mbps in     721.85 usec           
 17:      48 bytes     92 times -->      0.03 Mbps in   11973.77 usec           
 18:      51 bytes      5 times -->      0.51 Mbps in     764.70 usec           
 19:      61 bytes     51 times -->      0.01 Mbps in   42452.69 usec           
 20:      64 bytes      3 times -->      0.57 Mbps in     852.17 usec           
 21:      67 bytes     60 times -->      0.02 Mbps in   20637.03 usec           
 22:      93 bytes      3 times -->      0.00 Mbps in 1000327.83 usec           
 23:      96 bytes      3 times -->      0.00 Mbps in  961784.50 usec           
 24:      99 bytes      3 times -->      0.00 Mbps in  497735.83 usec           
 25:     125 bytes      3 times -->      0.00 Mbps in  832843.50 usec           
 26:     128 bytes      3 times -->      0.00 Mbps in  204765.50 usec           
 27:     131 bytes      3 times -->      0.01 Mbps in  126846.00 usec           
 28:     189 bytes      3 times -->      0.05 Mbps in   27758.17 usec           
 29:     192 bytes      3 times -->      1.79 Mbps in     817.83 usec           
 30:     195 bytes     82 times --> 
(stopped...)



flexible + ours
===============

right after windows client connected to the board with WPA2(AES)
----------------------------------------------------------------
$ cat /sys/kernel/debug/ieee80211/phy0/rt2800usb/queue/queue                    
qid     flags           count   limit   length  index   dma done        done    
14      0x00000001      55      128     128     55      55              55      
0       0x00000001      41      64      0       41      41              41      
1       0x00000001      0       64      0       0       0               0       
2       0x00000001      0       64      0       0       0               0       
3       0x00000001      0       64      0       0       0               0       
16      0x00000001      0       8       0       0       0               0       

right after four pings from windows client
------------------------------------------
$ cat /sys/kernel/debug/ieee80211/phy0/rt2800usb/queue/queue                    
qid     flags           count   limit   length  index   dma done        done    
14      0x00000001      154     128     128     26      26              26      
0       0x00000001      140     64      0       12      12              12      
1       0x00000001      0       64      0       0       0               0       
2       0x00000001      0       64      0       0       0               0       
3       0x00000001      0       64      0       0       0               0       
16      0x00000001      0       8       0       0       0               0       

NetPIPE
-------
$ NPtcp -h 192.168.40.101
  0:       1 bytes    120 times -->      0.01 Mbps in     750.40 usec           
  1:       2 bytes    133 times -->      0.02 Mbps in     748.81 usec           
  2:       3 bytes    133 times -->      0.03 Mbps in     728.36 usec           
  3:       4 bytes     91 times -->      0.04 Mbps in     754.80 usec           
  4:       6 bytes     99 times -->      0.06 Mbps in     723.39 usec           
  5:       8 bytes     69 times -->      0.08 Mbps in     737.79 usec           
  6:      12 bytes     84 times -->      0.12 Mbps in     740.74 usec           
  7:      13 bytes     56 times -->      0.13 Mbps in     752.49 usec           
  8:      16 bytes     61 times -->      0.17 Mbps in     700.23 usec           
  9:      19 bytes     80 times -->      0.19 Mbps in     751.41 usec           
 10:      21 bytes     84 times -->      0.22 Mbps in     739.90 usec           
 11:      24 bytes     90 times -->      0.25 Mbps in     742.70 usec           
 12:      27 bytes     95 times -->      0.28 Mbps in     728.53 usec           
 13:      29 bytes     61 times -->      0.30 Mbps in     736.39 usec           
 14:      32 bytes     65 times -->      0.34 Mbps in     718.62 usec           
 15:      35 bytes     73 times -->      0.35 Mbps in     757.30 usec           
 16:      45 bytes     75 times -->      0.46 Mbps in     740.49 usec           
 17:      48 bytes     90 times -->      0.51 Mbps in     722.49 usec           
 18:      51 bytes     95 times -->      0.53 Mbps in     736.47 usec           
 19:      61 bytes     53 times -->      0.62 Mbps in     748.58 usec           
 20:      64 bytes     65 times -->      0.65 Mbps in     754.20 usec           
 21:      67 bytes     68 times -->      0.70 Mbps in     732.01 usec           
 22:      93 bytes     73 times -->      0.95 Mbps in     747.98 usec           
 23:      96 bytes     89 times -->      0.98 Mbps in     745.40 usec           
 24:      99 bytes     90 times -->      1.02 Mbps in     743.47 usec           
 25:     125 bytes     48 times -->      1.30 Mbps in     734.55 usec           
 26:     128 bytes     67 times -->      1.31 Mbps in     744.35 usec           
 27:     131 bytes     68 times -->      1.34 Mbps in     745.50 usec           
 28:     189 bytes     69 times -->      1.86 Mbps in     775.32 usec           
 29:     192 bytes     85 times -->      1.85 Mbps in     792.12 usec           
 30:     195 bytes     84 times -->      1.92 Mbps in     774.57 usec           
 31:     253 bytes     45 times -->      2.41 Mbps in     802.03 usec           
 32:     256 bytes     62 times -->      2.48 Mbps in     788.34 usec           
 33:     259 bytes     63 times -->      2.48 Mbps in     795.95 usec           
 34:     381 bytes     64 times -->      3.64 Mbps in     798.36 usec           
 35:     384 bytes     83 times -->      3.67 Mbps in     797.61 usec           
 36:     387 bytes     83 times -->      3.67 Mbps in     804.17 usec           
 37:     509 bytes     42 times -->      4.49 Mbps in     865.31 usec           
 38:     512 bytes     57 times -->      4.57 Mbps in     854.59 usec           
 39:     515 bytes     58 times -->      4.58 Mbps in     857.14 usec           
 40:     765 bytes     58 times -->      6.61 Mbps in     883.34 usec           
 41:     768 bytes     75 times -->      6.77 Mbps in     865.93 usec           
 42:     771 bytes     77 times -->      6.62 Mbps in     888.43 usec           
 43:    1021 bytes     37 times -->      8.30 Mbps in     939.04 usec           
 44:    1024 bytes     53 times -->      8.17 Mbps in     955.88 usec           
 45:    1027 bytes     52 times -->      8.06 Mbps in     972.20 usec           
 46:    1533 bytes     51 times -->      7.66 Mbps in    1525.97 usec           
 47:    1536 bytes     43 times -->      7.46 Mbps in    1570.44 usec           
 48:    1539 bytes     42 times -->      7.60 Mbps in    1545.51 usec           
 49:    2045 bytes     21 times -->     10.09 Mbps in    1546.31 usec           
 50:    2048 bytes     32 times -->      9.75 Mbps in    1601.77 usec           
 51:    2051 bytes     31 times -->      9.83 Mbps in    1592.16 usec           
 52:    3069 bytes     31 times -->     12.37 Mbps in    1892.11 usec           
 53:    3072 bytes     35 times -->     12.31 Mbps in    1904.36 usec           
 54:    3075 bytes     35 times -->     12.02 Mbps in    1952.34 usec           
 55:    4093 bytes     17 times -->     15.79 Mbps in    1977.85 usec           
 56:    4096 bytes     25 times -->     15.37 Mbps in    2032.76 usec           
 57:    4099 bytes     24 times -->     15.10 Mbps in    2070.98 usec           
 58:    6141 bytes     24 times -->     13.74 Mbps in    3410.75 usec           
 59:    6144 bytes     19 times -->     13.72 Mbps in    3417.03 usec           
 60:    6147 bytes     19 times -->     13.80 Mbps in    3397.32 usec           
 61:    8189 bytes      9 times -->     15.29 Mbps in    4086.61 usec           
 62:    8192 bytes     12 times -->     14.93 Mbps in    4185.71 usec           
 63:    8195 bytes     11 times -->     14.99 Mbps in    4170.91 usec           
 64:   12285 bytes     11 times -->     15.38 Mbps in    6095.45 usec           
 65:   12288 bytes     10 times -->     16.12 Mbps in    5814.15 usec           
 66:   12291 bytes     11 times -->     16.20 Mbps in    5790.18 usec           
 67:   16381 bytes      5 times -->     16.05 Mbps in    7787.10 usec           
 68:   16384 bytes      6 times -->     15.27 Mbps in    8187.83 usec           
 69:   16387 bytes      6 times -->     16.26 Mbps in    7686.83 usec           
 70:   24573 bytes      6 times -->     16.59 Mbps in   11301.75 usec           
 71:   24576 bytes      5 times -->     17.07 Mbps in   10982.60 usec           
 72:   24579 bytes      6 times -->     17.46 Mbps in   10737.75 usec           
 73:   32765 bytes      3 times -->     17.40 Mbps in   14369.67 usec           
 74:   32768 bytes      3 times -->     17.83 Mbps in   14019.67 usec           
 75:   32771 bytes      3 times -->     17.34 Mbps in   14418.17 usec           
 76:   49149 bytes      3 times -->     17.16 Mbps in   21856.33 usec           
 77:   49152 bytes      3 times -->     17.06 Mbps in   21987.50 usec           
 78:   49155 bytes      3 times -->     17.27 Mbps in   21715.00 usec           
 79:   65533 bytes      3 times -->     17.92 Mbps in   27894.50 usec           
 80:   65536 bytes      3 times -->     17.52 Mbps in   28542.00 usec           
 81:   65539 bytes      3 times -->     17.55 Mbps in   28490.00 usec           
 82:   98301 bytes      3 times -->     17.94 Mbps in   41802.83 usec           
 83:   98304 bytes      3 times -->     16.13 Mbps in   46505.17 usec           
 84:   98307 bytes      3 times -->     17.44 Mbps in   43001.00 usec           
 85:  131069 bytes      3 times -->     17.74 Mbps in   56360.50 usec           
 86:  131072 bytes      3 times -->     18.14 Mbps in   55120.33 usec           
 87:  131075 bytes      3 times -->     18.08 Mbps in   55323.17 usec           
 88:  196605 bytes      3 times -->     17.87 Mbps in   83919.67 usec           
 89:  196608 bytes      3 times -->     16.90 Mbps in   88738.67 usec           
 90:  196611 bytes      3 times -->     17.73 Mbps in   84627.00 usec           
 91:  262141 bytes      3 times -->     17.84 Mbps in  112088.50 usec           
 92:  262144 bytes      3 times -->     17.58 Mbps in  113748.67 usec           
 93:  262147 bytes      3 times -->     17.88 Mbps in  111867.67 usec           
 94:  393213 bytes      3 times -->     17.27 Mbps in  173754.83 usec           
 95:  393216 bytes      3 times -->     17.55 Mbps in  170984.50 usec           
 96:  393219 bytes      3 times -->     17.86 Mbps in  167983.67 usec           
 97:  524285 bytes      3 times -->     17.47 Mbps in  228930.00 usec           
 98:  524288 bytes      3 times -->     16.85 Mbps in  237405.00 usec           
 99:  524291 bytes      3 times -->     16.75 Mbps in  238756.33 usec           
100:  786429 bytes      3 times -->     17.27 Mbps in  347394.50 usec           
101:  786432 bytes      3 times -->     17.11 Mbps in  350626.17 usec           
102:  786435 bytes      3 times -->     16.84 Mbps in  356215.50 usec           
103: 1048573 bytes      3 times -->     17.57 Mbps in  455389.83 usec           
104: 1048576 bytes      3 times -->     17.07 Mbps in  468556.83 usec           
105: 1048579 bytes      3 times -->     17.47 Mbps in  457837.50 usec           
106: 1572861 bytes      3 times -->     16.99 Mbps in  706165.00 usec           
107: 1572864 bytes      3 times -->     17.47 Mbps in  686900.50 usec           
108: 1572867 bytes      3 times -->     17.91 Mbps in  670021.00 usec           
109: 2097149 bytes      3 times -->     16.74 Mbps in  955773.67 usec           
110: 2097152 bytes      3 times -->     16.97 Mbps in  942824.67 usec           
111: 2097155 bytes      3 times -->     17.30 Mbps in  925022.67 usec           
112: 3145725 bytes      3 times -->     17.39 Mbps in 1379715.33 usec           
113: 3145728 bytes      3 times -->     17.06 Mbps in 1406779.83 usec           
114: 3145731 bytes      3 times -->     17.30 Mbps in 1387511.17 usec           
(done successfully)
--
           Yashi
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index bfbb446..6b0ca7e 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -392,7 +392,7 @@  static bool rt2x00usb_kick_rx_entry(struct queue_entry *entry, void* data)
 
 	if (test_and_set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) ||
 	    test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags))
-		return true;
+		return false;
 
 	rt2x00lib_dmastart(entry);
 
@@ -447,7 +447,7 @@  static bool rt2x00usb_flush_entry(struct queue_entry *entry, void* data)
 	struct queue_entry_priv_usb_bcn *bcn_priv = entry->priv_data;
 
 	if (!test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags))
-		return true;
+		return false;
 
 	usb_kill_urb(entry_priv->urb);