Hi Keith, I love your patch! Perhaps something to improve: [auto build test WARNING on axboe-block/for-next] [also build test WARNING on linus/master v6.1 next-20221220] [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#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Keith-Busch/block-save-user-max_sectors-limit/20221222-003202 base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next patch link: https://lore.kernel.org/r/20221221162758.407742-1-kbusch%40meta.com patch subject: [PATCH] block: save user max_sectors limit config: i386-randconfig-a014-20221219 compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1) 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/intel-lab-lkp/linux/commit/aab1e7d5915a6d2ff8418eda6d2334b1e4d79162 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Keith-Busch/block-save-user-max_sectors-limit/20221222-003202 git checkout aab1e7d5915a6d2ff8418eda6d2334b1e4d79162 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot All warnings (new ones prefixed by >>): >> block/blk-settings.c:138:49: warning: comparison of distinct pointer types ('typeof (limits->max_sectors) *' (aka 'unsigned int *') and 'typeof (BLK_DEF_MAX_SECTORS) *' (aka 'int *')) [-Wcompare-distinct-pointer-types] max_sectors = min_t(unsigned int, max_sectors, max(limits->max_sectors, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/minmax.h:74:19: note: expanded from macro 'max' #define max(x, y) __careful_cmp(x, y, >) ^ include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp' __builtin_choose_expr(__safe_cmp(x, y), \ ^ include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp' (__typecheck(x, y) && __no_side_effects(x, y)) ^ note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/minmax.h:36:38: note: expanded from macro '__careful_cmp' __builtin_choose_expr(__safe_cmp(x, y), \ ~~~~~~~~~~~~~~^~ include/linux/minmax.h:26:19: note: expanded from macro '__safe_cmp' (__typecheck(x, y) && __no_side_effects(x, y)) ~~~~~~~~~~~~~~~^~ include/linux/minmax.h:20:39: note: expanded from macro '__typecheck' (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) ^ >> block/blk-settings.c:138:49: warning: comparison of distinct pointer types ('typeof (limits->max_sectors) *' (aka 'unsigned int *') and 'typeof (BLK_DEF_MAX_SECTORS) *' (aka 'int *')) [-Wcompare-distinct-pointer-types] max_sectors = min_t(unsigned int, max_sectors, max(limits->max_sectors, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/minmax.h:74:19: note: expanded from macro 'max' #define max(x, y) __careful_cmp(x, y, >) ^ include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp' __builtin_choose_expr(__safe_cmp(x, y), \ ^ include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp' (__typecheck(x, y) && __no_side_effects(x, y)) ^ note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/minmax.h:26:46: note: expanded from macro '__safe_cmp' (__typecheck(x, y) && __no_side_effects(x, y)) ~~~~~~~~~~~~~~~~~~~~~^~ include/linux/minmax.h:23:40: note: expanded from macro '__no_side_effects' (__is_constexpr(x) && __is_constexpr(y)) ~~~~~~~~~~~~~~~^~ include/linux/const.h:12:48: note: expanded from macro '__is_constexpr' (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8))) ^ >> block/blk-settings.c:138:49: warning: comparison of distinct pointer types ('typeof (limits->max_sectors) *' (aka 'unsigned int *') and 'typeof (BLK_DEF_MAX_SECTORS) *' (aka 'int *')) [-Wcompare-distinct-pointer-types] max_sectors = min_t(unsigned int, max_sectors, max(limits->max_sectors, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/minmax.h:74:19: note: expanded from macro 'max' #define max(x, y) __careful_cmp(x, y, >) ^ include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp' __builtin_choose_expr(__safe_cmp(x, y), \ ^ include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp' (__typecheck(x, y) && __no_side_effects(x, y)) ^ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/minmax.h:126:59: note: expanded from macro 'min_t' #define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~ include/linux/minmax.h:37:12: note: expanded from macro '__careful_cmp' __cmp(x, y, op), \ ~~~~~~~~~^~~~~~ include/linux/minmax.h:28:34: note: expanded from macro '__cmp' #define __cmp(x, y, op) ((x) op (y) ? (x) : (y)) ^ >> block/blk-settings.c:138:49: warning: comparison of distinct pointer types ('typeof (limits->max_sectors) *' (aka 'unsigned int *') and 'typeof (BLK_DEF_MAX_SECTORS) *' (aka 'int *')) [-Wcompare-distinct-pointer-types] max_sectors = min_t(unsigned int, max_sectors, max(limits->max_sectors, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/minmax.h:74:19: note: expanded from macro 'max' #define max(x, y) __careful_cmp(x, y, >) ^ include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp' __builtin_choose_expr(__safe_cmp(x, y), \ ^ include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp' (__typecheck(x, y) && __no_side_effects(x, y)) ^ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/minmax.h:126:59: note: expanded from macro 'min_t' #define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~ include/linux/minmax.h:37:12: note: expanded from macro '__careful_cmp' __cmp(x, y, op), \ ~~~~~~~~~^~~~~~ include/linux/minmax.h:28:46: note: expanded from macro '__cmp' #define __cmp(x, y, op) ((x) op (y) ? (x) : (y)) ^ >> block/blk-settings.c:138:49: warning: comparison of distinct pointer types ('typeof (limits->max_sectors) *' (aka 'unsigned int *') and 'typeof (BLK_DEF_MAX_SECTORS) *' (aka 'int *')) [-Wcompare-distinct-pointer-types] max_sectors = min_t(unsigned int, max_sectors, max(limits->max_sectors, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/minmax.h:74:19: note: expanded from macro 'max' #define max(x, y) __careful_cmp(x, y, >) ^ include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp' __builtin_choose_expr(__safe_cmp(x, y), \ ^ include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp' (__typecheck(x, y) && __no_side_effects(x, y)) ^ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/minmax.h:126:59: note: expanded from macro 'min_t' #define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~ include/linux/minmax.h:38:17: note: expanded from macro '__careful_cmp' __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op)) ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/minmax.h:32:10: note: expanded from macro '__cmp_once' typeof(y) unique_y = (y); \ ^ >> block/blk-settings.c:138:49: warning: comparison of distinct pointer types ('typeof (limits->max_sectors) *' (aka 'unsigned int *') and 'typeof (BLK_DEF_MAX_SECTORS) *' (aka 'int *')) [-Wcompare-distinct-pointer-types] max_sectors = min_t(unsigned int, max_sectors, max(limits->max_sectors, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/minmax.h:74:19: note: expanded from macro 'max' #define max(x, y) __careful_cmp(x, y, >) ^ include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp' __builtin_choose_expr(__safe_cmp(x, y), \ ^ include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp' (__typecheck(x, y) && __no_side_effects(x, y)) ^ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/minmax.h:126:59: note: expanded from macro 'min_t' #define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~ include/linux/minmax.h:38:17: note: expanded from macro '__careful_cmp' __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op)) ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/minmax.h:32:25: note: expanded from macro '__cmp_once' typeof(y) unique_y = (y); \ ^ 6 warnings generated. vim +138 block/blk-settings.c 102 103 /** 104 * blk_queue_max_hw_sectors - set max sectors for a request for this queue 105 * @q: the request queue for the device 106 * @max_hw_sectors: max hardware sectors in the usual 512b unit 107 * 108 * Description: 109 * Enables a low level driver to set a hard upper limit, 110 * max_hw_sectors, on the size of requests. max_hw_sectors is set by 111 * the device driver based upon the capabilities of the I/O 112 * controller. 113 * 114 * max_dev_sectors is a hard limit imposed by the storage device for 115 * READ/WRITE requests. It is set by the disk driver. 116 * 117 * max_sectors is a soft limit imposed by the block layer for 118 * filesystem type requests. This value can be overridden on a 119 * per-device basis in /sys/block//queue/max_sectors_kb. 120 * The soft limit can not exceed max_hw_sectors. 121 **/ 122 void blk_queue_max_hw_sectors(struct request_queue *q, unsigned int max_hw_sectors) 123 { 124 struct queue_limits *limits = &q->limits; 125 unsigned int max_sectors; 126 127 if ((max_hw_sectors << 9) < PAGE_SIZE) { 128 max_hw_sectors = 1 << (PAGE_SHIFT - 9); 129 printk(KERN_INFO "%s: set to minimum %d\n", 130 __func__, max_hw_sectors); 131 } 132 133 max_hw_sectors = round_down(max_hw_sectors, 134 limits->logical_block_size >> SECTOR_SHIFT); 135 limits->max_hw_sectors = max_hw_sectors; 136 137 max_sectors = min_not_zero(max_hw_sectors, limits->max_dev_sectors); > 138 max_sectors = min_t(unsigned int, max_sectors, max(limits->max_sectors, 139 BLK_DEF_MAX_SECTORS)); 140 max_sectors = round_down(max_sectors, 141 limits->logical_block_size >> SECTOR_SHIFT); 142 limits->max_sectors = max_sectors; 143 144 if (!q->disk) 145 return; 146 q->disk->bdi->io_pages = max_sectors >> (PAGE_SHIFT - 9); 147 } 148 EXPORT_SYMBOL(blk_queue_max_hw_sectors); 149 -- 0-DAY CI Kernel Test Service https://01.org/lkp