WLAN and SPI: direct interrupt

Werner Almesberger werner at openmoko.org
Wed Oct 1 15:27:22 CEST 2008


I wrote:
> Second, the Linux SDIO stack uses a phantastically inefficient method
> for detecting interrupts from the SDIO device:

I just did a quick and dirty hack that makes the HIF use the module's
direct interrupt line. The performance difference isn't quite as
spectacular as I had hoped: it gets only about 4% faster. System time
drops by about 15%, though.

What's more interesting is that the HIF can now work asynchronously.
This is probably a side-effect of going through a work queue, and
I'll probably meet this issue again with the S3C MMC driver.
Asynchronous operation makes it 11% faster than just the interrupts
improvement and system time drops by another 10%.

My test setup: MMC-SPI, S3C SPI, 12MHz SPI clock, poll mode, sgi-ttcp
with default settings sending 16MB from the PC over WLAN (through an
aging Linksys WRT54G using WEP) to the Neo:

			Throughput at receiver	System time
SDIO interrupt polling:	386.1 kB/s      (100%)	3.5s	(100%)
Direct card interrupt:	402.6 kB/s      (104%)	2.9s	( 83%)
Asynchronous HIF:	448.8 kB/s      (116%)	2.5s 	( 71%)

The full ttcp output of five test runs for each configuration is
below.

The new patches are hif-direct-interrupt.patch and
hif-can-do-async.patch, as usual in
http://svn.openmoko.org/developers/werner/wlan-spi/patches/

- Werner

---------------------------------- cut here -----------------------------------

SDIO interrupt polling:

ttcp-t: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp  -> 192.168.1.100
ttcp-t: socket
ttcp-t: connect
ttcp-t: 16777216 bytes in 42.21 real seconds = 388.11 KB/sec +++
ttcp-t: 2048 I/O calls, msec/call = 21.11, calls/sec = 48.51
ttcp-t: 0.0user 0.0sys 0:42real 0% 0i+0d 0maxrss 0+3pf 255+0csw

ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp
ttcp-r: socket
ttcp-r: accept from 192.168.1.2
ttcp-r: 16777216 bytes in 42.38 real seconds = 386.56 KB/sec +++
ttcp-r: 11553 I/O calls, msec/call = 3.76, calls/sec = 272.58
ttcp-r: 0.7user 3.3sys 0:42real 9% 0i+0d 0maxrss 0+2pf 11547+46csw


ttcp-t: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp  -> 192.168.1.100
ttcp-t: socket
ttcp-t: connect
ttcp-t: 16777216 bytes in 42.15 real seconds = 388.68 KB/sec +++
ttcp-t: 2048 I/O calls, msec/call = 21.08, calls/sec = 48.58
ttcp-t: 0.0user 0.0sys 0:42real 0% 0i+0d 0maxrss 0+3pf 254+0csw

ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp
ttcp-r: socket
ttcp-r: accept from 192.168.1.2
ttcp-r: 16777216 bytes in 42.40 real seconds = 386.37 KB/sec +++
ttcp-r: 11533 I/O calls, msec/call = 3.77, calls/sec = 271.97
ttcp-r: 0.3user 3.5sys 0:42real 9% 0i+0d 0maxrss 0+2pf 11592+26csw


ttcp-t: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp  -> 192.168.1.100
ttcp-t: socket
ttcp-t: connect
ttcp-t: 16777216 bytes in 42.21 real seconds = 388.18 KB/sec +++
ttcp-t: 2048 I/O calls, msec/call = 21.10, calls/sec = 48.52
ttcp-t: 0.0user 0.0sys 0:42real 0% 0i+0d 0maxrss 0+3pf 334+0csw

ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp
ttcp-r: socket
ttcp-r: accept from 192.168.1.2
ttcp-r: 16777216 bytes in 42.47 real seconds = 385.77 KB/sec +++
ttcp-r: 11461 I/O calls, msec/call = 3.79, calls/sec = 269.85
ttcp-r: 0.2user 3.6sys 0:42real 9% 0i+0d 0maxrss 0+2pf 11581+35csw


ttcp-t: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp  -> 192.168.1.100
ttcp-t: socket
ttcp-t: connect
ttcp-t: 16777216 bytes in 42.25 real seconds = 387.74 KB/sec +++
ttcp-t: 2048 I/O calls, msec/call = 21.13, calls/sec = 48.47
ttcp-t: 0.0user 0.0sys 0:42real 0% 0i+0d 0maxrss 0+3pf 286+0csw

ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp
ttcp-r: socket
ttcp-r: accept from 192.168.1.2
ttcp-r: 16777216 bytes in 42.44 real seconds = 386.06 KB/sec +++
ttcp-r: 11529 I/O calls, msec/call = 3.77, calls/sec = 271.66
ttcp-r: 0.2user 3.8sys 0:42real 9% 0i+0d 0maxrss 0+2pf 11589+21csw


ttcp-t: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp  -> 192.168.1.100
ttcp-t: socket
ttcp-t: connect
ttcp-t: 16777216 bytes in 42.23 real seconds = 387.93 KB/sec +++
ttcp-t: 2048 I/O calls, msec/call = 21.12, calls/sec = 48.49
ttcp-t: 0.0user 0.0sys 0:42real 0% 0i+0d 0maxrss 0+3pf 288+1csw

ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp
ttcp-r: socket
ttcp-r: accept from 192.168.1.2
ttcp-r: 16777216 bytes in 42.47 real seconds = 385.81 KB/sec +++
ttcp-r: 11585 I/O calls, msec/call = 3.75, calls/sec = 272.80
ttcp-r: 0.5user 3.4sys 0:42real 9% 0i+0d 0maxrss 0+2pf 11593+26csw


Direct card interrupt:

ttcp-t: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp  -> 192.168.1.100
ttcp-t: socket
ttcp-t: connect
ttcp-t: 16777216 bytes in 40.34 real seconds = 406.17 KB/sec +++
ttcp-t: 2048 I/O calls, msec/call = 20.17, calls/sec = 50.77
ttcp-t: 0.0user 0.0sys 0:40real 0% 0i+0d 0maxrss 0+3pf 314+2csw

ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp
ttcp-r: socket
ttcp-r: accept from 192.168.1.2
ttcp-r: 16777216 bytes in 40.70 real seconds = 402.54 KB/sec +++
ttcp-r: 11317 I/O calls, msec/call = 3.68, calls/sec = 278.05
ttcp-r: 0.1user 2.8sys 0:40real 7% 0i+0d 0maxrss 0+2pf 11560+65csw


ttcp-t: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp  -> 192.168.1.100
ttcp-t: socket
ttcp-t: connect
ttcp-t: 16777216 bytes in 40.26 real seconds = 406.93 KB/sec +++
ttcp-t: 2048 I/O calls, msec/call = 20.13, calls/sec = 50.87
ttcp-t: 0.0user 0.0sys 0:40real 0% 0i+0d 0maxrss 0+3pf 340+0csw

ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp
ttcp-r: socket
ttcp-r: accept from 192.168.1.2
ttcp-r: 16777216 bytes in 40.54 real seconds = 404.17 KB/sec +++
ttcp-r: 11505 I/O calls, msec/call = 3.61, calls/sec = 283.81
ttcp-r: 0.1user 3.0sys 0:40real 7% 0i+0d 0maxrss 0+2pf 11591+10csw


ttcp-t: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp  -> 192.168.1.100
ttcp-t: socket
ttcp-t: connect
ttcp-t: 16777216 bytes in 40.36 real seconds = 405.90 KB/sec +++
ttcp-t: 2048 I/O calls, msec/call = 20.18, calls/sec = 50.74
ttcp-t: 0.0user 0.0sys 0:40real 0% 0i+0d 0maxrss 0+3pf 292+0csw

ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp
ttcp-r: socket
ttcp-r: accept from 192.168.1.2
ttcp-r: 16777216 bytes in 40.78 real seconds = 401.76 KB/sec +++
ttcp-r: 11440 I/O calls, msec/call = 3.65, calls/sec = 280.53
ttcp-r: 0.2user 2.8sys 0:40real 7% 0i+0d 0maxrss 0+2pf 11594+17csw


ttcp-t: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp  -> 192.168.1.100
ttcp-t: socket
ttcp-t: connect
ttcp-t: 16777216 bytes in 40.51 real seconds = 404.40 KB/sec +++
ttcp-t: 2048 I/O calls, msec/call = 20.26, calls/sec = 50.55
ttcp-t: 0.0user 0.0sys 0:40real 0% 0i+0d 0maxrss 0+3pf 373+0csw

ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp
ttcp-r: socket
ttcp-r: accept from 192.168.1.2
ttcp-r: 16777216 bytes in 40.91 real seconds = 400.53 KB/sec +++
ttcp-r: 11382 I/O calls, msec/call = 3.68, calls/sec = 278.25
ttcp-r: 0.2user 2.8sys 0:40real 7% 0i+0d 0maxrss 0+2pf 11592+35csw


ttcp-t: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp  -> 192.168.1.100
ttcp-t: socket
ttcp-t: connect
ttcp-t: 16777216 bytes in 40.28 real seconds = 406.79 KB/sec +++
ttcp-t: 2048 I/O calls, msec/call = 20.14, calls/sec = 50.85
ttcp-t: 0.0user 0.0sys 0:40real 0% 0i+0d 0maxrss 0+3pf 346+0csw

ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp
ttcp-r: socket
ttcp-r: accept from 192.168.1.2
ttcp-r: 16777216 bytes in 40.53 real seconds = 404.22 KB/sec +++
ttcp-r: 11420 I/O calls, msec/call = 3.63, calls/sec = 281.75
ttcp-r: 0.2user 2.9sys 0:40real 7% 0i+0d 0maxrss 0+2pf 11590+30csw


Asynchronous HIF:  

ttcp-t: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp  -> 192.168.1.100
ttcp-t: socket
ttcp-t: connect
ttcp-t: 16777216 bytes in 36.20 real seconds = 452.61 KB/sec +++
ttcp-t: 2048 I/O calls, msec/call = 18.10, calls/sec = 56.58
ttcp-t: 0.0user 0.0sys 0:36real 0% 0i+0d 0maxrss 0+3pf 293+0csw

ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp
ttcp-r: socket
ttcp-r: accept from 192.168.1.2
ttcp-r: 16777216 bytes in 36.45 real seconds = 449.52 KB/sec +++
ttcp-r: 11557 I/O calls, msec/call = 3.23, calls/sec = 317.09
ttcp-r: 0.1user 2.5sys 0:36real 7% 0i+0d 0maxrss 0+2pf 11555+24csw


ttcp-t: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp  -> 192.168.1.100
ttcp-t: socket
ttcp-t: connect
ttcp-t: 16777216 bytes in 36.17 real seconds = 452.97 KB/sec +++
ttcp-t: 2048 I/O calls, msec/call = 18.09, calls/sec = 56.62
ttcp-t: 0.0user 0.0sys 0:36real 0% 0i+0d 0maxrss 0+3pf 288+0csw

ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp
ttcp-r: socket
ttcp-r: accept from 192.168.1.2
ttcp-r: 16777216 bytes in 36.53 real seconds = 448.45 KB/sec +++
ttcp-r: 11588 I/O calls, msec/call = 3.23, calls/sec = 317.18
ttcp-r: 0.1user 2.5sys 0:36real 7% 0i+0d 0maxrss 0+1pf 11590+14csw


ttcp-t: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp  -> 192.168.1.100
ttcp-t: socket
ttcp-t: connect
ttcp-t: 16777216 bytes in 36.09 real seconds = 453.94 KB/sec +++
ttcp-t: 2048 I/O calls, msec/call = 18.05, calls/sec = 56.74
ttcp-t: 0.0user 0.0sys 0:36real 0% 0i+0d 0maxrss 0+3pf 288+2csw

ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp
ttcp-r: socket
ttcp-r: accept from 192.168.1.2
ttcp-r: 16777216 bytes in 36.49 real seconds = 448.96 KB/sec +++
ttcp-r: 11589 I/O calls, msec/call = 3.22, calls/sec = 317.56
ttcp-r: 0.1user 2.6sys 0:36real 7% 0i+0d 0maxrss 0+1pf 11594+16csw


ttcp-t: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp  -> 192.168.1.100
ttcp-t: socket
ttcp-t: connect
ttcp-t: 16777216 bytes in 36.26 real seconds = 451.79 KB/sec +++
ttcp-t: 2048 I/O calls, msec/call = 18.13, calls/sec = 56.47
ttcp-t: 0.0user 0.0sys 0:36real 0% 0i+0d 0maxrss 0+3pf 256+0csw

ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp
ttcp-r: socket
ttcp-r: accept from 192.168.1.2
ttcp-r: 16777216 bytes in 36.55 real seconds = 448.26 KB/sec +++
ttcp-r: 11587 I/O calls, msec/call = 3.23, calls/sec = 317.02
ttcp-r: 0.1user 2.3sys 0:36real 7% 0i+0d 0maxrss 0+1pf 11596+24csw


ttcp-t: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp  -> 192.168.1.100
ttcp-t: socket
ttcp-t: connect
ttcp-t: 16777216 bytes in 36.20 real seconds = 452.58 KB/sec +++
ttcp-t: 2048 I/O calls, msec/call = 18.10, calls/sec = 56.57
ttcp-t: 0.0user 0.0sys 0:36real 0% 0i+0d 0maxrss 0+3pf 245+2csw

ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp
ttcp-r: socket
ttcp-r: accept from 192.168.1.2
ttcp-r: 16777216 bytes in 36.52 real seconds = 448.66 KB/sec +++
ttcp-r: 11589 I/O calls, msec/call = 3.23, calls/sec = 317.35
ttcp-r: 0.1user 2.4sys 0:36real 7% 0i+0d 0maxrss 0+1pf 11590+25csw



More information about the openmoko-kernel mailing list