lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <201806012346.WE8DWjyB%fengguang.wu@intel.com>
Date:   Sat, 2 Jun 2018 00:39:02 +0800
From:   kbuild test robot <lkp@...el.com>
To:     Akshay Adiga <akshay.adiga@...ux.vnet.ibm.com>
Cc:     kbuild-all@...org, linux-kernel@...r.kernel.org,
        linuxppc-dev@...ts.ozlabs.org, stewart@...ux.vnet.ibm.com,
        svaidy@...ux.vnet.ibm.com, ego@...ux.vnet.ibm.com,
        mpe@...erman.id.au, Akshay Adiga <akshay.adiga@...ux.vnet.ibm.com>
Subject: Re: [PATCH] [SCHEME 2]powernv/cpuidle: Add support for new idle
 state device-tree format

Hi Akshay,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on powerpc/next]
[also build test ERROR on v4.17-rc7 next-20180531]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Akshay-Adiga/powernv-cpuidle-Add-support-for-new-idle-state-device-tree-format/20180601-202708
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-allmodconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=powerpc 

All errors (new ones prefixed by >>):

   drivers//cpuidle/cpuidle-powernv.c: In function 'powernv_add_idle_states':
>> drivers//cpuidle/cpuidle-powernv.c:403:36: error: 'versions' undeclared (first use in this function)
        "ibm,cpu-idle-state-versions", versions, additional_states) < 0) {
                                       ^~~~~~~~
   drivers//cpuidle/cpuidle-powernv.c:403:36: note: each undeclared identifier is reported only once for each function it appears in
>> drivers//cpuidle/cpuidle-powernv.c:436:17: error: 'version' undeclared (first use in this function); did you mean 'versions'?
      if (!( strcmp(version[i] , "ibm,idle-state-v1"))
                    ^~~~~~~
                    versions
>> drivers//cpuidle/cpuidle-powernv.c:437:5: error: expected ')' before 'continue'
        continue;
        ^~~~~~~~
>> drivers//cpuidle/cpuidle-powernv.c:511:2: error: expected expression before '}' token
     }
     ^
   drivers//cpuidle/cpuidle-powernv.c:426:8: warning: unused variable 'stops_timebase' [-Wunused-variable]
      bool stops_timebase = false;
           ^~~~~~~~~~~~~~
   drivers//cpuidle/cpuidle-powernv.c:425:30: warning: unused variable 'target_residency' [-Wunused-variable]
      unsigned int exit_latency, target_residency;
                                 ^~~~~~~~~~~~~~~~
   drivers//cpuidle/cpuidle-powernv.c:425:16: warning: unused variable 'exit_latency' [-Wunused-variable]
      unsigned int exit_latency, target_residency;
                   ^~~~~~~~~~~~
   At top level:
   drivers//cpuidle/cpuidle-powernv.c:121:12: warning: 'stop_loop' defined but not used [-Wunused-function]
    static int stop_loop(struct cpuidle_device *dev,
               ^~~~~~~~~
   drivers//cpuidle/cpuidle-powernv.c:95:12: warning: 'fastsleep_loop' defined but not used [-Wunused-function]
    static int fastsleep_loop(struct cpuidle_device *dev,
               ^~~~~~~~~~~~~~
   drivers//cpuidle/cpuidle-powernv.c:84:12: warning: 'nap_loop' defined but not used [-Wunused-function]
    static int nap_loop(struct cpuidle_device *dev,
               ^~~~~~~~

vim +/versions +403 drivers//cpuidle/cpuidle-powernv.c

   240	
   241	extern u32 pnv_get_supported_cpuidle_states(void);
   242	static int powernv_add_idle_states(void)
   243	{
   244		struct device_node *power_mgt,*np_new;
   245		int nr_idle_states = 1; /* Snooze */
   246		int dt_idle_states, count, additional_states;
   247		u32 latency_ns[CPUIDLE_STATE_MAX];
   248		u32 residency_ns[CPUIDLE_STATE_MAX];
   249		u32 flags[CPUIDLE_STATE_MAX];
   250		u64 psscr_val[CPUIDLE_STATE_MAX];
   251		u64 psscr_mask[CPUIDLE_STATE_MAX];
   252		const char *names[CPUIDLE_STATE_MAX];
   253		u32 has_stop_states = 0;
   254		int i, rc;
   255		u32 supported_flags = pnv_get_supported_cpuidle_states();
   256	
   257	
   258		/* Currently we have snooze statically defined */
   259	
   260		power_mgt = of_find_node_by_path("/ibm,opal/power-mgt");
   261		if (!power_mgt) {
   262			pr_warn("opal: PowerMgmt Node not found\n");
   263			goto out;
   264		}
   265	
   266		/* Read values of any property to determine the num of idle states */
   267		dt_idle_states = of_property_count_u32_elems(power_mgt, "ibm,cpu-idle-state-flags");
   268		if (dt_idle_states < 0) {
   269			pr_warn("cpuidle-powernv: no idle states found in the DT\n");
   270			goto out;
   271		}
   272	
   273		count = of_property_count_u32_elems(power_mgt,
   274						    "ibm,cpu-idle-state-latencies-ns");
   275	
   276		if (validate_dt_prop_sizes("ibm,cpu-idle-state-flags", dt_idle_states,
   277					   "ibm,cpu-idle-state-latencies-ns",
   278					   count) != 0)
   279			goto out;
   280	
   281		count = of_property_count_strings(power_mgt,
   282						  "ibm,cpu-idle-state-names");
   283		if (validate_dt_prop_sizes("ibm,cpu-idle-state-flags", dt_idle_states,
   284					   "ibm,cpu-idle-state-names",
   285					   count) != 0)
   286			goto out;
   287	
   288		/*
   289		 * Since snooze is used as first idle state, max idle states allowed is
   290		 * CPUIDLE_STATE_MAX -1
   291		 */
   292		if (dt_idle_states > CPUIDLE_STATE_MAX - 1) {
   293			pr_warn("cpuidle-powernv: discovered idle states more than allowed");
   294			dt_idle_states = CPUIDLE_STATE_MAX - 1;
   295		}
   296	
   297		if (of_property_read_u32_array(power_mgt,
   298				"ibm,cpu-idle-state-flags", flags, dt_idle_states)) {
   299			pr_warn("cpuidle-powernv : missing ibm,cpu-idle-state-flags in DT\n");
   300			goto out;
   301		}
   302	
   303		if (of_property_read_u32_array(power_mgt,
   304			"ibm,cpu-idle-state-latencies-ns", latency_ns,
   305			dt_idle_states)) {
   306			pr_warn("cpuidle-powernv: missing ibm,cpu-idle-state-latencies-ns in DT\n");
   307			goto out;
   308		}
   309		if (of_property_read_string_array(power_mgt,
   310			"ibm,cpu-idle-state-names", names, dt_idle_states) < 0) {
   311			pr_warn("cpuidle-powernv: missing ibm,cpu-idle-state-names in DT\n");
   312			goto out;
   313		}
   314	
   315		/*
   316		 * If the idle states use stop instruction, probe for psscr values
   317		 * and psscr mask which are necessary to specify required stop level.
   318		 */
   319		has_stop_states = (flags[0] &
   320				   (OPAL_PM_STOP_INST_FAST | OPAL_PM_STOP_INST_DEEP));
   321		if (has_stop_states) {
   322			count = of_property_count_u64_elems(power_mgt,
   323							    "ibm,cpu-idle-state-psscr");
   324			if (validate_dt_prop_sizes("ibm,cpu-idle-state-flags",
   325						   dt_idle_states,
   326						   "ibm,cpu-idle-state-psscr",
   327						   count) != 0)
   328				goto out;
   329	
   330			count = of_property_count_u64_elems(power_mgt,
   331							    "ibm,cpu-idle-state-psscr-mask");
   332			if (validate_dt_prop_sizes("ibm,cpu-idle-state-flags",
   333						   dt_idle_states,
   334						   "ibm,cpu-idle-state-psscr-mask",
   335						   count) != 0)
   336				goto out;
   337	
   338			if (of_property_read_u64_array(power_mgt,
   339			    "ibm,cpu-idle-state-psscr", psscr_val, dt_idle_states)) {
   340				pr_warn("cpuidle-powernv: missing ibm,cpu-idle-state-psscr in DT\n");
   341				goto out;
   342			}
   343	
   344			if (of_property_read_u64_array(power_mgt,
   345						       "ibm,cpu-idle-state-psscr-mask",
   346							psscr_mask, dt_idle_states)) {
   347				pr_warn("cpuidle-powernv:Missing ibm,cpu-idle-state-psscr-mask in DT\n");
   348				goto out;
   349			}
   350		}
   351	
   352		count = of_property_count_u32_elems(power_mgt,
   353						    "ibm,cpu-idle-state-residency-ns");
   354	
   355		if (count < 0) {
   356			rc = count;
   357		} else if (validate_dt_prop_sizes("ibm,cpu-idle-state-flags",
   358						  dt_idle_states,
   359						  "ibm,cpu-idle-state-residency-ns",
   360						  count) != 0) {
   361			goto out;
   362		} else {
   363			rc = of_property_read_u32_array(power_mgt,
   364							"ibm,cpu-idle-state-residency-ns",
   365							residency_ns, dt_idle_states);
   366		}
   367	
   368		/* Support new dt format for idle states */
   369	
   370		np_new = of_find_node_by_path("/ibm,opal/power-mgt/ibm,idle-states");
   371		if (!np_new) {
   372			pr_info("opal: PowerMgmt/ibm,idle-states Node not found\n");
   373		} else {
   374			additional_states = of_property_count_u32_elems(np_new,
   375				"ibm,cpu-idle-state-flags");
   376			if (additional_states < 0) 
   377				pr_info("cpuidle-powernv: no idle states found in the DT\n");
   378			else {
   379				if (of_property_read_u32_array(np_new,
   380					"ibm,cpu-idle-state-flags", flags+dt_idle_states, additional_states)) {
   381					pr_warn("cpuidle-powernv : missing ibm,cpu-idle-state-flags in DT\n");
   382					goto out;
   383				}
   384	
   385				if (of_property_read_u32_array(np_new,
   386					"ibm,cpu-idle-state-latencies-ns", latency_ns+dt_idle_states,
   387					additional_states)) {
   388					pr_warn("cpuidle-powernv: missing ibm,cpu-idle-state-latencies-ns in DT\n");
   389					goto out;
   390				}
   391				if (of_property_read_u32_array(np_new,
   392					"ibm,cpu-idle-state-residencies-ns", residency_ns+dt_idle_states,
   393					additional_states)) {
   394					pr_warn("cpuidle-powernv: missing ibm,cpu-idle-state-residencies-ns in DT\n");
   395					goto out;
   396				}
   397				if (of_property_read_string_array(np_new,
   398					"ibm,cpu-idle-state-names", names+dt_idle_states, additional_states) < 0) {
   399					pr_warn("cpuidle-powernv: missing ibm,cpu-idle-state-names in DT\n");
   400					goto out;
   401				}
   402				if (of_property_read_string_array(np_new,
 > 403					"ibm,cpu-idle-state-versions", versions, additional_states) < 0) {
   404					pr_warn("cpuidle-powernv: missing ibm,cpu-idle-state-names in DT\n");
   405					goto out;
   406				}
   407				if (of_property_read_u64_array(np_new,
   408				    "ibm,cpu-idle-state-psscr", psscr_val+ dt_idle_states, additional_states)) {
   409					pr_warn("cpuidle-powernv: missing ibm,cpu-idle-state-psscr in DT\n");
   410					goto out;
   411				}
   412	
   413				if (of_property_read_u64_array(power_mgt,
   414						       "ibm,cpu-idle-state-psscr-mask",
   415							psscr_mask + dt_idle_states,additional_states)) {
   416					pr_warn("cpuidle-powernv:Missing ibm,cpu-idle-state-psscr-mask in DT\n");
   417					goto out;
   418				}
   419			
   420	
   421				dt_idle_states += additional_states;
   422			}
   423		}
   424		for (i = 0; i < dt_idle_states; i++) {
   425			unsigned int exit_latency, target_residency;
   426			bool stops_timebase = false;
   427	
   428			/*
   429			 * Skip the platform idle state whose flag isn't in
   430			 * the supported_cpuidle_states flag mask.
   431			 */
   432			if ((flags[i] & supported_flags) != flags[i])
   433				continue;
   434	
   435			/* Supported version */
 > 436			if (!( strcmp(version[i] , "ibm,idle-state-v1"))
 > 437					continue;
   438					
   439			/*
   440			 * If an idle state has exit latency beyond
   441			 * POWERNV_THRESHOLD_LATENCY_NS then don't use it
   442			 * in cpu-idle.
   443			 */
   444			if (latency_ns[i] > POWERNV_THRESHOLD_LATENCY_NS)
   445				continue;
   446			/*
   447			 * Firmware passes residency and latency values in ns.
   448			 * cpuidle expects it in us.
   449			 */
   450			exit_latency = DIV_ROUND_UP(latency_ns[i], 1000);
   451			if (!rc)
   452				target_residency = DIV_ROUND_UP(residency_ns[i], 1000);
   453			else
   454				target_residency = 0;
   455	
   456			if (has_stop_states) {
   457				int err = validate_psscr_val_mask(&psscr_val[i],
   458								  &psscr_mask[i],
   459								  flags[i]);
   460				if (err) {
   461					report_invalid_psscr_val(psscr_val[i], err);
   462					continue;
   463				}
   464			}
   465	
   466			if (flags[i] & OPAL_PM_TIMEBASE_STOP)
   467				stops_timebase = true;
   468	
   469			/*
   470			 * For nap and fastsleep, use default target_residency
   471			 * values if f/w does not expose it.
   472			 */
   473			if (flags[i] & OPAL_PM_NAP_ENABLED) {
   474				if (!rc)
   475					target_residency = 100;
   476				/* Add NAP state */
   477				add_powernv_state(nr_idle_states, "Nap",
   478						  CPUIDLE_FLAG_NONE, nap_loop,
   479						  target_residency, exit_latency, 0, 0);
   480			} else if (has_stop_states && !stops_timebase) {
   481				add_powernv_state(nr_idle_states, names[i],
   482						  CPUIDLE_FLAG_NONE, stop_loop,
   483						  target_residency, exit_latency,
   484						  psscr_val[i], psscr_mask[i]);
   485			}
   486	
   487			/*
   488			 * All cpuidle states with CPUIDLE_FLAG_TIMER_STOP set must come
   489			 * within this config dependency check.
   490			 */
   491	#ifdef CONFIG_TICK_ONESHOT
   492			else if (flags[i] & OPAL_PM_SLEEP_ENABLED ||
   493				 flags[i] & OPAL_PM_SLEEP_ENABLED_ER1) {
   494				if (!rc)
   495					target_residency = 300000;
   496				/* Add FASTSLEEP state */
   497				add_powernv_state(nr_idle_states, "FastSleep",
   498						  CPUIDLE_FLAG_TIMER_STOP,
   499						  fastsleep_loop,
   500						  target_residency, exit_latency, 0, 0);
   501			} else if (has_stop_states && stops_timebase) {
   502				add_powernv_state(nr_idle_states, names[i],
   503						  CPUIDLE_FLAG_TIMER_STOP, stop_loop,
   504						  target_residency, exit_latency,
   505						  psscr_val[i], psscr_mask[i]);
   506			}
   507	#endif
   508			else
   509				continue;
   510			nr_idle_states++;
 > 511		}
   512	out:
   513		return nr_idle_states;
   514	}
   515	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Download attachment ".config.gz" of type "application/gzip" (56238 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ