InfiniBand Transport (IBTRS) and Network Block Device (IBNBD)
Subsystems (4)
kbuild test robot
build botRe: [PATCH v2 24/26] ibnbd: include client and server modules into kernel compilation
In reply to Roman PenThank you for the patch! Perhaps something to improve:
Hi Roman,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v4.17-rc5 next-20180517]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Roman-Pen/InfiniBand-Transport-IBTRS-and-Network-Block-Device-IBNBD/20180520-222445
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sh
All warnings (new ones prefixed by >>):
In file included from include/linux/printk.h:7:0,
from include/linux/kernel.h:14,
from include/linux/list.h:9,
from include/linux/module.h:9,
from drivers/block/ibnbd/ibnbd-clt-sysfs.c:37:
drivers/block/ibnbd/ibnbd-clt-sysfs.c: In function 'ibnbd_clt_parse_map_options':
include/linux/kern_levels.h:5:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'size_t {aka unsigned int}' [-Wformat=]
#define KERN_SOH "\001" /* ASCII Start Of Header */
^
include/linux/kern_levels.h:11:18: note: in expansion of macro 'KERN_SOH'
#define KERN_ERR KERN_SOH "3" /* error conditions */
^~~~~~~~
include/linux/printk.h:304:9: note: in expansion of macro 'KERN_ERR'
printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~
>> drivers/block/ibnbd/ibnbd-clt-sysfs.c:139:5: note: in expansion of macro 'pr_err'
pr_err("map_device: too many (> %lu) paths "
^~~~~~
drivers/block/ibnbd/ibnbd-clt-sysfs.c: In function 'ibnbd_clt_map_device_store':
>> drivers/block/ibnbd/ibnbd-clt-sysfs.c:613:1: warning: the frame size of 1616 bytes is larger than 1024 bytes [-Wframe-larger-than=]
}
^vim +/pr_err +139 drivers/block/ibnbd/ibnbd-clt-sysfs.c
ea541da7d Roman Pen 2018-05-18 88
ea541da7d Roman Pen 2018-05-18 89 static int ibnbd_clt_parse_map_options(const char *buf,
ea541da7d Roman Pen 2018-05-18 90 char *sessname,
ea541da7d Roman Pen 2018-05-18 91 struct ibtrs_addr *paths,
ea541da7d Roman Pen 2018-05-18 92 size_t *path_cnt,
ea541da7d Roman Pen 2018-05-18 93 size_t max_path_cnt,
ea541da7d Roman Pen 2018-05-18 94 char *pathname,
ea541da7d Roman Pen 2018-05-18 95 enum ibnbd_access_mode *access_mode,
ea541da7d Roman Pen 2018-05-18 96 enum ibnbd_io_mode *io_mode)
ea541da7d Roman Pen 2018-05-18 97 {
ea541da7d Roman Pen 2018-05-18 98 char *options, *sep_opt;
ea541da7d Roman Pen 2018-05-18 99 char *p;
ea541da7d Roman Pen 2018-05-18 100 substring_t args[MAX_OPT_ARGS];
ea541da7d Roman Pen 2018-05-18 101 int opt_mask = 0;
ea541da7d Roman Pen 2018-05-18 102 int token;
ea541da7d Roman Pen 2018-05-18 103 int ret = -EINVAL;
ea541da7d Roman Pen 2018-05-18 104 int i;
ea541da7d Roman Pen 2018-05-18 105 int p_cnt = 0;
ea541da7d Roman Pen 2018-05-18 106
ea541da7d Roman Pen 2018-05-18 107 options = kstrdup(buf, GFP_KERNEL);
ea541da7d Roman Pen 2018-05-18 108 if (!options)
ea541da7d Roman Pen 2018-05-18 109 return -ENOMEM;
ea541da7d Roman Pen 2018-05-18 110
ea541da7d Roman Pen 2018-05-18 111 sep_opt = strstrip(options);
ea541da7d Roman Pen 2018-05-18 112 strip(sep_opt);
ea541da7d Roman Pen 2018-05-18 113 while ((p = strsep(&sep_opt, " ")) != NULL) {
ea541da7d Roman Pen 2018-05-18 114 if (!*p)
ea541da7d Roman Pen 2018-05-18 115 continue;
ea541da7d Roman Pen 2018-05-18 116
ea541da7d Roman Pen 2018-05-18 117 token = match_token(p, ibnbd_opt_tokens, args);
ea541da7d Roman Pen 2018-05-18 118 opt_mask |= token;
ea541da7d Roman Pen 2018-05-18 119
ea541da7d Roman Pen 2018-05-18 120 switch (token) {
ea541da7d Roman Pen 2018-05-18 121 case IBNBD_OPT_SESSNAME:
ea541da7d Roman Pen 2018-05-18 122 p = match_strdup(args);
ea541da7d Roman Pen 2018-05-18 123 if (!p) {
ea541da7d Roman Pen 2018-05-18 124 ret = -ENOMEM;
ea541da7d Roman Pen 2018-05-18 125 goto out;
ea541da7d Roman Pen 2018-05-18 126 }
ea541da7d Roman Pen 2018-05-18 127 if (strlen(p) > NAME_MAX) {
ea541da7d Roman Pen 2018-05-18 128 pr_err("map_device: sessname too long\n");
ea541da7d Roman Pen 2018-05-18 129 ret = -EINVAL;
ea541da7d Roman Pen 2018-05-18 130 kfree(p);
ea541da7d Roman Pen 2018-05-18 131 goto out;
ea541da7d Roman Pen 2018-05-18 132 }
ea541da7d Roman Pen 2018-05-18 133 strlcpy(sessname, p, NAME_MAX);
ea541da7d Roman Pen 2018-05-18 134 kfree(p);
ea541da7d Roman Pen 2018-05-18 135 break;
ea541da7d Roman Pen 2018-05-18 136
ea541da7d Roman Pen 2018-05-18 137 case IBNBD_OPT_PATH:
ea541da7d Roman Pen 2018-05-18 138 if (p_cnt >= max_path_cnt) {
ea541da7d Roman Pen 2018-05-18 @139 pr_err("map_device: too many (> %lu) paths "
ea541da7d Roman Pen 2018-05-18 140 "provided\n", max_path_cnt);
ea541da7d Roman Pen 2018-05-18 141 ret = -ENOMEM;
ea541da7d Roman Pen 2018-05-18 142 goto out;
ea541da7d Roman Pen 2018-05-18 143 }
ea541da7d Roman Pen 2018-05-18 144 p = match_strdup(args);
ea541da7d Roman Pen 2018-05-18 145 if (!p) {
ea541da7d Roman Pen 2018-05-18 146 ret = -ENOMEM;
ea541da7d Roman Pen 2018-05-18 147 goto out;
ea541da7d Roman Pen 2018-05-18 148 }
ea541da7d Roman Pen 2018-05-18 149
ea541da7d Roman Pen 2018-05-18 150 ret = ibtrs_addr_to_sockaddr(p, strlen(p), IBTRS_PORT,
ea541da7d Roman Pen 2018-05-18 151 &paths[p_cnt]);
ea541da7d Roman Pen 2018-05-18 152 if (ret) {
ea541da7d Roman Pen 2018-05-18 153 pr_err("Can't parse path %s: %d\n", p, ret);
ea541da7d Roman Pen 2018-05-18 154 kfree(p);
ea541da7d Roman Pen 2018-05-18 155 goto out;
ea541da7d Roman Pen 2018-05-18 156 }
ea541da7d Roman Pen 2018-05-18 157
ea541da7d Roman Pen 2018-05-18 158 p_cnt++;
ea541da7d Roman Pen 2018-05-18 159
ea541da7d Roman Pen 2018-05-18 160 kfree(p);
ea541da7d Roman Pen 2018-05-18 161 break;
ea541da7d Roman Pen 2018-05-18 162
ea541da7d Roman Pen 2018-05-18 163 case IBNBD_OPT_DEV_PATH:
ea541da7d Roman Pen 2018-05-18 164 p = match_strdup(args);
ea541da7d Roman Pen 2018-05-18 165 if (!p) {
ea541da7d Roman Pen 2018-05-18 166 ret = -ENOMEM;
ea541da7d Roman Pen 2018-05-18 167 goto out;
ea541da7d Roman Pen 2018-05-18 168 }
ea541da7d Roman Pen 2018-05-18 169 if (strlen(p) > NAME_MAX) {
ea541da7d Roman Pen 2018-05-18 170 pr_err("map_device: Device path too long\n");
ea541da7d Roman Pen 2018-05-18 171 ret = -EINVAL;
ea541da7d Roman Pen 2018-05-18 172 kfree(p);
ea541da7d Roman Pen 2018-05-18 173 goto out;
ea541da7d Roman Pen 2018-05-18 174 }
ea541da7d Roman Pen 2018-05-18 175 strlcpy(pathname, p, NAME_MAX);
ea541da7d Roman Pen 2018-05-18 176 kfree(p);
ea541da7d Roman Pen 2018-05-18 177 break;
ea541da7d Roman Pen 2018-05-18 178
ea541da7d Roman Pen 2018-05-18 179 case IBNBD_OPT_ACCESS_MODE:
ea541da7d Roman Pen 2018-05-18 180 p = match_strdup(args);
ea541da7d Roman Pen 2018-05-18 181 if (!p) {
ea541da7d Roman Pen 2018-05-18 182 ret = -ENOMEM;
ea541da7d Roman Pen 2018-05-18 183 goto out;
ea541da7d Roman Pen 2018-05-18 184 }
ea541da7d Roman Pen 2018-05-18 185
ea541da7d Roman Pen 2018-05-18 186 if (!strcmp(p, "ro")) {
ea541da7d Roman Pen 2018-05-18 187 *access_mode = IBNBD_ACCESS_RO;
ea541da7d Roman Pen 2018-05-18 188 } else if (!strcmp(p, "rw")) {
ea541da7d Roman Pen 2018-05-18 189 *access_mode = IBNBD_ACCESS_RW;
ea541da7d Roman Pen 2018-05-18 190 } else if (!strcmp(p, "migration")) {
ea541da7d Roman Pen 2018-05-18 191 *access_mode = IBNBD_ACCESS_MIGRATION;
ea541da7d Roman Pen 2018-05-18 192 } else {
ea541da7d Roman Pen 2018-05-18 193 pr_err("map_device: Invalid access_mode:"
ea541da7d Roman Pen 2018-05-18 194 " '%s'\n", p);
ea541da7d Roman Pen 2018-05-18 195 ret = -EINVAL;
ea541da7d Roman Pen 2018-05-18 196 kfree(p);
ea541da7d Roman Pen 2018-05-18 197 goto out;
ea541da7d Roman Pen 2018-05-18 198 }
ea541da7d Roman Pen 2018-05-18 199
ea541da7d Roman Pen 2018-05-18 200 kfree(p);
ea541da7d Roman Pen 2018-05-18 201 break;
ea541da7d Roman Pen 2018-05-18 202
ea541da7d Roman Pen 2018-05-18 203 case IBNBD_OPT_IO_MODE:
ea541da7d Roman Pen 2018-05-18 204 p = match_strdup(args);
ea541da7d Roman Pen 2018-05-18 205 if (!p) {
ea541da7d Roman Pen 2018-05-18 206 ret = -ENOMEM;
ea541da7d Roman Pen 2018-05-18 207 goto out;
ea541da7d Roman Pen 2018-05-18 208 }
ea541da7d Roman Pen 2018-05-18 209 if (!strcmp(p, "blockio")) {
ea541da7d Roman Pen 2018-05-18 210 *io_mode = IBNBD_BLOCKIO;
ea541da7d Roman Pen 2018-05-18 211 } else if (!strcmp(p, "fileio")) {
ea541da7d Roman Pen 2018-05-18 212 *io_mode = IBNBD_FILEIO;
ea541da7d Roman Pen 2018-05-18 213 } else {
ea541da7d Roman Pen 2018-05-18 214 pr_err("map_device: Invalid io_mode: '%s'.\n",
ea541da7d Roman Pen 2018-05-18 215 p);
ea541da7d Roman Pen 2018-05-18 216 ret = -EINVAL;
ea541da7d Roman Pen 2018-05-18 217 kfree(p);
ea541da7d Roman Pen 2018-05-18 218 goto out;
ea541da7d Roman Pen 2018-05-18 219 }
ea541da7d Roman Pen 2018-05-18 220 kfree(p);
ea541da7d Roman Pen 2018-05-18 221 break;
ea541da7d Roman Pen 2018-05-18 222
ea541da7d Roman Pen 2018-05-18 223 default:
ea541da7d Roman Pen 2018-05-18 224 pr_err("map_device: Unknown parameter or missing value"
ea541da7d Roman Pen 2018-05-18 225 " '%s'\n", p);
ea541da7d Roman Pen 2018-05-18 226 ret = -EINVAL;
ea541da7d Roman Pen 2018-05-18 227 goto out;
ea541da7d Roman Pen 2018-05-18 228 }
ea541da7d Roman Pen 2018-05-18 229 }
ea541da7d Roman Pen 2018-05-18 230
ea541da7d Roman Pen 2018-05-18 231 for (i = 0; i < ARRAY_SIZE(ibnbd_opt_mandatory); i++) {
ea541da7d Roman Pen 2018-05-18 232 if ((opt_mask & ibnbd_opt_mandatory[i])) {
ea541da7d Roman Pen 2018-05-18 233 ret = 0;
ea541da7d Roman Pen 2018-05-18 234 } else {
ea541da7d Roman Pen 2018-05-18 235 pr_err("map_device: Parameters missing\n");
ea541da7d Roman Pen 2018-05-18 236 ret = -EINVAL;
ea541da7d Roman Pen 2018-05-18 237 break;
ea541da7d Roman Pen 2018-05-18 238 }
ea541da7d Roman Pen 2018-05-18 239 }
ea541da7d Roman Pen 2018-05-18 240
ea541da7d Roman Pen 2018-05-18 241 out:
ea541da7d Roman Pen 2018-05-18 242 *path_cnt = p_cnt;
ea541da7d Roman Pen 2018-05-18 243 kfree(options);
ea541da7d Roman Pen 2018-05-18 244 return ret;
ea541da7d Roman Pen 2018-05-18 245 }
ea541da7d Roman Pen 2018-05-18 246 :::::: The code at line 139 was first introduced by commit
:::::: ea541da7d8b2518d2b1d68d23d19bb13cca1119b ibnbd: client: sysfs interface functions
:::::: TO: Roman Pen <[email protected]> :::::: CC: 0day robot <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botRe: [PATCH v2 24/26] ibnbd: include client and server modules into kernel compilation
In reply to Roman PenThank you for the patch! Perhaps something to improve:
Hi Roman,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v4.17-rc5 next-20180517]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Roman-Pen/InfiniBand-Transport-IBTRS-and-Network-Block-Device-IBNBD/20180520-222445
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__sparse warnings: (new ones prefixed by >>)
>> drivers/block/ibnbd/ibnbd-clt.c:133:39: sparse: expression using sizeof(void) >> drivers/block/ibnbd/ibnbd-clt.c:133:39: sparse: expression using sizeof(void)
drivers/block/ibnbd/ibnbd-clt.c:135:37: sparse: expression using sizeof(void) drivers/block/ibnbd/ibnbd-clt.c:135:37: sparse: expression using sizeof(void) drivers/block/ibnbd/ibnbd-clt.c:592:29: sparse: expression using sizeof(void)
--
>> drivers/block/ibnbd/ibnbd-srv.c:357:48: sparse: incorrect type in argument 1 (different base types) @@ expected int [signed] dev_id @@ got restricted __le32 consint [signed] dev_id @@ drivers/block/ibnbd/ibnbd-srv.c:357:48: expected int [signed] dev_id drivers/block/ibnbd/ibnbd-srv.c:357:48: got restricted __le32 const [usertype] device_id >> drivers/block/ibnbd/ibnbd-srv.c:696:25: sparse: expression using sizeof(void)
include/linux/blkdev.h:1105:24: sparse: expression using sizeof(void)
vim +133 drivers/block/ibnbd/ibnbd-clt.c
563b98df Roman Pen 2018-05-18 108
563b98df Roman Pen 2018-05-18 109 static int ibnbd_clt_set_dev_attr(struct ibnbd_clt_dev *dev,
563b98df Roman Pen 2018-05-18 110 const struct ibnbd_msg_open_rsp *rsp)
563b98df Roman Pen 2018-05-18 111 {
563b98df Roman Pen 2018-05-18 112 struct ibnbd_clt_session *sess = dev->sess;
563b98df Roman Pen 2018-05-18 113
563b98df Roman Pen 2018-05-18 114 if (unlikely(!rsp->logical_block_size))
563b98df Roman Pen 2018-05-18 115 return -EINVAL;
563b98df Roman Pen 2018-05-18 116
563b98df Roman Pen 2018-05-18 117 dev->device_id = le32_to_cpu(rsp->device_id);
563b98df Roman Pen 2018-05-18 118 dev->nsectors = le64_to_cpu(rsp->nsectors);
563b98df Roman Pen 2018-05-18 119 dev->logical_block_size = le16_to_cpu(rsp->logical_block_size);
563b98df Roman Pen 2018-05-18 120 dev->physical_block_size = le16_to_cpu(rsp->physical_block_size);
563b98df Roman Pen 2018-05-18 121 dev->max_write_same_sectors = le32_to_cpu(rsp->max_write_same_sectors);
563b98df Roman Pen 2018-05-18 122 dev->max_discard_sectors = le32_to_cpu(rsp->max_discard_sectors);
563b98df Roman Pen 2018-05-18 123 dev->discard_granularity = le32_to_cpu(rsp->discard_granularity);
563b98df Roman Pen 2018-05-18 124 dev->discard_alignment = le32_to_cpu(rsp->discard_alignment);
563b98df Roman Pen 2018-05-18 125 dev->secure_discard = le16_to_cpu(rsp->secure_discard);
563b98df Roman Pen 2018-05-18 126 dev->rotational = rsp->rotational;
563b98df Roman Pen 2018-05-18 127 dev->remote_io_mode = rsp->io_mode;
563b98df Roman Pen 2018-05-18 128
563b98df Roman Pen 2018-05-18 129 dev->max_hw_sectors = sess->max_io_size / dev->logical_block_size;
563b98df Roman Pen 2018-05-18 130 dev->max_segments = BMAX_SEGMENTS;
563b98df Roman Pen 2018-05-18 131
563b98df Roman Pen 2018-05-18 132 if (dev->remote_io_mode == IBNBD_BLOCKIO) {
563b98df Roman Pen 2018-05-18 @133 dev->max_hw_sectors = min_t(u32, dev->max_hw_sectors,
563b98df Roman Pen 2018-05-18 134 le32_to_cpu(rsp->max_hw_sectors));
563b98df Roman Pen 2018-05-18 135 dev->max_segments = min_t(u16, dev->max_segments,
563b98df Roman Pen 2018-05-18 136 le16_to_cpu(rsp->max_segments));
563b98df Roman Pen 2018-05-18 137 }
563b98df Roman Pen 2018-05-18 138
563b98df Roman Pen 2018-05-18 139 return 0;
563b98df Roman Pen 2018-05-18 140 }
563b98df Roman Pen 2018-05-18 141 :::::: The code at line 133 was first introduced by commit
:::::: 563b98df79220ea51ec7d61fa671c810eef1db6b ibnbd: client: main functionality
:::::: TO: Roman Pen <[email protected]> :::::: CC: 0day robot <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botRe: [PATCH v2 24/26] ibnbd: include client and server modules into kernel compilation
In reply to Roman PenThank you for the patch! Perhaps something to improve:
Hi Roman,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v4.17-rc6 next-20180517]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Roman-Pen/InfiniBand-Transport-IBTRS-and-Network-Block-Device-IBNBD/20180520-222445
config: i386-allyesconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0 reproduce:
# save the attached .config to linux build tree
make ARCH=i386 All warnings (new ones prefixed by >>):
drivers/block/ibnbd/ibnbd-clt-sysfs.c: In function 'ibnbd_clt_parse_map_options':
>> drivers/block/ibnbd/ibnbd-clt-sysfs.c:139:12: warning: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'size_t {aka unsigned int}' [-Wformat=]
pr_err("map_device: too many (> %lu) paths "
^~~~~~
drivers/block/ibnbd/ibnbd-clt-sysfs.c: In function 'ibnbd_clt_map_device_store':
drivers/block/ibnbd/ibnbd-clt-sysfs.c:613:1: warning: the frame size of 1612 bytes is larger than 1024 bytes [-Wframe-larger-than=]
}
^vim +139 drivers/block/ibnbd/ibnbd-clt-sysfs.c
ea541da7d Roman Pen 2018-05-18 88
ea541da7d Roman Pen 2018-05-18 89 static int ibnbd_clt_parse_map_options(const char *buf,
ea541da7d Roman Pen 2018-05-18 90 char *sessname,
ea541da7d Roman Pen 2018-05-18 91 struct ibtrs_addr *paths,
ea541da7d Roman Pen 2018-05-18 92 size_t *path_cnt,
ea541da7d Roman Pen 2018-05-18 93 size_t max_path_cnt,
ea541da7d Roman Pen 2018-05-18 94 char *pathname,
ea541da7d Roman Pen 2018-05-18 95 enum ibnbd_access_mode *access_mode,
ea541da7d Roman Pen 2018-05-18 96 enum ibnbd_io_mode *io_mode)
ea541da7d Roman Pen 2018-05-18 97 {
ea541da7d Roman Pen 2018-05-18 98 char *options, *sep_opt;
ea541da7d Roman Pen 2018-05-18 99 char *p;
ea541da7d Roman Pen 2018-05-18 100 substring_t args[MAX_OPT_ARGS];
ea541da7d Roman Pen 2018-05-18 101 int opt_mask = 0;
ea541da7d Roman Pen 2018-05-18 102 int token;
ea541da7d Roman Pen 2018-05-18 103 int ret = -EINVAL;
ea541da7d Roman Pen 2018-05-18 104 int i;
ea541da7d Roman Pen 2018-05-18 105 int p_cnt = 0;
ea541da7d Roman Pen 2018-05-18 106
ea541da7d Roman Pen 2018-05-18 107 options = kstrdup(buf, GFP_KERNEL);
ea541da7d Roman Pen 2018-05-18 108 if (!options)
ea541da7d Roman Pen 2018-05-18 109 return -ENOMEM;
ea541da7d Roman Pen 2018-05-18 110
ea541da7d Roman Pen 2018-05-18 111 sep_opt = strstrip(options);
ea541da7d Roman Pen 2018-05-18 112 strip(sep_opt);
ea541da7d Roman Pen 2018-05-18 113 while ((p = strsep(&sep_opt, " ")) != NULL) {
ea541da7d Roman Pen 2018-05-18 114 if (!*p)
ea541da7d Roman Pen 2018-05-18 115 continue;
ea541da7d Roman Pen 2018-05-18 116
ea541da7d Roman Pen 2018-05-18 117 token = match_token(p, ibnbd_opt_tokens, args);
ea541da7d Roman Pen 2018-05-18 118 opt_mask |= token;
ea541da7d Roman Pen 2018-05-18 119
ea541da7d Roman Pen 2018-05-18 120 switch (token) {
ea541da7d Roman Pen 2018-05-18 121 case IBNBD_OPT_SESSNAME:
ea541da7d Roman Pen 2018-05-18 122 p = match_strdup(args);
ea541da7d Roman Pen 2018-05-18 123 if (!p) {
ea541da7d Roman Pen 2018-05-18 124 ret = -ENOMEM;
ea541da7d Roman Pen 2018-05-18 125 goto out;
ea541da7d Roman Pen 2018-05-18 126 }
ea541da7d Roman Pen 2018-05-18 127 if (strlen(p) > NAME_MAX) {
ea541da7d Roman Pen 2018-05-18 128 pr_err("map_device: sessname too long\n");
ea541da7d Roman Pen 2018-05-18 129 ret = -EINVAL;
ea541da7d Roman Pen 2018-05-18 130 kfree(p);
ea541da7d Roman Pen 2018-05-18 131 goto out;
ea541da7d Roman Pen 2018-05-18 132 }
ea541da7d Roman Pen 2018-05-18 133 strlcpy(sessname, p, NAME_MAX);
ea541da7d Roman Pen 2018-05-18 134 kfree(p);
ea541da7d Roman Pen 2018-05-18 135 break;
ea541da7d Roman Pen 2018-05-18 136
ea541da7d Roman Pen 2018-05-18 137 case IBNBD_OPT_PATH:
ea541da7d Roman Pen 2018-05-18 138 if (p_cnt >= max_path_cnt) {
ea541da7d Roman Pen 2018-05-18 @139 pr_err("map_device: too many (> %lu) paths "
ea541da7d Roman Pen 2018-05-18 140 "provided\n", max_path_cnt);
ea541da7d Roman Pen 2018-05-18 141 ret = -ENOMEM;
ea541da7d Roman Pen 2018-05-18 142 goto out;
ea541da7d Roman Pen 2018-05-18 143 }
ea541da7d Roman Pen 2018-05-18 144 p = match_strdup(args);
ea541da7d Roman Pen 2018-05-18 145 if (!p) {
ea541da7d Roman Pen 2018-05-18 146 ret = -ENOMEM;
ea541da7d Roman Pen 2018-05-18 147 goto out;
ea541da7d Roman Pen 2018-05-18 148 }
ea541da7d Roman Pen 2018-05-18 149
ea541da7d Roman Pen 2018-05-18 150 ret = ibtrs_addr_to_sockaddr(p, strlen(p), IBTRS_PORT,
ea541da7d Roman Pen 2018-05-18 151 &paths[p_cnt]);
ea541da7d Roman Pen 2018-05-18 152 if (ret) {
ea541da7d Roman Pen 2018-05-18 153 pr_err("Can't parse path %s: %d\n", p, ret);
ea541da7d Roman Pen 2018-05-18 154 kfree(p);
ea541da7d Roman Pen 2018-05-18 155 goto out;
ea541da7d Roman Pen 2018-05-18 156 }
ea541da7d Roman Pen 2018-05-18 157
ea541da7d Roman Pen 2018-05-18 158 p_cnt++;
ea541da7d Roman Pen 2018-05-18 159
ea541da7d Roman Pen 2018-05-18 160 kfree(p);
ea541da7d Roman Pen 2018-05-18 161 break;
ea541da7d Roman Pen 2018-05-18 162
ea541da7d Roman Pen 2018-05-18 163 case IBNBD_OPT_DEV_PATH:
ea541da7d Roman Pen 2018-05-18 164 p = match_strdup(args);
ea541da7d Roman Pen 2018-05-18 165 if (!p) {
ea541da7d Roman Pen 2018-05-18 166 ret = -ENOMEM;
ea541da7d Roman Pen 2018-05-18 167 goto out;
ea541da7d Roman Pen 2018-05-18 168 }
ea541da7d Roman Pen 2018-05-18 169 if (strlen(p) > NAME_MAX) {
ea541da7d Roman Pen 2018-05-18 170 pr_err("map_device: Device path too long\n");
ea541da7d Roman Pen 2018-05-18 171 ret = -EINVAL;
ea541da7d Roman Pen 2018-05-18 172 kfree(p);
ea541da7d Roman Pen 2018-05-18 173 goto out;
ea541da7d Roman Pen 2018-05-18 174 }
ea541da7d Roman Pen 2018-05-18 175 strlcpy(pathname, p, NAME_MAX);
ea541da7d Roman Pen 2018-05-18 176 kfree(p);
ea541da7d Roman Pen 2018-05-18 177 break;
ea541da7d Roman Pen 2018-05-18 178
ea541da7d Roman Pen 2018-05-18 179 case IBNBD_OPT_ACCESS_MODE:
ea541da7d Roman Pen 2018-05-18 180 p = match_strdup(args);
ea541da7d Roman Pen 2018-05-18 181 if (!p) {
ea541da7d Roman Pen 2018-05-18 182 ret = -ENOMEM;
ea541da7d Roman Pen 2018-05-18 183 goto out;
ea541da7d Roman Pen 2018-05-18 184 }
ea541da7d Roman Pen 2018-05-18 185
ea541da7d Roman Pen 2018-05-18 186 if (!strcmp(p, "ro")) {
ea541da7d Roman Pen 2018-05-18 187 *access_mode = IBNBD_ACCESS_RO;
ea541da7d Roman Pen 2018-05-18 188 } else if (!strcmp(p, "rw")) {
ea541da7d Roman Pen 2018-05-18 189 *access_mode = IBNBD_ACCESS_RW;
ea541da7d Roman Pen 2018-05-18 190 } else if (!strcmp(p, "migration")) {
ea541da7d Roman Pen 2018-05-18 191 *access_mode = IBNBD_ACCESS_MIGRATION;
ea541da7d Roman Pen 2018-05-18 192 } else {
ea541da7d Roman Pen 2018-05-18 193 pr_err("map_device: Invalid access_mode:"
ea541da7d Roman Pen 2018-05-18 194 " '%s'\n", p);
ea541da7d Roman Pen 2018-05-18 195 ret = -EINVAL;
ea541da7d Roman Pen 2018-05-18 196 kfree(p);
ea541da7d Roman Pen 2018-05-18 197 goto out;
ea541da7d Roman Pen 2018-05-18 198 }
ea541da7d Roman Pen 2018-05-18 199
ea541da7d Roman Pen 2018-05-18 200 kfree(p);
ea541da7d Roman Pen 2018-05-18 201 break;
ea541da7d Roman Pen 2018-05-18 202
ea541da7d Roman Pen 2018-05-18 203 case IBNBD_OPT_IO_MODE:
ea541da7d Roman Pen 2018-05-18 204 p = match_strdup(args);
ea541da7d Roman Pen 2018-05-18 205 if (!p) {
ea541da7d Roman Pen 2018-05-18 206 ret = -ENOMEM;
ea541da7d Roman Pen 2018-05-18 207 goto out;
ea541da7d Roman Pen 2018-05-18 208 }
ea541da7d Roman Pen 2018-05-18 209 if (!strcmp(p, "blockio")) {
ea541da7d Roman Pen 2018-05-18 210 *io_mode = IBNBD_BLOCKIO;
ea541da7d Roman Pen 2018-05-18 211 } else if (!strcmp(p, "fileio")) {
ea541da7d Roman Pen 2018-05-18 212 *io_mode = IBNBD_FILEIO;
ea541da7d Roman Pen 2018-05-18 213 } else {
ea541da7d Roman Pen 2018-05-18 214 pr_err("map_device: Invalid io_mode: '%s'.\n",
ea541da7d Roman Pen 2018-05-18 215 p);
ea541da7d Roman Pen 2018-05-18 216 ret = -EINVAL;
ea541da7d Roman Pen 2018-05-18 217 kfree(p);
ea541da7d Roman Pen 2018-05-18 218 goto out;
ea541da7d Roman Pen 2018-05-18 219 }
ea541da7d Roman Pen 2018-05-18 220 kfree(p);
ea541da7d Roman Pen 2018-05-18 221 break;
ea541da7d Roman Pen 2018-05-18 222
ea541da7d Roman Pen 2018-05-18 223 default:
ea541da7d Roman Pen 2018-05-18 224 pr_err("map_device: Unknown parameter or missing value"
ea541da7d Roman Pen 2018-05-18 225 " '%s'\n", p);
ea541da7d Roman Pen 2018-05-18 226 ret = -EINVAL;
ea541da7d Roman Pen 2018-05-18 227 goto out;
ea541da7d Roman Pen 2018-05-18 228 }
ea541da7d Roman Pen 2018-05-18 229 }
ea541da7d Roman Pen 2018-05-18 230
ea541da7d Roman Pen 2018-05-18 231 for (i = 0; i < ARRAY_SIZE(ibnbd_opt_mandatory); i++) {
ea541da7d Roman Pen 2018-05-18 232 if ((opt_mask & ibnbd_opt_mandatory[i])) {
ea541da7d Roman Pen 2018-05-18 233 ret = 0;
ea541da7d Roman Pen 2018-05-18 234 } else {
ea541da7d Roman Pen 2018-05-18 235 pr_err("map_device: Parameters missing\n");
ea541da7d Roman Pen 2018-05-18 236 ret = -EINVAL;
ea541da7d Roman Pen 2018-05-18 237 break;
ea541da7d Roman Pen 2018-05-18 238 }
ea541da7d Roman Pen 2018-05-18 239 }
ea541da7d Roman Pen 2018-05-18 240
ea541da7d Roman Pen 2018-05-18 241 out:
ea541da7d Roman Pen 2018-05-18 242 *path_cnt = p_cnt;
ea541da7d Roman Pen 2018-05-18 243 kfree(options);
ea541da7d Roman Pen 2018-05-18 244 return ret;
ea541da7d Roman Pen 2018-05-18 245 }
ea541da7d Roman Pen 2018-05-18 246 :::::: The code at line 139 was first introduced by commit
:::::: ea541da7d8b2518d2b1d68d23d19bb13cca1119b ibnbd: client: sysfs interface functions
:::::: TO: Roman Pen <[email protected]> :::::: CC: 0day robot <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
PATCH v2 25/26 ibnbd: a bit of documentation
In reply to Roman PenREADME with description of major sysfs entries.
--- drivers/block/ibnbd/README | 299 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 299 insertions(+) create mode 100644 drivers/block/ibnbd/README
drivers/block/ibnbd/README new file +299 -0
@@ -0,0 +1,299 @@ +*************************************** +Infiniband Network Block Device (IBNBD) +*************************************** + +Introduction +------------ + +IBNBD (InfiniBand Network Block Device) is a pair of kernel modules +(client and server) that allow for remote access of a block device on +the server over IBTRS protocol using the RDMA (InfiniBand, RoCE, iWarp) +transport. After being mapped, the remote block devices can be accessed +on the client side as local block devices. + +I/O is transfered between client and server by the IBTRS transport +modules. The administration of IBNBD and IBTRS modules is done via +sysfs entries. + +Requirements +------------ + + IBTRS kernel modules + +Quick Start +----------- + +Server side: + # modprobe ibnbd_server + +Client side: + # modprobe ibnbd_client + # echo "sessname=blya path=ip:10.50.100.66 device_path=/dev/ram0" > \ + /sys/devices/virtual/ibnbd-client/ctl/map_device + + Where "sessname=" is a session name, a string to identify the session + on client and on server sides; "path=" is a destination IP address or + a pair of a source and a destination IPs, separated by comma. Multiple + "path=" options can be specified in order to use multipath (see IBTRS + description for details); "device_path=" is the block device to be + mapped from the server side. After the session to the server machine is + established, the mapped device will appear on the client side under + /dev/ibnbd<N>. + + +====================== +Client Sysfs Interface +====================== + +All sysfs files that are not read-only provide the usage information on read: + +Example: + # cat /sys/devices/virtual/ibnbd-client/ctl/map_device + + > Usage: echo "sessname=<name of the ibtrs session> path=<[srcaddr,]dstaddr> + > [path=<[srcaddr,]dstaddr>] device_path=<full path on remote side> + > [access_mode=<ro|rw|migration>] + > [io_mode=<fileio|blockio>]" > map_device + > + > addr ::= [ ip:<ipv4> | ip:<ipv6> | gid:<gid> ] + +Entries under /sys/devices/virtual/ibnbd-client/ctl/ +======================================= + +map_device (RW) +--------------- + +Expected format is the following: + + sessname=<name of the ibtrs session> + path=<[srcaddr,]dstaddr> [path=<[srcaddr,]dstaddr> ...] + device_path=<full path on remote side> + [access_mode=<ro|rw|migration>] + [io_mode=<fileio|blockio>] + +Where: + +sessname: accepts a string not bigger than 256 chars, which identifies + a given session on the client and on the server. + I.e. "clt_hostname-srv_hostname" could be a natural choice. + +path: describes a connection between the client and the server by + specifying destination and, when required, the source address. + The addresses are to be provided in the following format: + + ip:<IPv6> + ip:<IPv4> + gid:<GID> + + for example: + + path=ip:10.0.0.66 + The single addr is treated as the destination. + The connection will be established to this + server from any client IP address. + + path=ip:10.0.0.66,ip:10.0.1.66 + First addr is the source address and the second + is the destination. + + If multiple "path=" options are specified multiple connection + will be established and data will be sent according to + the selected multipath policy (see IBTRS mp_policy sysfs entry + description). + +device_path: Path to the block device on the server side. Path is specified + relative to the directory on server side configured in the + 'dev_search_path' module parameter of the ibnbd_server. + The ibnbd_server prepends the <device_path> received from client + with <dev_search_path> and tries to open the + <dev_search_path>/<device_path> block device. On success, + a /dev/ibnbd<N> device file, a /sys/block/ibnbd_client/ibnbd<N>/ + directory and an entry in /sys/devices/virtual/ibnbd-client/ctl/devices + will be created. + + If 'dev_search_path' contains '%SESSNAME%', then each session can + have different devices namespace, e.g. server was configured with + the following parameter "dev_search_path=/run/ibnbd-devs/%SESSNAME%", + client has this string "sessname=blya device_path=sda", then server + will try to open: /run/ibnbd-devs/blya/sda. + +access_mode: the access_mode parameter specifies if the device is to be + mapped as "ro" read-only or "rw" read-write. The server allows + a device to be exported in rw mode only once. The "migration" + access mode has to be specified if a second mapping in read-write + mode is desired. + + By default "rw" is used. + +io_mode: the io_mode parameter specifies if the device on the server + will be opened as block device "blockio" or as file "fileio". + When the device is opened as file, the VFS page cache is used + for read I/O operations, write I/O operations bypass the page + cache and go directly to disk (except meta updates, like file + access time). + + By default "blockio" mode is used. + +Exit Codes: + +If the device is already mapped it will fail with EEXIST. If the input +has an invalid format it will return EINVAL. If the device path cannot +be found on the server, it will fail with ENOENT. + +Finding device file after mapping +--------------------------------- + +After mapping, the device file can be found by: + o The symlink /sys/devices/virtual/ibnbd-client/ctl/devices/<device_id> + points to /sys/block/<dev-name>. The last part of the symlink destination + is the same as the device name. By extracting the last part of the + path the path to the device /dev/<dev-name> can be build. + + o /dev/block/$(cat /sys/devices/virtual/ibnbd-client/ctl/devices/<device_id>/dev) + +How to find the <device_id> of the device is described on the next +section. + +Entries under /sys/devices/virtual/ibnbd-client/ctl/devices/ +============================================================ + +For each device mapped on the client a new symbolic link is created as +/sys/devices/virtual/ibnbd-client/ctl/devices/<device_id>, which points +to the block device created by ibnbd (/sys/block/ibnbd<N>/). +The <device_id> of each device is created as follows: + +- If the 'device_path' provided during mapping contains slashes ("/"), + they are replaced by exclamation mark ("!") and used as as the + <device_id>. Otherwise, the <device_id> will be the same as the + "device_path" provided. + +Entries under /sys/block/ibnbd<N>/ibnbd_client/ +=============================================== + +unmap_device (RW) +----------------- + +To unmap a volume, "normal" or "force" has to be written to: + /sys/block/ibnbd<N>/ibnbd_client/unmap_device + +When "normal" is used, the operation will fail with EBUSY if any process +is using the device. When "force" is used, the device is also unmapped +when device is in use. All I/Os that are in progress will fail. + +Example: + + # echo "normal" > /sys/block/ibnbd0/ibnbd/unmap_device + +state (RO) +---------- + +The file contains the current state of the block device. The state file +returns "open" when the device is successfully mapped from the server +and accepting I/O requests. When the connection to the server gets +disconnected in case of an error (e.g. link failure), the state file +returns "closed" and all I/O requests submitted to it will fail with -EIO. + +session (RO) +------------ + +IBNBD uses IBTRS session to transport the data between client and +server. The entry "session" contains the name of the session, that +was used to establish the IBTRS session. It's the same name that +was passed as server parameter to the map_device entry. + +mapping_path (RO) +----------------- + +Contains the path that was passed as "device_path" to the map_device +operation. + +====================== +Server Sysfs Interface +====================== + +Entries under /sys/devices/virtual/ibnbd-server/ctl/ +==================================================== + +When a client maps a device, a directory entry with the name of the +block device is created under /sys/devices/virtual/ibnbd-server/ctl/devices/. + +Entries under /sys/devices/virtual/ibnbd-server/ctl/devices/<device_name>/ +========================================================================== + +block_dev (link) +--------------- + +Is a symlink to the sysfs entry of the exported device. + +Example: + + block_dev -> ../../../../devices/virtual/block/ram0 + +Entries under /sys/devices/virtual/ibnbd-server/ctl/devices/<device_name>/sessions/ +=================================================================================== + +For each client a particular device is exported to, following directory will be +created: + +/sys/devices/virtual/ibnbd-server/ctl/devices/<device_name>/sessions/<session-name>/ + +When the device is unmapped by that client, the directory will be removed. + +Entries under /sys/devices/virtual/ibnbd-server/ctl/devices/<device_name>/sessions/<session-name> +================================================================================================= + +read_only (RO) +-------------- + +Contains '1' if device is mapped read-only, otherwise '0'. + +mapping_path (RO) +----------------- + +Contains the relative device path provided by the user during mapping. + +============================== +IBNBD-Server Module Parameters +============================== + +dev_search_path +--------------- + +When a device is mapped from the client, the server generates the path +to the block device on the server side by concatenating dev_search_path +and the "device_path" that was specified in the map_device operation. + +The default dev_search_path is: "/". + +dev_search_path option can also contain %SESSNAME% in order to provide +different deviec namespaces for different sessions. See "device_path" +option for details. + +============================== +Protocol (ibnbd/ibnbd-proto.h) +============================== + +1. Before mapping first device from a given server, client sends an +IBNBD_MSG_SESS_INFO to the server. Server responds with +IBNBD_MSG_SESS_INFO_RSP. Currently the messages only contain the protocol +version for backward compatibility. + +2. Client requests to open a device by sending IBNBD_MSG_OPEN message. This +contains the path to the device, access mode (read-only or writable), and +io_mode which specifies if the device should be opened as block device or +using file io. Server responds to the message with IBNBD_MSG_OPEN_RSP. This +contains a 32 bit device id to be used for IOs and device "geometry" related +information: side, max_hw_sectors, etc. + +3. Client attaches IBNBD_MSG_IO to each IO message send to a device. This +message contains device id, provided by server in his ibnbd_msg_open_rsp, +sector to be accessed, read-write flags and bi_size. + +4. Client closes a device by sending IBNBD_MSG_CLOSE which contains only the +device id provided by the server. + + +Contact +------- + +Mailing list: "IBNBD/IBTRS Storage Team" <[email protected]>
Signature · 1 line
2.13.1
PATCH v2 26/26 MAINTAINERS: Add maintainer for IBNBD/IBTRS modules
In reply to Roman Pen--- MAINTAINERS | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
MAINTAINERS +14 -0
@@ -6786,6 +6786,20 @@ IBM ServeRAID RAID DRIVER S: Orphan F: drivers/scsi/ips.* +IBNBD BLOCK DRIVERS +M: IBNBD/IBTRS Storage Team <[email protected]> +L: [email protected] +S: Maintained +T: git git://github.com/profitbricks/ibnbd.git +F: drivers/block/ibnbd/ + +IBTRS TRANSPORT DRIVERS +M: IBNBD/IBTRS Storage Team <[email protected]> +L: [email protected] +S: Maintained +T: git git://github.com/profitbricks/ibnbd.git +F: drivers/infiniband/ulp/ibtrs/ + ICH LPC AND GPIO DRIVER M: Peter Tyser <[email protected]> S: Maintained
Signature · 1 line
2.13.1
Quoted 64 lines · Roman Pen
Hi all,
This is v2 of series, which introduces IBNBD/IBTRS modules.
This cover letter is split on three parts:
1. Introduction, which almost repeats everything from previous cover letters.
2. Changelog.
3. Performance measurements on linux-4.17.0-rc2 and on two different Mellanox cards: ConnectX-2 and ConnectX-3 and CPUs: Intel and AMD.Introduction
IBTRS (InfiniBand Transport) is a reliable high speed transport library which allows for establishing connection between client and server machines via RDMA. It is optimized to transfer (read/write) IO blocks in the sense that it follows the BIO semantics of providing the possibility to either write data from a scatter-gather list to the remote side or to request ("read") data transfer from the remote side into a given set of buffers.
IBTRS is multipath capalbdke and provides I/O fail-over and load-balancing functionality, i.e. in IBTRS terminology, an IBTRS path is a set of RDMA CMs and particular path is selected according to the load-balancing policy.
IBNBD (InfiniBand Network Block Device) is a pair of kernel modules (client and server) that allow for remote access of a block device on the server over IBTRS protocol. After being mapped, the remote block devices can be accessed on the client side as local block devices. Internally IBNBD uses IBTRS as an RDMA transport library.
Why?
- IBNBD/IBTRS is developed in order to map thin provisioned volumes, thus internal protocol is simple.
- IBTRS was developed as an independent RDMA transport library, which supports fail-over and load-balancing policies using multipath, thus it can be used for any other IO needs rather than only for block device.
- IBNBD/IBTRS is faster than NVME over RDMA.
Old comparison results:
https://www.spinics.net/lists/linux-rdma/msg48799.html
New comparison results: see performance measurements section below.Key features of IBTRS transport library and IBNBD block device:
o High throughput and low latency due to:
- Only two RDMA messages per IO.
- IMM InfiniBand messages on responses to reduce round trip latency.
- Simplified memory management: memory allocation happens once on server side when IBTRS session is established.o IO fail-over and load-balancing by using multipath. According to our test loads additional path brings ~20% of bandwidth.
o Simple configuration of IBNBD:
- Server side is completely passive: volumes do not need to be explicitly exported.
- Only IB port GID and device path needed on client side to map a block device.
- A device is remapped automatically i.e. after storage reboot.
Quoted 8 lines
Commits for kernel can be found here:
https://github.com/profitbricks/ibnbd/commits/linux-4.17-rc2The out-of-tree modules are here:
https://github.com/profitbricks/ibnbd/Vault 2017 presentation:
http://events.linuxfoundation.org/sites/events/files/slides/IBNBD-Vault-2017.pdf
I think from the RDMA side, before we accept something like this, I'd like to hear from Christoph, Chuck or Sagi that the dataplane implementation of this is correct, eg it uses the MRs properly and invalidates at the right time, sequences with dma_ops as required, etc.
They all have done this work on their ULPs and it was tricky, I don't want to see another ULP implement this wrong..
I'm skeptical here already due to the performance numbers - they are not really what I'd expects and we may find that invalidate changes will bring the performance down further.
Jason