Lifecycle Subsystem Readout GENIVI EG-SI Architect – Mentor 2015-10-22 09:00 | Open Projects Track (Slides by David Yates – Continental)
Total Page:16
File Type:pdf, Size:1020Kb
Gianpaolo Macario Lifecycle Subsystem Readout GENIVI EG-SI Architect – Mentor 2015-10-22 09:00 | Open Projects Track (slides by David Yates – Continental) GENIVI is a registered trademark of the GENIVI Alliance in the USA and other countries 1 5-Oct-15 This work is licensed under a Creative Commons Attribution-Share Alike 4.0 (CC BY-SA 4.0) Agenda • Introduction, goals of session • Lifecycle Manifest • Startup/Shutdown • Health Management • Lifecycle Use cases • Open Source Status & Roadmap • Links • Wrap Up & Questions GENIVI is a registered trademark of the GENIVI Alliance in the USA and other countries 2 5-Oct-15 This work is licensed under a Creative Commons Attribution-Share Alike 4.0 (CC BY-SA 4.0) Lifecycle Overview 1*: Get internal states •Events: State chart State change notification • Phone session • Diag,SWL,Coding Plug in for: State chart session ADC, Supply Plug in for power • State change protocol handling PMIC Management HMI, Phone,… • (register for shutdown, get SWL/Update Node State states,handshake for Management Diagnostics state changes) Reaction on conditions Events: Turn off display, drives, mute audio,… • Good • Ctrls • Poor 1* Plug in for: State chart • Bad Sensors, Events: Node observing for CPU load, Devices Thermal • Full operational memory, appl. crash Management • Error startup Get states Node Resource Reaction on conditions PF-Events: Set LUC config Turn on fan, reduce audio volume,… • Last User Last-User-Context • Clamp Sts Boot config Resource Plug in for: • User ID Management Wakeup reason, Product-Event Power • Button WU Boot Limitation node / vehicle • Bus WU Management Ctrl network Management Raw-Events • Vehicle Network GENIVI is a registered trademark of the GENIVI Alliance in the USA and other countries 3 5-Oct-15 This work is licensed under a Creative Commons Attribution-Share Alike 4.0 (CC BY-SA 4.0) Lifecycle Manifest Package Product Component Platform Component Node State Node State Node Startup Machine Manager Controller Supply Manager systemd Supply Node State Boot Management Management Management Thermal Power Resource cgroup service Management Management Management Thermal Manager Node Health Power Event Node Resource Monitor Collector Mgr GENIVI is a registered trademark of the GENIVI Alliance in the USA and other countries 4 5-Oct-15 This work is licensed under a Creative Commons Attribution-Share Alike 4.0 (CC BY-SA 4.0) Status and Roadmap Kronos Leviathan Miranda N? Cgroup Adopted component, systemd specific specific specific specific (Kernel) provided by the OSS community Node Startup GENIVI funded OSS component specific specific specific specific (implemented by Codethink) Controller Node OSS Component specific specific specific specific State Manager (implemented and maintained by Continental) Node Product specific library n/a n/a n/a n/a State Machine Node Implemented by Continental placeholder abstract abstract specific Resource Mgr (OSS release upcoming) Node OSS Component specific specific specific specific Health Monitor (implemented and maintained by Continental) GENIVI is a registered trademark of the GENIVI Alliance in the USA and other countries 27-Oct-15 Copyright © GENIVI Alliance 2014 5 Startup/Shutdown Management takes care about Boot Management Startup Management takes care about Node State Management Shutdown Management Why do we have this split? systemd stops and unloads all components during its shutdown concept. This requires a lot of time to make them functional again in the event of a cancel shutdown. An IVI system must be able to resume operation without losing any context and without the need for a reboot. Therefore Node State Management will only call registered consumers in the shutdown phase. This event notification will drive the components into a stable state and ensure that everything has been stored which will be needed for the next startup. With this approach components would not be shutdown which is required for certain exceptions like the flash file system. Therefore additionally the shutdown management concept will include/use the systemd shutdown concept , where appropriate for legacy/critical components. GENIVI is a registered trademark of the GENIVI Alliance in the USA and other countries 6 5-Oct-15 This work is licensed under a Creative Commons Attribution-Share Alike 4.0 (CC BY-SA 4.0) Shutdown preparation in Startup Phase Before systemd kernel Runlevel replacement GENIVI extensions initrd Start NSM via systemd A Mandatory targets B (Base System & Early Features) C BASE_RUNNING (during NSC init) focussed.target (last user context) LUC_RUNNING unfocussed.target(s) Manager Node State FULLY_RUNNING J FULLY_ lazy.target OPERATIONAL GENIVI is a registered trademark of the GENIVI Alliance in the USA and other countries 7 5-Oct-15 This work is licensed under a Creative Commons Attribution-Share Alike 4.0 (CC BY-SA 4.0) Shutdown Execution Consumer J Consumer I Writing LUC Node Startup Consumer H Controller systemd app1.service Consumer G Consumer F Node Startup Consumer E systemd Controller app2.service Consumer D Writing LUC Manager Consumer C Node Node State Consumer B Node Startup Consumer A systemd Shutdown.target Controller (flash file systems) Enables: 1. Shutdown activities are trigger able without unloading the components. 2. Legacy components can be shut down in their traditional way. 3. Full flexibility on where to integrate systemd based shutdown units. GENIVI is a registered trademark of the GENIVI Alliance in the USA and other countries 8 5-Oct-15 This work is licensed under a Creative Commons Attribution-Share Alike 4.0 (CC BY-SA 4.0) Unit Files Unit] Description=Application launcher daemon After=mnt-appdata.mount What can be seen in this example is that the executable al-daemon will be run with the command options “–start –v”. It will notify systemd when it has [Service] completed its initialization. Type=notify ExecStart=/usr/bin/al-daemon --start -v With regards to dependencies, it can only be started after mnt- PIDFile=/tmp/al-daemon.pid appdata.mount is available and it is wanted by unfocussed.target. TimeoutStartSec=2 This means that whenever unfocussed.target is required this unit will be WatchdogSec=10 included. Restart=on-failure The application will complete initialization within 2 seconds and wants to StartLimitInterval=15 be monitored during runtime. The application will be deemed to have failed StartLimitBurst=5 if it has not sent a heartbeat (sd_notify) within 10 seconds. If it fails more StartLimitAction= reboot than 5 times within a period of 15 seconds then systemd will assume a critical failure and initiate a system restart [Install] WantedBy=unfocussed.target GENIVI is a registered trademark of the GENIVI Alliance in the USA and other countries 9 5-Oct-15 This work is licensed under a Creative Commons Attribution-Share Alike 4.0 (CC BY-SA 4.0) Interfaces The Node State Manager (NSM) will provides 2 D-Bus interfaces – org.genivi. NodeStateManager.Consumer – org.genivi. NodeStateManager.LifecycleControl The “Consumer” interface is publicly available in the system and should be used by any applications that are interested in the information that the NSM maintains. The “LifecycleControl” interface will contain functions that are secured via DBUS policies to restrict their usage. There should be a minimal subset of applications with access. These interfaces are documented in the GENIVI UML Model (Enterprise Architect trunk) under GENIVI Model -> Logical View -> SW Platform Components -> Node State Manager -> Interfaces and the use cases shown in parallel today from the model can be found under GENIVI Model -> Logical View -> Use Case Realizations -> Lifecycle For those without access to EA you can also find exported versions of the model that are regularly updated in the wiki GENIVI is a registered trademark of the GENIVI Alliance in the USA and other countries 10 5-Oct-15 This work is licensed under a Creative Commons Attribution-Share Alike 4.0 (CC BY-SA 4.0) System Startup The Node Application Mode (NAM) is a Node specific data item that is used to define the functionality level (systemd runlevel) that should be achieved in the current Lifecycle. Only one of the following example modes can be active at any one time : – Parking – Factory – Transport – SWL The data item will be updated in the Persistence via the Node State Manager when requested through the secured method SetApplicationMode available under org.genivi.NodeStateManager.LifecycleControl The data item will be read early in the startup sequence by a Lifecycle Support Library that will then define the target file to be started by systemd To see how the update method should be used please see use case (“WB – NSM – Updating the Node Application Mode”) GENIVI is a registered trademark of the GENIVI Alliance in the USA and other countries 11 5-Oct-15 This work is licensed under a Creative Commons Attribution-Share Alike 4.0 (CC BY-SA 4.0) System Shutdown • The ShutdownReason is a node-specific D-Bus property available under the org.genivi.NodeStateManager.Consumer interface • Updated via the NSM when an event in the system triggers the shutting down of the system (i.e Thermal Management reports a dangerously high temperature) • Consumers that want to be notified when the node will be shutdown must use the interface Consumers.RegisterShutdownClient and must provide their own method called LifecycleRequest that will be called by the NSM in the event of a shutdown (or cancel shutdown) • Additionally they must specify the type of shutdown they are registering