Unused (unnecessary) firmware tasks

Started by srsa, January 04, 2017, 04:01:07 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

srsa

I read that some ports (EOS M) experience a shortage of tasks. If this is related to the hardcoded limit of DryOS tasks, the following might help. Quoting an old post of mine:
QuoteLooking at the output of 'extask' (extended task information for DryOS), I noticed that a task named EvShel (event shell) has unusually large stack space (0x8000 bytes aka 32kB). This task is only used for debugging over the UART, but it's sitting idle in all cameras used by ordinary people - waste of RAM.
As an experiment, I have prevented this task from starting (on the a470) - it's usually started from the last BL in the 'CommonDrivers' task. Side effect is that this prevents two other tasks from being started (ConsoleSvr, LowConsole) - these would be started by EvShel itself.
That was a PowerShot cam. If cameras on the EOS codebase also survive if those 3 tasks are missing, ML could start 3 tasks more.
I only verified that the above task names are present in the 550d dump. Somebody will have to check if Evshel task's creation can indeed be removed from the boot process, without penalties.

Just an idea.

a1ex

On DSLR, I believe the EvShel task is only started if somebody types "akashimorino" on the UART console.

On 5D3 1.1.3, these are the tasks started by Canon in photo mode:

      init:000afed0:00:00: *** task_create("PowerMgr", 0x20, 0x400, 0xff301da0, 0x0), from ff301fb8
      init:000afed0:00:00: *** task_create("DbgMgr", 0x1f, 0x0, 0x17b60, &"TaskClass"), from 17c54
      init:000afed0:00:00: *** task_create("Startup", 0x19, 0x2800, 0xff0f9294 "[SEQ] seqEventDispatch (%s, %d)", &"Sequencer"), from ff0f9450
      init:000afed0:00:00: *** task_create("Startup", 0x11, 0x400, 0xff0c2928, 0x0), from ff0c32d4
   Startup:000afed0:00:00: *** task_create("PropMgr", 0x14, 0x0, 0x17b60, &"TaskClass"), from 17c54
   Startup:000afed0:00:00: *** task_create("HotPlug", 0x1e, 0x0, 0xff0cb304 "Video Connect    ->->->-> O", 0x0), from ff0cb870
   Startup:000afed0:00:00: *** task_create("EventMgr", 0xf, 0x0, 0x17b60, &"TaskClass"), from 17c54
   Startup:000afed0:00:00: *** task_create("FileMgr", 0x19, 0x0, 0x17b60, &"TaskClass"), from 17c54
   Startup:000afed0:00:00: *** task_create("FileCache", 0x14, 0x0, 0x17b60, &"TaskClass"), from 17c54
   Startup:000afed0:00:00: *** task_create("RscMgr", 0x12, 0x0, 0x17b60, &"TaskClass"), from 17c54
   Startup:000afed0:00:00: *** task_create("TOMgr", 0x19, 0x0, 0x17458, &"StageClass"), from 1756c
   Startup:000afed0:00:00: *** task_create("Fstorage", 0x19, 0x0, 0x17458, &"StageClass"), from 1756c
   Startup:000afed0:00:00: *** task_create("HDRMgr", 0x19, 0x0, 0x17b60, &"TaskClass"), from 17c54
   Startup:000afed0:00:00: *** task_create("HDRStage", 0x19, 0x0, 0x17458, &"StageClass"), from 1756c
   FileMgr:000afed0:00:00: *** task_create("CSMgrTask", 0x1c, 0x1000, 0xff5b9a8c "CSMgrTask: ReceiveMessageQueue(%#x)", 0x0), from ff5b9d08
   Startup:000afed0:00:00: *** task_create("ShootCapture", 0xf, 0x0, 0x17458, &"StageClass"), from 1756c
   Startup:000afed0:00:00: *** task_create("ShootBlack", 0x15, 0x0, 0x17458, &"StageClass"), from 1756c
ShootCaptu:000afed0:00:00: *** task_create("systemtask", 0x14, 0x400, 0xff3bad94, 0x0), from c194
ShootCaptu:000afed0:00:00: *** task_create("IvaDecTask", 0x15, 0x400, 0xff5061b4, 0x0), from c194
   Startup:000afed0:00:00: *** task_create("ShootPreDevelop", 0x16, 0x8000, 0x17458, &"StageClass"), from 1756c
   Startup:000afed0:00:00: *** task_create("MainCtrl", 0x11, 0x0, 0xff0cea28 "ID:%X(%d)", 0x0), from ff0ceaa4
   Startup:000afed0:00:00: *** task_create("AEmodeJudge", 0x1a, 0x400, 0xff145a9c, 0x0), from ff145b30
   Startup:000afed0:00:00: *** task_create("Ta10Mgr", 0x19, 0x0, 0x17b60, &"TaskClass"), from 17c54
   Startup:000afed0:00:00: *** task_create("FrontShtDevelop", 0x14, 0x0, 0x17458, &"StageClass"), from 1756c
   Startup:000afed0:00:00: *** task_create("RearShtDevelop", 0x14, 0x0, 0x17458, &"StageClass"), from 1756c
   Startup:000afed0:00:00: *** task_create("ShootSsDevelop", 0x14, 0x1000, 0x17458, &"StageClass"), from 1756c
   Startup:000afed0:00:00: *** task_create("SsLaterDevelop", 0x14, 0x1000, 0x17458, &"StageClass"), from 1756c
   Startup:000afed0:00:00: *** task_create("ShootVfx", 0x15, 0x1000, 0x17458, &"StageClass"), from 1756c
   Startup:000afed0:00:00: *** task_create("Fcreate", 0x19, 0x0, 0x17458, &"StageClass"), from 1756c
   Startup:000afed0:00:00: *** task_create("GuiLockTask", 0x17, 0x0, 0xff0df82c "< GUI Lock > GUILockTask %d", 0x0), from ff0dfb18
   Startup:000afed0:00:00: *** task_create("ASIF", 0x17, 0x0, 0xff10e664, 0x0), from c194
   Startup:000afed0:00:00: *** task_create("SoundDevice", 0x19, 0x0, 0xff110d0c, 0x0), from c194
   Startup:000afed0:00:00: *** task_create("AudioLevel", 0x19, 0x0, 0x17b60, &"TaskClass"), from 17c54
   Startup:000afed0:00:00: *** task_create("MovWriter", 0x15, 0x2000, 0x17b60, &"TaskClass"), from 17c54
   Startup:000afed0:00:00: *** task_create("MovieRecorder", 0x11, 0x2000, 0x17b60, &"TaskClass"), from 17c54
   Startup:000afed0:00:00: *** task_create("TestGero", 0x19, 0x1000, 0xff1e770c, 0x0), from ff1e7990
   Startup:000afed0:00:00: *** task_create("MRFRMTask", 0x11, 0x1000, 0xff39da00, 0x0), from c194
   Startup:000afed0:00:00: *** task_create("MoviePlay", 0x16, 0x1000, 0x17b60, &"TaskClass"), from 17c54
   Startup:000afed0:00:00: *** task_create("AviRead", 0x17, 0x1000, 0xff1cb3c4, 0x0), from c194
   Startup:000afed0:00:00: *** task_create("MovReader", 0x17, 0x1000, 0x17b60, &"TaskClass"), from 17c54
   Startup:000afed0:00:00: *** task_create("LVC_DEV", 0x14, 0x0, 0x17b60, &"TaskClass"), from 17c54
   Startup:000afed0:00:00: *** task_create("LVC_FACE", 0x17, 0x800, 0xff0fedb8, 0x0), from c194
   Startup:000afed0:00:00: *** task_create("Gmt", 0x14, 0x2000, 0x17b60, &"TaskClass"), from 17c54
   Startup:000afed0:00:00: *** task_create("Evf", 0xf, 0x1000, 0x17b60, &"TaskClass"), from 17c54
   Startup:000afed0:00:00: *** task_create("Epp", 0x10, 0xc00, 0x17b60, &"TaskClass"), from 17c54
   Startup:000afed0:00:00: *** task_create("LVFACE", 0x14, 0x2000, 0x17b60, &"TaskClass"), from 17c54
   Startup:000afed0:00:00: *** task_create("CLR_CALC", 0x18, 0x4000, 0x17b60, &"TaskClass"), from 17c54
   Startup:000afed0:00:00: *** task_create("AeWb", 0x13, 0x4000, 0x17b60, &"TaskClass"), from 17c54
   Startup:000afed0:00:00: *** task_create("GaUSB20Drv", 0x19, 0x800, 0x17458, &"StageClass"), from 1756c
   Startup:000afed0:00:00: *** task_create("USBTrns", 0x19, 0x0, 0xff253bf8, 0x0), from c194
   Startup:000afed0:00:00: *** task_create("SDIOTrns", 0x19, 0x0, 0xff25568c, 0x0), from c194
   Startup:000afed0:00:00: *** task_create("PTPSessionTASK", 0x19, 0x0, 0xff251d20, 0x8c48ec), from c194
   Startup:000afed0:00:00: *** task_create("PtpDps", 0x19, 0x0, 0x17458, &"StageClass"), from 1756c
   Startup:000afed0:00:00: *** task_create("Ceres", 0x19, 0x0, 0x17b60, &"TaskClass"), from 17c54
   Startup:000afed0:00:00: *** task_create("Remote", 0x19, 0x0, 0x17458, &"StageClass"), from 1756c
   FileMgr:000afed0:00:00: *** task_create("MetaCtg", 0x1b, 0x0, 0x17b60, &"TaskClass"), from 17c54
   FileMgr:000afed0:00:00: *** task_create("Fread", 0x19, 0x0, 0x17458, &"StageClass"), from 1756c
   FileMgr:000afed0:00:00: *** task_create("Fwrite", 0x12, 0x0, 0x17458, &"StageClass"), from 1756c
   FileMgr:000afed0:00:00: *** task_create("Voice", 0x19, 0x0, 0x17b60, &"TaskClass"), from 17c54
   FileMgr:000afed0:00:00: *** task_create("Sound", 0x17, 0x0, 0x17b60, &"TaskClass"), from 17c54
   FileMgr:000afed0:00:00: *** task_create("WavReader", 0x19, 0x0, 0x17b60, &"TaskClass"), from 17c54
   FileMgr:000afed0:00:00: *** task_create(0xff9de8d5, 0x1a, 0x0, 0x17b60, &"TaskClass"), from 17c54
   FileMgr:000afed0:00:00: *** task_create("MetaCtg", 0x1b, 0x0, 0x17b60, &"TaskClass"), from 17c54
   FileMgr:000afed0:00:00: *** task_create("Fread", 0x19, 0x0, 0x17458, &"StageClass"), from 1756c
   FileMgr:000afed0:00:00: *** task_create("Fwrite", 0x12, 0x0, 0x17458, &"StageClass"), from 1756c
   Startup:000afed0:00:00: *** task_create("ReDevelop", 0x19, 0x0, 0x17b60, &"TaskClass"), from 17c54
   Startup:000afed0:00:00: *** task_create("DpMgr", 0x19, 0x2000, 0x17b60, &"TaskClass"), from 17c54
   Startup:000afed0:00:00: *** task_create("DpsReceiveTask", 0x19, 0x1000, 0xff22ad98, 0x0), from ff22b5e4
   Startup:000afed0:00:00: *** task_create("DpImgEditMgr", 0x19, 0x0, 0x17b60, &"TaskClass"), from 17c54
   Startup:000afed0:00:00: *** task_create("InnerDevelopMgr", 0x19, 0x0, 0x17b60, &"TaskClass"), from 17c54
   Startup:000afed0:00:00: *** task_create("ShootArtFilter", 0x15, 0x0, 0x17458, &"StageClass"), from 1756c
   Startup:000afed0:00:00: *** task_create("DisplayMgr", 0x12, 0x0, 0x17b60, &"TaskClass"), from 17c54
   Startup:000afed0:00:00: *** task_create("Mrk", 0x19, 0x0, 0x17b60, &"TaskClass"), from 17c54
   Startup:000afed0:00:00: *** task_create("GuiMainTask", 0x17, 0x2000, 0xff0de8bc, 0x0), from ff0de9fc
GuiMainTas:000afed0:00:00: *** task_create("CtrlSrv", 0x18, 0x4000, 0xff2ee090, 0x0), from c194
GuiMainTas:000afed0:00:00: *** task_create("ImgPlayDrv", 0x12, 0x1000, 0xff215cb8, 0x0), from c194
   Startup:000afed0:00:00: *** task_create("EyeFi", 0x19, 0x1000, 0xff2e3d98, 0x0), from ff2e3e04
   Startup:000afed0:00:00: *** task_create("LpfMode", 0x1d, 0x0, 0xff1bf724, 0x0), from ff1bf794
   Startup:000afed0:00:00: *** task_create("PTPtoFAPI_EventProcTask", 0x19, 0x0, 0xff41e7a0, 0x0), from c194


BTW, ML code can be refactored to use fewer tasks (there are a bunch of them that just do polling activities), and that's probably a better idea than fiddling with Canon tasks.

g3gg0

totally agree.
most code was designed at a time when we didn't really know about message queues and were happy that we knew how to start tasks :D
so for sure a lot of things could be merged into a common task.

but didn't check it yet.

perhaps some things could be done with a single "ML" task, dispatching all main routines.
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

DeafEyeJedi

Quote from: g3gg0 on January 05, 2017, 07:30:18 PM
perhaps some things could be done with a single "ML" task, dispatching all main routines.

+1
5D3.113 | 5D3.123 | EOSM.203 | 7D.203 | 70D.112 | 100D.101 | EOSM2.* | 50D.109

Licaon_Kter