platform/core/system/pass.git
2 years agomonitor: request-handler: Replace with strerror_r to fix vulnerability issue 63/272563/2
Chanwoo Choi [Mon, 21 Mar 2022 04:16:50 +0000 (13:16 +0900)]
monitor: request-handler: Replace with strerror_r to fix vulnerability issue

Change-Id: I399fe56e8305df1ed3aef2b7e55677ea2b463313
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoresource: Add process group resource driver 24/272424/5
Dongwoo Lee [Mon, 14 Mar 2022 01:43:38 +0000 (10:43 +0900)]
resource: Add process group resource driver

This resource is pseudo-device driver which provides information of
related process group.

Controls:
 - PROCESS_GROUP_CTRL_ROOT_PID: pid of top-level process in a group
  what we want to see.
Atrributes:
 - PROCESS_GROUP_ATTR_LIST: array of pid which includes all processes
      related with root pid. if root pid is
    negative, list contains all processes.

Change-Id: I0b7a85dd7d8f2bd4628e17c8db923dd4abd112a8
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: kernel: Fix to close files after use 64/272564/1
Dongwoo Lee [Mon, 21 Mar 2022 04:10:15 +0000 (13:10 +0900)]
util: kernel: Fix to close files after use

Change-Id: I91c2869f4c8bcf9ff80bf9691d357088d80dce88
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agolib: tmonitor: Add get APIs for array type attributes 23/272423/2
Dongwoo Lee [Tue, 15 Mar 2022 03:45:22 +0000 (12:45 +0900)]
lib: tmonitor: Add get APIs for array type attributes

This adds internal API for getting array type attributes as below:

 - tmonitor_get_array_int
 - tmonitor_get_array_int64
 - tmonitor_get_array_uint
 - tmonitor_get_array_uint64
 - tmonitor_get_array_double
 - tmonitor_get_array_string

Since users get dynamically allocated array with length by just
passing pointer of pointer for each data type, it should be freed
after use.

Change-Id: I8f72ff5c6ceebcc4eda8998f2ad4fed47f71e3d5
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoresource: process: Add PGID and PPID attributes 21/272421/2
Dongwoo Lee [Fri, 11 Mar 2022 10:11:48 +0000 (19:11 +0900)]
resource: process: Add PGID and PPID attributes

Change-Id: I6516546b9e1603095070e02b299f8e904e1aa63f
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: kernel: Add functions for getting procfs stat fields 20/272420/2
Dongwoo Lee [Mon, 14 Mar 2022 09:33:54 +0000 (02:33 -0700)]
util: kernel: Add functions for getting procfs stat fields

This adds new functions for getting procfs stat fields of certain
process id as like below prototype:

int kernel_get_process_stat_fields(pid_t pid, char *buffer, int buf_len, char **stat_fields)
 - pid: target process id
 - buffer: string buffer for retrieving procfs stat, each field of
           stat_fileds points out some index within this buffer area.
   Thus, life time of stat_fields are determined by this.
 - buf_len: length of provided buffer
 - stat_fields: string array of retrieved fields, this should be
  declared as (char *)[PROCESS_STAT_FIELD_MAX] type.

Signed-off-by: Dongwoo Lee <dwlee08@gmail.com>
Change-Id: I23008751fdd17ddd17d9e756e1f0d7394bee5f98

2 years agoutil: Add resource_attr_supported_always() function 19/272419/1
Dongwoo Lee [Tue, 15 Mar 2022 11:19:20 +0000 (20:19 +0900)]
util: Add resource_attr_supported_always() function

This provides common callback to is_supported operation of attribute
for supporting always available attributes.

Change-Id: Iba5058e03cf583693a897684093cf5d35573be33
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: kernel: Fix overflow issue when multiply operation 95/272295/1 accepted/tizen/unified/20220315.065607 submit/tizen/20220315.010333
Chanwoo Choi [Mon, 14 Mar 2022 07:46:05 +0000 (16:46 +0900)]
util: kernel: Fix overflow issue when multiply operation

Change-Id: Ia9bce7fbc4adabafa76e788d78450ce38866d7cf
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoresource: process: Check return value of nla_put_u32 69/272269/3 submit/tizen/20220314.032636
Chanwoo Choi [Mon, 14 Mar 2022 02:42:14 +0000 (11:42 +0900)]
resource: process: Check return value of nla_put_u32

Change-Id: I2b31cd1d531d3ca219b535efed5e39c1a1a74698
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoresource: memory: Add new attributes for memory resource
Sung-hun Kim [Mon, 14 Mar 2022 01:42:22 +0000 (10:42 +0900)]
resource: memory: Add new attributes for memory resource

MEMORY_ATTR_BUFFER: an information about system I/O buffers
MEMORY_ATTR_CACHED: an information about system page cache
MEMORY_ATTR_CMA_TOTAL: an information about total CMA buffer size
MEMORY_ATTR_CMA_FREE: an information about free CMA buffers

Change-Id: I14fbc69e6f0a015c6137eed89650265b7fdda958
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
2 years agolib: tmonior: Implement the missing API 70/272170/4 accepted/tizen/unified/20220313.205607 submit/tizen/20220311.083421
Chanwoo Choi [Tue, 8 Mar 2022 10:53:44 +0000 (19:53 +0900)]
lib: tmonior: Implement the missing API

Implement the following tmonitor API:
- tmonitor_delete_resouce() : REQUEST_DELETE_RESOURCE
- tmonitor_get_resouce_count() : REQUEST_GET_RESOURCE_COUNT
- tmonitor_update() : REQUEST_UPDATE_RESOURCE_ALL
- tmonitor_unset_resource_attr : REQUEST_UNSET_RESOURCE_ATTR
- tmoniotr_is_resource_attr_supported() : REQUEST_IS_RESOURCE_ATTR_SUPPORTED

Change-Id: Id068940632c4bbd5bae79d907e77f846fff4a042
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agolib: tmonitor: Replace the initial tmonitor API to enhanced declaration 69/272169/4
Chanwoo Choi [Tue, 8 Mar 2022 07:34:49 +0000 (16:34 +0900)]
lib: tmonitor: Replace the initial tmonitor API to enhanced declaration

Replace the initial tmonitor API to enhanced declaration
and add the declaration of missing tmonitor API.

Change-Id: I8845f9a17e325e13118767943536c5c313828fd9
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: resource: Add is_resource_attr_supported function 68/272168/4
Chanwoo Choi [Thu, 10 Mar 2022 07:11:29 +0000 (16:11 +0900)]
util: resource: Add is_resource_attr_supported function

is_resource_attr_supported(struct resource *resource, u_int64_t attr_id)
checks whether resource attribute of attr_id is supported or not on
board. In order to check the support of resource attribute, add
.is_supported ops to struct resource_attribute_ops.

But if .is_supported ops is not implemented, use .get ops in order to
check whether the resource attribute is supported or not.

Change-Id: I0b4ed0579c6602e43ff6b3544b4d136707440124
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: resource: Return error for set/unset_resource_attr_interest 07/272207/3
Chanwoo Choi [Fri, 11 Mar 2022 06:46:42 +0000 (15:46 +0900)]
util: resource: Return error for set/unset_resource_attr_interest

Change-Id: I5fe36ff6dd5e38ccdfe64a7d7bb153d22b8d641c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agolib: tmonitor: Rename resource attribute name with _ATTR_ word 67/272167/4
Chanwoo Choi [Tue, 8 Mar 2022 09:21:03 +0000 (18:21 +0900)]
lib: tmonitor: Rename resource attribute name with _ATTR_ word

Rename resource attribute name with _ATTR_ word in order to improve
the readability and remove un-implemented attributes.

And fix minor coding style.

Change-Id: I9029ff3b49a57381ce763894014c7a3cc9357860
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agotmonitor: Implement additional get data functions 60/272160/3
Dongwoo Lee [Mon, 7 Mar 2022 10:25:49 +0000 (19:25 +0900)]
tmonitor: Implement additional get data functions

Change-Id: I94a3cb2950a44c8c7a2039341d2795fbce89480b
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: resource: Allocate storage for attribute data at set interest 59/272159/3
Dongwoo Lee [Thu, 10 Mar 2022 11:32:21 +0000 (20:32 +0900)]
util: resource: Allocate storage for attribute data at set interest

This introduces the new way to using attribute value. Instead of
allocate memory for each attribute value by driver-self, memory is
allocated when client sets interest for each attribute. This can
prevent from unnecessary memory allocation by deferring until it is
really required.

Change-Id: Ie6d47db4c6735510a0e784f8c254705c2c176b25
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: resource: Rework double type attributes 58/272158/1
Dongwoo Lee [Mon, 7 Mar 2022 08:48:49 +0000 (17:48 +0900)]
util: resource: Rework double type attributes

To support double type attributes with exact precison, instead of
casting double to void pointer, using double type allocated memory
as like string or array.

Change-Id: Ie432026f02ad0d22b98a24fdeed7ae1ddf5440ef
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: resource: Fix type check errors 57/272157/1
Dongwoo Lee [Thu, 10 Mar 2022 07:16:23 +0000 (16:16 +0900)]
util: resource: Fix type check errors

Change-Id: Ie4f3a00893aa4c3a87c5e83eb763135efc965cf1
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agomonitor: handler: Fix wrong argument type 56/272156/1
Dongwoo Lee [Thu, 10 Mar 2022 03:15:56 +0000 (12:15 +0900)]
monitor: handler: Fix wrong argument type

Change-Id: Iae4bee8a05313ff1ebd4e1de1892c7bf37af8c71
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agomonitor: request-handler: Handle negative return value of recv 55/272155/1
Dongwoo Lee [Thu, 10 Mar 2022 07:44:39 +0000 (16:44 +0900)]
monitor: request-handler: Handle negative return value of recv

Change-Id: I4a84b3f834fbc4f036f28597aa34f0bceb9d6c5c
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agomonitor: request: Remove unused request name array 54/272154/1
Dongwoo Lee [Thu, 10 Mar 2022 02:57:04 +0000 (11:57 +0900)]
monitor: request: Remove unused request name array

Change-Id: Idb1b47964b08b0fefeee8f4bec4eff201c896d0e
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agomonitor: Replace vulnerable sprintf to snprintf 47/272147/2
Sung-hun Kim [Thu, 10 Mar 2022 06:55:12 +0000 (15:55 +0900)]
monitor: Replace vulnerable sprintf to snprintf

Change-Id: I6baf894343dfa1db050bdf5ac20af735dc7c5185
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
2 years agomonitor: rename the member of request_client 40/272140/1
Sung-hun Kim [Thu, 10 Mar 2022 05:52:55 +0000 (14:52 +0900)]
monitor: rename the member of request_client

Previously, client->id is used as a socket descriptor.
It can be a confused situation for future readers. So,
rename it to client->socket_fd to reveal the intention
of the member variable.

Change-Id: I3512da878b412f3b8aa5821c70de254bf5cd64bb
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
2 years agomonitor: remove an unnecessary mutex in request_client 39/272139/1
Sung-hun Kim [Thu, 10 Mar 2022 03:42:57 +0000 (12:42 +0900)]
monitor: remove an unnecessary mutex in request_client

resource_table in request_client is only accessed by
the owner thread. Thus, such member does not need to
be protected from concurrent accesses.

Change-Id: I942e9b8a8de3a0bfb1d3a33fc249ebc1c3f2cb56
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
2 years agolib: tmonitor: Implement tmonitor APIs 15/271615/14
Dongwoo Lee [Mon, 7 Mar 2022 07:49:04 +0000 (16:49 +0900)]
lib: tmonitor: Implement tmonitor APIs

Tmonitor provides resource monitoring feature by using socket
connection. This is the first version of that implements a
subset of a tmonitor API set.

Change-Id: I9174ba3849f0eae069ace34e9a1b26be0064a436
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agomonitor: Add request-server and request-handler-thread 14/271614/13
Dongwoo Lee [Mon, 7 Mar 2022 07:50:11 +0000 (16:50 +0900)]
monitor: Add request-server and request-handler-thread

To provide libpass API via socket, a manager is required to
manage network connections and requests from clients.

Request-server is a manager to manage network connections.
It accepts and establishes a socket connection from each
client, then spawns a per-client request-handler-thread to
deal with incoming requests from the client if required.

Change-Id: I17cdf1fde69022663c2369b55982ac43e5b5c688
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: resource: Give unique id for each resource 78/271978/4
Dongwoo Lee [Thu, 3 Mar 2022 11:42:40 +0000 (20:42 +0900)]
util: resource: Give unique id for each resource

Change-Id: I9f4eb44862ed42a2189d1c1f6cac47e760b876fe
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoresource: Rework resource creation and initialization 77/271977/4
Dongwoo Lee [Thu, 24 Feb 2022 11:40:11 +0000 (20:40 +0900)]
resource: Rework resource creation and initialization

Change-Id: I386e277a20418b4030d3d5a63dcf10ea15898c6c
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: thread: Support free function for destorying queue 66/271766/2 accepted/tizen/unified/20220302.131908 submit/tizen/20220302.025412 submit/tizen/20220302.031108
Dongwoo Lee [Mon, 28 Feb 2022 09:02:10 +0000 (18:02 +0900)]
util: thread: Support free function for destorying queue

Since lock-free queue can have various data type, users can pass free
function when creating queue along with the corresponding data type in
queue.

Change-Id: I4ede38bd6e36a1622bb39c7183829c5372e3264b
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: kernel: Use 64-bit unsigned integer for memory information 65/271765/2
Dongwoo Lee [Mon, 28 Feb 2022 05:29:14 +0000 (14:29 +0900)]
util: kernel: Use 64-bit unsigned integer for memory information

Since memory information node of kernel can be presented with 32-bit
signed variable as maximum 2GB, to overcome this limitation, this
changes related functions using 64-bit unsigned integer variable.

Change-Id: Id1b1da468ca5e7c98cd65318c854cd5a98ae2086
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoresource: Distinguish signed/unsigned and 32/64 bits integer data types 64/271764/1
Dongwoo Lee [Mon, 28 Feb 2022 03:46:25 +0000 (12:46 +0900)]
resource: Distinguish signed/unsigned and 32/64 bits integer data types

To provide clients with the precise integer values, now support the new
data types:
 - DATA_TYPE_INT(32-bit signed integer),
 - DATA_TPYE_INT64(64-bit signed integer),
 - DATA_TYPE_UINT(32-bit unsigned integer),
 - DATA_TPYE_UINT64(64-bit unsigned integer),

Change-Id: I8f70fb38a1fd9876b53d52c2f7592120fc0f9b5c
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: kernel: Fix STATIC_OVERFLOW issue 54/271754/2
Chanwoo Choi [Mon, 28 Feb 2022 05:41:36 +0000 (14:41 +0900)]
util: kernel: Fix STATIC_OVERFLOW issue

Change-Id: Ic8118a695865913f06da029a47278cccfd266c09
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoresource: system: avoid possible use-after-free in error path 52/271752/4
Seung-Woo Kim [Mon, 28 Feb 2022 03:42:53 +0000 (12:42 +0900)]
resource: system: avoid possible use-after-free in error path

In error path, assigned pointer is not cleared after free. Fix
to avoid possible use-after-free with the not cleared pointer.

Change-Id: Idaa222afc9660e68cc5021bd251f21cd47e30b97
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2 years agoresource: system: Fix NULL_AFTER_DEREF issue 48/271748/4
Chanwoo Choi [Mon, 28 Feb 2022 03:03:36 +0000 (12:03 +0900)]
resource: system: Fix NULL_AFTER_DEREF issue

Change-Id: I9d25da863b004e11a71e0a44d7f8a0aebb22bc2c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoresource: Fix build warning for memory/process resource driver 22/271722/2
Chanwoo Choi [Fri, 25 Feb 2022 10:35:46 +0000 (19:35 +0900)]
resource: Fix build warning for memory/process resource driver

- Build warning 1
src/resource/resource-memory.c:42:10: warning: implicit declaration
  of function 'kernel_get_memory_total' [-Wimplicit-function-declaration]
[   11s]    42 |   return kernel_get_memory_total();
[   11s]       |          ^~~~~~~~~~~~~~~~~~~~~~~
src/resource/resource-memory.c:44:10: warning: implicit declaration
  of function 'kernel_get_memory_info' [-Wimplicit-function-declaration]
[   11s]    44 |   return kernel_get_memory_info(PROC_MEM_INFO_MEM_AVAILABLE);

- Build warning 2
src/resource/resource-process.c:452:19: warning: unused variable 'memory' [-Wunused-variable]
[   12s]   452 |  struct resource *memory;

Change-Id: I2a473453fb02fc7dd1eb8319474fe9e8633ea2a0
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agopass: Add capability for netlink interface 08/271608/1
Dongwoo Lee [Wed, 23 Feb 2022 09:16:16 +0000 (18:16 +0900)]
pass: Add capability for netlink interface

Due to CVE-2011-2494 which prohibits non-privileged users from getting
process information via netlink, pass daemon should be executed by
root or get capability on NET_ADMIN. To do this, it adds capability
into systemd service attribute with cap_net_admin.

Change-Id: Iefd4ca98e963b38a038a8c326f3abad996bb81ee
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoresource: process: Add new PROCESS_COMM and PROCESS_MEM_PERCENT attributes 15/271515/2
Dongwoo Lee [Tue, 22 Feb 2022 06:21:32 +0000 (15:21 +0900)]
resource: process: Add new PROCESS_COMM and PROCESS_MEM_PERCENT attributes

This introduces the new attributes as follows:

PROCESS_COMM: shows the name of process.
PROCESS_MEM_PERCENT: shows ratio of process rss against system memory.

Change-Id: Ia50715204c4195deed3b469798f3626a2ea45d5c
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: kernel: export apis for getting memory info 07/271607/1
Dongwoo Lee [Wed, 23 Feb 2022 08:39:57 +0000 (17:39 +0900)]
util: kernel: export apis for getting memory info

Change-Id: Ibd7c78f61de9ffcc8b9635a42c779af550c61124
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: kernel: Read stationary values once 06/271606/1
Dongwoo Lee [Wed, 23 Feb 2022 07:58:04 +0000 (16:58 +0900)]
util: kernel: Read stationary values once

Since statinary kernel sysfs or procfs nodes is not have to be
read every time, it lets them being read once.

Change-Id: Icee5f825694867ecb84847fd46830274fe8219d3
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoresource: process: Handle pid, tgid into parsing nla types 14/271514/1
Dongwoo Lee [Mon, 21 Feb 2022 07:22:01 +0000 (16:22 +0900)]
resource: process: Handle pid, tgid into parsing nla types

To prevent pid, tgid is considered error case, add handling of them.

Change-Id: I3ef127312e860f8bf625a8427d5e40cfb68196cc
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoresource: Add process resource driver 56/271356/2
Dongwoo Lee [Fri, 4 Feb 2022 06:54:46 +0000 (15:54 +0900)]
resource: Add process resource driver

Process resource driver provides information about process using
procfs and taskstats.

[Detailed description of added system attributes]
PROCESS_CPU_UTIL:  It shows cpu usage including its all threads.
PROCESS_MEM_VIRT:  It shows all memory that the process can
access, including memory that is swapped out,
memory that is allocated, but not used, and
memory that is from shared libraries.
PROCESS_MEM_RSS:  It shows how much memory is allocated to that
process and is in RAM.
PROCESS_DISK_READ: It shows acutal disk read bytes per second.
PROCESS_DISK_WRITE: It shows acutal disk write bytes per second.

Change-Id: Iab4a76334fc786f068cbee396f3896184cbfff47
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: resource: Add missing NULL checking for setting interest mask 60/271260/6
Chanwoo Choi [Thu, 17 Feb 2022 09:16:05 +0000 (18:16 +0900)]
util: resource: Add missing NULL checking for setting interest mask

Change-Id: Ibd91d659b9f0c8fee73114b97fafdde2cd3118a9
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoresource: Add battery resource driver 56/271256/7
Chanwoo Choi [Thu, 17 Feb 2022 04:12:49 +0000 (13:12 +0900)]
resource: Add battery resource driver

Add battery resouce driver which read the Linux standard power_supply
interface to get the battery information.

[Detailed description of battery attributes]
- BATTERY_CAPACITY indicates the SoC (State of Charging)and unit is %.
- BATTERY_STATUS indicates the charging status.
- BATTERY_TEMPERATURE indicates the battery temperature.
- BATTERY_VOLTAGE_NOW indicates the voltage value now.
- BATTERY_CURRENT_NOW indicates the current value now.
- BATTERY_PRESENT indicates the connection status of battery.
- BATTERY_ONLINE indicates the connection status of charging cable.

Change-Id: I6011e155d3e401f82538abbccba7ba02e33d796b
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: common: Add sys_get_int helper funciton to get integer 55/271255/5
Chanwoo Choi [Thu, 17 Feb 2022 07:05:33 +0000 (16:05 +0900)]
util: common: Add sys_get_int helper funciton to get integer

Change-Id: I8eca9fe1bb1f0c95954d0439d0f398795a5421db
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoresource: memory: Add RESOURCE_DRIVER_NO_DEVICE flag 18/271218/12
Chanwoo Choi [Thu, 17 Feb 2022 03:21:06 +0000 (12:21 +0900)]
resource: memory: Add RESOURCE_DRIVER_NO_DEVICE flag

Add RESOURCE_DRIVER_NO_DEVICE flag because memory resouce device
is always existing and fix wrong word.

Change-Id: Iad20a8d7f68a38925c74460e1eda51ec7a1e5128
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoresource: Add system resource driver 12/271212/16
Chanwoo Choi [Thu, 10 Feb 2022 06:41:49 +0000 (15:41 +0900)]
resource: Add system resource driver

The system resource driver provides the system attributes expressing
the whole system information.

[Detailed description of added system attributes]
- SYSTEM_CPU_UTIL : Average cpu utilization of all cpus
- SYSTEM_CPU_USER_UTIL : Average cpu utilization of all cpus on user
- SYSTEM_CPU_SYS_UTIL : Average cpu utilization of all cpus on system
- SYSTEM_PER_CPU_UTIL : Per-cpu utilization of all cpus
- SYSTEM_PER_CPU_USER_UTIL : Per-cpu utilization on user
- SYSTEM_PER_CPU_SYS_UTIL : Per-cpu utilization on system
- SYSTEM_POSSIBLE_CPU : the number of all cpus regardless cpu online status.
- SYSTEM_ONLINE_CPU : the number of online cpu.

Change-Id: Ide1673e8dae0076bb5dd47002457d0ff0e43649b
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: resource: Add missing free operation for put_resource_attr_array 13/271213/10
Chanwoo Choi [Thu, 17 Feb 2022 03:11:01 +0000 (12:11 +0900)]
util: resource: Add missing free operation for put_resource_attr_array

Change-Id: I65f3eef225cc8601b52f99c987c70ce3209f14ea
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: resouce: Add missing function declaration of put functions 11/271211/10
Chanwoo Choi [Thu, 17 Feb 2022 02:07:24 +0000 (11:07 +0900)]
util: resouce: Add missing function declaration of put functions

Change-Id: I5f31f0727b1b61f54161e2d0814f97a85e7043a3
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: kernel: Add cpu utilization helper function 10/271210/9
Chanwoo Choi [Wed, 16 Feb 2022 07:51:54 +0000 (16:51 +0900)]
util: kernel: Add cpu utilization helper function

Add cpu utilization helper function as following:

[Detailed description of cpu utilization helper function]
int kernel_get_avg_cpu_util(struct cpu_util_data *avg_cpu)
: Store the average cpu utilization of all cpus to 'avg_cpu'

int kernel_get_per_cpu_util(struct cpu_util_data *cpus, int num_possible_cpus,
    int *num_online_cpus);
: Store the per-cpu utilization datas to 'cpus' and store the number of
online to 'num_online_cpus'

Change-Id: I1594dc656759194ffa9468ed6eebbc159a47e5fd
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: kernel: Add kernel helper funtion to get number of cpu 49/271149/4
Dongwoo Lee [Wed, 16 Feb 2022 03:40:42 +0000 (12:40 +0900)]
util: kernel: Add kernel helper funtion to get number of cpu

include/util/kernel.h provides helper function to get the information
from standardy linux kernel interface. This version provdies the
function to get the number of online/possible cpu.

Change-Id: I4c5ae5d73e3250b141e5aea69231b6e850790a25
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: resouce: Print attribute name when upate fail 91/270991/1
Chanwoo Choi [Fri, 11 Feb 2022 02:16:24 +0000 (11:16 +0900)]
util: resouce: Print attribute name when upate fail

Change-Id: I63524d282d7083663b580dea7edbd81b57b7e8b3
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoresource: display: Fix error when get_fps_info return null 90/270990/1
Chanwoo Choi [Thu, 10 Feb 2022 10:13:48 +0000 (19:13 +0900)]
resource: display: Fix error when get_fps_info return null

When enlightenment doesn't draw the anything, get_fps_info of enlightenment
doesn't return the fps information with null. DISPLAY_FPS returns the 0.0
for handling this case.

And add RESOURCE_DRIVER_NO_DEVICE flag to display resource driver.

Change-Id: I4087e97f49231ab45bd1ce88a17a0cca5baf3441
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: resource: Add preprocessing before updating attributes 83/270883/2
Dongwoo Lee [Thu, 10 Feb 2022 12:00:11 +0000 (21:00 +0900)]
util: resource: Add preprocessing before updating attributes

There are resource information to be shared between attributes, so as
to support these resources this introduces prepare_update(), the new
driver operation called before update_resource_attrs() automatically.
In order to prevent updating each resource individually, removes
get_resource_attr_*_sync() functions and prohibits calling
update_resource_attr() soley.

Change-Id: Id3c0b19c6b4a78a6c7a018d8ead7d95f2cd8f4f1
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: resource: Make resource has its own driver 82/270882/2
Dongwoo Lee [Thu, 10 Feb 2022 11:42:14 +0000 (20:42 +0900)]
util: resource: Make resource has its own driver

Change-Id: I5355dd10289ecd51546b7db26ee769439c17a734
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoresource: display: Fix build error 61/270861/1
Chanwoo Choi [Thu, 10 Feb 2022 08:14:48 +0000 (17:14 +0900)]
resource: display: Fix build error

Change-Id: I643f110698f1f623cf4a6478c03cb64306781abf
Fixes: cc6617bc6f29 ("resource: Add display resource driver")
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoresource: Add display resource driver 86/270786/3
Chanwoo Choi [Tue, 8 Feb 2022 10:22:29 +0000 (19:22 +0900)]
resource: Add display resource driver

The resource-display.c provides the display information
like FPS (Frame Per Second) as the display resource driver.
This version supportsthe only DISPLAY_FPS attribute.

Change-Id: I105fb0d463e4ce55cff48ddf291f642ea5ca723d
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: resource: Bypass checking device for virtual device 38/270838/2
Dongwoo Lee [Tue, 8 Feb 2022 10:38:52 +0000 (19:38 +0900)]
util: resource: Bypass checking device for virtual device

Change-Id: I07076a0549130d452d82e611011389bd58843d88
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: common: Add BIT operation 42/270842/1
Dongwoo Lee [Thu, 10 Feb 2022 04:06:19 +0000 (13:06 +0900)]
util: common: Add BIT operation

Change-Id: I6db6713364c702e16018bba092fbc39a344fd9d5
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: resource: Add init/exit ops for resource driver 37/270837/2
Dongwoo Lee [Mon, 7 Feb 2022 12:53:50 +0000 (21:53 +0900)]
util: resource: Add init/exit ops for resource driver

Change-Id: Ie71a2f7de493f198dc57d9daa0b939b3c9eb8e4b
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: resource: Remove unnecessary passing user_data parameter 36/270836/1
Dongwoo Lee [Mon, 7 Feb 2022 12:41:36 +0000 (21:41 +0900)]
util: resource: Remove unnecessary passing user_data parameter

Change-Id: Ie867d19c667c3a7a273d31719161d74137d3cf84
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: gdbus: Rename gdbus-util functions by removing the specific module name 85/270785/1
Chanwoo Choi [Tue, 8 Feb 2022 07:19:19 +0000 (16:19 +0900)]
util: gdbus: Rename gdbus-util functions by removing the specific module name

Rename gdbus-util functions by removing the specific module name
without any behavior changes.

Change-Id: I5d0265a985443a628d1265c371c444686ba7d88e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: gdbus-util: Fix memory leak issue 04/270704/2
Chanwoo Choi [Tue, 8 Feb 2022 03:08:46 +0000 (12:08 +0900)]
util: gdbus-util: Fix memory leak issue

Change-Id: I3df1d2edbeec17f14cf87ee55065922e0362ba5f
Reported-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Suggested-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agomonitor: Add monitor module 24/270624/5
Dongwoo Lee [Mon, 7 Feb 2022 05:24:56 +0000 (14:24 +0900)]
monitor: Add monitor module

This introduce the new pass module monitor which provides methods for
accessing or controlling resources in a common way. By just creating
and queuing a request, resource attributes are updated, and we can
exploit it easily. And attributes also can be filtered in order not
to take unnecessary attributes by set interest mask.

How to request resource update:
 1) create resource
 2) set interest attributes for resource
 3) create monitor command
 4) bind resource with command
 5) submit command (sync or async)
 6) if async) wait for done
 7) get attributes values by 'get' function as following the
    corresponding type
 8) PTR_TYPE, STRING_TYPE, ARRAY_TYPE attributes should be call 'put'
    function to release memory

Change-Id: I110e46b96691381629b8da619d3519c50e409693
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agomonitor: internal: Add pointer attribute data type 23/270623/3
Dongwoo Lee [Mon, 7 Feb 2022 05:19:39 +0000 (14:19 +0900)]
monitor: internal: Add pointer attribute data type

Change-Id: Id4d711e38a036b26a8a24af3b7e92ab4177d8445
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoresource: Rework attribute value handling 22/270622/3
Dongwoo Lee [Fri, 4 Feb 2022 07:24:35 +0000 (16:24 +0900)]
resource: Rework attribute value handling

Change-Id: I8777093c47963a84913b9f7388816cd8cd455d58
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: resource: Use internal interest_mask 20/270620/2
Dongwoo Lee [Fri, 4 Feb 2022 04:16:20 +0000 (13:16 +0900)]
util: resource: Use internal interest_mask

Since interesting attributes might not be changed usually, it seems
better that each resource has interest_mask internally.

Change-Id: I6276dbb688ee4a3c5f68eff323bce6c5b1e967a1
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agopass: Add resource_device for each h/w resource 02/270602/6
Chanwoo Choi [Sun, 6 Feb 2022 08:31:16 +0000 (17:31 +0900)]
pass: Add resource_device for each h/w resource

Change-Id: I1b124c8828f05103226d9d84558d45bb397cedba
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: resource: Add resource_device struct and functions 01/270601/4
Chanwoo Choi [Sun, 6 Feb 2022 08:13:48 +0000 (17:13 +0900)]
util: resource: Add resource_device struct and functions

Add resource_device structure for expressing the each h/w resource
such as CPU, GPU, Memory BUS, battery and so on.

Each h/w board has the different h/w resource information
such as the number of h/w resource, name, access path and so on.
PASS daemon has already supported the configuration method to get
the h/w resource information like /hal/etc/pass/pass.json.
Each h/w resource has the unique name, resource type and resource index
because board is able to have the one more same resource like big.LITTLE
cpu cluster.

When creating the instance of struct resource, will use the struct
resource_drvier and resource_device with resource type and index argument
because the user of create_resource() cannot get the unique resource name
which depends on the specific h/w. But the user of create_resource()
can get the available count of specific resource type by get_resource_device_*().

[How to create the instance of struct resource]
1. Find resource_device with resource type and index
2. Find resource_driver with resource type
3. Create the instance of struct resource by using resouce_device/driver info.

And rename from get_resource_driver to find_resource_driver.

Change-Id: I8c2fa6c8d22dcea996a12048fcab7de21eca652d
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agopass: rescon: Move overriable property into pass_rescon struct 00/270600/3
Chanwoo Choi [Sun, 6 Feb 2022 08:18:27 +0000 (17:18 +0900)]
pass: rescon: Move overriable property into pass_rescon struct

The 'overriable' property is used for only rescon module.
It means that be able to move 'overriable' property from struct pass_resource
to struct pass_rescon for more capsulation.

Change-Id: Icd63b1b25fb8dcb64fd1d9fd894d2b604f10ea22
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agolib: tmonitor: Add libpass skeleton package for Tizen Monitor (tmonitor) 23/270523/6
Chanwoo Choi [Fri, 4 Feb 2022 04:21:17 +0000 (13:21 +0900)]
lib: tmonitor: Add libpass skeleton package for Tizen Monitor (tmonitor)

Add libpass skelegon packages which contains the shared library and
header files. Initial version just contains the Tizen Monitor's
shared library and header file. But it just defines the tmonitor
interface without any detailed implementation. It shold be implemnted.

[Newlyd Added Packages]
- libpass-1.2.0-1.aarch64.rpm
- libpass-debuginfo-1.2.0-1.aarch64.rpm
- libpass-devel-1.2.0-1.aarch64.rpm

[File Hierarchy]

└── usr
    ├── include
    │   └── pass
    │       └── tmonitor.h
    ├── lib
    │   └── debug
    │       └── usr
    │           └── lib64
    │               └── libpass.so.0.1.0.debug
    ├── lib64
    │   ├── libpass.so -> libpass.so.0
    │   ├── libpass.so.0 -> libpass.so.0.1.0
    │   ├── libpass.so.0.1.0
    │   └── pkgconfig
    │       └── pass.pc
    └── share
        └── licenses
            └── libpass
                └── LICENSE

Change-Id: I28d0e07e70db80471b50e749991f375267c8a0cb
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agopass: Move pass.pc.in into packaging and remove unused files 18/270518/1
Chanwoo Choi [Fri, 4 Feb 2022 03:44:59 +0000 (12:44 +0900)]
pass: Move pass.pc.in into packaging and remove unused files

Move pass.pc.in into packaging directory and commit 469051e30f820
("pass: hal: Replace HAL interface with hal-api-power") has removed
the pass-hal-devel package. But, pass-hal-devel.pc.in/.manifest files
were not removed. Remove unused pass-hal-devel related files.

Change-Id: I7d568a8389c35c5d76064fbb844e76bb65a06a52
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: resource: Check data type is integer or not when getting value 17/270517/1
Chanwoo Choi [Fri, 4 Feb 2022 03:28:08 +0000 (12:28 +0900)]
util: resource: Check data type is integer or not when getting value

Each resource_attribute has the only one data type like integer, string
and so on. When using the getter function for specific data type such as
get_resource_attr_integer(), must need to check the data type of
resource attribute.

Change-Id: I868c31011d61efe05ae8a72966db462370408977
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoutil: resource: Enable updating resources with interest mask 69/270469/3
Dongwoo Lee [Thu, 3 Feb 2022 06:31:33 +0000 (15:31 +0900)]
util: resource: Enable updating resources with interest mask

Change-Id: I0ea7b2b9bae7ad1c5291307581cbfae78004400f
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: resource: Change resource attribute id 68/270468/3
Dongwoo Lee [Thu, 3 Feb 2022 06:31:21 +0000 (15:31 +0900)]
util: resource: Change resource attribute id

This do refactoring resource attribute ids can be distinguished by
bitfield operation.

Change-Id: I07da21e442f761ffc212cab4507f4d7cd48d73d5
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agomonitor: Rename monitor.h to monitor-internal.h 67/270467/2
Dongwoo Lee [Thu, 3 Feb 2022 06:31:16 +0000 (15:31 +0900)]
monitor: Rename monitor.h to monitor-internal.h

Change-Id: I2a6463736ec92ba808c56d7c1cc0c2f083e4588b
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: Add lock-free queue utility 66/270466/2
Dongwoo Lee [Thu, 3 Feb 2022 06:30:59 +0000 (15:30 +0900)]
util: Add lock-free queue utility

Now lock-free queue for supporting multi-thread without lock
contention will be provided.

Change-Id: I6459e397954c95831ca3b31359cb9136eb59705e
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: thread: Let thread use self-allocated memory 65/270465/2
Dongwoo Lee [Thu, 3 Feb 2022 06:30:50 +0000 (15:30 +0900)]
util: thread: Let thread use self-allocated memory

Make easy to use thread without concerning about memory using thread

Change-Id: I170fd0afe772f47554dca95f3f61afd6b38e2921
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: thread: Fix to unlock mutex before doing job 64/270464/2
Dongwoo Lee [Thu, 3 Feb 2022 06:30:36 +0000 (15:30 +0900)]
util: thread: Fix to unlock mutex before doing job

Change-Id: I1af301998cdae5c92ffd249b9c61dfb9696e8677
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: thread: Fix missing preprocessor 63/270463/2
Dongwoo Lee [Thu, 3 Feb 2022 06:30:18 +0000 (15:30 +0900)]
util: thread: Fix missing preprocessor

This corrects that thread header is missing preprocessor define to prevent
including it multiple times.

Change-Id: Ic66e09df0759cbd72e03979861485fe1961b80f7
Signed-off-by: Dongwoo Lee <dwlee08@gmail.com>
2 years agoresource: Add memory resource driver 74/270274/4
Sung-hun Kim [Thu, 27 Jan 2022 08:27:30 +0000 (17:27 +0900)]
resource: Add memory resource driver

Change-Id: I74291dac952a7cba3a7c56038081215cb05b7adb
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
2 years agoutil: monitor: Fix a typo 73/270273/2
Sung-hun Kim [Thu, 27 Jan 2022 08:26:20 +0000 (17:26 +0900)]
util: monitor: Fix a typo

Change-Id: I98c1d0f42073c15fddf460e79701c1a0819eb862
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
2 years agoutil: Add common thread utility 70/270170/3
Dongwoo Lee [Mon, 24 Jan 2022 12:35:42 +0000 (21:35 +0900)]
util: Add common thread utility

To support multi-thread by common utility, now three types of threads
are provided as like 'daemon', 'worker', and 'timer'.

Change-Id: Ie2ac65187cab0ce9ec41a5610fc0b99d08f9e42a
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
2 years agoutil: common: Move container_of macro to common.h 07/270007/3
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>
2 years agoresource: Add CPU/BUS/GPU resource driver 86/269986/6
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>
2 years agopass: resmon: Replace timer-related code with timer utility 85/269985/6
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>
2 years agoutil: timer: Add timer management 84/269984/6
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>
2 years agoutil: resource: Add resource management 83/269983/6
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>
2 years agomonitor: Define resource attribute id and data type 82/269982/4
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>
2 years agoutil: Change directgory name from include/pass to include/util 81/269981/4
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>
2 years agoutil: devices: Rename to init_devices and exit_devices 80/269980/4
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>
2 years agopass: Remove unneeded header including 78/269978/4
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>
2 years agopass: resmon: Use monitor id to identify timer instead of monitor type 77/269977/4
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>
2 years agopass: resmon: Remove dependency of monitor->result and monitor->ops 76/269976/3
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>
2 years agopass: resmon: Remove dependnecy of resource type 75/269975/2
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>
2 years agopass: rescon: Fix missing NULL check 12/270012/1
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>
2 years agopass: rescon: Fix overridable property 95/269395/2
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>
2 years agopass: Change directory name from core to util 73/268373/1
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>
2 years agopass: Allow level update only for overridable resources 60/265560/6
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>
2 years agopass: thermal: Add overridable property 59/265559/3
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>