Raw access on eMMC with alternating speeds

847 Views Asked by At

on my embedded Linux system I do have a bunch of data, around 1MB, which has to be saved very quickly to an eMMC if someone unplugs the power cord. I did try a lot of things so far, for example:

  • fopen/fwrite with the sync option
  • performing a sync after copy
  • mounting the special partition with the sync option

All of these attempts where very slow, in the range of 1second.

I ended up using disk dump (dd) in BusyBox v1.20.2:

dd if=data1MB of=/dev/mmcblk0p3 bs=1M count=1

I did some experiements with different block sizes, aka bs, and all of the results where in the range of 200ms, mostly.

Now to my question: I have this odd behaviour that the write speed is alternating, so on the first write attempt the speed is 5MB/s on the second it's 1,5MB/s, the next is again 5MB/s and so on. I also have this behaviour if I change the input file on every dd.

I did strace with no noticeable difference between the dds.

Any help would be appreciated.

Thx Jay

Edit:

I am using the conv=fsync option, which should force the data to be written to the eMMC, with the same effect. So the problem might not be OS buffering

Edit2:

So everything is pointing towards the emmc, I'm going to contact the distribitor and hopefully will get a result. Thx so far to all.

Edit 3:

So after talking to our distributor, the alternating speeds might come from the internal Controller of my managed NAND, which can run background processes like Bad block mgmt and wear leveling. With my eMMC it is possible to send a high priority interrupt to the eMMC, which will yield all running processes on the eMMC controller. Using that backdoor, i will be able to achieve predictable and constant access times to my eMMC. On the ohter hand, this is quite dangerous, because data handled in the yielded process could be lossed.

My distributor is preparing a kernel patch to accesss this high priority interrupt from the user space. I'll let you know.

Thx for your help

0

There are 0 best solutions below