maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Troubleshooting (https://talk.maemo.org/forumdisplay.php?f=6)
-   -   Slow write speed on mmc? (2gb-mmcplus52Mhz) (https://talk.maemo.org/showthread.php?t=3316)

N770-Freak 2006-10-18 16:11

Slow write speed on mmc? (2gb-mmcplus52Mhz)
 
Hi,

i've bought a N770 (plus 2GB Kingston mmcmobile card) a few days ago.

My setup:
  • 2GB kernel (zImage-su-18-200625-2gb-mmcplus52Mhz)
  • bootmenu (booting from mmc2 ext2 partition)

Now the startup of the device is much faster!

But when i try to download larger files over wlan (with wget)
the download starts with ca. 600KB/s and slowsdown to ca. 200KB/s and
my CPU usage (xterm top) increases to ca. 100%. Then my system begins to
hang sometimes.
"Top" shows me that the service "mmcqd" is responsible to the high cpu usage!
So it seems that the download slowsdown when chached writes are synced to the mmc.

So I tested the read/write speed of my card.

Code:

time dd if=/dev/mmcblk0 of=/dev/null bs=8192 count=10240
10240+0 records in
10240+0 records out
real 0m 15.63s
user 0m 0.02s
sys 0m 2.25s

Code:

time dd if=/dev/zero of=zero-file bs=1024 count=10240; time sync
10240+0 records in
10240+0 records out
real 0m 0.62s
user 0m 0.03s
sys 0m 0.57s
real 0m 26.44s
user 0m 0.00s
sys 0m 0.01s

Result:
  • Read ca. 5200KB/sec (80MB in 16sec)
  • Write ca. 380KB/sec (10MB in 27sec)

Is that normal??? such a slow write speed?
Can anyone confirm this?


Greetings from Germany
N770-Freak

fanoush 2006-10-18 19:06

Noticed this too. Exactly same behaviour. Would be interesting to test it directly with raw device (will destroy data): time dd if=/dev/zero of=/dev/mmcblk0pX bs=1024 count=x. If this is considerably faster the linux file/buffer cache is probably the problem. If not, it can be something in mmc driver. Would be also interesting to test 2gb kernel without high-speed patches if it is same, but I guess it will be the same. There are no suspicious errors in kernel log (dmesg output) except ocassional unexpected interrupt or something similar so I guess the mmc driver works fine and there are no retries or timeouts while writing (caused by higher speed) that could slow it down.

ascherjim 2006-10-19 12:59

N770-Freak's initial thread would seem to indicate that he/she is accessing and using the 2GB Kingston Mobile card in the 770 without first attaining support for the card by flashing zImage-su-18-200627. Did the flashing of zImage-su-a8-200625-2gb-mmcplus52Mhz to gain a higher MMC bus speed also somehow accomplish the attaining of access provided by the 200627?

N770-Freak 2006-10-19 15:59

Quote:

he/she
He, please ;)

Quote:

Did the flashing of zImage-su-a8-200625-2gb-mmcplus52Mhz to gain a higher MMC bus speed also somehow accomplish the attaining of access provided by the 200627?
The "zImage-su-a8-200625-2gb-mmcplus52Mhz" is a kernel image with 2GB and 52Mhz support (like the file name says). I don't really know what this kernel image contains, but i think that this image is only a compiled kernel. So it doesn't matter what kernel was installed before (it is a complete replace of the old one).


Quote:

Would be interesting to test it directly with raw device (will destroy data): time dd if=/dev/zero of=/dev/mmcblk0pX bs=1024 count=x
I created a new partition at the end of the mmc (100MB ext2) and tested this...
Code:

time dd if=/dev/zero of=/dev/mmcblk0p3 bs=1024 count=10240
10240+0 records in
10240+0 records out
real 0m 34.30s
user 0m 0.02s
sys 0m 0.88s

300KB/sec write speed

Quote:

Would be also interesting to test 2gb kernel without high-speed patches if it is same, but I guess it will be the same.
I've flashed my device with the "zImage-su-18-200627"...

Code:

time dd if=/dev/mmcblk0 of=/dev/null bs=8192 count=10240
10240+0 records in
10240+0 records out
real 0m 58.96s
user 0m 0.03s
sys 0m 2.21s

1400KB/sec read speed

Code:

time dd if=/dev/zero of=outputf bs=1024 count=10240; time sync
10240+0 records in
10240+0 records out
real 0m 0.66s
user 0m 0.03s
sys 0m 0.54s
real 0m 31.63s
user 0m 0.00s
sys 0m 0.03s

320KB/sec write speed

Code:

time dd if=/dev/zero of=/dev/mmcblk0p3 bs=1024 count=10240
10240+0 records in
10240+0 records out
real 0m 39.58s
user 0m 0.05s
sys 0m 0.78s

260KB/sec write speed

Btw. i rounded all the values.


Hope that helps someone (perhaps fanoush ;)) to find the real source of the problem (and solves it).

Greetings
N770-Freak

fanoush 2006-10-30 07:37

Hello. The problem seems to be that MMC supports so called multiblock read and write command but current kernel support only multiblock read but not write. There is a patch that enables writing too http://www.spinics.net/lists/arm-kernel/msg35748.html but there was a reason for disabling that. On some MMC controllers it can cause data corruption. Maybe OMAP inside N770 works fine (see also http://www.spinics.net/lists/arm-kernel/msg35999.html ) but it is definitely untested.

Anyone wants to try kernel with multiblock writes enabled ? You can find it here http://fanoush.webpark.cz/maemo/#mmcplus below the high-speed one. It works for me and write speed is ~2MB/s but it may bite you in the future (same as high speed mode) so don't try it if you like your data on MMC and use N770 for something mission critical.

You can measure write speed like this

sync ; date ; dd if=/dev/zero of=/path/to/mmc/test bs=8192 count=5000 ; sync ; date

My test (system booted from MMC):

Code:

Nokia770-26:~# sync ; date ; dd if=/dev/zero of=/test bs=8192 count=5000 ; sync ; date
Mon Oct 30 08:33:09 CET 2006
5000+0 records in
5000+0 records out
Mon Oct 30 08:33:39 CET 2006
Nokia770-26:~#

40 MB in 20 seconds :-)

fanoush 2006-10-30 07:53

Oh, sorry it seems to be 30 seconds in the test above, I think I got 20 seconds yesterday.

N770-Freak 2006-10-30 10:23

Tanks for this patch!

I've flashed this new kernel a few minutes ago...
Got 40MB in 34 secs => ca. 1100KB/sec

Hope that my mmc controller can handle this without data corruption ;)


Greetings...
N770-Freak

fanoush 2006-10-30 11:31

It probably depends a lot on the filesystem i.e. you need to have continuous free blocks to use the multiblock write with big gains. Bus some gain is constant. Basic MMC block is 512bytes and ext2 filesystem uses 1024 or bigger blocks so at least such blocks can be written at once.

richie 2006-10-30 12:54

Hi

Does this only become an issue if writing a lot of data?

If you run the OS from the mmc card and don't have large file transfers, is the speed acceptable?

Cheers
Rich

fanoush 2006-10-30 15:27

Well, most usage is just reading so yes, mostly it is acceptable and hard to notice.

Slow writes may hurt virtual memory performace (i.e. when swapping) and when downloading from fast network or moving data via USB. Both speeds (wlan and USB) are slightly higher that default MMC write speed. It probably doesn't matter at all when you write few kilobytes or even megabytes infrequently since there is some cache. Of course it depends on amount of free memory which is unfortunately permanently low on N770. Once there is no free memory for more data when writing continuously it slows down to crawl (i.e. 200-300KB/s) and system may become low on memory (and a bit ustable and slow) because all memory is occupied by data which needs to be written.

penguinbait 2006-10-30 18:08

off topic
 
Fanoush, does the 52mhz mmc kernel also contain the mppe patch?

Thanks,

fanoush 2006-10-30 19:08

Quote:

Originally Posted by penguinbait
Fanoush, does the 52mhz mmc kernel also contain the mppe patch?

Yes and no
http://www.internettablettalk.com/fo...3372#post23372
crypto code is in but pptp is in extra module.

richie 2006-10-31 12:53

Mini-SD speed?
 
Hi

It's mentioned elsewhere about a new Nokia tablet, 870/880 in the works, and talks about mini-SD in the spec. If true, does Fanoush, anyone know if mini-SD offers the same performance as mmc?

I also think mini-SD is closed source so presumably speed tweaks might be harder? Though maybe mini-SD is already runs at a high speed.

Cheers
Rich

fanoush 2006-10-31 14:28

as for features there is nice table here
http://en.wikipedia.org/wiki/SD_card

I am not sure SD or miniSD is best choice for future. It may be more widespread right now but the limits (both speed and size) are lower then MMCplus. SD is dead end and will be replaced by incompatible SDHC soon http://www.sdcard.org/sdhc/index.html
http://www.sandisk.com/sdhc/SDHC.pdf

Still miniSD is improvement over current mmc slot in N770.

As for being open, SD is worse but not much, I hope the time when SD card kernel drivers were closed source (sharp zaurus) is over. We will see soon :-)

I still don't understand why they did not chose full SD slot which is the best solution for consumers (cheapest cards, better interoperability) but being phone company miniSD was probably more logical and maybe a bit cheaper to them.

dacb 2006-11-19 12:35

diffs against nov 2006 2.6.16 kernel
 
fanosh,

Can I get you to post your diffs for the kernel source - particularly those against the just released 2.6.16-27-omap1? I'm interested to see how your patches in drivers/mmc/*.c and includes/linux/mmc/*.h square with mine. Thanks,

-dacb

fanoush 2006-11-19 14:29

I have used this patch for high-speed mode
http://marc.theaimsgroup.com/?l=linu...18628389&q=raw
but replaced 'mmc_set_data_timeout(&data, card, 0);' call by older code from 2.6.16

as for omap and n770 specific parts I just bumped frequency to 48Mhz both in drivers/mmc/omap.c and arch/arm/mach-omap1/board-nokia770-mmc.c

I will produce diff eventually, but I don't have both old and new source trees right now.

dacb 2006-11-19 20:26

OK, it looks like we are both back porting from patches applied to 2.6.18 - fwiw, I understand that the the high speed (sans omap-1 specific hardcodes) and the multi-block writes are in the pipeline for the main-line kernel in 2.6.20.

Thanks, look forward to seeing your diffs.

fanoush 2006-11-25 16:23

Quote:

Originally Posted by dacb
Thanks, look forward to seeing your diffs.

updated http://fanoush.webpark.cz/maemo/#mmcplus with source diff for newer kernel

dacb 2006-11-26 17:42

Outstanding, thanks!


All times are GMT. The time now is 16:09.

vBulletin® Version 3.8.8