tree:   https://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next.git 
current-work
head:   71fe7e0ab249e42c17f387951aa09de7cb362d35
commit: 71fe7e0ab249e42c17f387951aa09de7cb362d35 [3/3] current-work
config: i386-randconfig-x010-201805 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        git checkout 71fe7e0ab249e42c17f387951aa09de7cb362d35
        # save the attached .config to linux build tree
        make ARCH=i386 

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:1005:33: error: 'struct blkcg' has no member named 'css'
     bio_associate_blkcg(bio, &blkcg->css);
                                    ^~
   block/blk-wbt.c:1010:10: error: implicit declaration of function 
'blkg_lookup_create'; did you mean 'blk_lookup_devt'? 
[-Werror=implicit-function-declaration]
      blkg = blkg_lookup_create(blkcg, q);
             ^~~~~~~~~~~~~~~~~~
             blk_lookup_devt
   block/blk-wbt.c:1010:8: warning: assignment makes pointer from integer 
without a cast [-Wint-conversion]
      blkg = blkg_lookup_create(blkcg, q);
           ^
>> block/blk-wbt.c:1019: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:1030: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:1105:14: error: 'struct bio' has no member named 'bi_blkg'; 
>> did you mean 'bi_flags'?
     blkg = bio->bi_blkg;
                 ^~~~~~~
                 bi_flags
   block/blk-wbt.c:1112: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:1167:13: error: 'struct blkcg_gq' has no member named 
'parent'
     while (blkg->parent) {
                ^~
   block/blk-wbt.c:1168:44: error: 'struct blkcg_gq' has no member named 
'parent'
      struct qos_grp *this_qg = blkg_to_qg(blkg->parent);
                                               ^~
   block/blk-wbt.c:1170: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:1182:24: error: implicit declaration of function 
'css_to_blkcg'; did you mean 'qg_to_blkg'? 
[-Werror=implicit-function-declaration]
     struct blkcg *blkcg = css_to_blkcg(of_css(of));
                           ^~~~~~~~~~~~
                           qg_to_blkg
   block/blk-wbt.c:1182:24: warning: initialization makes pointer from integer 
without a cast [-Wint-conversion]
   block/blk-wbt.c:1186:23: error: storage size of 'ctx' isn't known
     struct blkg_conf_ctx ctx;
                          ^~~
   block/blk-wbt.c:1193:8: error: implicit declaration of function 
'blkg_conf_prep'; did you mean 'blkg_to_pd'? 
[-Werror=implicit-function-declaration]
     ret = blkg_conf_prep(blkcg, &blkcg_policy_qos, buf, &ctx);
           ^~~~~~~~~~~~~~
           blkg_to_pd
   block/blk-wbt.c:1217:2: error: implicit declaration of function 
'blkg_for_each_descendant_pre'; did you mean 'css_for_each_descendant_pre'? 
[-Werror=implicit-function-declaration]
     blkg_for_each_descendant_pre(blkg, pos_css, ctx.blkg)
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
     css_for_each_descendant_pre
>> block/blk-wbt.c:1218:3: error: expected ';' before 'qos_set_min_lat_nsec'
      qos_set_min_lat_nsec(blkg, 1);
      ^~~~~~~~~~~~~~~~~~~~
>> block/blk-wbt.c:1221:2: error: implicit declaration of function 
>> 'blkg_conf_finish'; did you mean 'blkcg_qos_init'? 
>> [-Werror=implicit-function-declaration]
     blkg_conf_finish(&ctx);
     ^~~~~~~~~~~~~~~~
     blkcg_qos_init
   block/blk-wbt.c:1186: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:1229:22: error: implicit declaration of function 
'blkg_dev_name'; did you mean 'bio_devname'? 
[-Werror=implicit-function-declaration]
     const char *dname = blkg_dev_name(pd->blkg);
                         ^~~~~~~~~~~~~
                         bio_devname
   block/blk-wbt.c:1229: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:1240:2: error: implicit declaration of function 
'blkcg_print_blkgs'; did you mean 'blkcg_root_css'? 
[-Werror=implicit-function-declaration]
     blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), qg_prfill_limit,
     ^~~~~~~~~~~~~~~~~
     blkcg_root_css
   block/blk-wbt.c: In function 'qos_pd_init':
   block/blk-wbt.c:1265:41: error: 'struct blkcg_gq' has no member named 'q'
     struct rq_qos *rqos = blkcg_rq_qos(blkg->q);
                                            ^~
   block/blk-wbt.c:1270: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:1289: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:1310:3: error: 'struct blkcg_policy' has no member named 
'dfl_cftypes'
     .dfl_cftypes = qos_files,
      ^~~~~~~~~~~
   block/blk-wbt.c:1310:17: warning: excess elements in struct initializer
     .dfl_cftypes = qos_files,
                    ^~~~~~~~~
   block/blk-wbt.c:1310:17: note: (near initialization for 'blkcg_policy_qos')
   block/blk-wbt.c:1311:3: error: 'struct blkcg_policy' has no member named 
'pd_alloc_fn'
     .pd_alloc_fn = qos_pd_alloc,
      ^~~~~~~~~~~
   block/blk-wbt.c:1311:17: warning: excess elements in struct initializer
     .pd_alloc_fn = qos_pd_alloc,
                    ^~~~~~~~~~~~
   block/blk-wbt.c:1311:17: note: (near initialization for 'blkcg_policy_qos')
   block/blk-wbt.c:1312:3: error: 'struct blkcg_policy' has no member named 
'pd_init_fn'
     .pd_init_fn = qos_pd_init,
      ^~~~~~~~~~
   block/blk-wbt.c:1312:16: warning: excess elements in struct initializer
     .pd_init_fn = qos_pd_init,
                   ^~~~~~~~~~~
   block/blk-wbt.c:1312:16: note: (near initialization for 'blkcg_policy_qos')
   block/blk-wbt.c:1313:3: error: 'struct blkcg_policy' has no member named 
'pd_offline_fn'
     .pd_offline_fn = qos_pd_offline,
      ^~~~~~~~~~~~~
   block/blk-wbt.c:1313:19: warning: excess elements in struct initializer
     .pd_offline_fn = qos_pd_offline,
                      ^~~~~~~~~~~~~~
   block/blk-wbt.c:1313:19: note: (near initialization for 'blkcg_policy_qos')
   block/blk-wbt.c:1314:3: error: 'struct blkcg_policy' has no member named 
'pd_free_fn'
     .pd_free_fn = qos_pd_free,
      ^~~~~~~~~~
   block/blk-wbt.c:1314:16: warning: excess elements in struct initializer
     .pd_free_fn = qos_pd_free,
                   ^~~~~~~~~~~
   block/blk-wbt.c:1314:16: note: (near initialization for 'blkcg_policy_qos')
   cc1: some warnings being treated as errors

vim +1005 block/blk-wbt.c

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

---
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