sata_mars : Investigation to get hd-idle to work in all hard disks

Página 1 de 2. 1, 2  Siguiente

Ir abajo

sata_mars : Investigation to get hd-idle to work in all hard disks Empty sata_mars : Investigation to get hd-idle to work in all hard disks

Mensaje  vic1972 el Lun Mar 28, 2011 10:46 pm

Hello,
we have discovered that hd-idle does not work in all hard disk, because some disk needs some more seconds to start,
and module sata_mars does not wait this amount of time.

The idea is to get source code of module sata_mars, increase the timer, and recompile.

Can someone helps to locate source code for mipsel of module sata_mars ?
Thanks you all
vic1972
vic1972

Mensajes : 2260
Fecha de inscripción : 09/12/2009
Edad : 47
Localización : Malaga

Volver arriba Ir abajo

sata_mars : Investigation to get hd-idle to work in all hard disks Empty Re: sata_mars : Investigation to get hd-idle to work in all hard disks

Mensaje  evr el Mar Mar 29, 2011 1:08 am

vic1972 escribió:we have discovered that hd-idle does not work in all hard disk, because some disk needs some more seconds to start, and module sata_mars does not wait this amount of time. The idea is to get source code of module sata_mars, increase the timer, and recompile. Can someone helps to locate source code for mipsel of module sata_mars ?
It is in the directory linux-2.6.12/drivers/scsi/ of the source tree LG-MS408D supplied by LG (upon request).

So the question is one that I already posted several times in this forum, without response: Does anybody has the required tool-chain ready and know the details of how to compile a kernel module (and ideally the whole kernel too) ??

Best wishes,

evr

Mensajes : 279
Fecha de inscripción : 12/10/2010

Volver arriba Ir abajo

sata_mars : Investigation to get hd-idle to work in all hard disks Empty Re: sata_mars : Investigation to get hd-idle to work in all hard disks

Mensaje  Admin el Mar Mar 29, 2011 9:16 am

Hello,
regarding the toolchain, I cannot remember well, but i think there is a post in some place where keltek explained it....

Anyways, thanks for the info of source, I have in fact extracted some files from there:
probably we can start having a quick look into the sources to see if it is at least feasible to do the changes ..

http://dl.dropbox.com/u/684543/varios/ms450h/Cod_Fuente_LG/sata.zip

Best regards

Admin
Admin

Mensajes : 70
Fecha de inscripción : 07/12/2009

https://ms450.forosactivos.net

Volver arriba Ir abajo

sata_mars : Investigation to get hd-idle to work in all hard disks Empty Re: sata_mars : Investigation to get hd-idle to work in all hard disks

Mensaje  evr el Mar Mar 29, 2011 12:03 pm

Admin escribió:[...]we can start having a quick look into the sources to see if it is at least feasible to do the changes [...]
I already had a look. It creates some hooks under /sys/bus/SATA.... In fact, when all the modules are loaded, many hooks are made available under the tree /sys/bus/SATA.... Interestingly, there is one called timeout which by default holds a value of "7" (seconds ¡¿?!). It can be changed at will by just writing another number onto it.

This particular hook does not seem to be created by sata_mars (and for the moment I don't know which other module --or the kernel-- does create it), but given the value "7" and the fact that 1TB+ disks happen to fail just because they take more than "7" seconds to spin-up, I think it would be worth trying to increase it to 9 or 10 and test hd-idle again.

Vic, can you do it yourself? (to test hd-idle it is better not to start the service and just run it manually for inmediate speendown: "hd-idle -t /dev/sda"). Otherwise, I can test it on your LG if you give me access to it, as you did last Sunday. Please, let me know.

Best,

evr

Mensajes : 279
Fecha de inscripción : 12/10/2010

Volver arriba Ir abajo

sata_mars : Investigation to get hd-idle to work in all hard disks Empty Re: sata_mars : Investigation to get hd-idle to work in all hard disks

Mensaje  vic1972 el Mar Mar 29, 2011 6:16 pm

In my ms400 with usb disk, i have:


Código:

root@Venus:/sys/bus# ls -l
total 0
drwxr-xr-x    4 root    root            0 Mar 29 16:11 SATA_BUS
drwxr-xr-x    4 root    root            0 Jan  1  2009 i2c
drwxr-xr-x    4 root    root            0 Jan  1  2009 platform
drwxr-xr-x    4 root    root            0 Jan  1  2009 scsi
drwxr-xr-x    4 root    root            0 Jan  1  2009 usb
root@Venus:/sys/bus# cd SATA_BUS/
root@Venus:/sys/bus/SATA_BUS# ls -
ls: -: No such file or directory
root@Venus:/sys/bus/SATA_BUS# ls
devices            offline_dev        scan_dev
drivers            re_scan            wait_insmod_state
root@Venus:/sys/bus/SATA_BUS#



I will test later in the ms450, i cannot test right now.
But it seems there are different files....
vic1972
vic1972

Mensajes : 2260
Fecha de inscripción : 09/12/2009
Edad : 47
Localización : Malaga

Volver arriba Ir abajo

sata_mars : Investigation to get hd-idle to work in all hard disks Empty Re: sata_mars : Investigation to get hd-idle to work in all hard disks

Mensaje  evr el Mar Mar 29, 2011 7:00 pm

vic1972 escribió:In my ms400 with usb disk, i have:[...} I will test later in the ms450, i cannot test right now. But it seems there are different files....
Sorry, I wrote my message without having my LG at hand, so I wrote some wrong filenames. Here is the relevant tree:
Código:
/sys/bus/SATA_BUS/
  + devices
  |  + SATA_DEV
  |    + host0
  |    |  + target0:0:0
  |    |  |  + 0:0:0:0
  |    |  |  |  + timeout
  |    |  |  [...]
  |    |  [...]
  |    [..] 
  + offline_dev
  + re_scan
  [...]
To change the timer just go all the way down the tree and type:
cat timeout ; echo 10 > timeout ; cat timeout

Hope it is clear now.
Best,

evr

Mensajes : 279
Fecha de inscripción : 12/10/2010

Volver arriba Ir abajo

sata_mars : Investigation to get hd-idle to work in all hard disks Empty Re: sata_mars : Investigation to get hd-idle to work in all hard disks

Mensaje  vic1972 el Miér Mar 30, 2011 12:21 am

Yes, very clear now, thanks

wowww what a path
root@Venus:/sys/devices/SATA_DEV/host0/target0:0:0/0:0:0:0# cat timeout
10

ok, unfortunally i cannotest right now, as we are recording a couple of programs.,
will test tomorrow.

vic1972
vic1972

Mensajes : 2260
Fecha de inscripción : 09/12/2009
Edad : 47
Localización : Malaga

Volver arriba Ir abajo

sata_mars : Investigation to get hd-idle to work in all hard disks Empty Re: sata_mars : Investigation to get hd-idle to work in all hard disks

Mensaje  vic1972 el Miér Mar 30, 2011 7:54 am

it works!!!!

I just did a unique test, and it worked fine.
I will keep it in using for some days.
thanks
vic1972
vic1972

Mensajes : 2260
Fecha de inscripción : 09/12/2009
Edad : 47
Localización : Malaga

Volver arriba Ir abajo

sata_mars : Investigation to get hd-idle to work in all hard disks Empty Re: sata_mars : Investigation to get hd-idle to work in all hard disks

Mensaje  evr el Miér Mar 30, 2011 12:58 pm

vic1972 escribió:it works!!!! I just did a unique test, and it worked fine. I will keep it in using for some days. thanks
Thanks to you! These seem good news. Let's wait for a few more tests before including it in the hdidle service script.

Best,

evr

Mensajes : 279
Fecha de inscripción : 12/10/2010

Volver arriba Ir abajo

sata_mars : Investigation to get hd-idle to work in all hard disks Empty Re: sata_mars : Investigation to get hd-idle to work in all hard disks

Mensaje  vic1972 el Miér Mar 30, 2011 5:54 pm

Some checkings.

echo 10 > /sys/devices/SATA_DEV/host0/target0:0:0/0:0:0:0/timeout
cat /sys/devices/SATA_DEV/host0/target0:0:0/0:0:0:0/timeout
vic1972
vic1972

Mensajes : 2260
Fecha de inscripción : 09/12/2009
Edad : 47
Localización : Malaga

Volver arriba Ir abajo

sata_mars : Investigation to get hd-idle to work in all hard disks Empty Re: sata_mars : Investigation to get hd-idle to work in all hard disks

Mensaje  evr el Miér Mar 30, 2011 7:23 pm

vic1972 escribió:Some checkings.
echo 10 > /sys/devices/SATA_DEV/host0/target0:0:0/0:0:0:0/timeout
cat /sys/devices/SATA_DEV/host0/target0:0:0/0:0:0:0/timeout
???... I don't understand... Maybe we should use Spanish...

Best,

evr

Mensajes : 279
Fecha de inscripción : 12/10/2010

Volver arriba Ir abajo

sata_mars : Investigation to get hd-idle to work in all hard disks Empty Re: sata_mars : Investigation to get hd-idle to work in all hard disks

Mensaje  vic1972 el Miér Mar 30, 2011 10:16 pm

jajaja Smile
Sorry, I had to go in a kind or emergency ...

Just wanted to show all the necessary changes.


Changes are two:

*1* /usr/local/etc/starthddservices.sh
Near the end i have placed the code:

#Modify the timeout for SATA devices
echo 10 > /sys/devices/SATA_DEV/host0/target0:0:0/0:0:0:0/timeout


Why, because this value is resetted each time we start lg, so we are setting the right value.
I do not know if here is the best place, but it work well. suggestions are welcomed.


*2* Patch to enable the service,
we have to go to file:
root/custom/var/www/lgmenu/services/svc_hdidle.php
and comment or delete the line with the code:
return self::STATUS_NOCONTROL;


I am planing to put the changes in the service pack script, numeric code 960.


Another idea, is that, if we could put a value like 11 or 12, just in case .... ???

vic1972
vic1972

Mensajes : 2260
Fecha de inscripción : 09/12/2009
Edad : 47
Localización : Malaga

Volver arriba Ir abajo

sata_mars : Investigation to get hd-idle to work in all hard disks Empty Re: sata_mars : Investigation to get hd-idle to work in all hard disks

Mensaje  evr el Jue Mar 31, 2011 12:08 am

vic1972 escribió:Changes are two:
*1* /usr/local/etc/starthddservices.sh
Near the end i have placed the code:

#Modify the timeout for SATA devices
echo 10 > /sys/devices/SATA_DEV/host0/target0:0:0/0:0:0:0/timeout

Why, because this value is resetted each time we start lg, so we are setting the right value.
I do not know if here is the best place, but it work well. suggestions are welcomed.
I Think it is better to put it directly in the service script /tmp/hdd/root/custom/etc/init.d/hdidle:
Código:
  start)
    echo "Change the timeout for SATA devices   
    echo 10 > /sys/devices/SATA_DEV/host0/target0:0:0/0:0:0:0/timeout
    echo "Remounting /dev/sda4 with noatime flags"
    ...
This is just for the internal disk. In any case, the hdidle service script needs a complete rewrite to properly consider external SATA and/or USB disks. This can be done in another release...
*2* Patch to enable the service, we have to go to file:
root/custom/var/www/lgmenu/services/svc_hdidle.php
and comment or delete the line with the code:
return self::STATUS_NOCONTROL;
I am planing to put the changes in the service pack script, numeric code 960.
I don't know how can you do all these changes without previously loading some script or file on the LG ... I'd rather implement a patch to be manually downloaded (from SF), then put in a USB drive and finally manually execute it from a telnet connection...
Another idea, is that, if we could put a value like 11 or 12, just in case .... ???
May be... I think this does not really harm.

Best,

evr

Mensajes : 279
Fecha de inscripción : 12/10/2010

Volver arriba Ir abajo

sata_mars : Investigation to get hd-idle to work in all hard disks Empty Re: sata_mars : Investigation to get hd-idle to work in all hard disks

Mensaje  Keltek el Vie Abr 01, 2011 11:08 pm

Going to test it. Unfortunately I didn't have device like you so there must be some sophisticated command to set timeout for all the SATA hosts.
My device (MS400 with 1.5TB)
Código:
 /sys/devices/SATA_DEV/host1/target1:0:0/1:0:0:0/timeout
Keltek
Keltek

Mensajes : 291
Fecha de inscripción : 10/03/2010
Edad : 42
Localización : Praha - Czech Republic

http://www.fozona.cz/

Volver arriba Ir abajo

sata_mars : Investigation to get hd-idle to work in all hard disks Empty Re: sata_mars : Investigation to get hd-idle to work in all hard disks

Mensaje  evr el Sáb Abr 02, 2011 1:54 am

Keltek escribió:Going to test it. Unfortunately I didn't have device like you so there must be some sophisticated command to set timeout for all the SATA hosts. My device (MS400 with 1.5TB)
Código:
 /sys/devices/SATA_DEV/host1/target1:0:0/1:0:0:0/timeout
Yea! This is why I said:
This is just for the internal disk. In any case, the hdidle service script needs a complete rewrite to properly consider external SATA and/or USB disks. This can be done in another release
But it should be nice if your testing reveals that setting this timer does work for you... Of course, now something still left will be to test with a 1GB+ USB disk...

Best,

evr

Mensajes : 279
Fecha de inscripción : 12/10/2010

Volver arriba Ir abajo

sata_mars : Investigation to get hd-idle to work in all hard disks Empty Re: sata_mars : Investigation to get hd-idle to work in all hard disks

Mensaje  evr el Sáb Abr 02, 2011 1:57 am

vic1972 escribió:it works!!!!
I just did a unique test, and it worked fine. I will keep it in using for some days.
Hi Vic, any news on your testing?

Best,

evr

Mensajes : 279
Fecha de inscripción : 12/10/2010

Volver arriba Ir abajo

sata_mars : Investigation to get hd-idle to work in all hard disks Empty Re: sata_mars : Investigation to get hd-idle to work in all hard disks

Mensaje  Keltek el Sáb Abr 02, 2011 2:25 am

It works now Smile
I have to set the timeout to 20. I listen spinup the HDD and yes, it takes veeeeeeery long time. (with timeout 10 it not works and I must stop Samba and Transmission, but it is obvious)

So what about this"
Código:
echo "Starting the hd-idle daemon"
TIMEOUTFILES=`ls /sys/devices/SATA_DEV/host?/target*/*/timeout`
for file in $TIMEOUTFILES; do
  echo 20 > "$file"
done
/bin/mount -o remount,rw,noatime,nodiratime /dev/scsi/host1/bus0/target0/lun0/part4 /tmp/hdd/root
start-stop-daemon --start --quiet --oknodo --exec $DAEMON -- $HD_IDLE_OPTS

(the mount command should be redesigned too)
Keltek
Keltek

Mensajes : 291
Fecha de inscripción : 10/03/2010
Edad : 42
Localización : Praha - Czech Republic

http://www.fozona.cz/

Volver arriba Ir abajo

sata_mars : Investigation to get hd-idle to work in all hard disks Empty Re: sata_mars : Investigation to get hd-idle to work in all hard disks

Mensaje  evr el Sáb Abr 02, 2011 2:48 am

Keltek escribió:It works now :)
I have to set the timeout to 20. I listen spinup the HDD and yes, it takes veeeeeeery long time. (with timeout 10 it not works and I must stop Samba and Transmission, but it is obvious)
Looks like good news ;) Thanks!
So what about this"
[...]
(the mount command should be redesigned too)
Looks fine. Thanks! (but still it does not support 1TB+ USB disks).

BTW, have you figured out which module does create the /sys/devices/SATA_DEV/host?/target*/*/timeout hooks?

Best,

evr

Mensajes : 279
Fecha de inscripción : 12/10/2010

Volver arriba Ir abajo

sata_mars : Investigation to get hd-idle to work in all hard disks Empty Re: sata_mars : Investigation to get hd-idle to work in all hard disks

Mensaje  Keltek el Sáb Abr 02, 2011 10:09 pm

I don't know the SATA driver coding for Linux (I don't know any coding of drivers for Linux), but this is definitely in sata_mars, which use libata and scsi backend. But this seems all what I can say Wink

Hey all, are there someone who is Linux kernel guru? Please?

Keltek
Keltek

Mensajes : 291
Fecha de inscripción : 10/03/2010
Edad : 42
Localización : Praha - Czech Republic

http://www.fozona.cz/

Volver arriba Ir abajo

sata_mars : Investigation to get hd-idle to work in all hard disks Empty USB device identification

Mensaje  Keltek el Sáb Abr 02, 2011 10:31 pm

I connect the 500GB disc to front USB and the timeout parameter is at
Código:
/sys/devices/platform/ehci_hcd/usb1/1-2/1-2:1.0/host2/target2:0:0/2:0:0:0/timeout

It can be found using this pattern:
Código:
/sys/devices/platform/ehci_hcd/usb?/*/*/host?/*/*/block

So if I get this entry, it means this is the block device attached to USB (it can be flash disk or physical HDD) and on the same path (dirname <file>) is the timeout.
And so this should set the timeouts for all USB connected to system
Código:
USBBLOCKS=`ls /sys/devices/platform/ehci_hcd/usb?/*/*/host?/*/*/block`
for file in $USBBLOCKS; do
  USBTIMEOUT=`/usr/bin/dirname $file`/timeout
  echo 20 > "$USBTIMEOUT"
done
Keltek
Keltek

Mensajes : 291
Fecha de inscripción : 10/03/2010
Edad : 42
Localización : Praha - Czech Republic

http://www.fozona.cz/

Volver arriba Ir abajo

sata_mars : Investigation to get hd-idle to work in all hard disks Empty Re: sata_mars : Investigation to get hd-idle to work in all hard disks

Mensaje  evr el Dom Abr 03, 2011 1:35 am

Keltek escribió:I connect the 500GB disc to front USB and the timeout parameter is at
Código:
/sys/devices/platform/ehci_hcd/usb1/1-2/1-2:1.0/host2/target2:0:0/2:0:0:0/timeout
It can be found using this pattern:
Código:
/sys/devices/platform/ehci_hcd/usb?/*/*/host?/*/*/block
So if I get this entry, it means this is the block device attached to USB (it can be flash disk or physical HDD) and on the same path (dirname <file>) is the timeout. And so this should set the timeouts for all USB connected to system
Código:
USBBLOCKS=`ls /sys/devices/platform/ehci_hcd/usb?/*/*/host?/*/*/block`
for file in $USBBLOCKS; do
  USBTIMEOUT=`/usr/bin/dirname $file`/timeout
  echo 20 > "$USBTIMEOUT"
done
Great. So we have already all the needed info to prepare a general purpose service script for hd-idle. I'll make a proposal tomorrow (unless you're faster, as usual ;)

Best,

evr

Mensajes : 279
Fecha de inscripción : 12/10/2010

Volver arriba Ir abajo

sata_mars : Investigation to get hd-idle to work in all hard disks Empty Re: sata_mars : Investigation to get hd-idle to work in all hard disks

Mensaje  evr el Dom Abr 03, 2011 1:54 am

Keltek escribió:I don't know the SATA driver coding for Linux (I don't know any coding of drivers for Linux), but this is definitely in sata_mars, which use libata and scsi backend. But this seems all what I can say ;)
Hey all, are there someone who is Linux kernel guru? Please?
I started to read the source code of sata_mars, looking for some timeout definitions. This is how I found some hooks under /sys/devices/SATA_DEV/. Then I was curiuous and continued searching under SATA_DEV/ and finally hit host?/target*/*/timeout ;)

But I found no code in sata_mars.[ch] related with the timeout hook or any other hooks which are under host?/target*/*/ ...

Nevertheless, I think the problem is solved, so this is just trying to understad the details...

Best,

evr

Mensajes : 279
Fecha de inscripción : 12/10/2010

Volver arriba Ir abajo

sata_mars : Investigation to get hd-idle to work in all hard disks Empty Re: sata_mars : Investigation to get hd-idle to work in all hard disks

Mensaje  Keltek el Dom Abr 03, 2011 10:19 am

It can (and should) be using the libata interface in kernel. The driver itself is really simple (just access the hardware registers and all the work do libata, which is I think the main purpose for libata) and the rest of background is in the other resources. That's why I ask for Linux kernel guru Smile
Keltek
Keltek

Mensajes : 291
Fecha de inscripción : 10/03/2010
Edad : 42
Localización : Praha - Czech Republic

http://www.fozona.cz/

Volver arriba Ir abajo

sata_mars : Investigation to get hd-idle to work in all hard disks Empty Re: sata_mars : Investigation to get hd-idle to work in all hard disks

Mensaje  evr el Dom Abr 03, 2011 5:01 pm

Keltek escribió:I connect the 500GB disc to front USB and the timeout parameter is at
Código:
/sys/devices/platform/ehci_hcd/usb1/1-2/1-2:1.0/host2/target2:0:0/2:0:0:0/timeout
[...] And so this should set the timeouts for all USB connected to system
Código:
USBBLOCKS=`ls /sys/devices/platform/ehci_hcd/usb?/*/*/host?/*/*/block`
for file in $USBBLOCKS; do
  USBTIMEOUT=`/usr/bin/dirname $file`/timeout
  echo 20 > "$USBTIMEOUT"
done
I think a more direct, simple and safe way is:
Código:
D=/sys/devices/platform/ehci_hcd
USBTIMEOUTS=`ls $D/usb?/?-?/?-?:*/host?/target?:*/?:*/timeout 2>/dev/null`
for T in $USBTIMEOUTS ; do echo 20 > $T ; done
This also takes into account the case that no timeout hooks ar found.

One problem (both with this and with the way you had proposed), however, is that this does not work if the USB disk is plugged after the hd-idle service script has been executed. So, ideally, I think the USB timeout setting should be set by means of hotpulg...

More ideas?
Best,

evr

Mensajes : 279
Fecha de inscripción : 12/10/2010

Volver arriba Ir abajo

sata_mars : Investigation to get hd-idle to work in all hard disks Empty Re: sata_mars : Investigation to get hd-idle to work in all hard disks

Mensaje  evr el Dom Abr 03, 2011 5:38 pm

Keltek escribió:It can (and should) be using the libata interface in kernel. The driver itself is really simple (just access the hardware registers and all the work do libata, which is I think the main purpose for libata) and the rest of background is in the other resources. That's why I ask for Linux kernel guru :)
I already had a look at libata.[ch], but I did not find anything clearly related with the hooks under: /sys/devices/SATA_DEV/host0/target0:0:0/0:0:0:0/ ...

Best,

evr

Mensajes : 279
Fecha de inscripción : 12/10/2010

Volver arriba Ir abajo

sata_mars : Investigation to get hd-idle to work in all hard disks Empty Re: sata_mars : Investigation to get hd-idle to work in all hard disks

Mensaje  Contenido patrocinado


Contenido patrocinado


Volver arriba Ir abajo

Página 1 de 2. 1, 2  Siguiente

Volver arriba


 
Permisos de este foro:
No puedes responder a temas en este foro.