platform/core/system/pass.git
5 years agopass: Fix typo 72/194572/1
Suchang Woo [Tue, 23 Oct 2018 08:14:07 +0000 (17:14 +0900)]
pass: Fix typo

Change-Id: I5cce6c6c2a697e78a5871ad8482b1e1c66209293
Signed-off-by: Suchang Woo <suchang.woo@samsung.com>
5 years agoscripts: pmqos: Add default maximum duration value to keep scenario 70/191670/1
Chanwoo Choi [Fri, 19 Oct 2018 08:02:51 +0000 (17:02 +0900)]
scripts: pmqos: Add default maximum duration value to keep scenario

PMQoS keeps the scenario during the required duration.
But if the required duration is over than defined maximum duration,
PMQoS changes the required duration value by using the defined maximum
duration value. So, specify the default mamximum duration value of PMQoS.

Change-Id: Ieab7d6acfd4bd1cdfff7a2d730776441588b805d
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agocore: Remove unneeded codes 69/191669/1
Chanwoo Choi [Fri, 19 Oct 2018 08:01:32 +0000 (17:01 +0900)]
core: Remove unneeded codes

Change-Id: I6bc9acdc601e9d9d0b1ac9885c7cf952cde2467f
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agopass: Fix coverity and svace reported issue 04/191604/1
Chanwoo Choi [Fri, 19 Oct 2018 02:43:04 +0000 (11:43 +0900)]
pass: Fix coverity and svace reported issue

Change-Id: Ic36b58d4cf04023d733360f30cb186bd3a57ce2e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agopass: Replace obsolescent ato[if] functions with strto[ld] 03/191603/1
Chanwoo Choi [Thu, 18 Oct 2018 07:40:04 +0000 (16:40 +0900)]
pass: Replace obsolescent ato[if] functions with strto[ld]

Replace obsolescent ato[if] functions with recommended strto[ld]
according to codingy guide[1].

[1] https://wiki.sei.cmu.edu/confluence/display/c/MSC24-C.+Do+not+use+deprecated+or+obsolescent+functions

Change-Id: I23342d7312c1fe77b3734cb23b57948ceac7832b
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agopass: resmon: Fix potential NULL dereference value 02/191602/1
Chanwoo Choi [Thu, 18 Oct 2018 05:54:46 +0000 (14:54 +0900)]
pass: resmon: Fix potential NULL dereference value

Fix potential NULL dereference value by checking the returned value
from memory allocation functions.

Change-Id: I040f75a36f5ec904da45cd89633bba38e206f5ed
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agounittest: pass_gtest: Send start d-bus message before testing restart operation 01/191601/1
Chanwoo Choi [Mon, 1 Oct 2018 06:48:45 +0000 (15:48 +0900)]
unittest: pass_gtest: Send start d-bus message before testing restart operation

The unittest of PASS tests the 'restart' opertion. It assume that PASS is
already started before testing the unittest. In order to clarify the test
condition of 'restart' operation, make the state of PASS always start state.
So, send start d-bus message before testing restart operation.

Change-Id: I38eb1b75074c7b47b65665cb687f6be2e1cfc8ce
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agounittest: pass_gtest: Fix typo and remove unneed blank line 00/191600/1
Chanwoo Choi [Mon, 1 Oct 2018 06:39:19 +0000 (15:39 +0900)]
unittest: pass_gtest: Fix typo and remove unneed blank line

Change-Id: Id0bdbcff81f741e3e39ea97efab1057e83fcff4c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agounittest: pass_haltests: Remove unreached return statement and unneeded if statement 99/191599/1
Chanwoo Choi [Mon, 1 Oct 2018 00:36:00 +0000 (09:36 +0900)]
unittest: pass_haltests: Remove unreached return statement and unneeded if statement

ASSERT_EQ() macro is able to check the 'return value' and then if 'return value'
is less than zero, print error message and exit the unittest. It means that
the separate 'if statement' for checking 'return value' is not neeeded
when using ASSERT_EQ().

Also, when using ASSERT_EQ() macro, the unittest don't need to call
'return statement' because ASSERT_EQ() return right now if 'return value'
is error. So, remove unreached return statement.

Change-Id: I2808d033e669a021a5b53226bf44c91241640c9a
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agopass: Add detailed description for all modules with doxygen style 98/191598/1
Chanwoo Choi [Wed, 12 Sep 2018 07:13:32 +0000 (16:13 +0900)]
pass: Add detailed description for all modules with doxygen style

PASS(Power Aware System Serivce) provides the multiple modules like CPUHP,
PMQoS, Thermal Monitor and defines the various structure/enumeration.
In order to improve the readability and the understanding of each unit,
add the detailed description for all modules/functions/structures/enumerations
by using doxygen[1] style.

[1] http://www.doxygen.nl/

Change-Id: I0444a95fb31b7a1ac20c451dda16dcc8791ae30a
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agounittest: pass_haltests: Change name of hal unit tests 97/191597/1
Chanwoo Choi [Mon, 10 Sep 2018 06:37:55 +0000 (15:37 +0900)]
unittest: pass_haltests: Change name of hal unit tests

Change name of hal unit tests in order to improve readability.

Change-Id: Idbe24227edb172a9965a017ab75cfac6b4993fe3
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agounittest: pass_gtest: Change name of unit tests 96/191596/1
Chanwoo Choi [Mon, 10 Sep 2018 06:15:24 +0000 (15:15 +0900)]
unittest: pass_gtest: Change name of unit tests

Change the name of unit tests in order to improve the readability.

Change-Id: Ia18c511a36cbcf2e8c26cf0159901aaab3f32ff8
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agounittest: Rename haltest binary from pass_hal_gtest to pass_haltests 39/186739/1 accepted/tizen_5.0_unified tizen_5.0 accepted/tizen/5.0/unified/20181102.021359 accepted/tizen/unified/20180814.063323 submit/tizen/20180814.043415 submit/tizen_5.0/20181101.000004
Chanwoo Choi [Tue, 14 Aug 2018 04:23:10 +0000 (13:23 +0900)]
unittest: Rename haltest binary from pass_hal_gtest to pass_haltests

Change-Id: I1b22c4d34c09dfe21ebcd83d111d09f3bb571154
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agounittest: pass_hal_gtest: Modify path of systemctl command 33/185833/1 accepted/tizen/unified/20180808.063338 submit/tizen/20180803.032812
Chanwoo Choi [Fri, 3 Aug 2018 01:54:22 +0000 (10:54 +0900)]
unittest: pass_hal_gtest: Modify path of systemctl command

To prevent malicious binary by changing path of systemctl,
modify path of systemctl command with absolute path.

Change-Id: I6a7bc842d43f954ac3ac9a1a43684d4de7167155
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agopass: rescon: Fix issue of init_level setting and remove unneeded pass_hotplug 07/185807/5
Chanwoo Choi [Thu, 2 Aug 2018 07:40:51 +0000 (16:40 +0900)]
pass: rescon: Fix issue of init_level setting and remove unneeded pass_hotplug

RESCON (Resource Controller) module changes the value h/w resource
according to 'init_level' property getting from each h/w resource
configuration. Even if RESCON always is initialized before CPUHP init,
RESCON depends on CPUHP in order to get the limited number of online CPU.

Fix issue of init_level setting during init step by getting
limited_min_cpu value without CPUHP module. And remove unneeded pass_hotplug.

Change-Id: If7f13a7197fe93b41c23688d49370631d6d76e5e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agounittest: pass_gtest: Use gdbus-definition.h to remove local definition 06/185806/3
Chanwoo Choi [Thu, 2 Aug 2018 07:23:00 +0000 (16:23 +0900)]
unittest: pass_gtest: Use gdbus-definition.h to remove local definition

Remove local dbus definition and then use gdbus-definition.h which
contains dbus path/interface definition. And changes the path of
systemctl command.

Change-Id: Ic5ec5b36b5c36f9580be93fdc38a53cb15894102
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agogdbus: Separate gdubs-definition.h from gdbus-util.h 05/185805/2
Chanwoo Choi [Thu, 2 Aug 2018 07:17:51 +0000 (16:17 +0900)]
gdbus: Separate gdubs-definition.h from gdbus-util.h

gdbus-util.h contains the gdbus helper function and dbus path/interface
definitions. Some PASS modules only require the dbus path/interface
definitions with gdbus helper function. So, separate gdubs-definition.h
from gdbus-util.h.

Change-Id: I587c728d3d594adc65778e77bf7933a17acde4c1
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agopackaging: Add pass-unittest package 17/184817/6 accepted/tizen/unified/20180724.073356 submit/tizen/20180724.000537
Chanwoo Choi [Mon, 23 Jul 2018 09:38:39 +0000 (18:38 +0900)]
packaging: Add pass-unittest package

Add pass-unittest-* package contains 'pass_gtest' command binary
which tests the external d-bus interface.

Change-Id: Ic3a022a63fb5ab1001c1e14544a261f45613a7ec
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agopackaging: Add pass-haltests package 16/184816/6
Chanwoo Choi [Mon, 23 Jul 2018 01:46:26 +0000 (10:46 +0900)]
packaging: Add pass-haltests package

Add pass-haltests-* package contains 'pass_hal_gtest' command binary
which tests the HAL(Hardware Abstract Layer) interface.

Change-Id: I29687b0021c8a6cfd1d1b97560a25fbb3be70e89
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agounittest: Add testcase to verify pass daemon 15/184815/6
Dongwoo Lee [Mon, 23 Jul 2018 09:36:58 +0000 (18:36 +0900)]
unittest: Add testcase to verify pass daemon

This patch adds unittest based on gtest test suite.

Change-Id: I72a346720b32eb5941b1af9e4afb46533356bd24
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agounittest: Add testcase to verify PASS HAL interface 14/184814/6
Chanwoo Choi [Wed, 18 Jul 2018 11:11:56 +0000 (20:11 +0900)]
unittest: Add testcase to verify PASS HAL interface

PASS provides HAL(Hardware Abstract Layer) interface for CPU/GPU/Bus/memory
h/w resources and so on. Add testcase to verify PASS HAL interface.

Change-Id: I2c229b13e303f46007e32cc39f559fb29d8e1b78
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agopass: hal: Fix error number from EINVAL to EPERM/ENODEV 13/184813/2
Chanwoo Choi [Fri, 20 Jul 2018 04:23:11 +0000 (13:23 +0900)]
pass: hal: Fix error number from EINVAL to EPERM/ENODEV

All HAL functions return '-EINVAL' error number when error happen.
It is necessary to return more correct error value. Return -EPERM value
if HAL(Hardware Abstract Layer) function is not supported according to
h/w resource type and return -ENODEV value if HAL function is not implemented
on HAL package.

Change-Id: I0b0da7429f38aa0362293275849a713e6020a763
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agohal: Move LOG_TAG definition to makefile to remove the duplicate 24/184524/1
Chanwoo Choi [Tue, 17 Jul 2018 09:38:21 +0000 (18:38 +0900)]
hal: Move LOG_TAG definition to makefile to remove the duplicate

Each log header file defines LOG_TAG. It defines LOG_TAG on Makefile
in order to remove the duplicate definitions.

Change-Id: I3b4b08008e259fe3a0c8257ffaad0f291666a0c4
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agoRemove unused macro and definitions from CMakeLists.txt 23/184523/1
Chanwoo Choi [Wed, 18 Jul 2018 05:42:04 +0000 (14:42 +0900)]
Remove unused macro and definitions from CMakeLists.txt

Change-Id: Ib69cb04851a28a646f9682eebae5587a361c00a0
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agogdbus: Move dbus interface definition to one header file 22/184522/1
Chanwoo Choi [Thu, 17 May 2018 04:02:10 +0000 (13:02 +0900)]
gdbus: Move dbus interface definition to one header file

Move dbus interface definition to gdbus-util.h header file
and clean-up code as following:
- Rename dbus definition from PASS_DBUS_BUS_NAME to DBUS_CORE_BUS_NAME
- Use ARRAY_SIZE() macro and then remove unnecessary following definitions:
  : DBUS_CORE_I_NUM_SIGNALS
  : DBUS_PMQOS_I_NUM_SIGNALS

Change-Id: Ic3f78d84b353bfe382330366d10292711de8c5fa
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopackaging: Remove unused libpass.manifest file 43/184343/1
Chanwoo Choi [Tue, 17 Jul 2018 09:12:13 +0000 (18:12 +0900)]
packaging: Remove unused libpass.manifest file

Change-Id: I62564514c93b12f7211f37427207aa898e315092
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agocore: Remove unused helper functions 62/180962/1
Chanwoo Choi [Fri, 1 Jun 2018 01:25:46 +0000 (10:25 +0900)]
core: Remove unused helper functions

Change-Id: I70c130c7715dab70f11294547889022a44ff93ce
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopackaging: Remove unneeded package's dependency 87/178687/1 accepted/tizen/unified/20180516.065450 submit/tizen/20180514.060515
Chanwoo Choi [Fri, 11 May 2018 08:50:33 +0000 (17:50 +0900)]
packaging: Remove unneeded package's dependency

Change-Id: I7a641708123de7f02c68aa36685e8cb1fa1aed3c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: thermal: Fix issue during stop PASS daemon 39/178439/1 accepted/tizen/unified/20180510.134400 submit/tizen/20180510.070432
Chanwoo Choi [Thu, 10 May 2018 05:06:50 +0000 (14:06 +0900)]
pass: thermal: Fix issue during stop PASS daemon

thermal->state indicates the "thermal_support" property in the configuration.
If user doesn't want to use thermal monitor with "thermal_support=no",
thermal->state is 0 (PASS_OFF). It is not error when thermal->state is zero.
Just return zero value instead of error.

Change-Id: I04f76774afb3b811d56dc0ebfb3f0888541e649f
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agoRemove dependency of unneeded libtzplatform-config package 31/178331/2
Chanwoo Choi [Wed, 9 May 2018 10:23:15 +0000 (19:23 +0900)]
Remove dependency of unneeded libtzplatform-config package

Change-Id: Ifd1a7b230ebd138bd3e991221bb7d066a02d0d01
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agoscripts: Fix dbus issue to get dbus well-known name 18/178418/1
Chanwoo Choi [Thu, 10 May 2018 04:04:07 +0000 (13:04 +0900)]
scripts: Fix dbus issue to get dbus well-known name

The commit 83052f4b42d5 ("scripts: Simplify the deny permission
for PASS dbus interface") causes the dbus deny issue such as AppLaunch
request. Fix dbus issue to get dbus well-known name.

Change-Id: Id20941500249e6b6c753730fde336aedce4cfbdf
Fixes: 83052f4b42d5 ("scripts: Simplify the deny permission for PASS dbus interface")
Suggested-by: Sanghyeok Oh <sanghyeok.oh@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agoscripts: Simplify the deny permission for PASS dbus interface 60/177260/2 accepted/tizen/unified/20180430.072116 submit/tizen/20180427.074549
Chanwoo Choi [Wed, 25 Apr 2018 08:15:45 +0000 (17:15 +0900)]
scripts: Simplify the deny permission for PASS dbus interface

Prior to that PASS denies the each d-bus interface for pmqos/pass core.
Deny the parent dbus interface instead of each d-bus interface
when user is not root and unauthorized user.

Change-Id: I29a400178535222de637738d44e0269e0b282c72
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: resmon: Remove duplicate free operation of monitor instance 42/174942/6 accepted/tizen/unified/20180410.063557 submit/tizen/20180409.024353
Chanwoo Choi [Wed, 4 Apr 2018 04:05:54 +0000 (13:05 +0900)]
pass: resmon: Remove duplicate free operation of monitor instance

Change-Id: Ibbaa488ec6d42e1f566ec9bab847411fed992ba0
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: thermal: Add support of Thermal Monitor of each h/w resource 70/174370/7
Chanwoo Choi [Thu, 22 Mar 2018 10:57:07 +0000 (19:57 +0900)]
pass: thermal: Add support of Thermal Monitor of each h/w resource

In order to use Thermal Monitor, each h/w resource (e.g. CPU/GPU) monitors
the thermal information with timer-based and uevent-based resource monitors.

If the monitored temperature is included in the range of defined
thermal scenario, it send the notification to Thermal Monitor module.
The pass-thermal.c is the developerment for each h/w resource.

Change-Id: I0dbf77202e1c3d7bc54803b064c9d29d687b661b
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: parser: Add support of thermal monitor for each h/w resource 69/174369/7
Chanwoo Choi [Thu, 22 Mar 2018 10:56:26 +0000 (19:56 +0900)]
pass: parser: Add support of thermal monitor for each h/w resource

In order to use/support Thermal Monitor, each h/w resource (e.g., CPU/GPU)
have to write the configuration such as thermal scenario name, temperature
and timer interval for each thermal scenario. Parse the property for
Thermal Monitor.

Change-Id: I3aa08bcfbbb037897fff42cfe24aabc732610e05
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: pmqos: Group the private data of PMQoS module into struct pmqos 68/174368/7
Chanwoo Choi [Thu, 22 Mar 2018 10:30:54 +0000 (19:30 +0900)]
pass: pmqos: Group the private data of PMQoS module into struct pmqos

PASS uses the 'scenario' expression which indicates the unique user-scnaerio
or the specific situation. 'struct pass_pmqos' is used to handle 'scenario'.

'struct pass_pmqos' is used on multiple modules and then it might have
both common variables and specific variables used on particular PASS module.

So, group the private data of PMQOS module into the 'struct pmqos'.

Change-Id: I65111779ecd2dca7ff2ecbc5ace1d6e16f1824c8
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agothermal: Add new Thermal Monitor module 66/174366/7
Chanwoo Choi [Thu, 22 Mar 2018 09:34:13 +0000 (18:34 +0900)]
thermal: Add new Thermal Monitor module

PASS can monitor the various h/w resource such as CPU/GPU and so on.
The thermal information is one of them. Require the thermal monitoring
and then notify the meaningful data of thermal. So, Thermal Monitor
is required.

Thermal Monitor supports the configuration file in order to define
the thermal scenarios (e.g., ReleaseAction, ShutdownAction) according to
the user definition. It is very flexible to define the multiple thermal
scenarios. Thermal Monitor monitors the thermal information using
following two methods:
- uevent-based thermal monitoring (interrupt method)
- timer-baesd thermal monitoring (polling method)

[d-bus interface]
- d-bus interface: "org.tizen.system.pass.monitor.thermal"
- d-bus method : "thermal_scenario"
- configuration : /etc/pass/pass-thermal.conf

Change-Id: I63c138d33350f6e17f9ad9bb73bd837b4f2a278e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agoscripts: Add pass-thermal.conf configuration 67/174367/6
Chanwoo Choi [Tue, 20 Mar 2018 06:29:31 +0000 (15:29 +0900)]
scripts: Add pass-thermal.conf configuration

Thermal Monitor is able to define the multiple scenario indicating
the thermal status. Thermal Monitor uses the defined scenarios
when reporting the current system status according to raw temperature.

pass-thermal.conf contains the supported scenarios of Themral Monitor.
It will be located in "/etc/pass/pass-thermal.conf"

Change-Id: I98e4a109b47f1a4d398dfbf1cc4cdb08efa596e7
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agocore: gdbus: Add new gdbus function to send broadcast signal 64/174364/5
Chanwoo Choi [Tue, 20 Mar 2018 07:59:34 +0000 (16:59 +0900)]
core: gdbus: Add new gdbus function to send broadcast signal

Add new following new function in order to send broadcast signal
through d-bus interface:
- int pass_gdbus_send_broadcast_signal(char *path, char *interface,
char *method, GVariant *arg)

Change-Id: I4e08a984f234fb4557e94f446e2d0aea86afc768
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agocore: device-notifier: Add new DEVICE_NOTIFIER_THERMAL 63/174363/5
Chanwoo Choi [Thu, 22 Mar 2018 09:31:31 +0000 (18:31 +0900)]
core: device-notifier: Add new DEVICE_NOTIFIER_THERMAL

DEVICE_NOTIFIER_THERMAL is used to notify the thermal level.

Change-Id: I46e19f32b347ce70626876be5f8e8f7993795879
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agocore: device-notifier: Remove unused notifier definition 62/174362/5
Chanwoo Choi [Thu, 22 Mar 2018 08:02:45 +0000 (17:02 +0900)]
core: device-notifier: Remove unused notifier definition

DEVICE_NOTIFIER_POWER_OFF notifier definition is not used. Remove it.

Change-Id: I30ab609c55aa0f43b8b1a4fefcb6db2a716161a5
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopmqos: Clean-up code and remove unnecessary function 61/174361/5
Chanwoo Choi [Wed, 28 Mar 2018 12:31:59 +0000 (21:31 +0900)]
pmqos: Clean-up code and remove unnecessary function

Clean-up code and just remove unnecessary get_methods_from_conf().

Change-Id: I158603675172f32d01151b7269a73ba69d002258
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: resmon: Save updated timer interval 60/174360/1
Chanwoo Choi [Fri, 30 Mar 2018 06:52:57 +0000 (15:52 +0900)]
pass: resmon: Save updated timer interval

RESMON provides the update function of 'timer interval' on the runtime.
Should save the updated 'timer interval' value to 'struct resmon'.

Change-Id: Ice3deb34889343dfbcb555cb31fcfff37d6cf2a6
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: cpuhp: Fix error when exiting the CPUHP module 12/172812/3
Chanwoo Choi [Fri, 16 Mar 2018 04:56:48 +0000 (13:56 +0900)]
pass: cpuhp: Fix error when exiting the CPUHP module

If resource configuration doesn't specify the use of CPUHP,
pass_cpuhp_init() have to be skipped. But, the commit eac3132aeb70 ("pass:
cpuhp: Replace legacy monitoring with RESMON (Resource Monitor)") didn't
handle it rightly. If CPU h/w resource doesn't use the CPUHP governor
(radiation or step cpuhp governor), have to skip the exit sequence of CPUHP.

Change-Id: I2c97873eebfa1e441807b615637786ebda5ed8b8
Fixes: eac3132aeb70 ("pass: cpuhp: Replace legacy monitoring with RESMON (Resource Monitor)
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: resmon: Add uevent-based RESMON_SRC_THERMAL source 67/172667/4
Chanwoo Choi [Thu, 8 Mar 2018 11:00:30 +0000 (20:00 +0900)]
pass: resmon: Add uevent-based RESMON_SRC_THERMAL source

RESMON_SRC_THERMAL indicates the thermal monitoring for h/w resource
such as CPU, GPU and so on. The uevent-based RESMON_SRC_THERMAL uses
the uevent from kernel. When receving the uevent, RESMON_SRC_THERMAL
reads the temperature of h/w resource and then pass it to consumer
of resource monitor.

It is standard Linux Kernel interface which provides the thermal information
through thermal framework of Linux Kernel.

[Description of RESMON_SRC_THERMAL resource-monitor]
- The kind of resource data
: temperature of h/w resource (unit is centigrade)
: (e.g., 47000 means 47.0 degrees centigrade)

- The 'subsystem' name for uevent-based RESMON_SRC_THERMAL
: "thermal"

- Path of RESMON_SRC_THERMAL monitoring
: cat /sys/class/thermal/thermal_zone[X]/temp

- Result of RESMON_SRC_THERMAL monitoring
$ cat /sys/class/thermal/thermal_zone0/temp
47000

For exmaple on TM2 board,
: thermal_zone0 for ARM big core on TM2
: thermal_zone2 for ARM GPU on TM2
: thermal_zone3 for ARM LITTLE core on TM2

Change-Id: Ib66abc11b16c1e17084bc9b89e06c4fb81e6f897
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: resmon: Add uevent-based resource monitor 66/172666/4
Chanwoo Choi [Tue, 13 Feb 2018 06:31:06 +0000 (15:31 +0900)]
pass: resmon: Add uevent-based resource monitor

Resource-Monitor provides two monitoring method as following:
- Timer-based resource monitor like polling method. There are both oneshot
  and periodic timer and it requires the interval as the mandatory.
- Uevent-based resource monitor like interrupt method. It notifies the result
  of monitoring when receiving the uevent from Kernel.

Add the support of uevent-based resource monitor which uses the libudev.h
library in order to handle the uevent from kernel.

[Function description]
- Uevent-based resource monitor
int pass_resmon_register_uevent()
int pass_resmon_unregister_uevent()

Change-Id: I3c9362298f5e096600989d5aaa2c6720346b9c5c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: Initialize only supported module according to h/w resource 51/170451/4
Chanwoo Choi [Mon, 12 Feb 2018 06:12:12 +0000 (15:12 +0900)]
pass: Initialize only supported module according to h/w resource

PASS handlse the h/w resource such as CPU, BUS, GPU, Memory and so on.
Also, PASS provides the multiple module such as CPUHP, PMQoS, Rescon, Resmon
and Parser. All modules provided by PASS are not used for each h/w resource.

Each h/w resource must need to have the supported module list and then
initialize/exit the module according to the defined their own list.

Change-Id: I0453a7cb247fcd52fdd2f18953d7df1d1406114e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: rescon: Set default pass level when initializing RESCON 65/172665/2
Chanwoo Choi [Thu, 15 Mar 2018 01:00:11 +0000 (10:00 +0900)]
pass: rescon: Set default pass level when initializing RESCON

Before developed the RESCON (resource controller), CPUHP (cpu hotplug manager)
controls the level directly. CPUHP decides the next level and then ask them
to RESCON in order to control the h/w resource.

So, set default pass level when initializing RESCON in pass_resmon_init()
instead of CPUHP.

Change-Id: I0a8f86b7a781d4cf13e021f9a29537738a8fd70a
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: cpuhp: Replace legacy monitoring with RESMON (Resource Monitor) 50/170450/4
Chanwoo Choi [Mon, 12 Feb 2018 05:06:54 +0000 (14:06 +0900)]
pass: cpuhp: Replace legacy monitoring with RESMON (Resource Monitor)

PASS CPUHP (CPU Hotplug Manager) module requires the CPU resource
monitoring in order to check the current system status and then
decide the optimal amount of CPU resource. It makes the balance
between the ondemand peformanace and required low-power consumption.

But, CPUHP used the legacy and too tightly coupled monitoring code.
So, replace the legacy method for resource monitoring with RESMON
(Resource Monitor). CPUHP will use the RESMON_CPUHP type instead of
old method.

Change-Id: I1dbbafceeb1c747383fdbfe0aa33c3e84fe02a68
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: resmon: Add timer-based RESMON_SRC_THERMAL source 49/170449/4
Chanwoo Choi [Tue, 13 Feb 2018 13:34:01 +0000 (22:34 +0900)]
pass: resmon: Add timer-based RESMON_SRC_THERMAL source

RESMON_SRC_THERMAL indicates the thermal monitoring for h/w resource
such as CPU, GPU and so on. It is used to decide the current system status
like 'Low, Normal, High, Critical and Danger according to temperature of
h/w resource'. Also, other subsystems and user-processes can use
the temperature information.

It is standard Linux Kernel interface which provides the thermal infomation
through Thermal framework of Linux Kernel.

[Description of RESMON_SRC_THERMAL resource-monitor]
- The kind of resource data
: temperature of h/w resource (unit is centigrade)
: (e.g., 47000 means 47.0 degrees centigrade)

- Path of RESMON_SRC_THERMAL monitoring
: cat /sys/class/thermal/thermal_zone[X]/temp

- Result of RESMON_SRC_THERMAL monitoring
$ cat /sys/class/thermal/thermal_zone0/temp
47000

For exmaple on TM2 board,
: thermal_zone0 for ARM big core on TM2
: thermal_zone2 for ARM GPU on TM2
: thermal_zone3 for ARM LITTLE core on TM2

Change-Id: Ia6272621caea45a3c117d4d5bb9512ccafb9947a
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: resmon: Add timer-based RESMON_SRC_CPUHP source 48/170448/4
Chanwoo Choi [Tue, 13 Feb 2018 07:00:39 +0000 (16:00 +0900)]
pass: resmon: Add timer-based RESMON_SRC_CPUHP source

RESMON_SRC_CPUHP indicates the CPU resource monitoring for CPUHP (CPU Hotplug
Manager) module. RESMON_CPUHP contains the CPU's information. They are used
to decide the current system status on CPUHP.

Unfortunately, it is nonstandard linux kernel interface which is developed
for only CPUHP module. It should be replaced with standard linux kernel
interface on later.

[Description of RESMON_CPUHP resource-monitor]
- The kind of resource data
: time (time unit is millisecond)
: old CPU frequency (Minimum/Maximum is different accroding to h/w board)
: new CPU frequency (Minimum/Maximum is different accroding to h/w board)
: the number of nr_running tasks in the same cluster (100 means the one task)
: each CPU's utilization (Minimum is 0 and maximum is 100)

- Path of RESMON_SRC_CPUHP monitoring
: /sys/kernel/debug/cpufreq/cpu0/load_table

- Result of RESMON_SRC_CPUHP monitoring
$ cat /sys/kernel/debug/cpufreq/cpu0/load_table
Time(ms)   Old Freq(Hz) New Freq(Hz) NR_running CPU0 CPU1 CPU2 CPU3
3417690    500000       500000       300        10   4    0    0
3417770    500000       500000       182        10   4    0    0

Change-Id: Idcb3384e507f08aac282e0f0629a5666d7e0dd75
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: resmon: Add resmon source's skeleton code 47/170447/3
Chanwoo Choi [Tue, 13 Feb 2018 07:17:16 +0000 (16:17 +0900)]
pass: resmon: Add resmon source's skeleton code

The RESMON (resource monitor) module will monitor the various h/w resource
such as CPU, GPU, Memory, Network, Filesystem and so on. Each h/w resource
requires the common monitoring API like timer hanlding function. Add resmon
source's skeleton code.

RESMON makes the following two files to implement ths resource monitor:
- pass-resmon.c : Implment pass_resmon_init/exit() and common monitoring API
  which are used for all resource monitoring. It contains the exported API of
  both timer-based and uevent-baed resource monitor.

- pass-resmon-impl.c : Implement the h/w resource monitoring through HAL
  (Hardware Abstract Layer). Each resource-monitor would collect the data of
  h/w resource with their own method. For example, some resource-monitor just
  reads the value from fixed sysfs interface. On the other hand, other
  resource-monitor parses the multiple data and then make the meaningfull data
  from raw data.

Change-Id: I1a83c8ead16e6cba48e5ce191d55b5bde497afae
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: resmon: Add new Resource Monitor (resmon) module 46/170446/3
Chanwoo Choi [Fri, 2 Feb 2018 05:14:28 +0000 (14:14 +0900)]
pass: resmon: Add new Resource Monitor (resmon) module

PASS required the resource monitoring in order to decide the current system
status. Even if it was required, PASS had not supported the separate
resource monitor module.

Add Resource Monitor (resmon) module to support the resource monitoring.
Other modules in PASS are able to use resmon in order to monitor/collect
the resource data such as frequency, utilization, file/memory's usage and so on.

Resource-Monitor provides two monitoring method as following:
- Timer-based resource monitor like polling method. There are both oneshot
  and periodic timer and it requires the interval as the mandatory.
- Uevent-based resource monitor like interrupt method. It notifies the result
  of monitoring when receiving the uevent. But, uevent-based resource monitor
  will be implemented on later.

[Function description]
- Timer-based resource monitor
int pass_resmon_update_timer_interval()
int pass_resmon_register_timer()
int pass_resmon_unregister_timer()

Change-Id: I4ec40f570fa0083a0fc22754174e63033cd99836
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: cpuhp: Remove possible null deference 21/172221/1 accepted/tizen/unified/20180313.061035 submit/tizen/20180313.020130
Seung-Woo Kim [Tue, 13 Mar 2018 01:49:02 +0000 (10:49 +0900)]
pass: cpuhp: Remove possible null deference

From cpuhp_governor_timer_cb(), it checks null value of res after
deference it. Remove the possible null deference.

Change-Id: I236d93ec9829f4019fd25f7d6f16fa2d77f6761e
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agopass: Remove inclusion of unneeded header file 45/170445/2
Chanwoo Choi [Mon, 12 Feb 2018 06:12:43 +0000 (15:12 +0900)]
pass: Remove inclusion of unneeded header file

PASS core doesn't call the exported API of resource-controller module
except for init/exit().

Change-Id: I2ed6e5cb7032c9a70a5190e8c28c6af3c5205bfa
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agoRemove unnecessary CREDITS 30/170930/1
Chanwoo Choi [Tue, 13 Feb 2018 07:22:35 +0000 (16:22 +0900)]
Remove unnecessary CREDITS

CREDITS includes the developer's information. But it is not necessary.
Can check the contributor through git log. Also, CREDITS is not standard format.

Change-Id: I9554918fae7b393c51bafa37ac41eea7e96f5193
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: Remove unreachable code of dbus_cb_core_stop() 05/170405/1 accepted/tizen/unified/20180221.061150 submit/tizen/20180221.002730
Chanwoo Choi [Tue, 20 Feb 2018 01:33:04 +0000 (10:33 +0900)]
pass: Remove unreachable code of dbus_cb_core_stop()

The pass_exit_done() always returns zero. It means that pass_exit_done()
doesn't need to return any value and it makes the unreachable code of
dbus_cb_core_stop(). Replace return type from int to void of pass_exit_done()
to remove unreachable code of dbus_cb_core_stop().

Change-Id: Ia6ee0bc8b85719e396714454f3b3cc452020b37e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: cpuhp: Remove unnecessary struct pass_freq_policy and level_up_threshold 44/169044/2
Chanwoo Choi [Fri, 2 Feb 2018 04:39:40 +0000 (13:39 +0900)]
pass: cpuhp: Remove unnecessary struct pass_freq_policy and level_up_threshold

Remove unnecessary struct pass_freq_policy and level_up_threshold.
Instead, add max_freq which contains the maximum frequency among PASS's levels
to struct pass_cpuhp. The max_freq is used to calculate the busy cpu on CPUHP's
governor.

Change-Id: I3cab9c13baa927cf0ecd5a9220ba8ab8c8db30dd
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: cpuhp: Replace 'governor' with 'cpuhp' expression 43/169043/2
Chanwoo Choi [Fri, 2 Feb 2018 04:26:37 +0000 (13:26 +0900)]
pass: cpuhp: Replace 'governor' with 'cpuhp' expression

PASS uses 'CPUHP' indicating 'CPU Hotplug Manager' module.
'governor' is too abstract and old expression. Replace 'governor'
with 'cpuhp' expression in order to improve the readability.

Change-Id: Ib7c6509e200cd7603739bace6bcf913bea22475b
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: pmqos: Remove unneeded header file of PMQoS 32/169032/2
Chanwoo Choi [Fri, 2 Feb 2018 01:37:24 +0000 (10:37 +0900)]
pass: pmqos: Remove unneeded header file of PMQoS

PMQoS's init/exit functions are only called in the PASS core (pass.c).
It means that these functions are not library. Remove header file
of PMQoS module and then uses the 'extern' to call PMQoS's init/exit functions.

Change-Id: I37abc63dadf55402c3f30a316102c604b899d8b8
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: rescon: Set init_level for init step to write the required level 42/169042/1
Chanwoo Choi [Fri, 2 Feb 2018 03:53:52 +0000 (12:53 +0900)]
pass: rescon: Set init_level for init step to write the required level

The existing exported pass_rescon_set_level() controls the level
if required new level is different from current level. But, the init step
of ResCon (Resource Controller) always have to set the init_level
according to each resource's configuration file.

To support following two cases, add internal rescon_set_level() function
which doesn't check the available range of required level. Define internal
function instead of adding new exported function or changing the defintion
of existing function.
- case1: Change PASS level always if required.
- case2: Change PASS level if current level is different from required level.

Functions to control the h/w resource by PASS level.
- exported function : pass_rescon_set_level ()
- internal function : rescon_set_level ()

Change-Id: I912f8fbc5465f622a1191880e759f469477d6169
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: rescon: Move initialization code to guarantee the independnecy 31/169031/2
Chanwoo Choi [Fri, 2 Feb 2018 00:54:02 +0000 (09:54 +0900)]
pass: rescon: Move initialization code to guarantee the independnecy

Each module have to initialize/control their own variables
included in module structure. Move initialization code of ResCon
(Resource Controller) from pass.c/pass-gov.c to pass-rescon.c
in orer to guarantee the independnecy among modules.

Change-Id: I4568e2bfe3c6b6ba37b0161dce802bbcef4d6ba6
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: cpuhp: Remove unneeded header file of CPUHP 30/169030/2
Chanwoo Choi [Fri, 2 Feb 2018 01:34:22 +0000 (10:34 +0900)]
pass: cpuhp: Remove unneeded header file of CPUHP

CPUHP's init/exit functions are only called in the PASS core (pass.c).
It means that these functions are not library. Remove header file
of CPUHP module and then uses the 'extern' to call CPUHP's init/exit functions.

Change-Id: I1756448ca086839a577fe9f3880fa95636818a09
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: cpuhp: Move initialization code to guarantee the independnecy 29/169029/2
Chanwoo Choi [Thu, 1 Feb 2018 07:16:52 +0000 (16:16 +0900)]
pass: cpuhp: Move initialization code to guarantee the independnecy

Each module have to initialize/control their own variables
included in module structure. Move initialization code of CPUHP
from pass.c to pass-gov.c in orer to guarantee the independnecy
among modules.

Change-Id: I178246602b8c7eebc992c93d5fa34ca8b9494480
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: Redefine struct pass_* to modularize PASS's modules 02/168802/5
Chanwoo Choi [Tue, 30 Jan 2018 07:00:56 +0000 (16:00 +0900)]
pass: Redefine struct pass_* to modularize PASS's modules

The commit 86cd810d6e1ae ("pass: Add new helper function to handle the h/w
resource through hal interface") introduced the 'struct pass_resource' which
represents the each h/w resource such as CPU/GPU/BUS, memory and so on.
After applied commit 86cd810d6e1ae, struct pass_policy is not necessary
and doesn't represent each h/w resource.

Also, struct pass_policy contained the common data and the specific data of
both CPUHP (CPU Hotplug Manager) and PMQoS module. It cause that PASS was
gradually more complex and it obstructed the independency of each PASS's
module. It changed like a spaghetti code. In result, PASS must need to be
updated in order to consider the extensibility, independency between modules
and the removal of legacy codes.

So, do the refactoring to make PASS to imporeve the maintenance and to keep
the independncy among modules. Explain in detail what it did as following:
- Make new 'struct pass_cpuhp' represents CPUHP (CPU Hotplug Manager) module.
  CPUHP related variables are moved from 'pass_policy' to 'pass_cpuhp'.
- Make new 'struct pass_rescon' represents ResCon (Resource Controller) module.
- Move the parsed data from each resource configuration file.
  (pass_policy -> pass_resource_config_data).
- Move the controlled data by resource controller.
  (pass_policy -> pass_rescon)
- Replace 'pass_policy' with 'pass_resource' for each h/w resource.
- Remove unneeded 'struct pass_policy' anymore.
- Rename from 'struct pass_conf_data' to 'struct pass_resource_config_data'
  for the readability.
- Add missing description for all pass_* structure.

[Describe the role of each structure as following]
For h/w resource of PASS,
- 'struct pass_resource' represents each h/w resource such as cpu/gpu etc.

For module of PASS,
- strcut pass_rescon contains the data for ResCon (Resource Controller) module.
- strcut pass_cpuhp contains the data for CPUHP (CPU Hotplug Manager) module.
- struct pass_pmqos contains the data for PMQoS module.

For the basic unit of PASS,
- struct pass_level represents the 'level' unit which includes the real value
  such as the frequency, the number of cpu, fault_around_bytes of memory etc.
  If specific 'level' is selected, resource-controller writes the real value
  included in selected 'level' to real h/w resource.
- struct pass_scenario represents each scenario such as AppLaunch,
  UltraPowerSaving and etc. 'scenario' includes the 'level' infomation
  like available minimum/maximum level and etc. If some external daemon
  (e.g. App Launcher) requires the specific scenario thru dbus interface,
  resource-controller initializes the level to change the real h/w value.

Change-Id: Ib0e6ad68079ca70febe19b94b661f461a8eef673
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: pmqos: Separate PMQoS's code from pass-gov.c (cpu hotplug) 01/168801/1
Chanwoo Choi [Mon, 29 Jan 2018 08:16:06 +0000 (17:16 +0900)]
pass: pmqos: Separate PMQoS's code from pass-gov.c (cpu hotplug)

PASS supports CPUHP (CPU hotplug manager) and PMQoS features until now.
The pass-gov.c contains the CPU hotplug manager feature and a little
of PMQoS's code. In order to remove the tightly coupled code,
move PMQoS's code from pass-gov.c to pass-pmqos.c.

Change-Id: I2811414fbe99cea04d9f111dc61ec0a2e05cb21c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agoRemove dependency of unused packages 07/168507/2
Chanwoo Choi [Mon, 29 Jan 2018 06:14:11 +0000 (15:14 +0900)]
Remove dependency of unused packages

Remove the package dependency from PASS because they are not used.
- vconf, device-node, capi-base-common and eventsystem

Change-Id: I207b65070d979db917ce7aea730995ee795a46de
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agoRemove unneeded README.error.code file 06/168506/1
Chanwoo Choi [Mon, 29 Jan 2018 00:25:39 +0000 (09:25 +0900)]
Remove unneeded README.error.code file

Change-Id: Iedcfaf37a3418710e3928848a7a975edca0fc3b9
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: Replace pass_main() with main() expression 05/168505/1
Chanwoo Choi [Mon, 29 Jan 2018 00:29:20 +0000 (09:29 +0900)]
pass: Replace pass_main() with main() expression

PASS doesn't define the pass_main(). Instead, main() function name
is correct. Replace pass_main() with main() expression.

Change-Id: I6ff03c1069e452a0c7af75495ff9d8d08d4ccbea
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: Remove unused script from makefile 41/168341/1
Seung-Woo Kim [Fri, 26 Jan 2018 02:04:37 +0000 (11:04 +0900)]
pass: Remove unused script from makefile

Except for pass-hal-devel package, PASS doesn't make the devel package
including the header file and library. Remove unused script related to
installing the header file.

Change-Id: Ic9b24b7f81319c0e55e70620f4dea847ecbafbf3
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
[cw00.choi: Apply patch and write the patch description]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: hal: Remove example code for hal implementation 38/168338/1
Chanwoo Choi [Fri, 26 Jan 2018 01:24:18 +0000 (10:24 +0900)]
pass: hal: Remove example code for hal implementation

Remove example code for hal implementation because example is not updated
constantly and pass-hal-standard.git has the well-made hal implementation
for all h/w resources which are controlled in PASS framework.

[1] https://git.tizen.org/cgit/platform/adaptation/pass-hal-standard/

Change-Id: I3ceb46aecfd11abebf2055d32e865e67d5bb7471
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: Make include directory containing the exported header files 35/168335/1
Chanwoo Choi [Fri, 26 Jan 2018 00:57:48 +0000 (09:57 +0900)]
pass: Make include directory containing the exported header files

Existing *.[ch] files uses the following type in order to include
the header file which is located in the outside directory. But it is
not proper method for including the header file.
- #include "core/*.h:

Make 'include' directory containing the all exported header files
and move the exported header files under 'include/' as following:
- src/core/*.h   -> include/pass/log.h
- src/shared/*.h -> include/pass/*.h
- src/hal/hal.h  -> include/pass/hal/hal.h

Change-Id: I68f6ad4c711b50a1d48bee3785d5657a8b58c963
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: hal: Remove inefficient local variables 34/168334/1
Chanwoo Choi [Thu, 25 Jan 2018 23:58:40 +0000 (08:58 +0900)]
pass: hal: Remove inefficient local variables

Almost PASS hal function defines the 'res_type' and 'res_name'
local variables. It is not efficient method. Use the variable
of struct pass_resource directly instead of defining the separate
local variables on each hal functions.

Change-Id: Ia6719d65639777a4d90df0326adb0e2c66807e85
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: hal: Remove duplicate header file 33/168333/1
Chanwoo Choi [Thu, 25 Jan 2018 08:11:07 +0000 (17:11 +0900)]
pass: hal: Remove duplicate header file

Remove the duplicate hal/hal.h header file because pass/pass-hal.h
already includes the hal/hal.h header files.

Change-Id: I06f6b26835c9efcd663074d502d9f431ddb9422f
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: parser: Clean-up internal parsing functions to improve readability 32/168232/5
Chanwoo Choi [Thu, 25 Jan 2018 02:47:06 +0000 (11:47 +0900)]
pass: parser: Clean-up internal parsing functions to improve readability

Clean-up the internal parsing functions to improve the readability
and consider the extensibility because 'parse_level' and 'parse_scenario'
will be used on other features. Describe what are modified as following:
- Remove 'pass_' prefix from internal function
- Rename from check_compatible() to compare_compatible_name()
- Split out parse_scenario() function from parse_pmqos()
- Remove unneeded strlen() in the compare_compatible_name()
- Remove unnedded semiconlon from switch statement

[Detailed description of internal functions]
- parse_core(): Parse 'Pass' section including info of CPUHP feature
- parse_pmqos(): Parse 'PassScenario' section including info of PMQoS feature
- parse_level(): Parse 'Level' section including info of each scenario
- parse_scenario(): Parse 'Scenario' section including info of each level

Change-Id: Ibc3d8a3a546b322ec610a5f84646ae46e545641c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: parser: Clean-up exported parsing function to improve readability 31/168231/1
Chanwoo Choi [Thu, 25 Jan 2018 01:49:46 +0000 (10:49 +0900)]
pass: parser: Clean-up exported parsing function to improve readability

Clean-up exported parsing function in order to improve readability and
keep the consistency. Describe the detailed clean-up as following:
- Reorder exported functions into pass-parser.c
- Change the function name to improve readability and keep the consistency
  like pass_get/put_resource_config() as following:
  pass_get_table() -> pass_get_each_resource_config()
  pass_put_table() -> pass_put_each_resource_config()
- Modify argument name from 'path_conf_path' to 'path'

Change-Id: Ic8d517855c95e1a29ba5d6e4b62693c7b150e223
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: parser: Simplify parsing function of 'Level' section 30/168230/1
Dongwoo Lee [Thu, 25 Jan 2018 00:34:13 +0000 (09:34 +0900)]
pass: parser: Simplify parsing function of 'Level' section

The pass_parse_level() function is used for parsing 'Level%d' section.
Simplify the function's definition as following. Now, PASS uses the 'level'
concept which indicating the basic unit in order to initialize the h/w resource.
In the next time, PASS will use both 'global level' and 'local level' concept.
The changed pass_parse_level() is better to support both 'global level' and
'local level'.

[Before]
- pass_parse_level(struct parse_result *result, void *user_data, int level)
[After]
- pass_parse_level(struct parse_result *result, struct pass_level level)

Change-Id: Ib98b419d14e46f36de559b0f2b32c9fe63fc5bf4
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
[cw00.choi: Apply dongwoo's patch and document the description]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: gov: Fix bug for governor state of each h/w resource 18/164618/2 accepted/tizen/unified/20171221.071205 submit/tizen/20171220.053323
Chanwoo Choi [Wed, 20 Dec 2017 04:47:22 +0000 (13:47 +0900)]
pass: gov: Fix bug for governor state of each h/w resource

The commit 6133e7040ab49 ("pass: gov: Move private structure
from pass.h to pass-gov.h") moved the 'gov_state' variable
from 'struct pass_policy' to 'struct pass_governor'. It was wrong
because each pass_policy should contain the their own state of governor.
So, this patch moves the 'gov_state' variable to the 'struct pass_policy'.

Change-Id: I840c3ccf727ede1fc94de489b13c1703dc0d5d57
Fixes: 6133e7040ab49 ("pass: gov: Move private structure from pass.h to pass-gov.h")
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: hal: Fix wrong format string of variables in struct pass_cpu_stats 97/164597/1
Chanwoo Choi [Wed, 20 Dec 2017 01:55:00 +0000 (10:55 +0900)]
pass: hal: Fix wrong format string of variables in struct pass_cpu_stats

This patch fixes the wrong format string of variables in the
struct pass_cpu_stats from "%d" to "%u" because variables are
unsigned integer.

Change-Id: Iff5fceccd641a8146667e66322538464871f0e43
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: hal: Fix wrong format string of stat.load variable 96/164596/1
Jinhee Choi [Wed, 20 Dec 2017 01:52:30 +0000 (10:52 +0900)]
pass: hal: Fix wrong format string of stat.load variable

This patch fixes the wrong format string of stat.load variable
from "%d" to "%u" because stat.load[] variable is unsigned integer.

Change-Id: Ic8d28782b36690242a3503f6967e9fd8bf550f11
Signed-off-by: Jinhee Choi <jh106.choi@samsung.com>
[cw00.choi: Add the patch description'
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: Replace struct pass_policy to pass_resource for representing h/w resource 40/163440/3
Chanwoo Choi [Mon, 6 Nov 2017 01:47:24 +0000 (10:47 +0900)]
pass: Replace struct pass_policy to pass_resource for representing h/w resource

The commit 86cd810d6e1ae ("pass: Add new helper function to handle
the h/w resource through hal interface") introduced the 'struct pass_resource'
which represents the each h/w resource such as CPU/GPU/BUS, memory and so on.

Before applied commit 86cd810d6e1ae, PASS used the 'struct pass_policy' which
represented the each h/w resource. So, this patch replaces 'struct pass_policy'
to 'struct pass_resource' for representing the each h/w resource.

Change-Id: I714c633255696af2cbf4719ce2892f15b37e1b25
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopmqos: Do not send DBus method return message when PMQoS is not started 46/160446/4 accepted/tizen/unified/20171123.065848 submit/tizen/20171123.001235
Wook Song [Thu, 16 Nov 2017 06:48:48 +0000 (15:48 +0900)]
pmqos: Do not send DBus method return message when PMQoS is not started

When the PMQoS module receives PMQoS requests via DBus methods
invocation before its initialization, the module displays out the
message about that the module is not started yet and it returns a DBus
message to the sender. The following log message is displayed in the
systemd journal because of this DBus method return message sending:

pass[2132]: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

Although this warning may not harm any parts of the system, it is fixed
by this patch as well.

Change-Id: I4f22e4b429c2dcbbd2f1834ec485dc06bfdf24a2
Signed-off-by: Wook Song <wook16.song@samsung.com>
6 years agopass: Consolidate the size of char arrary to the 255 byte 00/158900/1
Chanwoo Choi [Mon, 6 Nov 2017 01:40:00 +0000 (10:40 +0900)]
pass: Consolidate the size of char arrary to the 255 byte

The multiple modules define the char array with the different size.
It might make the confusion and overflow error. This patch consolidates
the size of char arrary to the 255 byte and changes the name of 'PASS_NAME_LEN'
to 'BUFF_MAX' in order to remove the unneeded 'PASS_*' prefix.

Change-Id: I2ee11313f10f52f5aa24628afbac9facd45b50ad
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: Move local constatnt definition to the specific module 99/158899/1
Chanwoo Choi [Mon, 6 Nov 2017 01:29:38 +0000 (10:29 +0900)]
pass: Move local constatnt definition to the specific module

The some definitions were only used in the specific module.
They would be not included in the pass.h header file. This patch
moves the definition to the specific module.
- #define PASS_MIN_GOV_TIMEOUT 0.2 (pass-parser.c)
- #define PASS_CPU_STATS_DEFAULT 20 (pass.c)

Change-Id: Id3ce5c81198d74981a50541b6b71495c48bab3c3
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: Remove unneeded constant definition 98/158898/1
Chanwoo Choi [Mon, 6 Nov 2017 01:23:01 +0000 (10:23 +0900)]
pass: Remove unneeded constant definition

This patch removes the following unneeded definitions and clean-up
the unnecessary blank line from pass.h.
- #define PASS_RESOURCE_MAX 10
- #define PASS_CLUSTER_0 0
- #define PASS_CLUSTER_1 1

Change-Id: I6354067570995e03a5d077611c13781191ae85e8
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: pmqos: Change name of 'struct pass_scenario_policy' to 'struct pass_pmqos' 54/158854/1
Chanwoo Choi [Fri, 3 Nov 2017 09:15:05 +0000 (18:15 +0900)]
pass: pmqos: Change name of 'struct pass_scenario_policy' to 'struct pass_pmqos'

The 'struct pass_scenario_policy' indicates the PMQoS module
and contains the scenario information. The 'pass_scenario_policy'
name is ambiguous for indicating the PMQoS module. So, this patch changes
the name from 'struct pass_scenario_policy' to 'struct pass_pmqos'
for the readability.

Also, this patch changes the variable name from 'list' to 'scenarios'.
The pmqos->scenarios is better than 'pmqos->list' in side of readability
in order to indicate the scenario list.

Change-Id: I402cec7ff1f922edbe67b8c216408ff702f2a2fb
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: gov: Move private structure from pass.h to pass-gov.h 11/158611/2
Chanwoo Choi [Thu, 2 Nov 2017 06:37:16 +0000 (15:37 +0900)]
pass: gov: Move private structure from pass.h to pass-gov.h

The following private data are only used in the pass-gov*.c.
- enum pass_gov_state
- struct pass_governor

So, this patch moves them from pass.h to pass-gov.h in order
to prevent the unnecessary access to them.

Change-Id: Ia205a1f510eeea50a113fbefee7a48a499818246
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: rescon: Remove unneeded enumeration pass_cpu_state 10/158610/2
Chanwoo Choi [Thu, 2 Nov 2017 06:34:42 +0000 (15:34 +0900)]
pass: rescon: Remove unneeded enumeration pass_cpu_state

This patch removes the unnecessary enumeration pass_cpu_state.
Instead, this patch uses the integer (0 or 1) for cpu_up/down.

Change-Id: I12bbc54edff7047c06a18e5b04d03b8b807f15da
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: Change name of 'struct pass_table' to 'struct pass_level' 09/158609/1
Chanwoo Choi [Thu, 2 Nov 2017 06:32:00 +0000 (15:32 +0900)]
pass: Change name of 'struct pass_table' to 'struct pass_level'

PASS used the 'Level' expression which indicates the basic unit.
The modules of PASS decide the next level and then resource-controller
module set the h/w resource according to the decided level.

Prior to that, PASS used the 'struct pass_table' name. It is not correct
and make the confusion possible. So, this patch changes the name
of 'struct pass_table' to 'struct pass_level'.

Change-Id: If0df603dbaf98aa22aad49af15636cd67b35692a
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: parser: update pass->num_resources properly 19/158219/4
Seung-Woo Kim [Mon, 30 Oct 2017 10:34:33 +0000 (19:34 +0900)]
pass: parser: update pass->num_resources properly

During pass_resource_config(), if allocation of res is failed,
pass->num_resources is only updated. Also, after pass->res is
freed from pass_put_resource_config(), pass->num_resources is not
set to 0. Update pass->num_resources propery from both cases.

Change-Id: Idb72e0fe46889436ded7aa07e514e78e9594e2c6
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agopmqos: update scenarios->num properly from pmqos_parse_scenario() 18/158218/4
Seung-Woo Kim [Mon, 30 Oct 2017 10:27:26 +0000 (19:27 +0900)]
pmqos: update scenarios->num properly from pmqos_parse_scenario()

If allocation of scenarios->list is failed, only scenarios->num is
updated. Update the scenarios->num propery.

Change-Id: Ia9b6c47f8449870ddefaca600ed5d0c1d9c47fe7
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agopmqos: clear freed scenario->list in pmqos_put_scenario() 17/158217/4
Seung-Woo Kim [Mon, 30 Oct 2017 09:52:18 +0000 (18:52 +0900)]
pmqos: clear freed scenario->list in pmqos_put_scenario()

Clear freed scenario->list in pmqos_put_scenario() to remove
possiblity of use-after-free.

Change-Id: I55266716473889ede04384ed3b8825eaf1dfc32b
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agopmqos: fix wrong condition to clear in pmqos_put_scenario() 75/158575/1
Seung-Woo Kim [Thu, 2 Nov 2017 02:12:11 +0000 (11:12 +0900)]
pmqos: fix wrong condition to clear in pmqos_put_scenario()

There is wrong condition to check scenarios->list is null before
freeing it in pmqos_put_scenario(). Fix the wrong condition.

Change-Id: Ib759f0af452ed90512e8ed55f486943dd857b8ba
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agopass: parser: update policy->scenario.num_scenarios properly 16/158216/2
Seung-Woo Kim [Mon, 30 Oct 2017 10:42:24 +0000 (19:42 +0900)]
pass: parser: update policy->scenario.num_scenarios properly

The policy->scenario.num_scenarios is not updated properly if
allocation of policy->scernario.list is failed. Also for case of
free it. Update policy->scenario.num_scenarios properly for both
cases.

Change-Id: I0fe18520ab304c57df9e1cac8713848da19055e4
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agopass: parser: clear freed scenario.list in pass_put_table() 91/156991/7
Seung-Woo Kim [Mon, 23 Oct 2017 05:03:52 +0000 (14:03 +0900)]
pass: parser: clear freed scenario.list in pass_put_table()

Clear freed scenario.list in pass_put_table() to remove possibility
of use-after-free.

Change-Id: I959546e12c1f811313cd65b50b7bac18b9787d6d
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agopass: Remove use-after-free of policy->pass_table during pass_exit_resource() 15/158215/2
Seung-Woo Kim [Mon, 30 Oct 2017 09:46:32 +0000 (18:46 +0900)]
pass: Remove use-after-free of policy->pass_table during pass_exit_resource()

During the pass_exit_resource(), pass_put_table() frees the
g_pass->policy->pass_table, and after that, pass_hotplug_stop() is
called and uses the pointer. Remove the use-after-free by clearing
policy->pass_table from pass_put_table() instead of
__pass_governor_exit() and checking null from pass_hot_plug_stop().

Change-Id: I00d57320dd9ed9f0bcaed406f066bdce37215656
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agopass: Release v1.0.0 62/158162/1
Chanwoo Choi [Tue, 24 Oct 2017 05:47:30 +0000 (14:47 +0900)]
pass: Release v1.0.0

Detailed description for this release:
- Provide first Tizen Power-Management framework (PASS)
- Support Scenario-based PMQoS (pmqos)
- Support CPU Hotplug Manager (cpuhp)
- Support Resource Controller (rescon)
- Support HAL interface (hal)

Change-Id: Ic4cf720bba3cde0f2806466c0e06088f892234d9
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agohal: Fix the TOCTOU issue by using the path on dlopen directly 91/152591/2 accepted/tizen/4.0/unified/20170929.075611 accepted/tizen/unified/20170928.072150 submit/tizen/20170927.080101 submit/tizen_4.0/20170927.080359 tizen_4.0.IoT.p1_release tizen_4.0.m2_release
Chanwoo Choi [Tue, 26 Sep 2017 11:11:44 +0000 (20:11 +0900)]
hal: Fix the TOCTOU issue by using the path on dlopen directly

Prior to that, pass_get_hal_info() checks whether filename is
accessible or not wiht access() and then load the library through
dlopen(). This sequence between access() and dlopen() has the
TOCTOU (Time of Check to Time Of Use) issue. So, this patch just
removes the calling of access() and then only use dlopen()
in order to TOCTOU issue.

Change-Id: I510eb7bcd2e91a5bacd743ef22af92298f72b4ae
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: Fix the not-null terminated string 44/152544/4
Chanwoo Choi [Tue, 26 Sep 2017 09:54:59 +0000 (18:54 +0900)]
pass: Fix the not-null terminated string

The read() function doesn't add the '\0' character
to the end of string. So, this patch adds the '\0' char
on the last point of string if there is no error.

Change-Id: I1b3bf879b9c38f19edad8279d036c68655fae83b
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: Print thermal name for each resource 74/151574/2
Chanwoo Choi [Thu, 21 Sep 2017 07:49:21 +0000 (16:49 +0900)]
pass: Print thermal name for each resource

This patch just prints the thermal name for each resource
for starting PASS in order to provide the resource information.

Change-Id: I2824186649a784722d1647df2fea0082256a63a8
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>