Chris Li(deleted)
|
Seeking advice for Aviage to support low power mode
|
Chris Li(deleted)
07/27/2010 10:14 PM
post60825
|
Seeking advice for Aviage to support low power mode
Hi,
There is a customer requirement that the system needs to go to low power mode within 5ms, and before it enters low power
mode, the io-usb instance needs to be slain so the USB transceiver can be shut off.
Because io-usb is the crucial instance for Aviage suite while the connected iPod or usb key is playing, we can't just
slay io-usb without doing some proper handlings for Aviage beforehand. E.g., we might need to use mme_stop() to stop any
playback first, then do some handling for Aviage like slaying all Aviage instances including the io-usb in worst case,
then the system can go to low power mode. However, it seems it is hard to get all these things done within 5ms.
Now just seeking some advice of how to handle this case for Aviage to let it be able to enter low power mode within 5ms,
and to ensure it is recoverable
after back from low power mode, much thanks.
(Our testing hardware is a 400MHz freescale iMX31 platform and the Aviage Multimedia Suite is version 1.2)
Regards,
Chris
|
|
|
Ryan Allen(deleted)
|
RE: Seeking advice for Aviage to support low power mode
|
Ryan Allen(deleted)
07/27/2010 10:51 PM
post60827
|
RE: Seeking advice for Aviage to support low power mode
I think there could be two approaches:
1. you kill io-usb and drivers that depend on it (devb-umass, io-fs-media -dipod, etc.). These mediastores will go
away, and the MME will eject them. Upon restarting the driver the MME will re-insert the mediastores and you must
recover your playback state as desired.
2. slay mme-generic. No other process should write to the database, and the database is the only real persistent
location between executions. If mme-generic dies it won't log funny mediastore ejections, etc. And it is meant to try
to recover from "sudden deaths" in case of unexpected crashes. Upon restarting mme-generic it will re-discover
available mediastores.
Playback and sync will stop automatically in either case, because the MME or the mediastore will go away. If you're
concerned about your application getting undesired events in the case of suggestion 1. then killing the MME may be
better; if you're concerned about the database being consistent then suggestion 1. may technically be safer, but you
will end up with errors and ejections of each mediastore.
--
Ryan J. Allen
QNX Software Systems
|
|
|
Chris Li(deleted)
|
Re: RE: Seeking advice for Aviage to support low power mode
|
Chris Li(deleted)
07/28/2010 10:21 PM
post60994
|
Re: RE: Seeking advice for Aviage to support low power mode
Much thanks your advice, Ryan.
Just found that the whole process of slaying the necessary instances like mme-generic, iPod driver or umass driver, enum
-device and io-usb takes at least hundreds of ms to finish, it is still a bit hard to satisfy the 5ms requirement.
Regards,
Chris
|
|
|
Gilles Roy
|
Re: RE: Seeking advice for Aviage to support low power mode
|
Gilles Roy
07/29/2010 2:09 PM
post61091
|
Re: RE: Seeking advice for Aviage to support low power mode
Have you just tried to time how long slaying io-usb only takes?
|
|
|
Chris Li(deleted)
|
Re: RE: Seeking advice for Aviage to support low power mode
|
Chris Li(deleted)
07/29/2010 6:58 PM
post61116
|
Re: RE: Seeking advice for Aviage to support low power mode
Hi Gilles,
So far I have found that it took at least 50ms to slay the io-usb instance from a system call, sometimes 70ms or longer.
Regards,
Chris
|
|
|
Gilles Roy
|
Re: Seeking advice for Aviage to support low power mode
|
Gilles Roy
07/29/2010 9:14 PM
post61124
|
Re: Seeking advice for Aviage to support low power mode
On 10-07-29 6:58 PM, "Chris Li" <community-noreply@qnx.com> wrote:
> So far I have found that it took at least 50ms to slay the io-usb instance
> from a system call, sometimes 70ms or longer.
5 msec isn't much time. One thing you might also consider is the priority at
which you are terminating io-usb at. You might be terminating it at priority
10 (often a typical process priority) while other thing might be running at
higher priority on the system.
Also, how are you testing this? Using something like "time slay io-usb" in a
shell is bad. It has to spawn a time process, which spawns slay, etc.. all
of which might take over 5 msec if it is pulling these binaries from a flash
file system.
Gilles
|
|
|
Chris Li(deleted)
|
Re: Seeking advice for Aviage to support low power mode
|
Chris Li(deleted)
07/29/2010 9:56 PM
post61127
|
Re: Seeking advice for Aviage to support low power mode
> On 10-07-29 6:58 PM, "Chris Li" <community-noreply@qnx.com> wrote:
> > So far I have found that it took at least 50ms to slay the io-usb instance
> > from a system call, sometimes 70ms or longer.
>
> 5 msec isn't much time. One thing you might also consider is the priority at
> which you are terminating io-usb at. You might be terminating it at priority
> 10 (often a typical process priority) while other thing might be running at
> higher priority on the system.
>
Yes, I have thought about the priority problem and tried increasing the calling thread's priority from 10 to 20, it just
has a slight improvement but far from reaching the goal of 5ms.
> Also, how are you testing this? Using something like "time slay io-usb" in a
> shell is bad. It has to spawn a time process, which spawns slay, etc.. all
> of which might take over 5 msec if it is pulling these binaries from a flash
> file system.
>
> Gilles
Actually I just use a timer to trace how long the system("slay io-usb") call takes, it is not the exact time it used for
slaying the io-usb. However, I need to use this mechanism to slay other instances which depended on io-usb as well, so
the whole slaying process for all necessary instances takes much longer than 5ms.
Regards,
Chris
|
|
|
Gilles Roy
|
Re: Seeking advice for Aviage to support low power mode
|
Gilles Roy
07/29/2010 10:08 PM
post61128
|
Re: Seeking advice for Aviage to support low power mode
On 10-07-29 9:56 PM, "Chris Li" <community-noreply@qnx.com> wrote:
> Actually I just use a timer to trace how long the system("slay io-usb") call
> takes, it is not the exact time it used for slaying the io-usb. However, I
> need to use this mechanism to slay other instances which depended on io-usb as
> well, so the whole slaying process for all necessary instances takes much
> longer than 5ms.
OK, well if you had tracked the pid ahead of time you could call kill(). It
would be much faster than system("slay io-usb"). I was just thinking you
might be able to get away with just slaying io-usb and then slaying they
other processes once you power down the USB power.
Regards,
Gilles
|
|
|
Ryan Allen(deleted)
|
RE: Seeking advice for Aviage to support low power mode
|
Ryan Allen(deleted)
07/29/2010 10:17 PM
post61129
|
RE: Seeking advice for Aviage to support low power mode
You can also skip any chance of io-usb (or whatever process you kill) cleaning up by using SIGKILL rather than SIGTERM.
The safety of this depends on what state you expect the system to be in after the low power mode (and whether the newly
spawned instance of io-usb, or whatever process, can recover the hardware without cleanup).
In any case, if I'm not mistaken, the OS will spawn a little cleanup thread in your dead process to free up system
resources that may otherwise be left; I don't know how long this will take but it may be a factor in what is taking so
long. It might be an idea to take a kernel trace of your current method to get an idea of where the longest times are
spent (ie, is it in the system() call, io-usb "cleaning up" by catching the SIGTERM, the OS cleanup thread, etc.).
And if the conversation has really shifted from "what is safe from an MME perspective" to "how can I kill something
quickly" then I would also suggest posting the question in the OS forum. There are a lot of bright people who monitor
that forum that don't monitor the MME forum.
<http://community.qnx.com/sf/discussion/do/listTopics/projects.core_os/discussion.newcode>
--
Ryan J. Allen
QNX Software Systems
|
|
|
Chris Li(deleted)
|
Re: RE: Seeking advice for Aviage to support low power mode
|
Chris Li(deleted)
07/29/2010 10:35 PM
post61131
|
Re: RE: Seeking advice for Aviage to support low power mode
> You can also skip any chance of io-usb (or whatever process you kill) cleaning
> up by using SIGKILL rather than SIGTERM. The safety of this depends on what
> state you expect the system to be in after the low power mode (and whether the
> newly spawned instance of io-usb, or whatever process, can recover the
> hardware without cleanup).
>
> In any case, if I'm not mistaken, the OS will spawn a little cleanup thread in
> your dead process to free up system resources that may otherwise be left; I
> don't know how long this will take but it may be a factor in what is taking so
> long. It might be an idea to take a kernel trace of your current method to
> get an idea of where the longest times are spent (ie, is it in the system()
> call, io-usb "cleaning up" by catching the SIGTERM, the OS cleanup thread, etc
> .).
>
> And if the conversation has really shifted from "what is safe from an MME
> perspective" to "how can I kill something quickly" then I would also suggest
> posting the question in the OS forum. There are a lot of bright people who
> monitor that forum that don't monitor the MME forum.
> <http://community.qnx.com/sf/discussion/do/listTopics/projects.core_os/discussion.newcode>
>
> --
> Ryan J. Allen
> QNX Software Systems
>
Thanks your info and suggestion, Ryan.
Actually I am not keen to slay instances in order to go to low power mode unless have to do so. Now just consider
finding a way to 'pause' io-usb rather than slaying it. And just wonder whether it will cause any issues to Aviage if
the io-usb is suspended while playing a track or the mme is enumerating a usb device, thanks.
Regards,
Chris
|
|
|
|