cpuidle : Add support for pseudo-cpuidle driver
RFC v3 1/1 cpuidle : Add support for pseudo-cpuidle driver
This option adds support for a testing cpuidle driver, which allows user to define custom idle states with their respective latencies and residencies. This is useful for testing the behaviour of governors on customized set of idle states.
This can be used as of now by specifying a customized set of cpuidle states in the driver by the user. Will add the capability of this driver to be used as a module in subsequent patches.
Original idea and discussion for this patch can be found at:
https://lkml.org/lkml/2019/12/17/655
---
v1->v2 : Changes adapted from reviews of Randy, Dan and Nathan.
There was a divergence from expected behaviour of idle loop in v1. That has been fixed.
v2->v3 : Added simulated latency while entering into idle states.
drivers/cpuidle/Kconfig | 9 + drivers/cpuidle/Makefile | 1 + drivers/cpuidle/cpuidle-test.c | 289 +++++++++++++++++++++++++++++++++ 3 files changed, 299 insertions(+) create mode 100644 drivers/cpuidle/cpuidle-test.c
drivers/cpuidle/Kconfig +9 -0
@@ -71,6 +71,15 @@ config HALTPOLL_CPUIDLE before halting in the guest (more efficient than polling in the host via halt_poll_ns for some scenarios). +config TEST_CPUIDLE + tristate "cpuidle test driver" + default n + help + This option enables a testing cpuidle driver, which allows the user + to define custom idle states with their respective latencies & residencies. + This is useful for testing the behaviour of governors on different + sets of idle states. + endif config ARCH_NEEDS_CPU_IDLE_COUPLED
drivers/cpuidle/Makefile +1 -0
@@ -8,6 +8,7 @@ obj-$(CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED) += coupled.o obj-$(CONFIG_DT_IDLE_STATES) += dt_idle_states.o obj-$(CONFIG_ARCH_HAS_CPU_RELAX) += poll_state.o obj-$(CONFIG_HALTPOLL_CPUIDLE) += cpuidle-haltpoll.o +obj-$(CONFIG_TEST_CPUIDLE) += cpuidle-test.o ################################################################################## # ARM SoC drivers
drivers/cpuidle/cpuidle-test.c new file +289 -0
289 lines not on this page · raw message
Signature · 1 line
2.17.1
kernel test robot
build bot[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]
Hi Abhishek,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on pm/linux-next]
[also build test WARNING on linus/master linux/master v5.10-rc3 next-20201109] [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]
url: https://github.com/0day-ci/linux/commits/Abhishek-Goel/cpuidle-Add-support-for-pseudo-cpuidle-driver/20201109-142255 base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next config: sh-allmodconfig (attached as .config) compiler: sh4-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/1fb96577b34f9a7a8ca40bd5f7a8ca712fd2d363
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Abhishek-Goel/cpuidle-Add-support-for-pseudo-cpuidle-driver/20201109-142255 git checkout 1fb96577b34f9a7a8ca40bd5f7a8ca712fd2d363
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sh
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
drivers/cpuidle/cpuidle-test.c: In function 'add_cpuidle_states':
>> drivers/cpuidle/cpuidle-test.c:190:6: warning: variable 'rc' set but not used [-Wunused-but-set-variable]
190 | int rc;
| ^~vim +/rc +190 drivers/cpuidle/cpuidle-test.c
178
179 static int add_cpuidle_states(void)
180 {
181 /* Parse the module param and initialize the idle states here
182 * in cpuidle_state_table.
183 */
184 char *this_param;
185 char *input_name = name;
186 char *input_res = residency_us;
187 char *input_lat = latency_us;
188 int index = 1;
189 long temp;
> 190 int rc;
191
192 switch (sim_type) {
193 case 1:
194 cpuidle_state_table = cpuidle_states_ppc;
195 return 0;
196 case 2:
197 cpuidle_state_table = cpuidle_states_intel;
198 return 0;
199 case 3:
200 break;
201 default:
202 pr_warn("Sim value out of bound\n");
203 break;
204 }
205
206 if (strnlen(input_name, MAX_PARAM_LENGTH)) {
207 while ((this_param = strsep(&input_name, ",")) && index <= nr_states) {
208 strcpy(cpuidle_states[index].name, this_param);
209 cpuidle_states[index].enter = idle_loop;
210 index++;
211 }
212 }
213
214 if (strnlen(input_res, MAX_PARAM_LENGTH)) {
215 index = 1;
216 while ((this_param = strsep(&input_res, ",")) && index <= nr_states) {
217 rc = kstrtol(this_param, 10, &temp);
218 cpuidle_states[index].target_residency = temp;
219 index++;
220 }
221 }
222
223 if (strnlen(input_lat, MAX_PARAM_LENGTH)) {
224 index = 1;
225 while ((this_param = strsep(&input_lat, ",")) && index <= nr_states) {
226 rc = kstrtol(this_param, 10, &temp);
227 cpuidle_states[index].exit_latency = temp;
228 index++;
229 }
230 }
231
232 cpuidle_state_table = cpuidle_states;
233 return nr_states;
234 }
235
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]