Rockbox Technical Forums

Third Party => Unsupported Builds => Topic started by: r4bbit on February 13, 2017, 11:53:47 PM

Title: [share]custom rockbox build for SSDed ipod6g(classic)
Post by: r4bbit on February 13, 2017, 11:53:47 PM
background:
i have a SSDed ipod classic.i keep getting panic error of disk write. sometime its "dc_writeback_callback() - Could not write sector xxxx",sometimes its other error.
it happens several times per hour while listening music.and happens almost every time i unplug usb cable.
it also freezes about one time per hour,without any error shown on screen,usually happens after i pressed some button.
(my ipod also freeze after i play some ape with compress level larger than 4000, but this is as expected,since the limitation of cpu peformance,https://www.rockbox.org/wiki/CodecPerformanceComparison.the freezed i mentioned above doesnt include this kind of freeze )
it also happened one time that i keep getting panic error of dc_writeback_callback and could not log into rockbox ,nor could i connect it to computer and use the disk mode .i thought my ssd was dead. but it wasnt.after i flashed the apple official firmware and format my ssd and reflash rockbox.it works again. 

looks very like a disk driver issue.
i read it on the forum that the disk driver of ipod is reverse-engineered from an old official firmware of apple and its not designed for ssd,so rockbox doesnt work well on SSDed device.(sorry i cant find the link at the moment)

solution:
i modified source code and made a custom build.
https://drive.google.com/file/d/0B3ow0cQpIx1famljZy1Hanp6UEE

i doubled the long int "ata_sleep_timeout"  and doubled timeout value of every usage of “TIMEOUT_EXPIRED" marco in firmware/target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c。
i also disabled support of ape with compress level of 4000 and 5000 by the way by modificating lib/rbcodec/codecs/demac/libdemac/parser.c,bc ipod6g cant really play them in real time,all you can get from them is just intermittent sound and a freezed device...

after using this build,problem solved(at least on my device).my device had been running for 11hours before it freeze,no panic error any more,it eventually freezed though,but much more stable.
if this build also solves your problem,leave a message plz.if this is useful for many people,maybe we can merge the change into official build.
Title: Re: [share]custom rockbox build for SSDed ipod6g(classic)
Post by: __builtin on February 15, 2017, 03:46:06 PM
Hi, and welcome to the forums.

I see that you've provided a modified build, which is fine, but you haven't provided the source which it was built from. Can you please provide a link to it?

__builtin
Title: Re: [share]custom rockbox build for SSDed ipod6g(classic)
Post by: r4bbit on February 16, 2017, 04:43:20 AM
Hi, and welcome to the forums.

I see that you've provided a modified build, which is fine, but you haven't provided the source which it was built from. Can you please provide a link to it?

__builtin
hi,__builtin. thx and thx for reminder.

the code i modified was base on the latest master branch cloned a few days ago from https://github.com/Rockbox/rockbox.git

code version(last commit id):
eaf6aad690927ab0abfaae5276ef6561b334f803

patch of my modification:
https://drive.google.com/open?id=0B3ow0cQpIx1fUi1BVGRmeUIwNEU
Title: Re: [share]custom rockbox build for SSDed ipod6g(classic)
Post by: Massa on March 05, 2017, 12:45:15 PM
Hmm, I don't get it - why does doubling a timeout value make it more reliable for SSDs?
Aren't SSD faster than HDs and therefore shouldn't need longer timeouts?  ???

I'm confused!

Title: Re: [share]custom rockbox build for SSDed ipod6g(classic)
Post by: saratoga on March 05, 2017, 01:32:54 PM
His SSD is probably not made for use in a DAP that will go 30 minutes at a time without accessing it, so it probably powers off and has to reboot when he access it again.  The stock hard drives are made to work for portable devices so they are always ready to talk to the host. 
Title: Re: [share]custom rockbox build for SSDed ipod6g(classic)
Post by: r4bbit on March 06, 2017, 02:48:14 PM
His SSD is probably not made for use in a DAP that will go 30 minutes at a time without accessing it, so it probably powers off and has to reboot when he access it again.  The stock hard drives are made to work for portable devices so they are always ready to talk to the host.

this is not the case.the disk failure happens pretty randomly.it may happen in 30 seconds after i powered on my device.

Hmm, I don't get it - why does doubling a timeout value make it more reliable for SSDs?
Aren't SSD faster than HDs and therefore shouldn't need longer timeouts?  ???

I'm confused!

yes,the overall speed of ssd is almost always faster than hdd.no matter compared by 4k random write or by sequence write.but a disk write consists a few micro operation at lower level.

i assume at driver level there should be two mirco operations: 1.seek for a track.   2.write data to track , each of them has its own timeout value.

the seeking operation of ssd should be much faster than hdd and will never timeout. the write operation of ssd may be slower,because of the "write amplification" effect of writting a nand and the "wear leveling" work of the ssd's chip.

there is a ssd 4k random write latency test picture in attachment,its not tested on my ssd,its from internet.the highest latency of a 4k write can be 30ms when the ssd is 75% filled,and it become worse after 100% filled,as high as 40 ms.the seeking time of ssd is about 0.1ms,so you can ingore the seek time and consider the overall time as the time of doing write.

for hdd,after the track has been seeked,the write latency shouldnt be higher than spinning a round(which is 60min/4200RPM=14.3ms).

i m not an expert of disk driver. i was just analyzing ;D
Title: Re: [share]custom rockbox build for SSDed ipod6g(classic)
Post by: prof_wolfff on May 30, 2017, 06:43:30 PM
There are situations where writing a sector to a SDD takes more time, it is depending on the wearing algorithms and the block size of the SDD, i.e. when writing a sector requires to reallocate other sectors, or when there are free sectors but they are not erased, then the SDD FW needs to erase a whole block before writing this sector. It is supposed that the SDD FW will do these operations on background when the SDD is idle but not always is possible to do that way, or the FW algorithms are not good enough.