Chanwoo Choi [Mon, 24 Jan 2022 06:47:35 +0000 (15:47 +0900)]
util: common: Move container_of macro to common.h
Change-Id: I02fc5d60110132481719ded0d805dc88e12b9d2a
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Dongwoo Lee [Tue, 18 Jan 2022 07:26:26 +0000 (16:26 +0900)]
resource: Add CPU/BUS/GPU resource driver
Change-Id: I3aef9258ae02f80b9bf87d438352d57a33411576
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Thu, 20 Jan 2022 09:11:26 +0000 (18:11 +0900)]
pass: resmon: Replace timer-related code with timer utility
Change-Id: I30d9f3a8cc37036bb37c350565c6ef2c58f2bdba
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Thu, 20 Jan 2022 08:14:01 +0000 (17:14 +0900)]
util: timer: Add timer management
Add internal helper functions of timer and uevent code. It will be used
on multiple point in PASS daemon.
Change-Id: Id9abc31433021eb850ad0529cc1ee6b6fcf31cab
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Dongwoo Lee [Tue, 18 Jan 2022 06:32:00 +0000 (15:32 +0900)]
util: resource: Add resource management
Resource Manager provides the template and then each resource
is able to make the their own resource driver under src/resource
directory. Also, each resoruce is able to have the multiple attributes
such as min frequency of CPU, max frequency of CPU, available memory of
Memory and so on. Lastly, each attribute must define the their onw data
type like integer, double, string and so on.
[Example of resource and attribue, data type]
resource A
- attribute A1 with data type
- attribute A2 with data type
resource B
- attribute B1 with data type
- attribute B2 with data type
- attribute B3 with data type
resource C
...
resource D
...
[Newly added functions for resource manager]
- Add/Remove resource driver like resource-cpu.c. resource-memory.c
void add_resource_driver(const struct resource_driver *resource_driver);
void remove_resource_driver(const struct resource_driver *resource_driver);
- Create/Delete resource instance like CPU/BUS/GPU/Battery/Memory/Proc
struct resource *create_resource(int resource_type, char *resource_name);
void delete_resource(struct resource *resource);
- Update the attribute values of each resource
int update_resource_attr(struct resource *resource, int attr_id);
int update_resource_attrs(struct resource *resource);
- Get the attribute values of specific attribute
struct resource_attribute_value *get_resource_attr_value(struct resource *resource, int attr_id);
int get_resource_attr_integer(struct resource *resource, int attr_id);
int get_resource_attr_integer_sync(struct resource *resource, int attr_id);
Change-Id: I45e7ef3e6c8138b49063dd9fc6e84dd8b9448c0a
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Tue, 18 Jan 2022 08:29:17 +0000 (17:29 +0900)]
monitor: Define resource attribute id and data type
monitor.h header file defines the resource attribute id and data type
of attribute. Resource Manager provides the template and then each resource
is able to make the their own resource driver under src/resource
directory. Also, each resoruce is able to have the multiple attributes
such as min frequency of CPU, max frequency of CPU, available memory of
Memory and so on. Lastly, each attribute must define the their onw data
type like integer, double, string and so on.
Change-Id: I7c869a1db496a78f08f3e735a2319c910af4058c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Wed, 19 Jan 2022 10:03:37 +0000 (19:03 +0900)]
util: Change directgory name from include/pass to include/util
Change directory name from include/pass to include/util
because 'include/util' directory declares the utility functions.
Change-Id: Ie3dc727aac7ff4c074bea7ab5bec632685a9685e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Thu, 20 Jan 2022 07:01:14 +0000 (16:01 +0900)]
util: devices: Rename to init_devices and exit_devices
Change-Id: Id3dd8898849d0be990a36c305d1c5e1d3a80b7fa
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Wed, 19 Jan 2022 09:54:54 +0000 (18:54 +0900)]
pass: Remove unneeded header including
Change-Id: Ie7590805ce3d0b002dd1f67c7fd3dc8e85f1930d
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Wed, 12 Jan 2022 06:36:50 +0000 (15:36 +0900)]
pass: resmon: Use monitor id to identify timer instead of monitor type
Support that a pass_resource can register the multiple timers with same
monitor type. If use monitor type as ID, a pass_resource is not able
to use the one more timers with same monitor type. It is wrong
registration.
Change-Id: I8e0d24fe038039076bbd8a9cd47b3dedd54913c5
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Thu, 13 Jan 2022 05:58:45 +0000 (14:58 +0900)]
pass: resmon: Remove dependency of monitor->result and monitor->ops
Remove dependency of monitor->result and monitor->ops for supporting
the basic timer functionality. If monitor->ops is NULL, pass_resmon.c
just creates the periodic timer and uevent timer.
Change-Id: I43839a1b27f961d933e40177e1b2821b8ce775f0
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Mon, 10 Jan 2022 08:52:08 +0000 (17:52 +0900)]
pass: resmon: Remove dependnecy of resource type
Change-Id: I966c38bca2b52a40205b13f54db2bf5e4dc5ef49
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Dongwoo Lee [Mon, 24 Jan 2022 06:46:33 +0000 (15:46 +0900)]
pass: rescon: Fix missing NULL check
Change-Id: I374f3d608b055ea589d9ed1dbb4ca43d890a3fa3
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Dongwoo Lee [Thu, 13 Jan 2022 11:57:04 +0000 (20:57 +0900)]
pass: rescon: Fix overridable property
To prevent updating not overridable resources, adds more checks for
overridable, and also set overridable as true by default.
Change-Id: I06802347ca210653dce0e04d78e4cde55df6937f
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Chanwoo Choi [Wed, 22 Dec 2021 03:00:38 +0000 (12:00 +0900)]
pass: Change directory name from core to util
Change directory name from core to util because 'src/core' directory
contains the util functions and then move 'src/util/main.c' to src/main.c
in order to improve the readability of PASS daemon starting point.
Change-Id: I26d421d67ff4790c82e2a1af22d208104ad136db
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Dongwoo Lee [Wed, 20 Oct 2021 04:19:32 +0000 (21:19 -0700)]
pass: Allow level update only for overridable resources
To prevent unoverridable state such as LimitAction of thermal, this
adds overridable property to resources. Target level of those
resources can be update only overridable is 'true'.
Change-Id: Ia8187b014c1b86fd5d3e3039046cc28c1c48a95b
Signed-off-by: Dongwoo Lee <dwlee08@gmail.com>
Dongwoo Lee [Wed, 20 Oct 2021 03:54:46 +0000 (20:54 -0700)]
pass: thermal: Add overridable property
To represent scenario overridable which means that the resource is
allowed or disallowed to be changed by other modules such as PMQoS.
Change-Id: I8871b013ff93882c8cb0656f94e1e450e864e4ac
Signed-off-by: Dongwoo Lee <dwlee08@gmail.com>
Dongwoo Lee [Mon, 13 Sep 2021 05:18:15 +0000 (14:18 +0900)]
pass: thermal: Fix to copy scenario name for thermal_data
Scenario name in thermal_data can be modified by thermal module, so
it has side-effect intruding supported scenario list. This fixes to
copy scenario instead of assigning pointer to prevent side-effect.
Change-Id: I21fde12fed6bcd72fb83a6171e1b0a6d350261bd
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Dongwoo Lee [Tue, 14 Sep 2021 04:22:42 +0000 (13:22 +0900)]
pass: thermal: Set a separate threshold for warning level reduction
To prevent warning level is continuously changing at the edge of the
temperature range, this adds distinct thresholds for warning level
reduction.
Change-Id: I0f0e911c1b3a6ee88fa7b26162d076f811a8ffea
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Dongwoo Lee [Tue, 31 Aug 2021 03:40:48 +0000 (12:40 +0900)]
pass: thermal: Determine scenario with range value
To prevent to be confused for determining scenario as following the
temperature, now it is settled with range of temperature.
Change-Id: Ic605a9b629da79129cbac8c5750316e16cc1c47e
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Dongwoo Lee [Tue, 31 Aug 2021 11:59:30 +0000 (20:59 +0900)]
pass: Add JSON API for getting object from object
Since JSON object can have another object, now pass can parse object
from object.
Change-Id: I962fc8464e6cae895f178d19bcee095178157c08
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Dongwoo Lee [Mon, 30 Aug 2021 00:46:21 +0000 (09:46 +0900)]
pass: thermal: Fix build warning
Since the third agrument of strncpy means maximum permitted size of
destination, using length of source string cause warning as like
"specified bound depends on the length of the source argument". This
fixes warning to use NAME_MAX instead of source length.
Change-Id: I07399700ea454100ca0924c93eca6a99cb54b8cd
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Chanwoo Choi [Fri, 27 Aug 2021 07:00:25 +0000 (16:00 +0900)]
unittest: power-haltests: Restart PASS daemon when PutResource tc is failed
Even if PutResource tc is failed, need to restore the status of PASS
daemon. So that restart PASS daemon.
Change-Id: I3c4dab4f30a16660f0718bc1cd579afa15f75fbf
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Fri, 27 Aug 2021 06:35:02 +0000 (15:35 +0900)]
pass: parser: Fix uninitialized value of number_of_cpus property
If json configuraiton file doesn't contain the 'number_of_cpus'
property, number_of_cpus has the minus value. It causes the problem.
So that fix uninitialized value of number_of_cpus property when value is
out of range.
Change-Id: Ibac93e89b3cd85181287773b0bf0cf7f4aa6f692
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Dongwoo Lee [Fri, 27 Aug 2021 05:49:49 +0000 (14:49 +0900)]
pass: thermal: Fix to handle priority of initial state properly
At first, priority is intended to treat lower value as higher
priority, but it is not handled intentionally when monitoring devices.
So this fixes to handle it properly and to this end it is required to
retrieve highest priority from the corresponding thermal device.
Finally, instead of plain scenario string the notifer_data structure
is passed as THERMAL_GET_SCENARIO parameter to get both scenario and
priority.
Change-Id: I330729be2890cdcb89ee7a677af2c0b8d4905fb0
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Dongwoo Lee [Fri, 27 Aug 2021 05:46:45 +0000 (14:46 +0900)]
pass: thermal: Fix invalid return value
This fixes to not return value for void functions.
Change-Id: Ic341a80a69da983ffc5d76905c190957a6148632
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Dongwoo Lee [Fri, 20 Aug 2021 02:45:41 +0000 (11:45 +0900)]
pass: thermal: Supprot mupltiple resources for 'thermal_get_scenario'
To response 'getCoolDownStatus' dbus method call during boot, initial
scenario state should be set before thermal monitor works once. When
there are multiple resources which have thermal data, the final state
of thermal scenario should be determined theirs priority. For this,
this enables supporting multiple resources on 'thermal_get_scenario'
handler.
Change-Id: I920de0440efac9706405bcf63b0c110b407ddd60
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Dongwoo Lee [Mon, 9 Aug 2021 03:26:26 +0000 (12:26 +0900)]
pass: thermal: Notify scenario only when it changed
Since this, thermal monitor notify scenario when it is different with
previous on. To this end, set callback to thermal_result for notifying
scenario, and it called when the scenario is changed. And this also
enables to do different notification process for both thermal_monitor
and get_scenario handler.
Change-Id: Ib0e7cda2926f4402563b00e94125511954b2a043
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Dongwoo Lee [Wed, 4 Aug 2021 06:20:59 +0000 (15:20 +0900)]
pass: thermal: Set priority of thermal device through config file
Now, the priority of each thermal device is can be determined by
configuration file in pass-hal with 'thermal_priority' section.
Change-Id: I677dd719672dea43c6675ccf774e646b492914d5
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Dongwoo Lee [Tue, 3 Aug 2021 07:44:49 +0000 (16:44 +0900)]
thermal: Support multiple thermal resources
To handle thermal scenario from multiple resources, manage the
thermal data along with its own property.
Change-Id: I933205f17dd7dc2e264fa2322b3a301b8f8e01d5
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Dongwoo Lee [Fri, 30 Jul 2021 07:50:28 +0000 (16:50 +0900)]
pass: thermal: Send scenario with additional information
In order to prepare the case that pass can have multiple thermal
monitors, each monitor sends additional information which includes
resource name as a key.
Change-Id: I47b9fca69c9580774ddffd065bf86e4eef09ee56
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Dongwoo Lee [Wed, 11 Aug 2021 02:15:41 +0000 (11:15 +0900)]
pass: thermal: Fix missing unregister operation
DEVICE_NOTIFIER_THERMAL is registered during probe, but it is not
unregistered during exit. So this adds missing unregister to exit.
Change-Id: I035547932abed44a255b0701f2290e3e74d7d3a3
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Chanwoo Choi [Fri, 13 Aug 2021 04:23:46 +0000 (13:23 +0900)]
pass: Add support of battery charging properties
In order to control the battery charging status and charging current,
add new properties as following:
[Newly added properties for battery h/w resource]
- 'battery,charging_status' property in 'level_list' section
- 'battery,charging_current_limit' property in 'level_list' section
[Example of charging properties]
In case of scripts/pass-battery.json,
"support" : true,
"init_level" : 0,
"level_list" :
[
{
"level" : 0,
"battery,charging_status" : 0, // POWER_SUPPLY_STATUS_UNKNOWN
"battery_charging_currnt_uA" : 2048000
}, {
"level" : 1,
"battery,charging_status" : 0, // POWER_SUPPLY_STATUS_UNKNOWN
"battery_charging_currnt_uA" : 1024000
}, {
"level" : 2,
"battery,charging_status" : 3, // POWER_SUPPLY_STATUS_NOT_CHARGING
"battery_charging_currnt_uA" : 1024000
}
],
Change-Id: I5a762d3127c2b156be377846a8ab19c4e582b247
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Wed, 11 Aug 2021 10:30:37 +0000 (19:30 +0900)]
pass: Update supported module information for PASS_RESOURCE_BATTERY/NONSTANDARD_ID
Update supported module information for both new PASS_RESOURCE_BATTERY_ID type
and PASS_RESOURCE_NONSTANDARD_ID type as following:
[Updated supported module list for each h/w resource type]
1. PASS_RESOURCE_BATTERY_ID (new h/w resoruce type)
- PASS_MODULE_PARSER
- PASS_MODULE_RESCON
- PASS_MODULE_RESMON
- PASS_MODULE_PMQOS
- PASS_MODULE_THERMAL
2. PASS_RESOURCE_NONSTANDARD_ID
- PASS_MODULE_RESMON
- PASS_MODULE_PMQOS
- PASS_MODULE_THERMAL
Change-Id: I9161898b7d9b8b886081eabac3eb91db3fc8b76e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Wed, 11 Aug 2021 11:03:43 +0000 (20:03 +0900)]
pass: parser: Don't check resource type when verify pass_level
'struct pass_level' doesn't have the any dependency of h/w resource
type. So that don't check the resource type when verify pass_level.
Change-Id: Ib2aa302f6ed84e741b61e4e6b5b7db895152ba4c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Wed, 11 Aug 2021 10:57:09 +0000 (19:57 +0900)]
pass: parser: Remove unnecessary log when PMQOS module is not used
If 'pmqos_property' is false, don't need to print the state of pmqos for
each h/w resource. Remove unnecessary log when PMQOS module is not used.
Change-Id: I09eed2828aa760c57e92bd1bda449e428769983f
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Wed, 11 Aug 2021 10:29:54 +0000 (19:29 +0900)]
pass: hal: Add missing save/restore of initdata for cooling-device property
The commit
256425c1250a ("pass: Add support of cooling-device property")
added cooling-device property. But, this commit didn't add the
save/restore of initdata for cooling-device property. In order to
restore the initial value of cooling-device property after finishing
PASS daemon, add missing save/restore of initdata for cooling-device property.
Change-Id: I97317a11613bfc29851ef1eecd7b9d7b531c7578
Fixes:
256425c1250a ("pass: Add support of cooling-device property")
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Mon, 9 Aug 2021 04:54:26 +0000 (13:54 +0900)]
pass: resmon: Add new power_supply uevent type to catch temperature changes
The power_supply subsystem in Linux kernel provides the temperature information
via POWER_SUPPLY_PROP_TEMP property. In order to catch the temperature changes,
add power_supply uevent subsystem type. When send power_supply uevent to
user-space from kernel space, resource monitor try to get the current
temperature for deciding the proper thermal scenario and then control the h/w
resources.
Change-Id: If5ae48885f2c5b895bf24c5f9da3193fdea85981
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Mon, 9 Aug 2021 04:18:51 +0000 (13:18 +0900)]
pass: resmon: Add support of multiple uevent subsystem type by one resource monitor
The an 'struct resmon_ops' instance has supported only one uevent subsystem type.
But, even if subsystems in linux kernel are different, sometimes treats
the same raw data like thermal. For example, both thermal and power_supply
subsystems provides the current temperature to user-space via uevent and sysfs
node. So that Add support of multiple uevent subsystem type by one resource monitor
instance.
Change-Id: I2ad7f25f1a894539ea1e460c4faeb5334acc50b5
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Wed, 4 Aug 2021 08:56:27 +0000 (17:56 +0900)]
pass: parser: Add missing code for PASS_RESROUCE_BATTERY_ID
When using 'battery' h/w resouce in /hal/etc/pass/pass.conf,
the following error happen. So that add the missing code for PASS_RESROUCE_BATTERY_ID.
[Error log]
pass-parser.c: parse_resource_data(748) > Unknown 'device_type' property value (battery)
Change-Id: I30fb782e4e67b0fbe728201e30e2e4d0a1698c4c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Tue, 3 Aug 2021 06:19:23 +0000 (15:19 +0900)]
pass: Add support of cooling-device property
Already thermal monitor in pass get the thermal information with
'thermal_device_name' property. When over-temperature is deteced,
must need to prevent the dangerous situation by using the cooling-device
which is attached to a thermal device.
So that add 'cooling_device_name' property in 'device_list' section
in order to get/set the information of cooling-device.
Also, 'thermal,cooling_device_state' property will be used
when try to change the state of cooling-device if over-temperature is
detected.
Lastly, enable thermal operation for both new PASS_RESOURCE_BATTERY_ID devie type
and PASS_RESOURCE_NONSTANDARD_ID.
[Newly added properties for cooling-device]
- 'cooling_device_name' property in 'device_list' section
- 'thermal,cooling_device_state' property in 'level_list' section
[Example of cooling-device properties]
In case of scripts/pass.json,
"device_name" : "cpu0",
"device_config_path" : "/hal/etc/pass/pass-cpu0.json",
"thermal_device_name" : "thermal_zone0",
"cooling_device_name" : "cooling_device0", <- Added
"cpu,number_of_cpus" : 4,
"cpu,first_cpu" : 0,
In case of scripts/pass-cpu0.json,
{
"level" : 0,
"dvfs,minimum_frequency_khz" : 600000,
"dvfs,maximum_frequency_khz" : 1500000,
"thermal,cooling_device_state" : 0 <- Added
}, {
"level" : 1,
"dvfs,minimum_frequency_khz" : 1500000,
"dvfs,maximum_frequency_khz" : 1500000,
"thermal,cooling_device_state" : 1 <- Added
},
Change-Id: I86bfc5ce2037559e81bbf70567b82457167d4ced
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Mon, 2 Aug 2021 10:09:40 +0000 (19:09 +0900)]
pass: rescon: Fix wrong initial value to distinguish either property is added or not
The commit
d54cf9cc4588 ("pass: rescon: Add support for multiple
scenario pass_level") has defined the MIN_INT (zeor) to inialize
the property values in struct pass_level. But, some property values
will have the zero value like cooling_device_state is zero.
In that case, if MIN_INT is zero, cannot separate the following two
cases:
- propery is absence in configuration file -> 0
- property value is zero in configuration file -> 0
In order to separate the above two cases, change the MIN_INT value
from 0 to -1. After changes, can separate the two cases as following:
- propery is absence in configuration file -> -1
- property value is zero in configuration file -> 0
Change-Id: I2ee3fe9372c2deb82018949fc2b4b85eb3bb96ff
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Wed, 28 Jul 2021 01:01:07 +0000 (10:01 +0900)]
pass: parser: Convert script format to json to improve readability
The legacy .conf file format is not better on side of readability.
So that change the configuration file format to json style to improve
readability.
Change-Id: I056971e4674ccfee703d3b55636575f8a0d83fbd
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Thu, 29 Jul 2021 12:44:15 +0000 (21:44 +0900)]
thermal: Convert pass-thermal.conf format to json to improve readability
The legacy pass-thermal.conf file format is not better on side of readability.
So that change the configuration file format to json style to improve
readability.
Change-Id: I228559fbc348b097284263a6bd8c57c1b2e6fa37
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Thu, 29 Jul 2021 12:38:13 +0000 (21:38 +0900)]
pmqos: Convert pass-pmqos.conf format to json to improve readability
The legacy pass-pmqos.conf file format is not better on side of readability.
So that change the configuration file format to json style to improve
readability.
Change-Id: I4898d431b1d0f8bc3b50b1d1ea764c87992cdf6c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
INSUN PYO [Wed, 21 Jul 2021 01:05:55 +0000 (10:05 +0900)]
pass: resmon: Remove unused code
Change-Id: I0e4f5e61fe5ed0ab8a58ec69c02f0115b16a247f
Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Chanwoo Choi [Thu, 17 Jun 2021 07:34:01 +0000 (16:34 +0900)]
unittest: Replace system command with dbus signal
system() command causes the security issue. So that fix issue
to replace system command with dbus signal.
Change-Id: I83843697c9b64bd1c14fc54d1e9773dcfbdc5a3b
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Thu, 17 Jun 2021 07:23:14 +0000 (16:23 +0900)]
scripts: dbus: Allow root to use core d-bus interface
Allow 'root' to use core d-bus interface provided by PASS.
The 'root' have to control all d-bus interface without any restrictions.
Change-Id: Ie322e426cbc945209cd9188ffa642444ce69880a
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Thu, 17 Jun 2021 01:59:01 +0000 (10:59 +0900)]
pass: rescon: Add missing lock for scenario_level_list
scenario_level_list variables should be protected by mutext.
So thath add missing lock for scenario_level_list
Change-Id: Ib4590fd3b76e3e9f6953234cbb1f7b21c7af7520
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Wed, 3 Mar 2021 03:56:18 +0000 (12:56 +0900)]
pass: pmqos: Add new Performance mode
Add new 'Performance' mode in order to support the highest performance.
There are always requirements to test the device with high-performance.
Change-Id: I5d2eadefeedd8d0d56e08f37c68fd0664c2ffb8b
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Mon, 1 Feb 2021 04:43:51 +0000 (13:43 +0900)]
pass: unittest: Change install path and test file name
Change install path and test file name. Tizen 6.5 requires the install
and naming format as '/usr/bin/hal/[module name]-haltests'.
[Detailed changes]
- /usr/bin/pass_haltests -> /usr/bin/hal/power-haltests
- /usr/bin/pass_gtest -> /usr/bin/pass-unittests
And replace -ENODEV with -ENOTSUP because hal-api-power uses
the more correct error value of -ENOTSUP.
Change-Id: Ia2c8fd772d10e8b55db4dc66d9ee4f6d2be511e4
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
lokilee73 [Thu, 4 Feb 2021 03:57:45 +0000 (12:57 +0900)]
pmqos: add AppLaunchHome and HomeScreen
Two scenarios are added to support C# APIs.
ex) DevicePmQosAppLaunchHome
DevicePmQosHomeScreen
Change-Id: I93ffd4fb0f2e91b00ba3fdaeb7b14b00a4eaa444
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
Chanwoo Choi [Mon, 1 Feb 2021 01:32:35 +0000 (10:32 +0900)]
pass: rescon: Handle -ENOTSUP error instad of -ENODEV
The Power HAL API (hal-api-power) uses the -ENOTSUP error when HAL
function is not implemented instead of -ENODEV error. So that
handle -ENOTSUP error instad of -ENODEV
Change-Id: I7637f78d76e2350d95091cf216757b1ce53416e4
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Seung-Woo Kim [Fri, 29 Jan 2021 09:21:15 +0000 (18:21 +0900)]
pass: resmon: Fix memory leak of udev_monitor in error path
The resmon_uevent_add() has memory leak in error path. Fix the
memory leak.
Change-Id: I53c07b891b888cd1bdd596f872dd204f620d5b7c
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Chanwoo Choi [Tue, 26 Jan 2021 01:03:35 +0000 (10:03 +0900)]
PASS v1.2.0
- Changes from v1.1.0
1. Use hal-api-power (/platform/hal/api/power) instead of loading
the HAL backend library directly.
Change-Id: I53d30b334e307f3320346114a61d45889e59a104
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Tue, 19 Jan 2021 01:59:40 +0000 (10:59 +0900)]
pass: Remove hal-api-common dependency
/etc/ld.so.conf.d/libhal-api.conf contains the '/usr/lib/hal and
/usr/lib64/hal' path for loading the shard library. So that PASS daemon
doesn't need to specify the dependency of hal-api-common.
Change-Id: I56a254f9d4baa3c5f252c99fdf4f4e7bdb0f5307
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Wed, 6 Jan 2021 04:55:33 +0000 (13:55 +0900)]
pass: hal: Replace HAL interface with hal-api-power
Tizen 6.5 provides new HAL API layer to make tizen porting easy.
Power HAL API (hal-api-power) provides HAL C API for controlling
the h/w resources such as CPU/GPU/Memory Bus/Memory devices
and provides HAL interface for HAL backend developer for using
Tizen platform on new h/w device. PASS daemon just calls the Power HAL
API without handling the HAL backend anymore.
Describe the detailed changes as following:
1. Remove self-defined HAL functions and don't open HAL backend library
directly. Instead, use hal-api-power to control the h/w resources.
PASS deamon doesn't need to handle the HAL backend library anymore.
2. Remove pass-hal-devel package because of moving HAL interface
defintion (src/hal/hal.h) into hal-api-power (hal-power-interface.h).
3. Change the open path of pass configuration files.
- /etc/pass/ -> /hal/etc/pass/
Change-Id: I73a1c29c7af000335021faac62157b5342065682
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Tue, 22 Dec 2020 07:09:00 +0000 (16:09 +0900)]
pass: resmon: Fix memory leak of udev_monitor instance
In order to fix the memory leak, jump exception handling code
when error happen.
Change-Id: I0b288b602d61cab6ebdce3c5e53ff808e0b2d001
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Tue, 15 Dec 2020 06:21:52 +0000 (15:21 +0900)]
pass: resmon: Fix memory leak of udev instance
In order to fix the memory leak, call udev_device_unref
when error happen.
Change-Id: Ic5919eeb07c34e564bf5ad7cf357ff8ae35c2733
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Thu, 3 Dec 2020 10:00:09 +0000 (19:00 +0900)]
pass: pmqos: Change the log level to debug for removing confusion
When the following case, it is not error. But, need to print
the log message for debugging.
- Unknown scearnio for each h/w resource
- Nost supported scenario for each h/w resource
- The some scenario is already locked.
Change-Id: Ib4280a4feae6d7fdfcc35ca1be89526d42be1d1c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Wed, 25 Nov 2020 05:43:30 +0000 (14:43 +0900)]
pmqos: Edit the unproper expression of pmqos data structure
The pmqos module supports the multiple h/w resources like CPU, GPU, bus
and memory. In order to express the correct meaning, edit the unproper
expression of pmqos data structure from 'pmqos_cpu' and 'pmqos_data'
and change the local variable name from 'cpu' to 'pmqos'.
Change-Id: I25151a22b417c697b74758c531c5d11ab15e5430
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Tue, 28 Apr 2020 01:07:23 +0000 (10:07 +0900)]
PASS v1.1.0
In order to support 'scenario pass_level', the format of pass configuration
are changed. It affects the pass-hal packages. So, it needs to increse
the version up to prevent the confusion between pass and pass-hal packages.
- Changes from v1.0.0
1. Support 'scenario' pass_level' for PMQoS and Thermal Monitor
2. Support 'scenario' with maximum duration and 'mode' without maximum duration
3. Add new 'SetScenario' method
- org.tizen.system.pass.pmqos.SetScenario
4. Add new 'Doze' mode
Change-Id: I429e79171a22f7e1ce7b3248e04a0e1e1fe33f82
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Fri, 7 Aug 2020 04:08:23 +0000 (13:08 +0900)]
scripts: pmqos: Add new Doze mode
Add new Doze scenario which handles h/w resources like CPU frequency
when right after LCD off and before entering the suspend-to-RAM
for reducing the idle power-consumption.
[How to hanel 'Doze' mode]
- Enable 'Doze' mode
dbus-send --system --type=method_call --print-reply --reply-timeout=5000 \
--dest=org.tizen.system.pass /Org/Tizen/System/Pass/Pmqos \
org.tizen.system.pass.pmqos.SetScenario \
string:Doze int32:1;
- Disable 'Doze' mode
dbus-send --system --type=method_call --print-reply --reply-timeout=5000 \
--dest=org.tizen.system.pass /Org/Tizen/System/Pass/Pmqos \
org.tizen.system.pass.pmqos.SetScenario \
string:Doze int32:0;
Change-Id: I536acbb36f663e4ad0ffa474f0a0981351428f0e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Fri, 7 Aug 2020 02:16:25 +0000 (11:16 +0900)]
pmqos: Add support of 'mode' like UltraPowerSaving
Priot to that support only 'scenario' with the maximum duration time
in order to prevent the misuse of scenario from client. Additionally,
'mode' is required to change the system status until receiving
the unlock request without any maximum duration time.
So, make 'max_duration_ms' property optional. If some scenario in
/etc/pass/pass-pmqos.conf' don't have the 'max_duration_ms' property
it considers the 'mode'.
Difference of both scenario and mode as following:
1. 'scenario' with the maximum duration time like AppLaunch
- Lock case
a. Client send dbus signal with both 'scenario' name and duration
- Unlock case
a. Client send dbus signal with both 'scenario' name and 0
a. When timer with specific duration from client is expired,
unlock scenario automatically.
a. When timer with maximum duration is expired,
unlock scenario automatically.
2. 'mode' without any duration time like UltraPowerSaving
- Lock case
a. Client send dbus signal with both 'mode' name and 1
- Unlock case
a. Client send dbus signal with both 'mode' name and 0
Change-Id: I02cac0820b3085f7046689aecf8dc679f5f381c4
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Thu, 6 Aug 2020 09:57:01 +0000 (18:57 +0900)]
pmqos: Add new SetScenario method for pmqos dbus interface
When add new scenario to pmqos, it have to edit the code.
It is not extensible. In order to improve the extensiblity
without code changes, add new SetScenario method for pmqos dbus interface
as following: When need to add new scenario, just add new scenario info.
to scripts/pass-pmqos.conf (/etc/pass/pass-pmqos.conf) without any code
changes.
[Interface for new SetScenario method of pmqos dbus]
- dbus interface : org.tizen.system.pass.pmqos.SetScenario
- parameter 1: scenario name like AppLaunch
- parameter 2: duration time like 3000 means 3 second
Change-Id: I5ee8da4ec62a9cf1d55ea51f6c7fb8ca9ce7b9e7
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Thu, 6 Aug 2020 09:14:27 +0000 (18:14 +0900)]
pass: Adjust indentation to show current resource statues for readability
Adjust indentation to show current resource statues and remove unneeded
blank line for readability. And remove unneeded comment and blank line.
Change-Id: Ibb2e660374626b942a2dd14c3bdb59caa5725162
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Thu, 6 Aug 2020 08:40:28 +0000 (17:40 +0900)]
pmqos: Set max_duration_ms for each scenario
Until now, only support global max_duration_ms time. But, if each scenario
need to set the different maximum duration time, it is not supported.
Allow each scenario to set the default maximume duration time.
Change-Id: I6f294ab55d2157c251593c300cb04eefb598b751
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Fri, 7 Aug 2020 06:22:56 +0000 (15:22 +0900)]
pmqos: Fix issue when the part of scenario name is same with supported scenario
If the part of scenario name sent from client is same with among
the supported scenario name, strncmp() causes the issue.
In order to fix this issue, compare the full scenario name with strcmp():
Change-Id: Ibc712b0b4be2cb752506ac7094b27abd88e587b5
Reported-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Fri, 7 Aug 2020 06:03:47 +0000 (15:03 +0900)]
pmqos: Fix wrong unlocked issue when pmqos list contains only one scenario
The pmqos list contains only one scenario like UltraPowerSaving
and when receiving the unmated scenario name like AppLaunch with unlock info
with that duration is zero, the last scenario will be unlocked.
In order to fix this issuse, correct the conditional statement.
Change-Id: Ica2a3a3f44d02dfd07e3cb57e1dab300decee9d0
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Tue, 4 Aug 2020 02:05:41 +0000 (11:05 +0900)]
scripts: dbus: Allow root to use d-bus interface
Allow 'root' to use d-bus interface provided by PASS.
The 'root' have to control all d-bus interface without any restrictions.
Change-Id: I18d467f2745741c7c4b990b64210dfd16692d39c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Mon, 24 Feb 2020 11:05:21 +0000 (20:05 +0900)]
pass: parser: Clean-up code to remove warning from static code analyzer
Change-Id: I627fc5e55497a34b318273bbb06af2664cdc2b03
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Tue, 11 Feb 2020 07:49:47 +0000 (16:49 +0900)]
pass: parser: Rename parser API for the readability
Rename all parser API from "pass_*()" to "pass_parser_*()"
to improve the readability.
Change-Id: Iade47afa9463093698612bb2d81004ae918695f9
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Wed, 12 Feb 2020 09:05:47 +0000 (18:05 +0900)]
pass: hal: Rename HAL API for the readability
Rename all HAL API from "pass_*()" to "pass_hal_*()" to improve the
readability. Usually, PASS modules used their own prefix on function name
like 'pass_resmon_*', 'pass_rescon_*'. After that, anyone can know
the kind of PASS module of functions.
Change-Id: I275fc6154eeab2af1d0e6755c3e6ceae762548b6
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Wed, 12 Feb 2020 08:59:54 +0000 (17:59 +0900)]
pass: thermal: Change local variable name for readability
Change local variable name for readability as following
without any behavior changes:
- curr_temp -> new_temp which is the measured temperature
- timer_interval -> new_timer_interval of new thermal scenario
- scenario -> new_scenario which is instance of new thermal scenario
- scenario_idx -> new_scenario_idx which is index of new thernal scenario
- timer_interval_of_scenario is removed due to unneeded
Change-Id: Ie9fed6c3be9e3ad490c2d0eec3a02c839ab6be7d
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Tue, 11 Feb 2020 12:45:12 +0000 (21:45 +0900)]
pass: thermal: Add support for scenario_level for thermal scenario
Prior to that thermal monitor has been monitoring the temperature
and then decide current thermal scenario like 'Release', 'Warning'.
And send the broadcast dbus message to inform the current thermal scenario
to otther Tizen framework. It didn't support to change the value
of the h/w resource like frequency, the number of online CPU.
Finally, thermal monitor is able to change the value of h/w resource
according to their own 'scenario_level' value on each thermal scenario.
For example with following configuration example,
- If thermal monitor decide the current thermal scenario as 'Release',
'Release' sceanrio has 'scenario_level=0'. It means that set 'ScenarioLeve0'.
It allow max_freq as 1.3GHz and max_cpu as 4 core.
- If thermal monitor decide the current thermal scenario as 'Warning',
'Warning' sceanrio has 'scenario_level=2'. It means that set 'ScenarioLeve2'.
It allow max_freq as 768MHz and max_cpu as 2 core.
This feature is important for preventing the dangerous overheating of h/w
target and it is very easy to tune up the configuration of thermal monitor
by editing the configuration files under '/etc/pass' path.
[Example of configuraiton file for CPU h/w resource]
(snip)
[ScenarioLevel0]
limit_min_freq=768000
limit_max_freq=1300000
limit_min_cpu=0
limit_max_cpu=4
[ScenarioLevel2]
limit_min_freq=768000
limit_max_freq=768000
limit_min_cpu=0
limit_max_cpu=2
(snip)
[thermal.scenario0]
support=yes
name=Release
temperature=25
timer_interval_ms=5000
scenario_level=0 <- It means 'ScenarioLevel0' is used for 'Release'.
Allow max_freq as 1.3GHz and max_cpu as 4 core.
[thermal.scenario1]
support=yes
name=Warning
temperature=30
timer_interval_ms=3000
scenario_level=2 <- It means 'ScenarioLevel2' is used for 'Warning'.
Allow max_freq as 768MHz and max_cpu as 2 core.
Change-Id: I3a5ff802e68f1452e90d766cfe1f04b4554413fd
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Tue, 28 Jan 2020 05:47:44 +0000 (14:47 +0900)]
pass: rescon: Add support for multiple scenario pass_level
PASS provides multiple modules like CPUHP (CPU Hotplug Manager), PMQoS,
Thermal Monitor and so on. Each module requires their own pass_level
in order to change h/w resources such as the number of online CPU,
the minimum/maximum frequency of GPU.
Prior to that, PASS supports only 'pass_level'. If user of PASS want to
set 'AppLaunch' scenario of PMQoS module, PMQoS only requires the range
of 'pass_level' like the minimum and maximum 'pass_level'. It is not enough
to meet the requirements from 'AppLaunch' scenario. Some scenario might
require the more detailed changes than already defined 'pass_level'.
In result of these requirements, add support for new 'scenario pass_level'
for scenarios such as AppLaunch of PMQoS and WarningAction of Thermal
Monitor. 'scenario pass_level' is possible to specify the detailed value
of h/w resources such as the minimum/maximum frequency (limit_(min|max)_freq),
the minimum/maximum number of online CPU (limit_(min|max)_cpu)
and fault_around_bytes for memorh h/w resource.
In order to support the multiple scenario pass_level at the same time,
RESCON (Resource Controller) module adds new following functions and then
delete previous function.
PMQoS will use new functions for supporting the 'scenario pass_level'
and Thermal Monitor will use the new functions for 'scenario pass_level'
for constrainting the h/w resouece to prevent the dangerous overheating.
[Added new functions]
- int pass_rescon_sync(struct pass_resource *res);
- int pass_rescon_set_level_sync(struct pass_resource *res, int level);
- int pass_rescon_set_scenario_level_sync(struct pass_resource *res,
int scenario_level);
- int pass_rescon_unset_scenario_level_sync(struct pass_resource *res,
int scenario_level);
- int pass_rescon_set_scenario_level(struct pass_resource *res,
int scenario_level);
- int pass_rescon_unset_scenario_level(struct pass_resource *res,
int scenario_level);
[Deleted functions]
- int pass_rescon_set_level_scope(struct pass_resource *res, int new_level,
int min_level, int max_level, void *data);
[Deprecated functions. Because these functions are keeping
for the compatibility with legacy feature. It should be used on PMQoS module.]
- int pass_rescon_set_scenario_level_sync_with_data(struct pass_resource *res,
int scenario_level, void *data);
- int pass_rescon_unset_scenario_level_sync_with_data(struct pass_resource *res,
int scenario_level, void *data);
[Exmaple of multiple scenario pass_level on PMQoS and Thermal Monitor modules]
Case 1. AppLaunch scenario of PMQoS ,
- 'AppLaunch' scenario contains 'scenario_level=1' property as following:
[ScenarioLevel1]
limit_min_freq=1300000
limit_max_freq=1300000
limit_min_cpu=3
limit_max_cpu=4
- In result, RESCON (Resource Controller) set h/w resource as following:
The minimum frequency is 1300MHz.
The maximum frequency is 1300MHz.
The minimum number of online CPU is 3.
The maximum number of online CPU is 4.
-> It maintains 1300MHz and three online CPU.
Case 2. Warning scenario of Thermal Monitor,
- 'Warning' scenario contains 'scenario_level=2' property as following:
[ScenarioLevel2]
limit_min_freq=768000
limit_max_freq=1000000
limit_min_cpu=0
limit_max_cpu=2
- In result, RESCON (Resource Controller) set h/w resource as following:
The minimum frequency is 768MHz.
The maximum frequency is 1000MHz.
The minimum number of online CPU has no any constraint.
The maximum number of online CPU is 2.
-> It maintain 768MHz and doesn't turn on more than 2 CPU.
Case 3. AppLaunch scenario of PMQoS + Warning scenario of Thermal Monitor,
- 'AppLaunch' scenario contains 'scenario_level=1' property and
'Warning' scenario contains 'scenario_level=2' property as following:
[ScenarioLevel1]
limit_min_freq=1300000
limit_max_freq=1300000
limit_min_cpu=3
limit_max_cpu=4
[ScenarioLevel2]
limit_min_freq=768000
limit_max_freq=1000000
limit_min_cpu=0
limit_max_cpu=2
- In result, RESCON (Resource Controller) set h/w resource as following:
The minimum frequency is 1000MHz because MAX(1300000, 768000) cannot be
over thatn maximum frequency (1000MHz).
The maximum frequency is 1000MHz.
The minimum number of online CPU is 2.
The maximum number of online CPU is 2.
-> It maintain 1000MHz and doesn't turn on more than 2 CPU.
[ScenarioLevel0]
limit_min_freq=768000
limit_max_freq=1300000
limit_min_cpu=0
limit_max_cpu=4
[ScenarioLevel1]
limit_min_freq=1300000
limit_max_freq=1300000
limit_min_cpu=3
limit_max_cpu=4
[ScenarioLevel2]
limit_min_freq=768000
limit_max_freq=1000000
limit_min_cpu=0
limit_max_cpu=2
[PassScenario]
pass_scenario_support=yes
pass_num_scenarios=1
[Scenario0]
name=AppLaunch
support=yes
scenario_level=1 <- It indicates 'ScenarioLevel1' for AppLaunch scenario.
[thermal]
thermal_support=yes
thermal_number_of_scenario=2
thermal_timer_interval_ms=5000
[thermal.scenario0]
support=yes
name=Release
temperature=25
timer_interval_ms=5000
scenario_level=0
[thermal.scenario1]
support=yes
name=Warning
temperature=30
timer_interval_ms=3000
scenario_level=2 <- It indicates 'ScenarioLevel2' for Warning scenario.
Change-Id: I45e99b1794b85342f29bf0decec6a859f56f8f58
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Tue, 28 Jan 2020 05:02:30 +0000 (14:02 +0900)]
pass: parser: Add support for parsing of scenario pass_level
PASS provides multiple modules like CPUHP (CPU Hotplug Manager), PMQoS,
Thermal Monitor and so on. Each module requires their own pass_level
in order to change h/w resources such as the number of online CPU,
the minimum/maximum frequency of GPU.
Prior to that, PASS supports only 'pass_level'. If user of PASS want to
set 'AppLaunch' scenario of PMQoS module, PMQoS only requires the range
of 'pass_level' like the minimum and maximum 'pass_level'. It is not enough
to meet the requirements from 'AppLaunch' scenario. Some scenario might
require the more detailed changes than already defined 'pass_level'.
In result of these requirements, add support for new 'scenario pass_level'
for only scenario such as AppLaunch of PMQoS and WarningAction of Thermal
Monitor. 'scenario pass_level' is possible to specify the detailed value
of h/w resources such as the minimum/maximum frequency (limit_min/max_fre),
the minimum/maximum number of online CPU (limit_min/max_cpu)
and fault_around_bytes for memorh h/w resource.
[Detailed new properties for 'scenario pass_level']
1.
- section name : [pass]
- property name : pass_num_scenario_levels
- property value type : integer
- mandatory or optional : mandatory
2.
- section name : [pass]
- property name : pass_init_scenario_levels
- property value type : integer
- mandatory or optional : mandatory
3.
- section name : [ScenarioLevel%d]
- properties name in section : pass_level and scenario pass_level
are to use common properties.
4.
- section name : [Scenario%d]
- property name : scenario_level
- property value type : integer, it denotes the index of scenario pass_level.
- mandatory or optional : mandatory
For example, usecase of scenario pass_level by AppLaunch PMQoS scenario.
[pass]
pass_num_scenario_levels=2
pass_init_scenario_levels=0
[ScenarioLevel0]
limit_min_freq=400000
limit_max_freq=1300000
limit_min_cpu=1
limit_max_cpu=4
[ScenarioLevel1]
limit_min_freq=800000
limit_max_freq=1300000
limit_min_cpu=4
limit_max_cpu=4
[PassScenario]
pass_scenario_support=yes
pass_num_scenarios=1
[Scenario0]
name=AppLaunch
support=yes
scenario_level=1
Change-Id: I8f058bf68278667ee68b821eb58c972aa298646f
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Tue, 28 Jan 2020 04:40:38 +0000 (13:40 +0900)]
pass: parser: Verify properties of pass_level before using
Prior to that there are no any restrictions about adding properties
to pass_level in the configuration file such as /etc/pass/pass-resource-*.conf
for each h/w resource.
Add some restrictions of pass_level as following:
- In case of CPU,
If there is either limit_min_cpu or limit_max_cpu in pass_level,
have to add both limit_min_cpu and limit_max_cpu to pass_level.
- In case of CPU/GPU/BUS,
if there is either limit_min_freq or limit_max_freq in pass_level,
have to add both limit_min_freq and limit_max_frewq to pass_level.
Change-Id: I899121c433432ad92800f741f2b8df78dc135de0
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Tue, 28 Jan 2020 02:32:41 +0000 (11:32 +0900)]
pass: rescon: Add new 'limit_max_cpu' property for CPU h/w resource
'limit_max_cpu' means the maximum number of online CPU.
If pass_level contains 'limit_max_cpu' value, RESCON (Resource Controller)
And remove the wrong comment from 'limit_min_cpu' comment
because 'limit_max_cpu' and 'limit_min_cpu' are supported
for only PASS_RESOURCE_CPU_ID h/w resource.
Change-Id: Ice6033491532895c8f1e1a71d7229f9362b184bf
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Mon, 10 Feb 2020 09:56:52 +0000 (18:56 +0900)]
pass: thermal: Call resource monitor API directly without redundant function
get_thermal_result() is called once. It is possible to be removed
instead of calling resmon (resouce monitor) API directly without
any middle step.
Change-Id: Ib058d540056fe1a8fc7b206fb98c096272c17121
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Fri, 7 Feb 2020 10:57:02 +0000 (19:57 +0900)]
pass: Clean-up minor indentaion to show the scenario name during init step
Clean-up indentaion to show the scenario name during init step
without any behavior changes.
[Before]
I/PASS ( 1110): pmqos.c: pmqos_init_done(498) > Support 'AppLaunch' scenario
I/PASS ( 1110): pmqos.c: pmqos_init_done(498) > Support 'UltraPowerSaving' scenario
I/PASS ( 1110): thermal.c: thermal_init_done(139) > Support 'Release' scenario
I/PASS ( 1110): thermal.c: thermal_init_done(139) > Support 'Warning' scenario
I/PASS ( 1110): thermal.c: thermal_init_done(139) > Support 'LimitAction' scenario
I/PASS ( 1110): thermal.c: thermal_init_done(139) > Support 'Shutdown' scenario
[After]
I/PASS ( 2109): pmqos.c: pmqos_init_done(498) > Support 'AppLaunch ' pmqos scenario
I/PASS ( 2109): pmqos.c: pmqos_init_done(498) > Support 'UltraPowerSaving' pmqos scenario
I/PASS ( 2109): thermal.c: thermal_init_done(139) > Support 'Release ' thermal scenario
I/PASS ( 2109): thermal.c: thermal_init_done(139) > Support 'Warning ' thermal scenario
I/PASS ( 2109): thermal.c: thermal_init_done(139) > Support 'LimitAction ' thermal scenario
I/PASS ( 2109): thermal.c: thermal_init_done(139) > Support 'Shutdown ' thermal scenario
Change-Id: I08223949a76610352475592f02856f07c3f2c69a
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Fri, 7 Feb 2020 10:28:55 +0000 (19:28 +0900)]
pass: thermal: Define thermal_update function to reduce duplicate code
thermal_moitor_func() and thermal_get_scenario() functions contains
the same code for deciding the next thermal scenario by using the
thermal raw data. So that define thermal_update() function to reduce
duplicate code from both thermal_moitor_func() and thermal_get_scenario().
Change-Id: Ia0bfef053163a848e657efb36c2dccb232037a04
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Fri, 7 Feb 2020 08:13:29 +0000 (17:13 +0900)]
pass: thermal: Fix bug of interval update until changed first thermal scenario
The commit
6e9640753a86 ("thermal: Support dbus activation for thermal f/w")
read the temperature and then updated the system early thermal scenario
on thermal_get_scenario() function. When updated the thermal scenario,
have to update the timer interval ('timer_interval_ms' property)
if each thernmal scenaior defines their own timer interval
in configuration file.
But, thermal_get_scenario() has missed the interval update for thermal
monitoring when detecting the ealy thermal scenario on initialization step.
Because each thermal scenario is able to have their own timer interval
('timer_interval_ms' property) for adjusting the timer interval of monitoring.
[Example how to define the thermal scenario information for each h/w resource]
[thermal.scenario1]
support=no
name=Warning
temperature=65
timer_interval_ms=2000
So that in order to fix this bug, update the timer interval of monitoring
when changing the thermal scenario information.
Change-Id: Ib909539ffac357d7a804f726ae43e61a7a044d60
Fixes:
6e9640753a86 ("thermal: Support dbus activation for thermal f/w")
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Mon, 10 Feb 2020 07:31:44 +0000 (16:31 +0900)]
pass: resmon: Fix unneeded g_list_remove call when updating timer interval
The commit
204e36c7c18a ("pass: resmon: Add new Resource Monitor (resmon)
module") added 'resmon_timer_add()' function which support two case as
following:
- case 1: Create timer with timer interval and add created timer to timer_list
- case 2: Update timer interval of already created timer in timer_list
In case 2, resmon_timer_add() had a bug about freeing resource because
don't need to remove a timer from 'resmon->timer_list' by using g_list_remove.
So that in order to fix this issue, do refactor the body of resmon_timer_add().
Change-Id: Iee76e42dd1eb92675e626d91e25f0672477fc3cc
Fixes:
204e36c7c18a ("pass: resmon: Add new Resource Monitor (resmon) module")
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Tue, 4 Feb 2020 03:27:59 +0000 (12:27 +0900)]
unittest: pass_gtest: Use dbus defintion
The supported dbus path/interface were defined in gdbus-defintion.sh.
So that use the dbus defintion to remove the potential error.
Change-Id: Icebefcbb58a7d135eda873ed827ea7c2d50e59b3
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Chanwoo Choi [Tue, 4 Feb 2020 02:28:57 +0000 (11:28 +0900)]
unittest: pass_gtest: Fix thermal monitor dbus path
The commit
a33200bbbe14 ("pass: Change DBUS interface of thermal monitor")
changed the Thermal Monitor dbus path/interface as following:
In order to support the unittest of Thermal Monitor, fix the thermal monitor
dbus path.
[Before]
DBUS_THERMAL_INTERFACE "org.tizen.system.pass.monitor.thermal"
DBUS_THERMAL_PATH "/Org/Tizen/System/Pass/Monitor/Thermal"
[After]
DBUS_THERMAL_INTERFACE "org.tizen.system.thermal"
DBUS_THERMAL_PATH "/Org/Tizen/System/Thermal"
Change-Id: I6adb48a167bd72b91ba495d099bfa32071ba2b5f
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Dongwoo Lee [Mon, 3 Feb 2020 08:49:03 +0000 (17:49 +0900)]
scripts: Allow telephony to send thermal method_call
To allow callmgr to send method_call dbus interface for themal,
this patch adds dbus policy.
Change-Id: Ifd06ad37299f6acef32a90b107f15c5ec8119467
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Seung-Woo Kim [Thu, 9 Jan 2020 08:36:10 +0000 (17:36 +0900)]
pass: pmqos: remove possible stringop-overflow
When parsing and trimming qos scenario name, there can be possible
stringop-overflow. To remove possible overflow, copy string with
strncpy() and then cut 'Lock' or 'Unlock'. Also, remove function,
is_pmqos_locked(), called only once.
Change-Id: I95a4bcde662c3d8390fab0dd661c9ecc84eb407a
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Seung-Woo Kim [Thu, 9 Jan 2020 07:37:46 +0000 (16:37 +0900)]
pass: resmon: Remove unnecessary check in exit
After monitor->result is null-checked and it is re-checked.
Remove the unnecessary check routine in resmon_cpuhp_exit().
Change-Id: I345a497fa67ba4ee0334c24327d2f7ea74dd7996
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Seung-Woo Kim [Thu, 9 Jan 2020 05:21:30 +0000 (14:21 +0900)]
thermal: Fix incompatible-pointer-types
After the commit
6e9640753a86 ("thermal: Support dbus activation
for thermal f/w"), function pointer for register_notifier() and
unregister_notifier() type is incompatible. Fix the warning by
casting inside the function.
Change-Id: Iebc590cc1d3d9a7adaca1a896f6313a225ddb6ca
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Seung-Woo Kim [Thu, 9 Jan 2020 04:57:35 +0000 (13:57 +0900)]
unittest: pass_haltests: Remove dangling-else warnings
The ASSERT_EQ() macro internal has 'if' statement, so gcc9 gives
dangling-else build warnings for single 'if' statement without
braces before ASSERT_EQ(). Remove The build warnings by adding
explict braces.
Change-Id: I56d955c71c58d2fbd99a18f0983bb5af88cd430e
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Dongwoo Lee [Thu, 9 Jan 2020 05:12:25 +0000 (14:12 +0900)]
CMakeLists: Fix cmake warnings
Since cmake version 3.1, variable reference policy is changed, and
'PREFIX' defined for refer '/usr/' directory cause warnings during
dealing with internal scripts like below:
#if defined(__VISUALDSPVERSION__)
/* __VISUALDSPVERSION__ = 0xVVRRPP00 */
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__VISUALDSPVERSION__>>24)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__VISUALDSPVERSION__>>16 & 0xFF)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__VISUALDSPVERSION__>>8 & 0xFF)
#endif'
To fix it, this changes to not use PREFIX as pre-defined variable no
longer.
Change-Id: Ie62509318b84075b8a03be0e806696b2837ecbd9
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Dongwoo Lee [Fri, 23 Aug 2019 04:58:35 +0000 (13:58 +0900)]
pass: Add PMQoS as supported module for nonstandard resource
Since PMQoS is not supported for the nonstandard resource, these
resourced such as trm cannot receive PMQoS events. This patch adds
PMQoS as supported module for nonstandard resource in order to
handle relevant events.
Change-Id: I8377fb4cc1a6a0bf1df7029c9efbbd433a5806a7
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Dongwoo Lee [Tue, 23 Jul 2019 02:07:11 +0000 (11:07 +0900)]
thermal: Support dbus activation for thermal f/w
Since resource monitoring first announce the temperature state a
single seconds later after all initialization over, to support dbus
activation for thermal f/w, temperature should be set during
initialization. To support this feature, current temprature is
retrived in advance while thermal is initialized, and it will be
announced before sd_notify called.
Change-Id: I83dae123a51fbdd953fe467ae408cae1a100c059
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Dongwoo Lee [Thu, 18 Jul 2019 01:51:12 +0000 (10:51 +0900)]
core: sd_notify() when all dbus name is owned
If pass is waken-up by thermal method call, sd_notify() should be
called after all dbus name is successfully owned including thermal
dbus. To handle this case, this patch refactors name acquired event
callback.
Change-Id: I88549a81aaa38082c3d7e53c995d9f62145a6266
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Dongwoo Lee [Thu, 18 Jul 2019 01:51:12 +0000 (10:51 +0900)]
core: Add support for dbus activation for thermal
To support dbus activation by not only pass core but also thermal,
this patch adds dbus activation support.
Change-Id: I50e13d43df9c775ae177a455805af41921f00286
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Dongwoo Lee [Fri, 19 Jul 2019 03:33:55 +0000 (12:33 +0900)]
thermal: Change order of initialization
To prevent race condition, dbus object should be registered before
well-known name is acquired. This patch changes order of initilizing
to fit this precondition.
Change-Id: I9fe60af8ed542155d26cc9c8a5f88eade3b38bb5
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Dongwoo Lee [Thu, 18 Jul 2019 01:58:28 +0000 (10:58 +0900)]
core: Remove unnecessary parameter for booting_done event
Even the late activation process is removed since commit
cdf2e4d1139c
("core: Remove late activation process"), the 'boot_done' state is
still passed as a parameter for INIT_DONE event. So, this patch
removes the unnecessary parameter.
Change-Id: I3b7bf1d6cba8080618fd486c7ab5c2db775ae7de
fixes:
cdf2e4d1139c ("core: Remove late activation process")
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Hyotaek Shim [Mon, 15 Jul 2019 06:13:35 +0000 (15:13 +0900)]
core: Apply systemd-based dbus activation
To activate PASS service immediately when other service requests the
dbus methods of it, this patch applies systemd-based dbus
activation. In addition, to announce PASS startup completion to
systemd, this patch adds notification through 'sd_notify()' call.
Without it, systemd will block PASS activation.
Change-Id: I4bfd6fce55d83aee646405af7bafbc650cb177e5
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Dongwoo Lee [Mon, 15 Jul 2019 08:07:00 +0000 (17:07 +0900)]
core: Add name acquired event handler parameter to dbus name own API.
To register handler for name acquired event for dbus name own process,
this patch adds it as parameter.
Change-Id: I91ffaf85100e49a80e9654a039ff544b37e210b4
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>