tree: https://github.com/ammarfaizi2/linux-block google/android/kernel/common/android-4.14-q-release head: 556853b32b4656f1072ed285ee06b9519bb5ed8b commit: a58d5685c5d9e7d39632cd21a4d339847a63e92c [7200/9999] FROMLIST: psi: introduce psi monitor config: arm64-randconfig-r036-20220906 compiler: aarch64-linux-gcc (GCC) 7.5.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/ammarfaizi2/linux-block/commit/a58d5685c5d9e7d39632cd21a4d339847a63e92c git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block git fetch --no-tags ammarfaizi2-block google/android/kernel/common/android-4.14-q-release git checkout a58d5685c5d9e7d39632cd21a4d339847a63e92c # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-7.5.0 make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash M=kernel/sched If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot All warnings (new ones prefixed by >>): In file included from kernel/sched/sched.h:6:0, from kernel/sched/psi.c:144: include/linux/sched/topology.h:197:1: warning: type qualifiers ignored on function return type [-Wignored-qualifiers] const struct sched_group_energy * const(*sched_domain_energy_f)(int cpu); ^~~~~ >> kernel/sched/psi.c:1007:21: warning: no previous declaration for 'psi_trigger_create' [-Wmissing-declarations] struct psi_trigger *psi_trigger_create(struct psi_group *group, ^~~~~~~~~~~~~~~~~~ kernel/sched/psi.c:1141:6: warning: no previous declaration for 'psi_trigger_replace' [-Wmissing-declarations] void psi_trigger_replace(void **trigger_ptr, struct psi_trigger *new) ^~~~~~~~~~~~~~~~~~~ >> kernel/sched/psi.c:1153:14: warning: no previous declaration for 'psi_trigger_poll' [-Wmissing-declarations] unsigned int psi_trigger_poll(void **trigger_ptr, struct file *file, ^~~~~~~~~~~~~~~~ vim +/psi_trigger_create +1007 kernel/sched/psi.c 1006 > 1007 struct psi_trigger *psi_trigger_create(struct psi_group *group, 1008 char *buf, size_t nbytes, enum psi_res res) 1009 { 1010 struct psi_trigger *t; 1011 enum psi_states state; 1012 u32 threshold_us; 1013 u32 window_us; 1014 1015 if (static_branch_likely(&psi_disabled)) 1016 return ERR_PTR(-EOPNOTSUPP); 1017 1018 if (sscanf(buf, "some %u %u", &threshold_us, &window_us) == 2) 1019 state = PSI_IO_SOME + res * 2; 1020 else if (sscanf(buf, "full %u %u", &threshold_us, &window_us) == 2) 1021 state = PSI_IO_FULL + res * 2; 1022 else 1023 return ERR_PTR(-EINVAL); 1024 1025 if (state >= PSI_NONIDLE) 1026 return ERR_PTR(-EINVAL); 1027 1028 if (window_us < WINDOW_MIN_US || 1029 window_us > WINDOW_MAX_US) 1030 return ERR_PTR(-EINVAL); 1031 1032 /* Check threshold */ 1033 if (threshold_us == 0 || threshold_us > window_us) 1034 return ERR_PTR(-EINVAL); 1035 1036 t = kmalloc(sizeof(*t), GFP_KERNEL); 1037 if (!t) 1038 return ERR_PTR(-ENOMEM); 1039 1040 t->group = group; 1041 t->state = state; 1042 t->threshold = threshold_us * NSEC_PER_USEC; 1043 t->win.size = window_us * NSEC_PER_USEC; 1044 window_reset(&t->win, 0, 0, 0); 1045 1046 t->event = 0; 1047 t->last_event_time = 0; 1048 init_waitqueue_head(&t->event_wait); 1049 kref_init(&t->refcount); 1050 1051 mutex_lock(&group->trigger_lock); 1052 1053 if (!rcu_access_pointer(group->poll_kworker)) { 1054 struct sched_param param = { 1055 .sched_priority = MAX_RT_PRIO - 1, 1056 }; 1057 struct kthread_worker *kworker; 1058 1059 kworker = kthread_create_worker(0, "psimon"); 1060 if (IS_ERR(kworker)) { 1061 kfree(t); 1062 mutex_unlock(&group->trigger_lock); 1063 return ERR_CAST(kworker); 1064 } 1065 sched_setscheduler(kworker->task, SCHED_FIFO, ¶m); 1066 kthread_init_delayed_work(&group->poll_work, 1067 psi_poll_work); 1068 rcu_assign_pointer(group->poll_kworker, kworker); 1069 } 1070 1071 list_add(&t->node, &group->triggers); 1072 group->poll_min_period = min(group->poll_min_period, 1073 div_u64(t->win.size, UPDATES_PER_WINDOW)); 1074 group->nr_triggers[t->state]++; 1075 group->poll_states |= (1 << t->state); 1076 1077 mutex_unlock(&group->trigger_lock); 1078 1079 return t; 1080 } 1081 1082 static void psi_trigger_destroy(struct kref *ref) 1083 { 1084 struct psi_trigger *t = container_of(ref, struct psi_trigger, refcount); 1085 struct psi_group *group = t->group; 1086 struct kthread_worker *kworker_to_destroy = NULL; 1087 1088 if (static_branch_likely(&psi_disabled)) 1089 return; 1090 1091 /* 1092 * Wakeup waiters to stop polling. Can happen if cgroup is deleted 1093 * from under a polling process. 1094 */ 1095 wake_up_interruptible(&t->event_wait); 1096 1097 mutex_lock(&group->trigger_lock); 1098 1099 if (!list_empty(&t->node)) { 1100 struct psi_trigger *tmp; 1101 u64 period = ULLONG_MAX; 1102 1103 list_del(&t->node); 1104 group->nr_triggers[t->state]--; 1105 if (!group->nr_triggers[t->state]) 1106 group->poll_states &= ~(1 << t->state); 1107 /* reset min update period for the remaining triggers */ 1108 list_for_each_entry(tmp, &group->triggers, node) 1109 period = min(period, div_u64(tmp->win.size, 1110 UPDATES_PER_WINDOW)); 1111 group->poll_min_period = period; 1112 /* Destroy poll_kworker when the last trigger is destroyed */ 1113 if (group->poll_states == 0) { 1114 group->polling_until = 0; 1115 kworker_to_destroy = rcu_dereference_protected( 1116 group->poll_kworker, 1117 lockdep_is_held(&group->trigger_lock)); 1118 rcu_assign_pointer(group->poll_kworker, NULL); 1119 } 1120 } 1121 1122 mutex_unlock(&group->trigger_lock); 1123 1124 /* 1125 * Wait for both *trigger_ptr from psi_trigger_replace and 1126 * poll_kworker RCUs to complete their read-side critical sections 1127 * before destroying the trigger and optionally the poll_kworker 1128 */ 1129 synchronize_rcu(); 1130 /* 1131 * Destroy the kworker after releasing trigger_lock to prevent a 1132 * deadlock while waiting for psi_poll_work to acquire trigger_lock 1133 */ 1134 if (kworker_to_destroy) { 1135 kthread_cancel_delayed_work_sync(&group->poll_work); 1136 kthread_destroy_worker(kworker_to_destroy); 1137 } 1138 kfree(t); 1139 } 1140 1141 void psi_trigger_replace(void **trigger_ptr, struct psi_trigger *new) 1142 { 1143 struct psi_trigger *old = *trigger_ptr; 1144 1145 if (static_branch_likely(&psi_disabled)) 1146 return; 1147 1148 rcu_assign_pointer(*trigger_ptr, new); 1149 if (old) 1150 kref_put(&old->refcount, psi_trigger_destroy); 1151 } 1152 > 1153 unsigned int psi_trigger_poll(void **trigger_ptr, struct file *file, 1154 poll_table *wait) 1155 { 1156 unsigned int ret = DEFAULT_POLLMASK; 1157 struct psi_trigger *t; 1158 1159 if (static_branch_likely(&psi_disabled)) 1160 return DEFAULT_POLLMASK | POLLERR | POLLPRI; 1161 1162 rcu_read_lock(); 1163 1164 t = rcu_dereference(*(void __rcu __force **)trigger_ptr); 1165 if (!t) { 1166 rcu_read_unlock(); 1167 return DEFAULT_POLLMASK | POLLERR | POLLPRI; 1168 } 1169 kref_get(&t->refcount); 1170 1171 rcu_read_unlock(); 1172 1173 poll_wait(file, &t->event_wait, wait); 1174 1175 if (cmpxchg(&t->event, 1, 0) == 1) 1176 ret |= POLLPRI; 1177 1178 kref_put(&t->refcount, psi_trigger_destroy); 1179 1180 return ret; 1181 } 1182 -- 0-DAY CI Kernel Test Service https://01.org/lkp