tree:   https://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next.git 
current-work
head:   8e6eb5db8cf85a5af945098166954454c3169b29
commit: 8e6eb5db8cf85a5af945098166954454c3169b29 [3/3] current-work
config: x86_64-randconfig-s0-02160955 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
        git checkout 8e6eb5db8cf85a5af945098166954454c3169b29
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   In file included from include/linux/blkdev.h:21:0,
                    from include/linux/backing-dev.h:15,
                    from block/blk-wbt.c:24:
   include/linux/bio.h:521:55: warning: 'struct blkcg_gq' declared inside 
parameter list will not be visible outside of this definition or declaration
    static int bio_associate_blkg(struct bio *bio, struct blkcg_gq *blkg) { 
return 0; }
                                                          ^~~~~~~~
   block/blk-wbt.c: In function 'blkcg_qos_throttle':
>> block/blk-wbt.c:1014:33: error: 'struct blkcg' has no member named 'css'
     bio_associate_blkcg(bio, &blkcg->css);
                                    ^~
>> block/blk-wbt.c:1019:10: error: implicit declaration of function 
>> 'blkg_lookup_create' [-Werror=implicit-function-declaration]
      blkg = blkg_lookup_create(blkcg, q);
             ^~~~~~~~~~~~~~~~~~
   block/blk-wbt.c:1019:8: warning: assignment makes pointer from integer 
without a cast [-Wint-conversion]
      blkg = blkg_lookup_create(blkcg, q);
           ^
>> block/blk-wbt.c:1028:26: error: passing argument 2 of 'bio_associate_blkg' 
>> from incompatible pointer type [-Werror=incompatible-pointer-types]
     bio_associate_blkg(bio, blkg);
                             ^~~~
   In file included from include/linux/blkdev.h:21:0,
                    from include/linux/backing-dev.h:15,
                    from block/blk-wbt.c:24:
   include/linux/bio.h:521:12: note: expected 'struct blkcg_gq *' but argument 
is of type 'struct blkcg_gq *'
    static int bio_associate_blkg(struct bio *bio, struct blkcg_gq *blkg) { 
return 0; }
               ^~~~~~~~~~~~~~~~~~
>> block/blk-wbt.c:1039:26: error: 'struct bio' has no member named 
>> 'bi_issue_stat'
      blk_stat_set_issue(&bio->bi_issue_stat, bio_sectors(bio));
                             ^~
   block/blk-wbt.c: In function 'blkcg_qos_done_bio':
>> block/blk-wbt.c:1114:12: error: 'struct bio' has no member named 'bi_blkg'; 
>> did you mean 'bi_flags'?
     blkg = bio->bi_blkg;
               ^~
   block/blk-wbt.c:1124:26: error: 'struct bio' has no member named 
'bi_issue_stat'
     qos_record_time(qg, &bio->bi_issue_stat, now);
                             ^~
   block/blk-wbt.c: In function 'qos_set_min_lat_nsec':
>> block/blk-wbt.c:1180:13: error: 'struct blkcg_gq' has no member named 
>> 'parent'
     while (blkg->parent) {
                ^~
   block/blk-wbt.c:1181:44: error: 'struct blkcg_gq' has no member named 
'parent'
      struct qos_grp *this_qg = blkg_to_qg(blkg->parent);
                                               ^~
   block/blk-wbt.c:1183:14: error: 'struct blkcg_gq' has no member named 
'parent'
      blkg = blkg->parent;
                 ^~
   block/blk-wbt.c: In function 'qos_set_limit':
>> block/blk-wbt.c:1195:24: error: implicit declaration of function 
>> 'css_to_blkcg' [-Werror=implicit-function-declaration]
     struct blkcg *blkcg = css_to_blkcg(of_css(of));
                           ^~~~~~~~~~~~
   block/blk-wbt.c:1195:24: warning: initialization makes pointer from integer 
without a cast [-Wint-conversion]
>> block/blk-wbt.c:1199:23: error: storage size of 'ctx' isn't known
     struct blkg_conf_ctx ctx;
                          ^~~
>> block/blk-wbt.c:1206:8: error: implicit declaration of function 
>> 'blkg_conf_prep' [-Werror=implicit-function-declaration]
     ret = blkg_conf_prep(blkcg, &blkcg_policy_qos, buf, &ctx);
           ^~~~~~~~~~~~~~
>> block/blk-wbt.c:1230:2: error: implicit declaration of function 
>> 'blkg_for_each_descendant_pre' [-Werror=implicit-function-declaration]
     blkg_for_each_descendant_pre(blkg, pos_css, ctx.blkg)
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> block/blk-wbt.c:1231:3: error: expected ';' before 'qos_set_min_lat_nsec'
      qos_set_min_lat_nsec(blkg, 1);
      ^~~~~~~~~~~~~~~~~~~~
>> block/blk-wbt.c:1234:2: error: implicit declaration of function 
>> 'blkg_conf_finish' [-Werror=implicit-function-declaration]
     blkg_conf_finish(&ctx);
     ^~~~~~~~~~~~~~~~
   block/blk-wbt.c:1199:23: warning: unused variable 'ctx' [-Wunused-variable]
     struct blkg_conf_ctx ctx;
                          ^~~
   block/blk-wbt.c: In function 'qg_prfill_limit':
>> block/blk-wbt.c:1242:22: error: implicit declaration of function 
>> 'blkg_dev_name' [-Werror=implicit-function-declaration]
     const char *dname = blkg_dev_name(pd->blkg);
                         ^~~~~~~~~~~~~
>> block/blk-wbt.c:1242:38: error: 'struct blkg_policy_data' has no member 
>> named 'blkg'
     const char *dname = blkg_dev_name(pd->blkg);
                                         ^~
   block/blk-wbt.c: In function 'qos_print_limit':
>> block/blk-wbt.c:1253:2: error: implicit declaration of function 
>> 'blkcg_print_blkgs' [-Werror=implicit-function-declaration]
     blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), qg_prfill_limit,
     ^~~~~~~~~~~~~~~~~
   block/blk-wbt.c: In function 'qos_pd_init':
>> block/blk-wbt.c:1278:41: error: 'struct blkcg_gq' has no member named 'q'
     struct rq_qos *rqos = blkcg_rq_qos(blkg->q);
                                            ^~
   block/blk-wbt.c:1283:49: error: 'struct blkcg_gq' has no member named 'q'
     qg->rq_depth.queue_depth = blk_queue_depth(blkg->q);
                                                    ^~
   block/blk-wbt.c: In function 'qos_pd_offline':
   block/blk-wbt.c:1304:3: error: expected ';' before 'qos_set_min_lat_nsec'
      qos_set_min_lat_nsec(blkg, -1);
      ^~~~~~~~~~~~~~~~~~~~
   block/blk-wbt.c: At top level:
>> block/blk-wbt.c:1326:2: error: unknown field 'dfl_cftypes' specified in 
>> initializer
     .dfl_cftypes = qos_files,
     ^
   block/blk-wbt.c:1326:17: warning: excess elements in struct initializer
     .dfl_cftypes = qos_files,
                    ^~~~~~~~~
   block/blk-wbt.c:1326:17: note: (near initialization for 'blkcg_policy_qos')
>> block/blk-wbt.c:1327:2: error: unknown field 'pd_alloc_fn' specified in 
>> initializer
     .pd_alloc_fn = qos_pd_alloc,
     ^
   block/blk-wbt.c:1327:17: warning: excess elements in struct initializer
     .pd_alloc_fn = qos_pd_alloc,
                    ^~~~~~~~~~~~
   block/blk-wbt.c:1327:17: note: (near initialization for 'blkcg_policy_qos')
>> block/blk-wbt.c:1328:2: error: unknown field 'pd_init_fn' specified in 
>> initializer
     .pd_init_fn = qos_pd_init,
     ^
   block/blk-wbt.c:1328:16: warning: excess elements in struct initializer
     .pd_init_fn = qos_pd_init,
                   ^~~~~~~~~~~
   block/blk-wbt.c:1328:16: note: (near initialization for 'blkcg_policy_qos')
>> block/blk-wbt.c:1329:2: error: unknown field 'pd_offline_fn' specified in 
>> initializer
     .pd_offline_fn = qos_pd_offline,
     ^
   block/blk-wbt.c:1329:19: warning: excess elements in struct initializer
     .pd_offline_fn = qos_pd_offline,
                      ^~~~~~~~~~~~~~
   block/blk-wbt.c:1329:19: note: (near initialization for 'blkcg_policy_qos')

vim +1014 block/blk-wbt.c

   998  
   999  static enum wbt_flags blkcg_qos_throttle(struct rq_qos *rqos, struct 
bio *bio,
  1000                                           spinlock_t *lock)
  1001  {
  1002          struct blkcg_qos *blkqos = BLKQOS(rqos);
  1003          struct blkcg *blkcg;
  1004          struct blkcg_gq *blkg;
  1005          struct qos_grp *qg;
  1006          struct request_queue *q = rqos->q;
  1007          bool throttle = false;
  1008  
  1009          if (!blkcg_qos_enabled(blkqos))
  1010                  return 0;
  1011  
  1012          rcu_read_lock();
  1013          blkcg = bio_blkcg(bio);
> 1014          bio_associate_blkcg(bio, &blkcg->css);
  1015          blkg = blkg_lookup(blkcg, q);
  1016          if (unlikely(!blkg)) {
  1017                  if (!lock)
  1018                          spin_lock_irq(q->queue_lock);
> 1019                  blkg = blkg_lookup_create(blkcg, q);
  1020                  if (IS_ERR(blkg))
  1021                          blkg = NULL;
  1022                  if (!lock)
  1023                          spin_unlock_irq(q->queue_lock);
  1024          }
  1025          if (!blkg)
  1026                  goto out;
  1027  
> 1028          bio_associate_blkg(bio, blkg);
  1029          qg = blkg_to_qg(blkg);
  1030          check_scale_change(blkqos, qg);
  1031          if (!atomic_inc_below(&qg->rq_wait.inflight,
  1032                                qg->rq_depth.max_depth))
  1033                  throttle = true;
  1034  out:
  1035          rcu_read_unlock();
  1036          if (throttle)
  1037                  __blkcg_qos_throttle(rqos, qg, lock);
  1038          if (blkg)
> 1039                  blk_stat_set_issue(&bio->bi_issue_stat, 
> bio_sectors(bio));
  1040          return 0;
  1041  }
  1042  
  1043  static void qos_record_time(struct qos_grp *qg, struct blk_issue_stat 
*stat,
  1044                              u64 now)
  1045  {
  1046          struct blk_rq_stat *rq_stat;
  1047          u64 start = blk_stat_time(stat);
  1048  
  1049          if (now <= start)
  1050                  return;
  1051          rq_stat = get_cpu_ptr(qg->stats);
  1052          blk_rq_stat_add(rq_stat, now - start);
  1053          put_cpu_ptr(rq_stat);
  1054  }
  1055  
  1056  #define BLKCG_QOS_MIN_SAMPLES 4
  1057  #define BLKQOS_MIN_ADJUST_TIME (5 * NSEC_PER_MSEC)
  1058  
  1059  static void qos_check_latencies(struct qos_grp *qg, u64 now)
  1060  {
  1061          struct blkcg_qos *blkqos = qg->blkqos;
  1062          struct blk_rq_stat stat;
  1063          unsigned cookie = atomic_read(&blkqos->scale_cookie);
  1064          int cpu;
  1065  
  1066          blk_rq_stat_init(&stat);
  1067          preempt_disable();
  1068          for_each_online_cpu(cpu) {
  1069                  struct blk_rq_stat *s;
  1070                  s = per_cpu_ptr(qg->stats, cpu);
  1071                  blk_rq_stat_sum(&stat, s);
  1072                  blk_rq_stat_init(s);
  1073          }
  1074          preempt_enable();
  1075  
  1076          if (stat.nr_samples < BLKCG_QOS_MIN_SAMPLES)
  1077                  return;
  1078  
  1079          /* Everything is ok and we don't need to adjust the scale. */
  1080          if (stat.min <= qg->rq_depth.min_lat_nsec &&
  1081              cookie == DEFAULT_SCALE_COOKIE)
  1082                  return;
  1083  
  1084          if (blkqos->last_scale_event >= now)
  1085                  return;
  1086  
  1087          if (now - blkqos->last_scale_event < BLKQOS_MIN_ADJUST_TIME)
  1088                  return;
  1089  
  1090          spin_lock(&blkqos->scale_lock);
  1091          if (blkqos->last_scale_event >= now ||
  1092              now - blkqos->last_scale_event < BLKQOS_MIN_ADJUST_TIME)
  1093                  goto out;
  1094  
  1095          if (stat.min <= qg->rq_depth.min_lat_nsec) {
  1096                  if (blkqos->scale_lat == qg->rq_depth.min_lat_nsec)
  1097                          atomic_inc(&qg->scale_cookie);
  1098          } else {
  1099                  blkqos->scale_lat = qg->rq_depth.min_lat_nsec;
  1100                  smp_mb__before_atomic();
  1101                  atomic_dec(&blkqos->scale_cookie);
  1102          }
  1103  out:
  1104          spin_unlock(&blkqos->scale_lock);
  1105  }
  1106  
  1107  static void blkcg_qos_done_bio(struct rq_qos *rqos, struct bio *bio)
  1108  {
  1109          struct blkcg_gq *blkg;
  1110          struct qos_grp *qg;
  1111          u64 window_start;
  1112          u64 now;
  1113  
> 1114          blkg = bio->bi_blkg;
  1115          if (!blkg)
  1116                  return;
  1117          qg = blkg_to_qg(blkg);
  1118  
  1119          if (!blkcg_qos_enabled(qg->blkqos))
  1120                  return;
  1121  
  1122          /* Record the time for our bio. */
  1123          now = ktime_to_ns(ktime_get());
  1124          qos_record_time(qg, &bio->bi_issue_stat, now);
  1125  
  1126          /*
  1127           * Now check to see if enough time has elapsed, and if it has 
check to
  1128           * see if we've missed our latency targets.
  1129           */
  1130          window_start = atomic64_read(&qg->window_start);
  1131          if (now > window_start && (now - window_start) >= 
qg->cur_win_nsec) {
  1132                  if (atomic64_cmpxchg(&qg->window_start, window_start, 
now) ==
  1133                      window_start)
  1134                          qos_check_latencies(qg, now);
  1135          }
  1136  }
  1137  
  1138  static struct rq_qos_ops blkcg_qos_ops = {
  1139          .throttle = blkcg_qos_throttle,
  1140          .done_bio = blkcg_qos_done_bio,
  1141  };
  1142  
  1143  int blkcg_qos_init(struct request_queue *q)
  1144  {
  1145          struct blkcg_qos *blkqos;
  1146          struct rq_qos *rqos;
  1147          int ret;
  1148  
  1149          BUILD_BUG_ON(WBT_NR_BITS > BLK_STAT_RES_BITS);
  1150  
  1151          blkqos = kzalloc(sizeof(*blkqos), GFP_KERNEL);
  1152          if (!blkqos)
  1153                  return -ENOMEM;
  1154  
  1155          rqos = &blkqos->rqos;
  1156          rqos->id = RQ_QOS_CGROUP;
  1157          rqos->ops = &blkcg_qos_ops;
  1158          rqos->q = q;
  1159  
  1160          rq_qos_add(q, rqos);
  1161          atomic_set(&blkqos->scale_cookie, DEFAULT_SCALE_COOKIE);
  1162          blkqos->scale_lat = 0;
  1163  
  1164          ret = blkcg_activate_policy(q, &blkcg_policy_qos);
  1165          if (ret) {
  1166                  kfree(blkqos);
  1167                  return ret;
  1168          }
  1169  
  1170          return 0;
  1171  }
  1172  
  1173  static void qos_set_min_lat_nsec(struct blkcg_gq *blkg, int direction)
  1174  {
  1175          struct qos_grp *qg = blkg_to_qg(blkg);
  1176          struct blkcg_qos *blkqos = qg->blkqos;
  1177          u64 val = qg->set_min_lat_nsec;
  1178          u64 oldval = qg->rq_depth.min_lat_nsec;
  1179  
> 1180          while (blkg->parent) {
> 1181                  struct qos_grp *this_qg = blkg_to_qg(blkg->parent);
  1182                  val = max(val, this_qg->set_min_lat_nsec);
> 1183                  blkg = blkg->parent;
  1184          }
  1185          qg->rq_depth.min_lat_nsec = val;
  1186          if (direction > 0 && !oldval && val)
  1187                  atomic_inc(&blkqos->enabled);
  1188          if (direction < 0 && oldval && !val)
  1189                  atomic_dec(&blkqos->enabled);
  1190  }
  1191  
  1192  static ssize_t qos_set_limit(struct kernfs_open_file *of, char *buf,
  1193                               size_t nbytes, loff_t off)
  1194  {
> 1195          struct blkcg *blkcg = css_to_blkcg(of_css(of));
  1196          struct blkcg_gq *blkg;
  1197          struct cgroup_subsys_state *pos_css;
  1198          struct blkcg_qos *blkqos;
> 1199          struct blkg_conf_ctx ctx;
  1200          struct qos_grp *qg;
  1201          char tok[29];   /* latency=18446744073709551616 */
  1202          char *p;
  1203          u64 val;
  1204          int len, ret;
  1205  
> 1206          ret = blkg_conf_prep(blkcg, &blkcg_policy_qos, buf, &ctx);
  1207          if (ret)
  1208                  return ret;
  1209  
  1210          qg = blkg_to_qg(ctx.blkg);
  1211          blkqos = qg->blkqos;
  1212          if (sscanf(ctx.body,"%28s%n", tok, &len) != 1)
  1213                  goto out;
  1214          if (tok[0] == '\0')
  1215                  goto out;
  1216  
  1217          ret = -EINVAL;
  1218          p = tok;
  1219          strsep(&p, "=");
  1220          if (!p || sscanf(p, "%llu", &val) != 1)
  1221                  goto out;
  1222          if (strcmp(tok, "latency"))
  1223                  goto out;
  1224          qg->set_min_lat_nsec = val;
  1225  
  1226          /* Walk up the tree to see if our new val is lower than it 
should be. */
  1227          blkg = ctx.blkg;
  1228          qos_set_min_lat_nsec(blkg, 1);
  1229  
  1230          blkg_for_each_descendant_pre(blkg, pos_css, ctx.blkg)
  1231                  qos_set_min_lat_nsec(blkg, 1);
  1232          ret = 0;
  1233  out:
  1234          blkg_conf_finish(&ctx);
  1235          return ret ?: nbytes;
  1236  }
  1237  

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

Attachment: .config.gz
Description: application/gzip

Reply via email to