Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

PM: EM: Rename em.yaml to dev-energymodel.yaml

The EM YNL specification used many acronyms, including ‘em’, ‘pd’,
‘ps’, etc. While the acronyms are short and convenient, they could be
confusing. So, let’s spell them out to be more specific. The following
changes were made in the spec. Note that the protocol name cannot exceed
GENL_NAMSIZ (16).

em -> dev-energymodel
pds -> perf-domains
pd -> perf-domain
pd-id -> perf-domain-id
pd-table -> perf-table
ps -> perf-state
get-pds -> get-perf-domains
get-pd-table -> get-perf-table
pd-created -> perf-domain-created
pd-updated -> perf-domain-updated
pd-deleted -> perf-domain-deleted

In addition. doc strings were added to the spec. based on the comments in
energy_model.h. Two flag attributes (perf-state-flags and
perf-domain-flags) were added for easily interpreting the bit flags.

Finally, the autogenerated files and em_netlink.c were updated accordingly
to reflect the name changes.

Suggested-by: Donald Hunter <donald.hunter@gmail.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Reviewed-by: Donald Hunter <donald.hunter@gmail.com>
Signed-off-by: Changwoo Min <changwoo@igalia.com>
Link: https://patch.msgid.link/20260108053212.642478-3-changwoo@igalia.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Changwoo Min and committed by
Rafael J. Wysocki
caa07a81 ebabc32d

+384 -266
+175
Documentation/netlink/specs/dev-energymodel.yaml
··· 1 + # SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 2 + # 3 + # Copyright (c) 2025 Valve Corporation. 4 + # 5 + --- 6 + name: dev-energymodel 7 + 8 + doc: | 9 + Energy model netlink interface to notify its changes. 10 + 11 + protocol: genetlink 12 + 13 + uapi-header: linux/dev_energymodel.h 14 + 15 + definitions: 16 + - 17 + type: flags 18 + name: perf-state-flags 19 + entries: 20 + - 21 + name: perf-state-inefficient 22 + doc: >- 23 + The performance state is inefficient. There is in this perf-domain, 24 + another performance state with a higher frequency but a lower or 25 + equal power cost. 26 + - 27 + type: flags 28 + name: perf-domain-flags 29 + entries: 30 + - 31 + name: perf-domain-microwatts 32 + doc: >- 33 + The power values are in micro-Watts or some other scale. 34 + - 35 + name: perf-domain-skip-inefficiencies 36 + doc: >- 37 + Skip inefficient states when estimating energy consumption. 38 + - 39 + name: perf-domain-artificial 40 + doc: >- 41 + The power values are artificial and might be created by platform 42 + missing real power information. 43 + 44 + attribute-sets: 45 + - 46 + name: perf-domains 47 + doc: >- 48 + Information on all the performance domains. 49 + attributes: 50 + - 51 + name: perf-domain 52 + type: nest 53 + nested-attributes: perf-domain 54 + multi-attr: true 55 + - 56 + name: perf-domain 57 + doc: >- 58 + Information on a single performance domains. 59 + attributes: 60 + - 61 + name: pad 62 + type: pad 63 + - 64 + name: perf-domain-id 65 + type: u32 66 + doc: >- 67 + A unique ID number for each performance domain. 68 + - 69 + name: flags 70 + type: u64 71 + doc: >- 72 + Bitmask of performance domain flags. 73 + enum: perf-domain-flags 74 + - 75 + name: cpus 76 + type: string 77 + doc: >- 78 + CPUs that belong to this performance domain. 79 + - 80 + name: perf-table 81 + doc: >- 82 + Performance states table. 83 + attributes: 84 + - 85 + name: perf-domain-id 86 + type: u32 87 + doc: >- 88 + A unique ID number for each performance domain. 89 + - 90 + name: perf-state 91 + type: nest 92 + nested-attributes: perf-state 93 + multi-attr: true 94 + - 95 + name: perf-state 96 + doc: >- 97 + Performance state of a performance domain. 98 + attributes: 99 + - 100 + name: pad 101 + type: pad 102 + - 103 + name: performance 104 + type: u64 105 + doc: >- 106 + CPU performance (capacity) at a given frequency. 107 + - 108 + name: frequency 109 + type: u64 110 + doc: >- 111 + The frequency in KHz, for consistency with CPUFreq. 112 + - 113 + name: power 114 + type: u64 115 + doc: >- 116 + The power consumed at this level (by 1 CPU or by a registered 117 + device). It can be a total power: static and dynamic. 118 + - 119 + name: cost 120 + type: u64 121 + doc: >- 122 + The cost coefficient associated with this level, used during energy 123 + calculation. Equal to: power * max_frequency / frequency. 124 + - 125 + name: flags 126 + type: u64 127 + doc: >- 128 + Bitmask of performance state flags. 129 + enum: perf-state-flags 130 + 131 + operations: 132 + list: 133 + - 134 + name: get-perf-domains 135 + attribute-set: perf-domains 136 + doc: Get the list of information for all performance domains. 137 + do: 138 + reply: 139 + attributes: 140 + - perf-domain 141 + - 142 + name: get-perf-table 143 + attribute-set: perf-table 144 + doc: Get the energy model table of a performance domain. 145 + do: 146 + request: 147 + attributes: 148 + - perf-domain-id 149 + reply: 150 + attributes: 151 + - perf-domain-id 152 + - perf-state 153 + - 154 + name: perf-domain-created 155 + doc: A performance domain is created. 156 + notify: get-perf-table 157 + mcgrp: event 158 + - 159 + name: perf-domain-updated 160 + doc: A performance domain is updated. 161 + notify: get-perf-table 162 + mcgrp: event 163 + - 164 + name: perf-domain-deleted 165 + doc: A performance domain is deleted. 166 + attribute-set: perf-table 167 + event: 168 + attributes: 169 + - perf-domain-id 170 + mcgrp: event 171 + 172 + mcast-groups: 173 + list: 174 + - 175 + name: event
-116
Documentation/netlink/specs/em.yaml
··· 1 - # SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 2 - # 3 - # Copyright (c) 2025 Valve Corporation. 4 - # 5 - --- 6 - name: em 7 - 8 - doc: | 9 - Energy model netlink interface to notify its changes. 10 - 11 - protocol: genetlink 12 - 13 - uapi-header: linux/energy_model.h 14 - 15 - attribute-sets: 16 - - 17 - name: pds 18 - attributes: 19 - - 20 - name: pd 21 - type: nest 22 - nested-attributes: pd 23 - multi-attr: true 24 - - 25 - name: pd 26 - attributes: 27 - - 28 - name: pad 29 - type: pad 30 - - 31 - name: pd-id 32 - type: u32 33 - - 34 - name: flags 35 - type: u64 36 - - 37 - name: cpus 38 - type: string 39 - - 40 - name: pd-table 41 - attributes: 42 - - 43 - name: pd-id 44 - type: u32 45 - - 46 - name: ps 47 - type: nest 48 - nested-attributes: ps 49 - multi-attr: true 50 - - 51 - name: ps 52 - attributes: 53 - - 54 - name: pad 55 - type: pad 56 - - 57 - name: performance 58 - type: u64 59 - - 60 - name: frequency 61 - type: u64 62 - - 63 - name: power 64 - type: u64 65 - - 66 - name: cost 67 - type: u64 68 - - 69 - name: flags 70 - type: u64 71 - 72 - operations: 73 - list: 74 - - 75 - name: get-pds 76 - attribute-set: pds 77 - doc: Get the list of information for all performance domains. 78 - do: 79 - reply: 80 - attributes: 81 - - pd 82 - - 83 - name: get-pd-table 84 - attribute-set: pd-table 85 - doc: Get the energy model table of a performance domain. 86 - do: 87 - request: 88 - attributes: 89 - - pd-id 90 - reply: 91 - attributes: 92 - - pd-id 93 - - ps 94 - - 95 - name: pd-created 96 - doc: A performance domain is created. 97 - notify: get-pd-table 98 - mcgrp: event 99 - - 100 - name: pd-updated 101 - doc: A performance domain is updated. 102 - notify: get-pd-table 103 - mcgrp: event 104 - - 105 - name: pd-deleted 106 - doc: A performance domain is deleted. 107 - attribute-set: pd-table 108 - event: 109 - attributes: 110 - - pd-id 111 - mcgrp: event 112 - 113 - mcast-groups: 114 - list: 115 - - 116 - name: event
+4 -4
MAINTAINERS
··· 9298 9298 M: "Rafael J. Wysocki" <rafael@kernel.org> 9299 9299 L: linux-pm@vger.kernel.org 9300 9300 S: Maintained 9301 - F: kernel/power/energy_model.c 9302 - F: include/linux/energy_model.h 9301 + F: Documentation/netlink/specs/dev-energymodel.yaml 9303 9302 F: Documentation/power/energy-model.rst 9304 - F: Documentation/netlink/specs/em.yaml 9305 - F: include/uapi/linux/energy_model.h 9303 + F: include/linux/energy_model.h 9304 + F: include/uapi/linux/dev_energymodel.h 9306 9305 F: kernel/power/em_netlink*.* 9306 + F: kernel/power/energy_model.c 9307 9307 9308 9308 EPAPR HYPERVISOR BYTE CHANNEL DEVICE DRIVER 9309 9309 M: Laurentiu Tudor <laurentiu.tudor@nxp.com>
+89
include/uapi/linux/dev_energymodel.h
··· 1 + /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ 2 + /* Do not edit directly, auto-generated from: */ 3 + /* Documentation/netlink/specs/dev-energymodel.yaml */ 4 + /* YNL-GEN uapi header */ 5 + /* To regenerate run: tools/net/ynl/ynl-regen.sh */ 6 + 7 + #ifndef _UAPI_LINUX_DEV_ENERGYMODEL_H 8 + #define _UAPI_LINUX_DEV_ENERGYMODEL_H 9 + 10 + #define DEV_ENERGYMODEL_FAMILY_NAME "dev-energymodel" 11 + #define DEV_ENERGYMODEL_FAMILY_VERSION 1 12 + 13 + /** 14 + * enum dev_energymodel_perf_state_flags 15 + * @DEV_ENERGYMODEL_PERF_STATE_FLAGS_PERF_STATE_INEFFICIENT: The performance 16 + * state is inefficient. There is in this perf-domain, another performance 17 + * state with a higher frequency but a lower or equal power cost. 18 + */ 19 + enum dev_energymodel_perf_state_flags { 20 + DEV_ENERGYMODEL_PERF_STATE_FLAGS_PERF_STATE_INEFFICIENT = 1, 21 + }; 22 + 23 + /** 24 + * enum dev_energymodel_perf_domain_flags 25 + * @DEV_ENERGYMODEL_PERF_DOMAIN_FLAGS_PERF_DOMAIN_MICROWATTS: The power values 26 + * are in micro-Watts or some other scale. 27 + * @DEV_ENERGYMODEL_PERF_DOMAIN_FLAGS_PERF_DOMAIN_SKIP_INEFFICIENCIES: Skip 28 + * inefficient states when estimating energy consumption. 29 + * @DEV_ENERGYMODEL_PERF_DOMAIN_FLAGS_PERF_DOMAIN_ARTIFICIAL: The power values 30 + * are artificial and might be created by platform missing real power 31 + * information. 32 + */ 33 + enum dev_energymodel_perf_domain_flags { 34 + DEV_ENERGYMODEL_PERF_DOMAIN_FLAGS_PERF_DOMAIN_MICROWATTS = 1, 35 + DEV_ENERGYMODEL_PERF_DOMAIN_FLAGS_PERF_DOMAIN_SKIP_INEFFICIENCIES = 2, 36 + DEV_ENERGYMODEL_PERF_DOMAIN_FLAGS_PERF_DOMAIN_ARTIFICIAL = 4, 37 + }; 38 + 39 + enum { 40 + DEV_ENERGYMODEL_A_PERF_DOMAINS_PERF_DOMAIN = 1, 41 + 42 + __DEV_ENERGYMODEL_A_PERF_DOMAINS_MAX, 43 + DEV_ENERGYMODEL_A_PERF_DOMAINS_MAX = (__DEV_ENERGYMODEL_A_PERF_DOMAINS_MAX - 1) 44 + }; 45 + 46 + enum { 47 + DEV_ENERGYMODEL_A_PERF_DOMAIN_PAD = 1, 48 + DEV_ENERGYMODEL_A_PERF_DOMAIN_PERF_DOMAIN_ID, 49 + DEV_ENERGYMODEL_A_PERF_DOMAIN_FLAGS, 50 + DEV_ENERGYMODEL_A_PERF_DOMAIN_CPUS, 51 + 52 + __DEV_ENERGYMODEL_A_PERF_DOMAIN_MAX, 53 + DEV_ENERGYMODEL_A_PERF_DOMAIN_MAX = (__DEV_ENERGYMODEL_A_PERF_DOMAIN_MAX - 1) 54 + }; 55 + 56 + enum { 57 + DEV_ENERGYMODEL_A_PERF_TABLE_PERF_DOMAIN_ID = 1, 58 + DEV_ENERGYMODEL_A_PERF_TABLE_PERF_STATE, 59 + 60 + __DEV_ENERGYMODEL_A_PERF_TABLE_MAX, 61 + DEV_ENERGYMODEL_A_PERF_TABLE_MAX = (__DEV_ENERGYMODEL_A_PERF_TABLE_MAX - 1) 62 + }; 63 + 64 + enum { 65 + DEV_ENERGYMODEL_A_PERF_STATE_PAD = 1, 66 + DEV_ENERGYMODEL_A_PERF_STATE_PERFORMANCE, 67 + DEV_ENERGYMODEL_A_PERF_STATE_FREQUENCY, 68 + DEV_ENERGYMODEL_A_PERF_STATE_POWER, 69 + DEV_ENERGYMODEL_A_PERF_STATE_COST, 70 + DEV_ENERGYMODEL_A_PERF_STATE_FLAGS, 71 + 72 + __DEV_ENERGYMODEL_A_PERF_STATE_MAX, 73 + DEV_ENERGYMODEL_A_PERF_STATE_MAX = (__DEV_ENERGYMODEL_A_PERF_STATE_MAX - 1) 74 + }; 75 + 76 + enum { 77 + DEV_ENERGYMODEL_CMD_GET_PERF_DOMAINS = 1, 78 + DEV_ENERGYMODEL_CMD_GET_PERF_TABLE, 79 + DEV_ENERGYMODEL_CMD_PERF_DOMAIN_CREATED, 80 + DEV_ENERGYMODEL_CMD_PERF_DOMAIN_UPDATED, 81 + DEV_ENERGYMODEL_CMD_PERF_DOMAIN_DELETED, 82 + 83 + __DEV_ENERGYMODEL_CMD_MAX, 84 + DEV_ENERGYMODEL_CMD_MAX = (__DEV_ENERGYMODEL_CMD_MAX - 1) 85 + }; 86 + 87 + #define DEV_ENERGYMODEL_MCGRP_EVENT "event" 88 + 89 + #endif /* _UAPI_LINUX_DEV_ENERGYMODEL_H */
-63
include/uapi/linux/energy_model.h
··· 1 - /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ 2 - /* Do not edit directly, auto-generated from: */ 3 - /* Documentation/netlink/specs/em.yaml */ 4 - /* YNL-GEN uapi header */ 5 - /* To regenerate run: tools/net/ynl/ynl-regen.sh */ 6 - 7 - #ifndef _UAPI_LINUX_ENERGY_MODEL_H 8 - #define _UAPI_LINUX_ENERGY_MODEL_H 9 - 10 - #define EM_FAMILY_NAME "em" 11 - #define EM_FAMILY_VERSION 1 12 - 13 - enum { 14 - EM_A_PDS_PD = 1, 15 - 16 - __EM_A_PDS_MAX, 17 - EM_A_PDS_MAX = (__EM_A_PDS_MAX - 1) 18 - }; 19 - 20 - enum { 21 - EM_A_PD_PAD = 1, 22 - EM_A_PD_PD_ID, 23 - EM_A_PD_FLAGS, 24 - EM_A_PD_CPUS, 25 - 26 - __EM_A_PD_MAX, 27 - EM_A_PD_MAX = (__EM_A_PD_MAX - 1) 28 - }; 29 - 30 - enum { 31 - EM_A_PD_TABLE_PD_ID = 1, 32 - EM_A_PD_TABLE_PS, 33 - 34 - __EM_A_PD_TABLE_MAX, 35 - EM_A_PD_TABLE_MAX = (__EM_A_PD_TABLE_MAX - 1) 36 - }; 37 - 38 - enum { 39 - EM_A_PS_PAD = 1, 40 - EM_A_PS_PERFORMANCE, 41 - EM_A_PS_FREQUENCY, 42 - EM_A_PS_POWER, 43 - EM_A_PS_COST, 44 - EM_A_PS_FLAGS, 45 - 46 - __EM_A_PS_MAX, 47 - EM_A_PS_MAX = (__EM_A_PS_MAX - 1) 48 - }; 49 - 50 - enum { 51 - EM_CMD_GET_PDS = 1, 52 - EM_CMD_GET_PD_TABLE, 53 - EM_CMD_PD_CREATED, 54 - EM_CMD_PD_UPDATED, 55 - EM_CMD_PD_DELETED, 56 - 57 - __EM_CMD_MAX, 58 - EM_CMD_MAX = (__EM_CMD_MAX - 1) 59 - }; 60 - 61 - #define EM_MCGRP_EVENT "event" 62 - 63 - #endif /* _UAPI_LINUX_ENERGY_MODEL_H */
+83 -52
kernel/power/em_netlink.c
··· 12 12 #include <linux/energy_model.h> 13 13 #include <net/sock.h> 14 14 #include <net/genetlink.h> 15 - #include <uapi/linux/energy_model.h> 15 + #include <uapi/linux/dev_energymodel.h> 16 16 17 17 #include "em_netlink.h" 18 18 #include "em_netlink_autogen.h" 19 19 20 - #define EM_A_PD_CPUS_LEN 256 20 + #define DEV_ENERGYMODEL_A_PERF_DOMAIN_CPUS_LEN 256 21 21 22 22 /*************************** Command encoding ********************************/ 23 23 static int __em_nl_get_pd_size(struct em_perf_domain *pd, void *data) 24 24 { 25 - char cpus_buf[EM_A_PD_CPUS_LEN]; 25 + char cpus_buf[DEV_ENERGYMODEL_A_PERF_DOMAIN_CPUS_LEN]; 26 26 int *tot_msg_sz = data; 27 27 int msg_sz, cpus_sz; 28 28 29 29 cpus_sz = snprintf(cpus_buf, sizeof(cpus_buf), "%*pb", 30 30 cpumask_pr_args(to_cpumask(pd->cpus))); 31 31 32 - msg_sz = nla_total_size(0) + /* EM_A_PDS_PD */ 33 - nla_total_size(sizeof(u32)) + /* EM_A_PD_PD_ID */ 34 - nla_total_size_64bit(sizeof(u64)) + /* EM_A_PD_FLAGS */ 35 - nla_total_size(cpus_sz); /* EM_A_PD_CPUS */ 32 + msg_sz = nla_total_size(0) + 33 + /* DEV_ENERGYMODEL_A_PERF_DOMAINS_PERF_DOMAIN */ 34 + nla_total_size(sizeof(u32)) + 35 + /* DEV_ENERGYMODEL_A_PERF_DOMAIN_PERF_DOMAIN_ID */ 36 + nla_total_size_64bit(sizeof(u64)) + 37 + /* DEV_ENERGYMODEL_A_PERF_DOMAIN_FLAGS */ 38 + nla_total_size(cpus_sz); 39 + /* DEV_ENERGYMODEL_A_PERF_DOMAIN_CPUS */ 36 40 37 41 *tot_msg_sz += nlmsg_total_size(genlmsg_msg_size(msg_sz)); 38 42 return 0; ··· 44 40 45 41 static int __em_nl_get_pd(struct em_perf_domain *pd, void *data) 46 42 { 47 - char cpus_buf[EM_A_PD_CPUS_LEN]; 43 + char cpus_buf[DEV_ENERGYMODEL_A_PERF_DOMAIN_CPUS_LEN]; 48 44 struct sk_buff *msg = data; 49 45 struct nlattr *entry; 50 46 51 - entry = nla_nest_start(msg, EM_A_PDS_PD); 47 + entry = nla_nest_start(msg, 48 + DEV_ENERGYMODEL_A_PERF_DOMAINS_PERF_DOMAIN); 52 49 if (!entry) 53 50 goto out_cancel_nest; 54 51 55 - if (nla_put_u32(msg, EM_A_PD_PD_ID, pd->id)) 52 + if (nla_put_u32(msg, DEV_ENERGYMODEL_A_PERF_DOMAIN_PERF_DOMAIN_ID, 53 + pd->id)) 56 54 goto out_cancel_nest; 57 55 58 - if (nla_put_u64_64bit(msg, EM_A_PD_FLAGS, pd->flags, EM_A_PD_PAD)) 56 + if (nla_put_u64_64bit(msg, DEV_ENERGYMODEL_A_PERF_DOMAIN_FLAGS, 57 + pd->flags, DEV_ENERGYMODEL_A_PERF_DOMAIN_PAD)) 59 58 goto out_cancel_nest; 60 59 61 60 snprintf(cpus_buf, sizeof(cpus_buf), "%*pb", 62 61 cpumask_pr_args(to_cpumask(pd->cpus))); 63 - if (nla_put_string(msg, EM_A_PD_CPUS, cpus_buf)) 62 + if (nla_put_string(msg, DEV_ENERGYMODEL_A_PERF_DOMAIN_CPUS, cpus_buf)) 64 63 goto out_cancel_nest; 65 64 66 65 nla_nest_end(msg, entry); ··· 76 69 return -EMSGSIZE; 77 70 } 78 71 79 - int em_nl_get_pds_doit(struct sk_buff *skb, struct genl_info *info) 72 + int dev_energymodel_nl_get_perf_domains_doit(struct sk_buff *skb, 73 + struct genl_info *info) 80 74 { 81 75 struct sk_buff *msg; 82 76 void *hdr; ··· 90 82 if (!msg) 91 83 return -ENOMEM; 92 84 93 - hdr = genlmsg_put_reply(msg, info, &em_nl_family, 0, cmd); 85 + hdr = genlmsg_put_reply(msg, info, &dev_energymodel_nl_family, 0, cmd); 94 86 if (!hdr) 95 87 goto out_free_msg; 96 88 ··· 115 107 struct em_perf_domain *pd; 116 108 int id; 117 109 118 - if (!attrs[EM_A_PD_TABLE_PD_ID]) 110 + if (!attrs[DEV_ENERGYMODEL_A_PERF_TABLE_PERF_DOMAIN_ID]) 119 111 return NULL; 120 112 121 - id = nla_get_u32(attrs[EM_A_PD_TABLE_PD_ID]); 113 + id = nla_get_u32(attrs[DEV_ENERGYMODEL_A_PERF_TABLE_PERF_DOMAIN_ID]); 122 114 pd = em_perf_domain_get_by_id(id); 123 115 return pd; 124 116 } ··· 127 119 { 128 120 int id_sz, ps_sz; 129 121 130 - id_sz = nla_total_size(sizeof(u32)); /* EM_A_PD_TABLE_PD_ID */ 131 - ps_sz = nla_total_size(0) + /* EM_A_PD_TABLE_PS */ 132 - nla_total_size_64bit(sizeof(u64)) + /* EM_A_PS_PERFORMANCE */ 133 - nla_total_size_64bit(sizeof(u64)) + /* EM_A_PS_FREQUENCY */ 134 - nla_total_size_64bit(sizeof(u64)) + /* EM_A_PS_POWER */ 135 - nla_total_size_64bit(sizeof(u64)) + /* EM_A_PS_COST */ 136 - nla_total_size_64bit(sizeof(u64)); /* EM_A_PS_FLAGS */ 122 + id_sz = nla_total_size(sizeof(u32)); 123 + /* DEV_ENERGYMODEL_A_PERF_TABLE_PERF_DOMAIN_ID */ 124 + ps_sz = nla_total_size(0) + 125 + /* DEV_ENERGYMODEL_A_PERF_TABLE_PERF_STATE */ 126 + nla_total_size_64bit(sizeof(u64)) + 127 + /* DEV_ENERGYMODEL_A_PERF_STATE_PERFORMANCE */ 128 + nla_total_size_64bit(sizeof(u64)) + 129 + /* DEV_ENERGYMODEL_A_PERF_STATE_FREQUENCY */ 130 + nla_total_size_64bit(sizeof(u64)) + 131 + /* DEV_ENERGYMODEL_A_PERF_STATE_POWER */ 132 + nla_total_size_64bit(sizeof(u64)) + 133 + /* DEV_ENERGYMODEL_A_PERF_STATE_COST */ 134 + nla_total_size_64bit(sizeof(u64)); 135 + /* DEV_ENERGYMODEL_A_PERF_STATE_FLAGS */ 137 136 ps_sz *= pd->nr_perf_states; 138 137 139 138 return nlmsg_total_size(genlmsg_msg_size(id_sz + ps_sz)); 140 139 } 141 140 142 - static int __em_nl_get_pd_table(struct sk_buff *msg, const struct em_perf_domain *pd) 141 + static 142 + int __em_nl_get_pd_table(struct sk_buff *msg, const struct em_perf_domain *pd) 143 143 { 144 144 struct em_perf_state *table, *ps; 145 145 struct nlattr *entry; 146 146 int i; 147 147 148 - if (nla_put_u32(msg, EM_A_PD_TABLE_PD_ID, pd->id)) 148 + if (nla_put_u32(msg, DEV_ENERGYMODEL_A_PERF_TABLE_PERF_DOMAIN_ID, 149 + pd->id)) 149 150 goto out_err; 150 151 151 152 rcu_read_lock(); ··· 163 146 for (i = 0; i < pd->nr_perf_states; i++) { 164 147 ps = &table[i]; 165 148 166 - entry = nla_nest_start(msg, EM_A_PD_TABLE_PS); 149 + entry = nla_nest_start(msg, 150 + DEV_ENERGYMODEL_A_PERF_TABLE_PERF_STATE); 167 151 if (!entry) 168 152 goto out_unlock_ps; 169 153 170 - if (nla_put_u64_64bit(msg, EM_A_PS_PERFORMANCE, 171 - ps->performance, EM_A_PS_PAD)) 154 + if (nla_put_u64_64bit(msg, 155 + DEV_ENERGYMODEL_A_PERF_STATE_PERFORMANCE, 156 + ps->performance, 157 + DEV_ENERGYMODEL_A_PERF_STATE_PAD)) 172 158 goto out_cancel_ps_nest; 173 - if (nla_put_u64_64bit(msg, EM_A_PS_FREQUENCY, 174 - ps->frequency, EM_A_PS_PAD)) 159 + if (nla_put_u64_64bit(msg, 160 + DEV_ENERGYMODEL_A_PERF_STATE_FREQUENCY, 161 + ps->frequency, 162 + DEV_ENERGYMODEL_A_PERF_STATE_PAD)) 175 163 goto out_cancel_ps_nest; 176 - if (nla_put_u64_64bit(msg, EM_A_PS_POWER, 177 - ps->power, EM_A_PS_PAD)) 164 + if (nla_put_u64_64bit(msg, 165 + DEV_ENERGYMODEL_A_PERF_STATE_POWER, 166 + ps->power, 167 + DEV_ENERGYMODEL_A_PERF_STATE_PAD)) 178 168 goto out_cancel_ps_nest; 179 - if (nla_put_u64_64bit(msg, EM_A_PS_COST, 180 - ps->cost, EM_A_PS_PAD)) 169 + if (nla_put_u64_64bit(msg, 170 + DEV_ENERGYMODEL_A_PERF_STATE_COST, 171 + ps->cost, 172 + DEV_ENERGYMODEL_A_PERF_STATE_PAD)) 181 173 goto out_cancel_ps_nest; 182 - if (nla_put_u64_64bit(msg, EM_A_PS_FLAGS, 183 - ps->flags, EM_A_PS_PAD)) 174 + if (nla_put_u64_64bit(msg, 175 + DEV_ENERGYMODEL_A_PERF_STATE_FLAGS, 176 + ps->flags, 177 + DEV_ENERGYMODEL_A_PERF_STATE_PAD)) 184 178 goto out_cancel_ps_nest; 185 179 186 180 nla_nest_end(msg, entry); ··· 207 179 return -EMSGSIZE; 208 180 } 209 181 210 - int em_nl_get_pd_table_doit(struct sk_buff *skb, struct genl_info *info) 182 + int dev_energymodel_nl_get_perf_table_doit(struct sk_buff *skb, 183 + struct genl_info *info) 211 184 { 212 185 int cmd = info->genlhdr->cmd; 213 186 int msg_sz, ret = -EMSGSIZE; ··· 226 197 if (!msg) 227 198 return -ENOMEM; 228 199 229 - hdr = genlmsg_put_reply(msg, info, &em_nl_family, 0, cmd); 200 + hdr = genlmsg_put_reply(msg, info, &dev_energymodel_nl_family, 0, cmd); 230 201 if (!hdr) 231 202 goto out_free_msg; 232 203 ··· 250 221 int msg_sz, ret = -EMSGSIZE; 251 222 void *hdr; 252 223 253 - if (!genl_has_listeners(&em_nl_family, &init_net, EM_NLGRP_EVENT)) 224 + if (!genl_has_listeners(&dev_energymodel_nl_family, &init_net, DEV_ENERGYMODEL_NLGRP_EVENT)) 254 225 return; 255 226 256 227 msg_sz = __em_nl_get_pd_table_size(pd); ··· 259 230 if (!msg) 260 231 return; 261 232 262 - hdr = genlmsg_put(msg, 0, 0, &em_nl_family, 0, ntf_type); 233 + hdr = genlmsg_put(msg, 0, 0, &dev_energymodel_nl_family, 0, ntf_type); 263 234 if (!hdr) 264 235 goto out_free_msg; 265 236 ··· 269 240 270 241 genlmsg_end(msg, hdr); 271 242 272 - genlmsg_multicast(&em_nl_family, msg, 0, EM_NLGRP_EVENT, GFP_KERNEL); 243 + genlmsg_multicast(&dev_energymodel_nl_family, msg, 0, 244 + DEV_ENERGYMODEL_NLGRP_EVENT, GFP_KERNEL); 273 245 274 246 return; 275 247 276 248 out_free_msg: 277 249 nlmsg_free(msg); 278 - return; 279 250 } 280 251 281 252 void em_notify_pd_created(const struct em_perf_domain *pd) 282 253 { 283 - __em_notify_pd_table(pd, EM_CMD_PD_CREATED); 254 + __em_notify_pd_table(pd, DEV_ENERGYMODEL_CMD_PERF_DOMAIN_CREATED); 284 255 } 285 256 286 257 void em_notify_pd_updated(const struct em_perf_domain *pd) 287 258 { 288 - __em_notify_pd_table(pd, EM_CMD_PD_UPDATED); 259 + __em_notify_pd_table(pd, DEV_ENERGYMODEL_CMD_PERF_DOMAIN_UPDATED); 289 260 } 290 261 291 262 static int __em_notify_pd_deleted_size(const struct em_perf_domain *pd) 292 263 { 293 - int id_sz = nla_total_size(sizeof(u32)); /* EM_A_PD_TABLE_PD_ID */ 264 + int id_sz = nla_total_size(sizeof(u32)); /* DEV_ENERGYMODEL_A_PERF_TABLE_PERF_DOMAIN_ID */ 294 265 295 266 return nlmsg_total_size(genlmsg_msg_size(id_sz)); 296 267 } ··· 301 272 void *hdr; 302 273 int msg_sz; 303 274 304 - if (!genl_has_listeners(&em_nl_family, &init_net, EM_NLGRP_EVENT)) 275 + if (!genl_has_listeners(&dev_energymodel_nl_family, &init_net, 276 + DEV_ENERGYMODEL_NLGRP_EVENT)) 305 277 return; 306 278 307 279 msg_sz = __em_notify_pd_deleted_size(pd); ··· 311 281 if (!msg) 312 282 return; 313 283 314 - hdr = genlmsg_put(msg, 0, 0, &em_nl_family, 0, EM_CMD_PD_DELETED); 284 + hdr = genlmsg_put(msg, 0, 0, &dev_energymodel_nl_family, 0, 285 + DEV_ENERGYMODEL_CMD_PERF_DOMAIN_DELETED); 315 286 if (!hdr) 316 287 goto out_free_msg; 317 288 318 - if (nla_put_u32(msg, EM_A_PD_TABLE_PD_ID, pd->id)) { 289 + if (nla_put_u32(msg, DEV_ENERGYMODEL_A_PERF_TABLE_PERF_DOMAIN_ID, 290 + pd->id)) 319 291 goto out_free_msg; 320 - } 321 292 322 293 genlmsg_end(msg, hdr); 323 294 324 - genlmsg_multicast(&em_nl_family, msg, 0, EM_NLGRP_EVENT, GFP_KERNEL); 295 + genlmsg_multicast(&dev_energymodel_nl_family, msg, 0, 296 + DEV_ENERGYMODEL_NLGRP_EVENT, GFP_KERNEL); 325 297 326 298 return; 327 299 328 300 out_free_msg: 329 301 nlmsg_free(msg); 330 - return; 331 302 } 332 303 333 304 /**************************** Initialization *********************************/ 334 305 static int __init em_netlink_init(void) 335 306 { 336 - return genl_register_family(&em_nl_family); 307 + return genl_register_family(&dev_energymodel_nl_family); 337 308 } 338 309 postcore_initcall(em_netlink_init);