All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 09/10] PM: EM: Implement em_notify_pd_created/updated().
  2025-06-13  9:44 [PATCH v2 00/10] PM: EM: Add netlink support for the energy model Changwoo Min
@ 2025-06-13  9:44 ` Changwoo Min
  2025-06-13 20:02   ` kernel test robot
  0 siblings, 1 reply; 3+ messages in thread
From: Changwoo Min @ 2025-06-13  9:44 UTC (permalink / raw)
  To: lukasz.luba, rafael, len.brown, pavel
  Cc: christian.loehle, tj, kernel-dev, linux-pm, sched-ext,
	linux-kernel, Changwoo Min

Implement two event notifications when a performance domain is created
(EM_CMD_PD_CREATED) and updated (EM_CMD_PD_UPDATED). The message format
of these two event notifications is the same as EM_CMD_GET_PD_TABLE --
containing the performance domain's ID and its energy model table.

Signed-off-by: Changwoo Min <changwoo@igalia.com>
---
 kernel/power/em_netlink.c | 38 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 36 insertions(+), 2 deletions(-)

diff --git a/kernel/power/em_netlink.c b/kernel/power/em_netlink.c
index 4e34799fd1f8..d42da92d1af4 100644
--- a/kernel/power/em_netlink.c
+++ b/kernel/power/em_netlink.c
@@ -215,14 +215,48 @@ int em_nl_get_pd_table_doit(struct sk_buff *skb, struct genl_info *info)
 
 
 /**************************** Event encoding *********************************/
+static int __em_notify_pd_table(const struct em_perf_domain *pd, int ntf_type)
+{
+	struct sk_buff *msg;
+	int msg_sz, ret;
+	void *hdr;
+
+	if (!genl_has_listeners(&em_nl_family, &init_net, EM_NLGRP_EVENT))
+		return 0;
+
+	msg_sz = __em_nl_get_pd_table_size(pd);
+
+	msg = genlmsg_new(msg_sz, GFP_KERNEL);
+	if (!msg)
+		return -ENOMEM;
+
+	hdr = genlmsg_put(msg, 0, 0, &em_nl_family, 0, ntf_type);
+	if (!hdr)
+		goto out_free_msg;
+
+	ret = __em_nl_get_pd_table(msg, pd);
+	if (ret)
+		goto out_free_msg;
+
+	genlmsg_end(msg, hdr);
+
+	genlmsg_multicast(&em_nl_family, msg, 0, EM_NLGRP_EVENT, GFP_KERNEL);
+
+	return 0;
+
+out_free_msg:
+	nlmsg_free(msg);
+	return ret;
+}
+
 int em_notify_pd_created(const struct em_perf_domain *pd)
 {
-	return -EOPNOTSUPP;
+	return __em_notify_pd_table(pd, EM_CMD_PD_CREATED);
 }
 
 int em_notify_pd_updated(const struct em_perf_domain *pd)
 {
-	return -EOPNOTSUPP;
+	return __em_notify_pd_table(pd, EM_CMD_PD_UPDATED);
 }
 
 static int __em_notify_pd_deleted_size(const struct em_perf_domain *pd)
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 09/10] PM: EM: Implement em_notify_pd_created/updated().
  2025-06-13  9:44 ` [PATCH v2 09/10] PM: EM: Implement em_notify_pd_created/updated() Changwoo Min
@ 2025-06-13 20:02   ` kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2025-06-13 20:02 UTC (permalink / raw)
  To: Changwoo Min, lukasz.luba, rafael, len.brown, pavel
  Cc: llvm, oe-kbuild-all, christian.loehle, tj, kernel-dev, linux-pm,
	sched-ext, linux-kernel, Changwoo Min

Hi Changwoo,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.16-rc1 next-20250613]
[cannot apply to amd-pstate/linux-next amd-pstate/bleeding-edge]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Changwoo-Min/PM-EM-Add-em-yaml-and-autogen-files/20250613-174859
base:   linus/master
patch link:    https://lore.kernel.org/r/20250613094428.267791-10-changwoo%40igalia.com
patch subject: [PATCH v2 09/10] PM: EM: Implement em_notify_pd_created/updated().
config: i386-randconfig-001-20250614 (https://download.01.org/0day-ci/archive/20250614/202506140306.tuIoz8rN-lkp@intel.com/config)
compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250614/202506140306.tuIoz8rN-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202506140306.tuIoz8rN-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> kernel/power/em_netlink.c:234:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
     234 |         if (!hdr)
         |             ^~~~
   kernel/power/em_netlink.c:249:9: note: uninitialized use occurs here
     249 |         return ret;
         |                ^~~
   kernel/power/em_netlink.c:234:2: note: remove the 'if' if its condition is always false
     234 |         if (!hdr)
         |         ^~~~~~~~~
     235 |                 goto out_free_msg;
         |                 ~~~~~~~~~~~~~~~~~
   kernel/power/em_netlink.c:221:17: note: initialize the variable 'ret' to silence this warning
     221 |         int msg_sz, ret;
         |                        ^
         |                         = 0
   1 warning generated.


vim +234 kernel/power/em_netlink.c

   215	
   216	
   217	/**************************** Event encoding *********************************/
   218	static int __em_notify_pd_table(const struct em_perf_domain *pd, int ntf_type)
   219	{
   220		struct sk_buff *msg;
   221		int msg_sz, ret;
   222		void *hdr;
   223	
   224		if (!genl_has_listeners(&em_nl_family, &init_net, EM_NLGRP_EVENT))
   225			return 0;
   226	
   227		msg_sz = __em_nl_get_pd_table_size(pd);
   228	
   229		msg = genlmsg_new(msg_sz, GFP_KERNEL);
   230		if (!msg)
   231			return -ENOMEM;
   232	
   233		hdr = genlmsg_put(msg, 0, 0, &em_nl_family, 0, ntf_type);
 > 234		if (!hdr)
   235			goto out_free_msg;
   236	
   237		ret = __em_nl_get_pd_table(msg, pd);
   238		if (ret)
   239			goto out_free_msg;
   240	
   241		genlmsg_end(msg, hdr);
   242	
   243		genlmsg_multicast(&em_nl_family, msg, 0, EM_NLGRP_EVENT, GFP_KERNEL);
   244	
   245		return 0;
   246	
   247	out_free_msg:
   248		nlmsg_free(msg);
   249		return ret;
   250	}
   251	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 09/10] PM: EM: Implement em_notify_pd_created/updated().
@ 2025-06-18  9:54 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2025-06-18  9:54 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20250613094428.267791-10-changwoo@igalia.com>
References: <20250613094428.267791-10-changwoo@igalia.com>
TO: Changwoo Min <changwoo@igalia.com>
TO: lukasz.luba@arm.com
TO: rafael@kernel.org
TO: len.brown@intel.com
TO: pavel@kernel.org
CC: christian.loehle@arm.com
CC: tj@kernel.org
CC: kernel-dev@igalia.com
CC: linux-pm@vger.kernel.org
CC: sched-ext@lists.linux.dev
CC: linux-kernel@vger.kernel.org
CC: Changwoo Min <changwoo@igalia.com>

Hi Changwoo,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.16-rc2 next-20250618]
[cannot apply to amd-pstate/linux-next amd-pstate/bleeding-edge]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Changwoo-Min/PM-EM-Add-em-yaml-and-autogen-files/20250613-174859
base:   linus/master
patch link:    https://lore.kernel.org/r/20250613094428.267791-10-changwoo%40igalia.com
patch subject: [PATCH v2 09/10] PM: EM: Implement em_notify_pd_created/updated().
:::::: branch date: 5 days ago
:::::: commit date: 5 days ago
config: x86_64-randconfig-161-20250618 (https://download.01.org/0day-ci/archive/20250618/202506181708.P4eRyPUC-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202506181708.P4eRyPUC-lkp@intel.com/

smatch warnings:
kernel/power/em_netlink.c:249 __em_notify_pd_table() error: uninitialized symbol 'ret'.

vim +/ret +249 kernel/power/em_netlink.c

24b309699bc739 Changwoo Min 2025-06-13  215  
b0668476cf48ef Changwoo Min 2025-06-13  216  
b0668476cf48ef Changwoo Min 2025-06-13  217  /**************************** Event encoding *********************************/
76ab710f256a78 Changwoo Min 2025-06-13  218  static int __em_notify_pd_table(const struct em_perf_domain *pd, int ntf_type)
76ab710f256a78 Changwoo Min 2025-06-13  219  {
76ab710f256a78 Changwoo Min 2025-06-13  220  	struct sk_buff *msg;
76ab710f256a78 Changwoo Min 2025-06-13  221  	int msg_sz, ret;
76ab710f256a78 Changwoo Min 2025-06-13  222  	void *hdr;
76ab710f256a78 Changwoo Min 2025-06-13  223  
76ab710f256a78 Changwoo Min 2025-06-13  224  	if (!genl_has_listeners(&em_nl_family, &init_net, EM_NLGRP_EVENT))
76ab710f256a78 Changwoo Min 2025-06-13  225  		return 0;
76ab710f256a78 Changwoo Min 2025-06-13  226  
76ab710f256a78 Changwoo Min 2025-06-13  227  	msg_sz = __em_nl_get_pd_table_size(pd);
76ab710f256a78 Changwoo Min 2025-06-13  228  
76ab710f256a78 Changwoo Min 2025-06-13  229  	msg = genlmsg_new(msg_sz, GFP_KERNEL);
76ab710f256a78 Changwoo Min 2025-06-13  230  	if (!msg)
76ab710f256a78 Changwoo Min 2025-06-13  231  		return -ENOMEM;
76ab710f256a78 Changwoo Min 2025-06-13  232  
76ab710f256a78 Changwoo Min 2025-06-13  233  	hdr = genlmsg_put(msg, 0, 0, &em_nl_family, 0, ntf_type);
76ab710f256a78 Changwoo Min 2025-06-13  234  	if (!hdr)
76ab710f256a78 Changwoo Min 2025-06-13  235  		goto out_free_msg;
76ab710f256a78 Changwoo Min 2025-06-13  236  
76ab710f256a78 Changwoo Min 2025-06-13  237  	ret = __em_nl_get_pd_table(msg, pd);
76ab710f256a78 Changwoo Min 2025-06-13  238  	if (ret)
76ab710f256a78 Changwoo Min 2025-06-13  239  		goto out_free_msg;
76ab710f256a78 Changwoo Min 2025-06-13  240  
76ab710f256a78 Changwoo Min 2025-06-13  241  	genlmsg_end(msg, hdr);
76ab710f256a78 Changwoo Min 2025-06-13  242  
76ab710f256a78 Changwoo Min 2025-06-13  243  	genlmsg_multicast(&em_nl_family, msg, 0, EM_NLGRP_EVENT, GFP_KERNEL);
76ab710f256a78 Changwoo Min 2025-06-13  244  
76ab710f256a78 Changwoo Min 2025-06-13  245  	return 0;
76ab710f256a78 Changwoo Min 2025-06-13  246  
76ab710f256a78 Changwoo Min 2025-06-13  247  out_free_msg:
76ab710f256a78 Changwoo Min 2025-06-13  248  	nlmsg_free(msg);
76ab710f256a78 Changwoo Min 2025-06-13 @249  	return ret;
76ab710f256a78 Changwoo Min 2025-06-13  250  }
76ab710f256a78 Changwoo Min 2025-06-13  251  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-06-18  9:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-18  9:54 [PATCH v2 09/10] PM: EM: Implement em_notify_pd_created/updated() kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2025-06-13  9:44 [PATCH v2 00/10] PM: EM: Add netlink support for the energy model Changwoo Min
2025-06-13  9:44 ` [PATCH v2 09/10] PM: EM: Implement em_notify_pd_created/updated() Changwoo Min
2025-06-13 20:02   ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.