blk: make blk-rq-qos policies pluggable and modular
Subsystems (2)
v3 cover blk: make blk-rq-qos policies pluggable and modular
Hi Jens
blk-rq-qos is a standalone framework out of io-sched and can be used to control or observe the IO progress in block-layer with hooks. blk-rq-qos is a great design but right now, it is totally fixed and built-in and shut out peoples who want to use it with external module.
This patchset attempts to make blk-rq-qos framework pluggable and modular. Then we can update the blk-rq-qos policy module w/o stopping the IO workload. And it is more convenient to introduce new policy on old machines w/o udgrade kernel. And we can close all of the blk-rq-qos policy if we needn't any of them. At the moment, the request_queue.rqos list is empty, we needn't to waste cpu cyles on them.
Changes since v2:
Refactor the patches,
- patch01 only provide new interfaces and not export the sysfs interface.
- patch02 adapt the wbt to new interface, reserve the previous action when write to wbt_lat
- export sysfs interface in last patch when all of the blk-rqos policies are preprared well.
Changes since v1:
- Just make iocost and iolatency pluggable, then we needn't to export those interfaces
- Remove the iostat rqos policy
- Rename module of blk-ioprio to io-prio to avoid rename ioprio.c file
WangJianchao(6):
blk: prepare to make blk-rq-qos pluggable and modular
blk-wbt: make wbt pluggable
blk-iolatency: make iolatency pluggable
blk-iocost: make iocost pluggable
blk-ioprio: make ioprio pluggable and modular
blk: export the sysfs for switching qos
block/Kconfig | 2 +- block/Makefile | 3 +- block/blk-cgroup.c | 11 --- block/blk-iocost.c | 49 +++++++----- block/blk-iolatency.c | 33 +++++++-- block/blk-ioprio.c | 50 ++++++++----- block/blk-ioprio.h | 19 ----- block/blk-mq-debugfs.c | 23 ++---- block/blk-rq-qos.c | 303 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- block/blk-rq-qos.h | 96 +++++++++--------------- block/blk-sysfs.c | 2 + block/blk-wbt.c | 52 +++++++++++-- block/blk-wbt.h | 7 +- block/blk.h | 6 -- include/linux/blkdev.h | 4 + 15 files changed, 488 insertions(+), 172 deletions(-)
RFC v3 1/6 blk: prepare to make blk-rq-qos pluggable and modular
blk-rq-qos is a standalone framework out of io-sched and can be used to control or observe the IO progress in block-layer with hooks. blk-rq-qos is a great design but right now, it is totally fixed and built-in and shut out peoples who want to use it with external module.
This patch make blk-rq-qos policies pluggable and modular.
(1) Add code to maintain the rq_qos_ops. A rq-qos module need to register itself with rq_qos_register(). The original enum rq_qos_id will be removed in following patch. They will use a dynamic id maintained by rq_qos_ida.
(2) Add .init callback into rq_qos_ops. We use it to initialize the resource.
(3) Add /sys/block/x/queue/qos
We can use '+name' or "-name" to open or close the blk-rq-qos policy.
This patch mainly prepare help interfaces and no functional changes. Following patches will adpat the code of wbt, iolatency, iocost and ioprio to make them pluggable and modular one by one. And after that, the /sys/block/xxx/queue/qos interfaces will be exported.
--- block/blk-mq-debugfs.c | 9 +- block/blk-rq-qos.c | 303 ++++++++++++++++++++++++++++++++++++++++- block/blk-rq-qos.h | 39 +++++- include/linux/blkdev.h | 4 + 4 files changed, 350 insertions(+), 5 deletions(-)
block/blk-mq-debugfs.c +7 -2
@@ -729,7 +729,10 @@ void blk_mq_debugfs_register(struct request_queue *q)if (q->rq_qos) {struct rq_qos *rqos = q->rq_qos; - +/* +* queue has not been registered right now, it is safe to +* iterate the rqos w/o lock +*/ while (rqos) {blk_mq_debugfs_register_rqos (rqos); rqos = rqos->next;
@@ -844,7 +847,9 @@ void blk_mq_debugfs_unregister_rqos(struct rq_qos *rqos)void blk_mq_debugfs_register_rqos (struct rq_qos *rqos) {struct request_queue *q = rqos->q; -const char *dir_name =rq_qos_id_to_name (rqos->id); +const char *dir_name; + + dir_name = rqos->ops->name ? rqos->ops->name :rq_qos_id_to_name (rqos->id);if (rqos->debugfs_dir || !rqos->ops->debugfs_attrs)return ;
block/blk-rq-qos.c +301 -2
318 lines not on this page · raw message
block/blk-rq-qos.h +38 -1
@@ -26,16 +26,28 @@ struct rq_wait { };struct rq_qos { -struct rq_qos_ops *ops; +const struct rq_qos_ops *ops;struct request_queue *q;enum rq_qos_id id; +refcount_t ref; +wait_queue_head_t waitq; +bool dying;struct rq_qos *next;#ifdef CONFIG_BLK_DEBUG_FS struct dentry *debugfs_dir;#endif }; +enum { +RQOS_FLAG_CGRP_POL =1 <<0 , +}; +struct rq_qos_ops { +struct list_head node; +struct module *owner; +const char *name; +int flags; +int id;void (*throttle)(struct rq_qos *,struct bio *);void (*track)(struct rq_qos *,struct request *,struct bio *);void (*merge)(struct rq_qos *,struct request *,struct bio *);
@@ -46,6 +58,7 @@ struct rq_qos_ops {void (*cleanup)(struct rq_qos *,struct bio *);void (*queue_depth_changed)(struct rq_qos *);void (*exit)(struct rq_qos *); +int (*init)(struct request_queue *);const struct blk_mq_debugfs_attr *debugfs_attrs; };
@@ -70,6 +83,19 @@ static inline struct rq_qos *rq_qos_id(struct request_queue *q,return rqos; } +static inline struct rq_qos *rq_qos_by_id (struct request_queue *q,int id) +{ +struct rq_qos *rqos; + +WARN_ON (!mutex_is_locked (&q->sysfs_lock) && !spin_is_locked (&q->queue_lock)); + +for (rqos = q->rq_qos; rqos; rqos = rqos->next) { +if (rqos->id == id) +break ; + } +return rqos; +} +static inline struct rq_qos *wbt_rq_qos (struct request_queue *q) {return rq_qos_id (q,RQ_QOS_WBT );
@@ -132,6 +158,17 @@ static inline void rq_qos_del(struct request_queue *q, struct rq_qos *rqos)blk_mq_debugfs_unregister_rqos (rqos); } +int rq_qos_register (struct rq_qos_ops *ops); +void rq_qos_unregister (struct rq_qos_ops *ops); +void rq_qos_activate (struct request_queue *q, +struct rq_qos *rqos,const struct rq_qos_ops *ops); +void rq_qos_deactivate (struct rq_qos *rqos); +ssize_t queue_qos_show (struct request_queue *q,char *buf); +ssize_t queue_qos_store (struct request_queue *q,const char *page, +size_t count); +struct rq_qos *rq_qos_get (struct request_queue *q,int id); +void rq_qos_put (struct rq_qos *rqos); +typedef bool (acquire_inflight_cb_t )(struct rq_wait *rqw,void *private_data);typedef void (cleanup_cb_t )(struct rq_wait *rqw,void *private_data);
include/linux/blkdev.h +4 -0
@@ -44,6 +44,10 @@ struct blk_crypto_profile;* Defined here to simplify include dependency. */ #define BLKCG_MAX_POLS 6 +/* +* Non blk-rq-qos blkcg policies include blk-throttle and bfq +*/ +#define BLKCG_NON_RQOS_POLS 2static inline int blk_validate_block_size (unsigned long bsize) {
Signature · 1 line
2.17.1
kernel test robot
build botRe: [RFC V3 1/6] blk: prepare to make blk-rq-qos pluggable and modular
[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]
Hi "Wang,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on v5.17-rc4]
[also build test WARNING on next-20220216]
[cannot apply to axboe-block/for-next]
[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/Wang-Jianchao-Kuaishou/blk-make-blk-rq-qos-policies-pluggable-and-modular/20220216-195026 base: 754e0b0e35608ed5206d6a67a791563c631cec07 config: um-i386_defconfig (https://download.01.org/0day-ci/archive/20220216/202202162159.aWo1ROMf-lkp(a)intel.com/config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/e486fdca8e0e257a237ae001ff5759e4a06ae114
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Wang-Jianchao-Kuaishou/blk-make-blk-rq-qos-policies-pluggable-and-modular/20220216-195026 git checkout e486fdca8e0e257a237ae001ff5759e4a06ae114
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=um SUBARCH=i386 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> block/blk-rq-qos.c:516:5: warning: no previous prototype for 'rq_qos_switch' [-Wmissing-prototypes]
516 | int rq_qos_switch(struct request_queue *q,
| ^~~~~~~~~~~~~
vim +/rq_qos_switch +516 block/blk-rq-qos.c
515
> 516 int rq_qos_switch(struct request_queue *q,
517 const struct rq_qos_ops *ops,
518 struct rq_qos *rqos)
519 {
520 int ret;
521
522 blk_mq_freeze_queue(q);
523 if (!rqos) {
524 ret = ops->init(q);
525 } else {
526 ops->exit(rqos);
527 ret = 0;
528 }
529 blk_mq_unfreeze_queue(q);
530
531 return ret;
532 }
533
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
RFC v3 2/6 blk-wbt: make wbt pluggable
In reply to Wang Jianchao (Kuaishou)This patch makes wbt pluggable through /sys/block/xxx/queue/qos. Some queue_lock/unlock is added to protect rq_qos_by_id() in wbt_rq_qos().
--- block/blk-mq-debugfs.c | 2 -- block/blk-rq-qos.h | 6 ----- block/blk-wbt.c | 52 +++++++++++++++++++++++++++++++++++------- block/blk-wbt.h | 7 +++++- 4 files changed, 50 insertions(+), 17 deletions(-)
block/blk-mq-debugfs.c +0 -2
@@ -826,8 +826,6 @@ void blk_mq_debugfs_unregister_sched(struct request_queue *q)static const char *rq_qos_id_to_name (enum rq_qos_id id) {switch (id) { -case RQ_QOS_WBT : -return "wbt" ;case RQ_QOS_LATENCY :return "latency" ;case RQ_QOS_COST :
block/blk-rq-qos.h +0 -6
@@ -14,7 +14,6 @@struct blk_mq_debugfs_attr ;enum rq_qos_id { -RQ_QOS_WBT ,RQ_QOS_LATENCY ,RQ_QOS_COST ,RQ_QOS_IOPRIO ,
@@ -96,11 +95,6 @@ static inline struct rq_qos *rq_qos_by_id(struct request_queue *q, int id)return rqos; } -static inline struct rq_qos *wbt_rq_qos (struct request_queue *q) -{ -return rq_qos_id (q,RQ_QOS_WBT ); -} -static inline struct rq_qos *blkcg_rq_qos (struct request_queue *q) {return rq_qos_id (q,RQ_QOS_LATENCY );
block/blk-wbt.c +44 -8
126 lines not on this page · raw message
block/blk-wbt.h +6 -1
@@ -87,7 +87,7 @@ static inline unsigned int wbt_inflight(struct rq_wb *rwb)#ifdef CONFIG_BLK_WBT - +struct rq_qos *wbt_rq_qos (struct request_queue *q);int wbt_init (struct request_queue *);void wbt_disable_default (struct request_queue *);void wbt_enable_default (struct request_queue *);
@@ -101,6 +101,11 @@ u64 wbt_default_latency_nsec(struct request_queue *);#else +static inline struct rq_qos *wbt_rq_qos (struct request_queue *q) +{ +return NULL ; +} +static inline void wbt_track (struct request *rq,enum wbt_flags flags) { }
Signature · 1 line
2.17.1
RFC v3 3/6 blk-iolatency: make iolatency pluggable
In reply to Wang Jianchao (Kuaishou)Make blk-iolatency pluggable. Then we can close or open it through /sys/block/xxx/queue/qos.
--- block/blk-cgroup.c | 6 ------ block/blk-iolatency.c | 33 +++++++++++++++++++++++++-------- block/blk-mq-debugfs.c | 2 -- block/blk-rq-qos.h | 6 ------ block/blk.h | 6 ------ 5 files changed, 25 insertions(+), 28 deletions(-)
block/blk-cgroup.c +0 -6
@@ -1203,12 +1203,6 @@ int blkcg_init_queue(struct request_queue *q)if (ret) goto err_destroy_all; - ret =blk_iolatency_init (q); -if (ret) { -blk_throtl_exit (q); - goto err_destroy_all; - } -return 0 ; err_destroy_all:
block/blk-iolatency.c +25 -8
@@ -90,6 +90,12 @@ struct blk_iolatency {atomic_t enabled; }; +static struct rq_qos_ops blkcg_iolatency_ops; +static inline struct rq_qos *blkcg_rq_qos (struct request_queue *q) +{ +return rq_qos_by_id (q, blkcg_iolatency_ops.id); +} +static inline struct blk_iolatency *BLKIOLATENCY (struct rq_qos *rqos) { return container_of(rqos, struct blk_iolatency, rqos);
@@ -646,13 +652,18 @@ static void blkcg_iolatency_exit(struct rq_qos *rqos)del_timer_sync (&blkiolat->timer);blkcg_deactivate_policy (rqos->q, &blkcg_policy_iolatency); +rq_qos_deactivate (rqos);kfree (blkiolat); } +static int blk_iolatency_init (struct request_queue *q);static struct rq_qos_ops blkcg_iolatency_ops = { + .name ="iolat" , + .flags =RQOS_FLAG_CGRP_POL , .throttle = blkcg_iolatency_throttle, .done_bio = blkcg_iolatency_done_bio, .exit = blkcg_iolatency_exit, + .init = blk_iolatency_init, };static void blkiolatency_timer_fn (struct timer_list *t)
@@ -727,15 +738,10 @@ int blk_iolatency_init(struct request_queue *q)return -ENOMEM ; rqos = &blkiolat->rqos; - rqos->id =RQ_QOS_LATENCY ; - rqos->ops = &blkcg_iolatency_ops; - rqos->q = q; - -rq_qos_add (q, rqos); - +rq_qos_activate (q, rqos, &blkcg_iolatency_ops); ret =blkcg_activate_policy (q, &blkcg_policy_iolatency);if (ret) { -rq_qos_del (q, rqos); +rq_qos_deactivate (rqos);kfree (blkiolat);return ret; }
@@ -1046,12 +1052,23 @@ static struct blkcg_policy blkcg_policy_iolatency = {static int __init iolatency_init (void ) { -return blkcg_policy_register (&blkcg_policy_iolatency); +int ret; + + ret =rq_qos_register (&blkcg_iolatency_ops); +if (ret) +return ret; + + ret =blkcg_policy_register (&blkcg_policy_iolatency); +if (ret) +rq_qos_unregister (&blkcg_iolatency_ops); + +return ret; } static void __exit iolatency_exit(void) {blkcg_policy_unregister (&blkcg_policy_iolatency); +rq_qos_unregister (&blkcg_iolatency_ops); }module_init (iolatency_init);
block/blk-mq-debugfs.c +0 -2
@@ -826,8 +826,6 @@ void blk_mq_debugfs_unregister_sched(struct request_queue *q)static const char *rq_qos_id_to_name (enum rq_qos_id id) {switch (id) { -case RQ_QOS_LATENCY : -return "latency" ;case RQ_QOS_COST :return "cost" ;case RQ_QOS_IOPRIO :
block/blk-rq-qos.h +0 -6
@@ -14,7 +14,6 @@struct blk_mq_debugfs_attr ;enum rq_qos_id { -RQ_QOS_LATENCY ,RQ_QOS_COST ,RQ_QOS_IOPRIO , };
@@ -95,11 +94,6 @@ static inline struct rq_qos *rq_qos_by_id(struct request_queue *q, int id)return rqos; } -static inline struct rq_qos *blkcg_rq_qos (struct request_queue *q) -{ -return rq_qos_id (q,RQ_QOS_LATENCY ); -} -static inline void rq_wait_init (struct rq_wait *rq_wait) {atomic_set (&rq_wait->inflight,0 );
block/blk.h +0 -6
@@ -400,12 +400,6 @@ static inline void blk_queue_bounce(struct request_queue *q, struct bio **bio)__blk_queue_bounce (q, bio); } -#ifdef CONFIG_BLK_CGROUP_IOLATENCY -extern int blk_iolatency_init (struct request_queue *q); -#else -static inline int blk_iolatency_init (struct request_queue *q) {return 0 ; } -#endif -struct bio *blk_next_bio (struct bio *bio,unsigned int nr_pages,gfp_t gfp);#ifdef CONFIG_BLK_DEV_ZONED
Signature · 1 line
2.17.1
RFC v3 4/6 blk-iocost: make iocost pluggable
In reply to Wang Jianchao (Kuaishou)Make blk-iocost pluggable. Then we can close or open it through /sys/block/xxx/queue/qos.
--- block/blk-iocost.c | 49 ++++++++++++++++++++++++++---------------- block/blk-mq-debugfs.c | 2 -- block/blk-rq-qos.h | 1 - 3 files changed, 30 insertions(+), 22 deletions(-)
block/blk-iocost.c +30 -19
@@ -660,9 +660,10 @@ static struct ioc *rqos_to_ioc(struct rq_qos *rqos) return container_of(rqos, struct ioc, rqos); } +static struct rq_qos_ops ioc_rqos_ops;static struct ioc *q_to_ioc (struct request_queue *q) { -return rqos_to_ioc (rq_qos_id (q,RQ_QOS_COST )); +return rqos_to_ioc (rq_qos_by_id (q, ioc_rqos_ops.id)); }static const char *q_name (struct request_queue *q)
@@ -2810,6 +2811,7 @@ static void ioc_rqos_exit(struct rq_qos *rqos)struct ioc *ioc =rqos_to_ioc (rqos);blkcg_deactivate_policy (rqos->q, &blkcg_policy_iocost); +rq_qos_deactivate (rqos);spin_lock_irq (&ioc->lock); ioc->running =IOC_STOP ;
@@ -2820,13 +2822,17 @@ static void ioc_rqos_exit(struct rq_qos *rqos)kfree (ioc); } +static int blk_iocost_init (struct request_queue *q);static struct rq_qos_ops ioc_rqos_ops = { + .name ="iocost" , + .flags =RQOS_FLAG_CGRP_POL , .throttle = ioc_rqos_throttle, .merge = ioc_rqos_merge, .done_bio = ioc_rqos_done_bio, .done = ioc_rqos_done, .queue_depth_changed = ioc_rqos_queue_depth_changed, .exit = ioc_rqos_exit, + .init = blk_iocost_init, };static int blk_iocost_init (struct request_queue *q)
@@ -2856,10 +2862,7 @@ static int blk_iocost_init(struct request_queue *q) } rqos = &ioc->rqos; - rqos->id =RQ_QOS_COST ; - rqos->ops = &ioc_rqos_ops; - rqos->q = q; - +rq_qos_activate (q, rqos, &ioc_rqos_ops);spin_lock_init (&ioc->lock);timer_setup (&ioc->timer, ioc_timer_fn,0 );INIT_LIST_HEAD (&ioc->active_iocgs);
@@ -2883,10 +2886,9 @@ static int blk_iocost_init(struct request_queue *q)* called before policy activation completion, can't assume that the * target bio has an iocg associated and need to test for NULL iocg. */ -rq_qos_add (q, rqos); ret =blkcg_activate_policy (q, &blkcg_policy_iocost);if (ret) { -rq_qos_del (q, rqos); +rq_qos_deactivate (rqos);free_percpu (ioc->pcpu_stat);kfree (ioc);return ret;
@@ -3162,6 +3164,7 @@ static ssize_t ioc_qos_write(struct kernfs_open_file *of, char *input, size_t nbytes, loff_t off) {struct block_device *bdev; +struct rq_qos *rqos;struct ioc *ioc;u32 qos[NR_QOS_PARAMS ];bool enable, user;
@@ -3172,12 +3175,10 @@ static ssize_t ioc_qos_write(struct kernfs_open_file *of, char *input,if (IS_ERR (bdev))return PTR_ERR (bdev); - ioc =q_to_ioc (bdev_get_queue (bdev)); -if (!ioc) { - ret =blk_iocost_init (bdev_get_queue (bdev)); -if (ret) - goto err; - ioc =q_to_ioc (bdev_get_queue (bdev)); + rqos =rq_qos_get (bdev_get_queue (bdev), ioc_rqos_ops.id); +if (!rqos) { + ret = -EOPNOTSUPP ; + goto err; }spin_lock_irq (&ioc->lock);
@@ -3329,6 +3330,7 @@ static ssize_t ioc_cost_model_write(struct kernfs_open_file *of, char *input, size_t nbytes, loff_t off) {struct block_device *bdev; +struct rq_qos *rqos;struct ioc *ioc;u64 u[NR_I_LCOEFS ];bool user;
@@ -3339,12 +3341,10 @@ static ssize_t ioc_cost_model_write(struct kernfs_open_file *of, char *input,if (IS_ERR (bdev))return PTR_ERR (bdev); - ioc =q_to_ioc (bdev_get_queue (bdev)); + rqos =rq_qos_get (bdev_get_queue (bdev), ioc_rqos_ops.id);if (!ioc) { - ret =blk_iocost_init (bdev_get_queue (bdev)); -if (ret) - goto err; - ioc =q_to_ioc (bdev_get_queue (bdev)); + ret = -EOPNOTSUPP ; + goto err; }spin_lock_irq (&ioc->lock);
@@ -3441,12 +3441,23 @@ static struct blkcg_policy blkcg_policy_iocost = {static int __init ioc_init (void ) { -return blkcg_policy_register (&blkcg_policy_iocost); +int ret; + + ret =rq_qos_register (&ioc_rqos_ops); +if (ret) +return ret; + + ret =blkcg_policy_register (&blkcg_policy_iocost); +if (ret) +rq_qos_unregister (&ioc_rqos_ops); + +return ret; } static void __exit ioc_exit(void) {blkcg_policy_unregister (&blkcg_policy_iocost); +rq_qos_unregister (&ioc_rqos_ops); }module_init (ioc_init);
block/blk-mq-debugfs.c +0 -2
@@ -826,8 +826,6 @@ void blk_mq_debugfs_unregister_sched(struct request_queue *q)static const char *rq_qos_id_to_name (enum rq_qos_id id) {switch (id) { -case RQ_QOS_COST : -return "cost" ;case RQ_QOS_IOPRIO :return "ioprio" ; }
block/blk-rq-qos.h +0 -1
@@ -14,7 +14,6 @@struct blk_mq_debugfs_attr ;enum rq_qos_id { -RQ_QOS_COST ,RQ_QOS_IOPRIO , };
Signature · 1 line
2.17.1
kernel test robot
build botRe: [RFC V3 4/6] blk-iocost: make iocost pluggable
[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]
Hi "Wang,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on v5.17-rc4]
[cannot apply to axboe-block/for-next next-20220216]
[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/Wang-Jianchao-Kuaishou/blk-make-blk-rq-qos-policies-pluggable-and-modular/20220216-195026 base: 754e0b0e35608ed5206d6a67a791563c631cec07 config: riscv-buildonly-randconfig-r004-20220216 (https://download.01.org/0day-ci/archive/20220216/202202162343.zPf2UuRg-lkp(a)intel.com/config) compiler: riscv32-linux-gcc (GCC) 11.2.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/0day-ci/linux/commit/28800cf3765b9c31df59c666540b777f278f03e5
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Wang-Jianchao-Kuaishou/blk-make-blk-rq-qos-policies-pluggable-and-modular/20220216-195026 git checkout 28800cf3765b9c31df59c666540b777f278f03e5
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=riscv SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
block/blk-iocost.c: In function 'iocg_activate':
block/blk-iocost.c:1245:13: warning: variable 'last_period' set but not used [-Wunused-but-set-variable]
1245 | u64 last_period, cur_period;
| ^~~~~~~~~~~
block/blk-iocost.c: In function 'ioc_cost_model_write':
>> block/blk-iocost.c:3333:24: warning: variable 'rqos' set but not used [-Wunused-but-set-variable]
3333 | struct rq_qos *rqos;
| ^~~~vim +/rqos +3333 block/blk-iocost.c
3328
3329 static ssize_t ioc_cost_model_write(struct kernfs_open_file *of, char *input,
3330 size_t nbytes, loff_t off)
3331 {
3332 struct block_device *bdev;
> 3333 struct rq_qos *rqos;
3334 struct ioc *ioc;
3335 u64 u[NR_I_LCOEFS];
3336 bool user;
3337 char *p;
3338 int ret;
3339
3340 bdev = blkcg_conf_open_bdev(&input);
3341 if (IS_ERR(bdev))
3342 return PTR_ERR(bdev);
3343
3344 rqos = rq_qos_get(bdev_get_queue(bdev), ioc_rqos_ops.id);
3345 if (!ioc) {
3346 ret = -EOPNOTSUPP;
3347 goto err;
3348 }
3349
3350 spin_lock_irq(&ioc->lock);
3351 memcpy(u, ioc->params.i_lcoefs, sizeof(u));
3352 user = ioc->user_cost_model;
3353 spin_unlock_irq(&ioc->lock);
3354
3355 while ((p = strsep(&input, " \t\n"))) {
3356 substring_t args[MAX_OPT_ARGS];
3357 char buf[32];
3358 int tok;
3359 u64 v;
3360
3361 if (!*p)
3362 continue;
3363
3364 switch (match_token(p, cost_ctrl_tokens, args)) {
3365 case COST_CTRL:
3366 match_strlcpy(buf, &args[0], sizeof(buf));
3367 if (!strcmp(buf, "auto"))
3368 user = false;
3369 else if (!strcmp(buf, "user"))
3370 user = true;
3371 else
3372 goto einval;
3373 continue;
3374 case COST_MODEL:
3375 match_strlcpy(buf, &args[0], sizeof(buf));
3376 if (strcmp(buf, "linear"))
3377 goto einval;
3378 continue;
3379 }
3380
3381 tok = match_token(p, i_lcoef_tokens, args);
3382 if (tok == NR_I_LCOEFS)
3383 goto einval;
3384 if (match_u64(&args[0], &v))
3385 goto einval;
3386 u[tok] = v;
3387 user = true;
3388 }
3389
3390 spin_lock_irq(&ioc->lock);
3391 if (user) {
3392 memcpy(ioc->params.i_lcoefs, u, sizeof(u));
3393 ioc->user_cost_model = true;
3394 } else {
3395 ioc->user_cost_model = false;
3396 }
3397 ioc_refresh_params(ioc, true);
3398 spin_unlock_irq(&ioc->lock);
3399
3400 blkdev_put_no_open(bdev);
3401 return nbytes;
3402
3403 einval:
3404 ret = -EINVAL;
3405 err:
3406 blkdev_put_no_open(bdev);
3407 return ret;
3408 }
3409
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
RFC v3 5/6 blk-ioprio: make ioprio pluggable and modular
In reply to Wang Jianchao (Kuaishou)Make blk-ioprio pluggable and modular. Then we can close or open it through /sys/block/xxx/queue/qos and rmmod the module if we don't need it which can release one blkcg policy slot.
--- block/Kconfig | 2 +- block/Makefile | 3 ++- block/blk-cgroup.c | 5 ----- block/blk-ioprio.c | 50 ++++++++++++++++++++++++++++-------------- block/blk-ioprio.h | 19 ---------------- block/blk-mq-debugfs.c | 4 ---- block/blk-rq-qos.c | 2 +- block/blk-rq-qos.h | 2 +- 8 files changed, 38 insertions(+), 49 deletions(-) delete mode 100644 block/blk-ioprio.h
block/Kconfig +1 -1
@@ -145,7 +145,7 @@ config BLK_CGROUP_IOCOST their share of the overall weight distribution. config BLK_CGROUP_IOPRIO - bool "Cgroup I/O controller for assigning an I/O priority class" + tristate "Cgroup I/O controller for assigning an I/O priority class" depends on BLK_CGROUP help Enable the .prio interface for assigning an I/O priority class to
block/Makefile +2 -1
@@ -17,7 +17,8 @@ obj-$(CONFIG_BLK_DEV_BSGLIB) += bsg-lib.o obj-$(CONFIG_BLK_CGROUP) += blk-cgroup.o obj-$(CONFIG_BLK_CGROUP_RWSTAT) += blk-cgroup-rwstat.o obj-$(CONFIG_BLK_DEV_THROTTLING) += blk-throttle.o -obj-$(CONFIG_BLK_CGROUP_IOPRIO) += blk-ioprio.o +io-prio-y := blk-ioprio.o +obj-$(CONFIG_BLK_CGROUP_IOPRIO) += io-prio.o obj-$(CONFIG_BLK_CGROUP_IOLATENCY) += blk-iolatency.o obj-$(CONFIG_BLK_CGROUP_IOCOST) += blk-iocost.o obj-$(CONFIG_MQ_IOSCHED_DEADLINE) += mq-deadline.o
block/blk-cgroup.c +0 -5
@@ -32,7 +32,6 @@#include <linux/psi.h> #include <linux/part_stat.h> #include "blk.h" -#include "blk-ioprio.h" #include "blk-throttle.h" /*
@@ -1195,10 +1194,6 @@ int blkcg_init_queue(struct request_queue *q)if (preloaded)radix_tree_preload_end (); - ret =blk_ioprio_init (q); -if (ret) - goto err_destroy_all; - ret =blk_throtl_init (q);if (ret) goto err_destroy_all;
block/blk-ioprio.c +33 -17
91 lines not on this page · raw message
block/blk-ioprio.h deleted +0 -19
@@ -1,19 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ - -#ifndef _BLK_IOPRIO_H_ -#define _BLK_IOPRIO_H_ - -#include <linux/kconfig.h> - -struct request_queue ; - -#ifdef CONFIG_BLK_CGROUP_IOPRIO -int blk_ioprio_init (struct request_queue *q); -#else -static inline int blk_ioprio_init (struct request_queue *q) -{ -return 0 ; -} -#endif - -#endif /* _BLK_IOPRIO_H_ */
block/blk-mq-debugfs.c +0 -4
@@ -825,10 +825,6 @@ void blk_mq_debugfs_unregister_sched(struct request_queue *q)static const char *rq_qos_id_to_name (enum rq_qos_id id) { -switch (id) { -case RQ_QOS_IOPRIO : -return "ioprio" ; - }return "unknown" ; }
block/blk-rq-qos.c +1 -1
@@ -454,7 +454,7 @@ int rq_qos_register(struct rq_qos_ops *ops) goto out; } - start =RQ_QOS_IOPRIO +1 ; + start =1 ; ret =ida_simple_get (&rq_qos_ida, start,INT_MAX ,GFP_KERNEL );if (ret <0 ) goto out;
block/blk-rq-qos.h +1 -1
@@ -14,7 +14,7 @@struct blk_mq_debugfs_attr ;enum rq_qos_id { -RQ_QOS_IOPRIO , +RQ_QOS_UNUSED , };struct rq_wait {
Signature · 1 line
2.17.1
RFC v3 6/6 blk: export the sysfs for switching qos
In reply to Wang Jianchao (Kuaishou)And also remove the unused interfaces.
--- block/blk-mq-debugfs.c | 10 +------- block/blk-rq-qos.h | 54 ++---------------------------------------- block/blk-sysfs.c | 2 ++ 3 files changed, 5 insertions(+), 61 deletions(-)
block/blk-mq-debugfs.c +1 -9
@@ -823,11 +823,6 @@ void blk_mq_debugfs_unregister_sched(struct request_queue *q) q->sched_debugfs_dir =NULL ; } -static const char *rq_qos_id_to_name (enum rq_qos_id id) -{ -return "unknown" ; -} -void blk_mq_debugfs_unregister_rqos (struct rq_qos *rqos) {debugfs_remove_recursive (rqos->debugfs_dir);
@@ -837,9 +832,6 @@ void blk_mq_debugfs_unregister_rqos(struct rq_qos *rqos)void blk_mq_debugfs_register_rqos (struct rq_qos *rqos) {struct request_queue *q = rqos->q; -const char *dir_name; - - dir_name = rqos->ops->name ? rqos->ops->name :rq_qos_id_to_name (rqos->id);if (rqos->debugfs_dir || !rqos->ops->debugfs_attrs)return ;
@@ -848,7 +840,7 @@ void blk_mq_debugfs_register_rqos(struct rq_qos *rqos) q->rqos_debugfs_dir =debugfs_create_dir ("rqos" , q->debugfs_dir); - rqos->debugfs_dir =debugfs_create_dir (dir_name, + rqos->debugfs_dir =debugfs_create_dir (rqos->ops->name, rqos->q->rqos_debugfs_dir);debugfs_create_files (rqos->debugfs_dir, rqos, rqos->ops->debugfs_attrs);
block/blk-rq-qos.h +2 -52
78 lines not on this page · raw message
block/blk-sysfs.c +2 -0
@@ -574,6 +574,7 @@ QUEUE_RO_ENTRY(queue_max_segments, "max_segments");QUEUE_RO_ENTRY (queue_max_integrity_segments,"max_integrity_segments" );QUEUE_RO_ENTRY (queue_max_segment_size,"max_segment_size" );QUEUE_RW_ENTRY (elv_iosched,"scheduler" ); +QUEUE_RW_ENTRY (queue_qos,"qos" );QUEUE_RO_ENTRY (queue_logical_block_size,"logical_block_size" );QUEUE_RO_ENTRY (queue_physical_block_size,"physical_block_size" );
@@ -633,6 +634,7 @@ static struct attribute *queue_attrs[] = { &queue_max_integrity_segments_entry.attr, &queue_max_segment_size_entry.attr, &elv_iosched_entry.attr, + &queue_qos_entry.attr, &queue_hw_sector_size_entry.attr, &queue_logical_block_size_entry.attr, &queue_physical_block_size_entry.attr,
Signature · 1 line
2.17.1