Harmonizing policy management with Murphy in GENIVI, AGL and TIZEN IVI 1
Long term TIZEN Objectives for harmonization Support in TIZEN for coexistence of GENIVI applications Allow portable business rules Harmonize HW adaptation 2
Murphy introduction 3
What is Murphy? Policy Management framework Open source project http://01.org/murphy Liberal licensing The policy management framework in TIZEN IVI http://review.tizen.org/gerrit - sources http://download.tizen.org - packages 4
What does the `policy management framework mean? Toolkit to build policy engines Support libraries to make easy to write plugins manage data (ie. Murphy provides a memory resident database) communicate (over D-Bus, web socket, or export/import DB tables) build logic networks LUA scripting Can be used achieve portability Set of readily available frameworks that Can be used without change Can be modified/extended to fulfill special needs by scripting by forking, ie. modifying/extending the existing plugins Can serve as an example how to write something new/different 5
What are the `readily available frameworks in Murphy? Audio management Playback right management Routing Volume control Screen management Layout management Visibility management Input management System resource management Tracking Limit setting 6
Policy Model Centralized decision in Murphy daemon decision support data collected from system daemons policy aware applications domain servers System Daemons Murphy Murphy daemon Domain Controllers Distributed enforcement in various domain controllers Applications policy aware domain controllers are either plugins in a domain server plugins in murphy daemon Applications policy unaware Domain Servers 7
Architecture and operation 1. system state change 1 Data Source Murphy DB 2 5 6 2. data collection 3. trigger decisions 3 4 4. store decisions 5. export decisions Murphy daemon Decision Logic Domain controller 6. enforce decisions 8
Logic can span over multiple components Murphy daemon Domain Controller Logic Domain Controller Plugin Domain Controller Library Logic DB tables can be exported/imported single writer; multiple consumers DB exports implemented by domain controller using domain control support library exporting is triggered by database changes DB imports domain controller can create/update DB tables in Murphy daemon 9
Multi host support Centralised Distributed Single Master host #2 Murphy Murphy host #2 daemon daemon Network host #1 host #1 Network Slave Murphy daemon domain controllers domain controllers domain controllers domain controllers 10
Audio Management Harmonization of TIZEN and GENIVI audio stacks 11
PoC for harmonization of TIZEN - GENIVI Intel & ADIT currently make a joint effort to harmonize GENIVI & TIZEN audio stacks The resulting components will be open sourced The results will be part of future releases of Tizen the PoC will be the basis for GENIVI audio support in TIZEN GENIVI might consider to include also the resulting components and Murphy 12
Motivation for building the PoC Co-existence of TIZEN and GENIVI Audio applications Audio management in TIZEN and GENIVI are different Murphy and the GENIVI Audio Manager should be integrated Exploring how Murphy can be used See and learn the lessons how actual IVI audio use cases and environment can be implemented Make adjustments if needed Hope this attempt will be the starting point for policy management in IVI 13
Overview of GENIVI audio management Central management point in GENIVI Audio Manager Support for multiple domains Brain of audio policy is implemented in the Control Plugin Hardware adaptation is in the Router Plugins Applications are expected to request routes (connections) before playing back or capturing 14
Control Plug-in Example for GENIVI audio management GENIVI application GENIVI application Central management point in GENIVI Audio Manager Routing Plug-in For DSP routing / volume Command Interface Plugin GENIVI Audio Manager Routing Plug-in For ALSA Support for multiple domains Brain of audio policy is implemented in the Control Plugin Hardware adaptation is in the Router Plugins DSP Linux Audio Server (ALSA) Applications are expected to request routes (connections) before playing back or capturing 15
Overview of audio management in TIZEN IVI Linux application (policy unaware) WRT application (policy aware) Central management point in Murphy Enforcement point in the Sound Server Murphy ASM resource plugin Supports a single domain only module-murphy-ivi plugin PulseAudio Support for both policy aware and policy unaware applications ALSA BlueZ 16
Harmonization challenge: explicit vs. Implicit routing explicit routes GENIVI model applications explicitly set the routing targets an audio source can have 0+ explicit routes explicit routes are static, e.g. connecting new headsets will not effect existing explicit routes implicit routes WebRuntime and Linux applications automatic @ stream creation default routes determined by the stream class which in turn determined by a stream property and/or the name of the exe image an audio source can have 0 or 1 default route default routes are dynamic, eg. connecting a new headset might change the routing 17
Harmonization challenge: static vs. dynamic sinks/source Many Tier1 prefer static setups GENIVI Audio Manager supports both dynamic and static setups Pulseaudio (what is used in Tizen) supports just dynamic setups Solution in the PoC For GENIVI simulated static setup sink/sources appear all the time for sinks/sources that are implemented by applications availability changes as the application runs/exits e.g. a source implemented by an MP3 player become available when the player app runs and become unavailable when the app exits For TIZEN The usual dynamic setup 18
Harmonization challenge: routing logic GENIVI If an application wants to play It has to request a route (connection) Application should be aware of its own sink/source and the routing target (the other end of the connection) TIZEN If an application wants to play it has to either create the stream and start to play (policy unaware apps) ask for playback rights beside creating a stream (policy aware) In both cases the policy engine determines the routing target ie. the source or sink The logic to determine the routing target is in a PulseAudio plugin (pulseaudio-module-murphy-ivi) In order to support multiple audio domains the logic had to be moved from PulseAudio to Murphy 19
Murphy control plugin GAM support plugin How will the GENIVI Audio Manager will be supported in TIZEN GENIVI application Routing volume Command Interface Plugin Genivi Audio Manager DSP D-Bus Router InterfaceRouter Interface Plugin Plugin PoC components Murphy WRT application esource plugin Implicit routing logic Linux application module-murphy-ivi plugin PulseAudio ALSA BlueZ DSP 20
Murphy control plugin GAM support plugin Example flow GENIVI application WRT application Linux application Routing volume Command Interface Plugin resource plugin Genivi Audio Manager DSP D-Bus Router Interface Router Interface Plugin Plugin Murphy Implicit routing logic module-murphy-ivi plugin PulseAudio ALSA BlueZ DSP 21
Gatway 1 Gatway 2 Gatway 3 Gatway 6 Gatway 4 Gatway 5 PoC test setup Radio GENIVI application DSP Domain ICO application WRT application mp3 Navigation GENIVI application PulseAudio Domain ALSA Domain 22
Harmonized HW adaptation If you need to adapt new audio HW like DSP or external AVB amplifier... Write a Router Plugin for GENIVI Audio Manager and you can use your HW in TIZEN for both TIZEN apps (assuming your HW has ALSA PCM devices) GENIVI apps GENIVI platforms 23
Screen Management 24
Overview of Screen Management in TIZEN IVI HomeScreen TIZEN application GENIVI application Murphy Libilm_client.so libwayland-client.so ivi-controller protocol Wayland & Weston protocols ivi-application protocols libwayland-server.so ivi-controller.so ivi-shell plugin libivi-layout.so hmi-controller.so Weston Core Weston Backends (drm, X11,...) 25
Screen Management main building blocks Regulator Logic to adapt vehicle state, driver activities and application usage scenarios Set of rules and/or state machines Determines what applications can be active Layout Manager Manages Areas and Layers Assigns and moves surfaces to areas/layers Depends on Regulations Resource Manager Decides what active applications can do and when Depends on Regulations Application Launcher / Task Switcher Launches/kills application Requests to switch active application Screen Controller Carries out / enforces the decisions of Layout & Resource Manager Input Controller Carries out / enforces the decisions of Input & Resource Manager 26
Screen Management in TIZEN M14.3 release Layout Manager Input Manager Launcher Task Switcher Layout Manager Input Manager Resource Manager Regulator Implemented in ivi-shell & ivi-contoller Input Controller Screen Controller Home Screen Murphy Weston 27
Screen Management PoC after TIZEN M14.3 release Layout Manager Input Manager Launcher Task Switcher Home Screen Layout Manager Input Manager Resource Manager Regulator Murphy Input Manager Input Controller Screen Controller Layout Manager Weston 28
Harmonized HW adaptation If you need to adapt new graphics HW... Write a backend for Weston and you can use your HW in TIZEN for both TIZEN apps (assuming your HW has ALSA PCM devices) GENIVI apps GENIVI platforms 29
Lifecycle Management Harmonization of TIZEN and GENIVI system resource management 30
System resource management in TIZEN Murphy can track Memory usage (MemFree, SwapFree, Dirty, Writeback) CPU load (Combined single virtual CPU, Per physical CPU, Per Cgroup) Murphy can notify For notifications CPU and Memory watches can be defined The whole tracked value range is split into zones Callbacks are set for each watch If a watched value goes from a zone to another the specified callback is called Murphy can set Per Cgroup Memory (limit_in_bytes, soft_limit_in_bytes, memsw.limit_in_bytes, swappiness) CPU (shares, cfs_period_us, cfs_quota_us, rt_period_us, rt_runtime_us) Freezer (state) Scriptable logic 31
Harmonization efforts Ongoing discussion with GENIVI folks Possible scenarios No harmonization at all Provide in TIZEN some of the GENIVI lifecycle management API s using Murphy First target is the GENIVI Resource Management which is the counterpart of TIZEN system Resource Management The Murphy implementation could be used also in GENIVI 32
Future works in TIZEN Support for new Cgroup controllers net_cls (network bandwidth control) blkio (storage I/O bandwidth control) Application tracking Note: applications and processes are not necessarily the same Web Runtime Threads, forks execs understood and handled properly Watches for applications Similar mechanism what Murphy already has to track CPU and Memory usage Improvements to the existing features per Cgroup memory monitoring 33
Summary 34
Summary Harmonization areas Audio Management Screen Management System Resource Management Achievement of objectives Support in TIZEN for coexistence of GENIVI applications Audio Management: integration of Murphy and GENIVI Audio Manager Screen Management: use of Weston + IVI shell + Wayland IVI extension + integration of Murphy to Weston Allow portable business rules Murphy s configurability and scriptability Harmonize HW adaptation Audio Management: GENIVI Audio Manager + Router Plugin Screen Management: Weston + backend 35