Hi Lina, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on pm/linux-next] [also build test WARNING on linus/master v5.9 next-20201013] [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/Lina-Iyer/Better-domain-idle-from-device-wakeup-patterns/20201013-063543 base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next config: i386-randconfig-m021-20201013 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot smatch warnings: drivers/base/power/domain_governor.c:269 default_power_down_ok() warn: always true condition '(state_idx >= 0) => (0-u32max >= 0)' drivers/base/power/domain_governor.c:269 default_power_down_ok() warn: always true condition '(state_idx >= 0) => (0-u32max >= 0)' drivers/base/power/domain_governor.c:277 default_power_down_ok() warn: unsigned 'state_idx' is never less than zero. vim +269 drivers/base/power/domain_governor.c 245 246 /** 247 * default_power_down_ok - Default generic PM domain power off governor routine. 248 * @pd: PM domain to check. 249 * 250 * This routine must be executed under the PM domain's lock. 251 */ 252 static bool default_power_down_ok(struct dev_pm_domain *pd) 253 { 254 struct generic_pm_domain *genpd = pd_to_genpd(pd); 255 struct gpd_link *link; 256 unsigned int state_idx; 257 ktime_t now = ktime_get(); 258 259 /* 260 * Find the next wakeup from devices that can determine their own wakeup 261 * to find when the domain would wakeup and do it for every device down 262 * the hierarchy. It is not worth while to sleep if the state's residency 263 * cannot be met. 264 */ 265 update_domain_next_wakeup(genpd, now); 266 state_idx = genpd->state_count - 1; 267 if (genpd->next_wakeup != KTIME_MAX) { 268 /* Let's find out the deepest domain idle state, the devices prefer */ > 269 while (state_idx >= 0) { 270 if (next_wakeup_allows_state(genpd, state_idx, now)) { 271 genpd->max_off_time_changed = true; 272 break; 273 } 274 state_idx--; 275 } 276 > 277 if (state_idx < 0) { 278 state_idx = 0; 279 genpd->cached_power_down_ok = false; 280 goto done; 281 } 282 } 283 284 if (!genpd->max_off_time_changed) { 285 genpd->state_idx = genpd->cached_power_down_state_idx; 286 return genpd->cached_power_down_ok; 287 } 288 289 /* 290 * We have to invalidate the cached results for the parents, so 291 * use the observation that default_power_down_ok() is not 292 * going to be called for any parent until this instance 293 * returns. 294 */ 295 list_for_each_entry(link, &genpd->child_links, child_node) 296 link->parent->max_off_time_changed = true; 297 298 genpd->max_off_time_ns = -1; 299 genpd->max_off_time_changed = false; 300 genpd->cached_power_down_ok = true; 301 302 /* Find a state to power down to, starting from the state 303 * determined by the next wakeup. 304 */ 305 while (!__default_power_down_ok(pd, state_idx)) { 306 if (state_idx == 0) { 307 genpd->cached_power_down_ok = false; 308 break; 309 } 310 state_idx--; 311 } 312 313 done: 314 genpd->state_idx = state_idx; 315 genpd->cached_power_down_state_idx = genpd->state_idx; 316 return genpd->cached_power_down_ok; 317 } 318 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org