drivers/infiniband/hw/bnxt_re/ib_verbs.c:3315:2: note: in expansion of macro 'if'
From: kbuild test robot
Date: Fri Feb 02 2018 - 02:44:43 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 4bf772b14675411a69b3c807f73006de0fe4b649
commit: 872f3578241d7e648b3bfcf6451a55faf97ce2e9 RDMA/bnxt_re: Add support for MRs with Huge pages
date: 2 weeks ago
config: i386-randconfig-sb0-02021411 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
git checkout 872f3578241d7e648b3bfcf6451a55faf97ce2e9
# save the attached .config to linux build tree
make ARCH=i386
All warnings (new ones prefixed by >>):
drivers/infiniband/hw/bnxt_re/ib_verbs.c: In function 'bnxt_re_query_device':
drivers/infiniband/hw/bnxt_re/ib_verbs.c:149:2: warning: left shift count >= width of type
ib_attr->max_mr_size = BNXT_RE_MAX_MR_SIZE;
^
drivers/infiniband/hw/bnxt_re/ib_verbs.c: In function 'bnxt_re_reg_user_mr':
drivers/infiniband/hw/bnxt_re/ib_verbs.c:3315:2: warning: left shift count >= width of type
if (length > BNXT_RE_MAX_MR_SIZE) {
^
drivers/infiniband/hw/bnxt_re/ib_verbs.c:3315:2: warning: left shift count >= width of type
In file included from include/linux/kernel.h:10:0,
from include/linux/interrupt.h:6,
from drivers/infiniband/hw/bnxt_re/ib_verbs.c:39:
>> include/linux/compiler.h:61:17: warning: left shift count >= width of type
static struct ftrace_branch_data \
^
include/linux/compiler.h:56:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^
>> drivers/infiniband/hw/bnxt_re/ib_verbs.c:3315:2: note: in expansion of macro 'if'
if (length > BNXT_RE_MAX_MR_SIZE) {
^
drivers/infiniband/hw/bnxt_re/ib_verbs.c:3317:4: warning: left shift count >= width of type
length, BNXT_RE_MAX_MR_SIZE);
^
--
drivers/infiniband//hw/bnxt_re/ib_verbs.c: In function 'bnxt_re_query_device':
drivers/infiniband//hw/bnxt_re/ib_verbs.c:149:2: warning: left shift count >= width of type
ib_attr->max_mr_size = BNXT_RE_MAX_MR_SIZE;
^
drivers/infiniband//hw/bnxt_re/ib_verbs.c: In function 'bnxt_re_reg_user_mr':
drivers/infiniband//hw/bnxt_re/ib_verbs.c:3315:2: warning: left shift count >= width of type
if (length > BNXT_RE_MAX_MR_SIZE) {
^
drivers/infiniband//hw/bnxt_re/ib_verbs.c:3315:2: warning: left shift count >= width of type
In file included from include/linux/kernel.h:10:0,
from include/linux/interrupt.h:6,
from drivers/infiniband//hw/bnxt_re/ib_verbs.c:39:
>> include/linux/compiler.h:61:17: warning: left shift count >= width of type
static struct ftrace_branch_data \
^
include/linux/compiler.h:56:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^
drivers/infiniband//hw/bnxt_re/ib_verbs.c:3315:2: note: in expansion of macro 'if'
if (length > BNXT_RE_MAX_MR_SIZE) {
^
drivers/infiniband//hw/bnxt_re/ib_verbs.c:3317:4: warning: left shift count >= width of type
length, BNXT_RE_MAX_MR_SIZE);
^
vim +/if +3315 drivers/infiniband/hw/bnxt_re/ib_verbs.c
872f35782 Somnath Kotur 2018-01-11 3302
1ac5a4047 Selvin Xavier 2017-02-10 3303 /* uverbs */
1ac5a4047 Selvin Xavier 2017-02-10 3304 struct ib_mr *bnxt_re_reg_user_mr(struct ib_pd *ib_pd, u64 start, u64 length,
1ac5a4047 Selvin Xavier 2017-02-10 3305 u64 virt_addr, int mr_access_flags,
1ac5a4047 Selvin Xavier 2017-02-10 3306 struct ib_udata *udata)
1ac5a4047 Selvin Xavier 2017-02-10 3307 {
1ac5a4047 Selvin Xavier 2017-02-10 3308 struct bnxt_re_pd *pd = container_of(ib_pd, struct bnxt_re_pd, ib_pd);
1ac5a4047 Selvin Xavier 2017-02-10 3309 struct bnxt_re_dev *rdev = pd->rdev;
1ac5a4047 Selvin Xavier 2017-02-10 3310 struct bnxt_re_mr *mr;
1ac5a4047 Selvin Xavier 2017-02-10 3311 struct ib_umem *umem;
872f35782 Somnath Kotur 2018-01-11 3312 u64 *pbl_tbl = NULL;
872f35782 Somnath Kotur 2018-01-11 3313 int umem_pgs, page_shift, rc;
1ac5a4047 Selvin Xavier 2017-02-10 3314
58d4a671d Selvin Xavier 2017-06-29 @3315 if (length > BNXT_RE_MAX_MR_SIZE) {
58d4a671d Selvin Xavier 2017-06-29 3316 dev_err(rdev_to_dev(rdev), "MR Size: %lld > Max supported:%ld\n",
58d4a671d Selvin Xavier 2017-06-29 3317 length, BNXT_RE_MAX_MR_SIZE);
58d4a671d Selvin Xavier 2017-06-29 3318 return ERR_PTR(-ENOMEM);
58d4a671d Selvin Xavier 2017-06-29 3319 }
58d4a671d Selvin Xavier 2017-06-29 3320
1ac5a4047 Selvin Xavier 2017-02-10 3321 mr = kzalloc(sizeof(*mr), GFP_KERNEL);
1ac5a4047 Selvin Xavier 2017-02-10 3322 if (!mr)
1ac5a4047 Selvin Xavier 2017-02-10 3323 return ERR_PTR(-ENOMEM);
1ac5a4047 Selvin Xavier 2017-02-10 3324
1ac5a4047 Selvin Xavier 2017-02-10 3325 mr->rdev = rdev;
1ac5a4047 Selvin Xavier 2017-02-10 3326 mr->qplib_mr.pd = &pd->qplib_pd;
1ac5a4047 Selvin Xavier 2017-02-10 3327 mr->qplib_mr.flags = __from_ib_access_flags(mr_access_flags);
1ac5a4047 Selvin Xavier 2017-02-10 3328 mr->qplib_mr.type = CMDQ_ALLOCATE_MRW_MRW_FLAGS_MR;
1ac5a4047 Selvin Xavier 2017-02-10 3329
872f35782 Somnath Kotur 2018-01-11 3330 rc = bnxt_qplib_alloc_mrw(&rdev->qplib_res, &mr->qplib_mr);
872f35782 Somnath Kotur 2018-01-11 3331 if (rc) {
872f35782 Somnath Kotur 2018-01-11 3332 dev_err(rdev_to_dev(rdev), "Failed to allocate MR");
872f35782 Somnath Kotur 2018-01-11 3333 goto free_mr;
872f35782 Somnath Kotur 2018-01-11 3334 }
872f35782 Somnath Kotur 2018-01-11 3335 /* The fixed portion of the rkey is the same as the lkey */
872f35782 Somnath Kotur 2018-01-11 3336 mr->ib_mr.rkey = mr->qplib_mr.rkey;
872f35782 Somnath Kotur 2018-01-11 3337
1ac5a4047 Selvin Xavier 2017-02-10 3338 umem = ib_umem_get(ib_pd->uobject->context, start, length,
1ac5a4047 Selvin Xavier 2017-02-10 3339 mr_access_flags, 0);
1ac5a4047 Selvin Xavier 2017-02-10 3340 if (IS_ERR(umem)) {
1ac5a4047 Selvin Xavier 2017-02-10 3341 dev_err(rdev_to_dev(rdev), "Failed to get umem");
1ac5a4047 Selvin Xavier 2017-02-10 3342 rc = -EFAULT;
872f35782 Somnath Kotur 2018-01-11 3343 goto free_mrw;
1ac5a4047 Selvin Xavier 2017-02-10 3344 }
1ac5a4047 Selvin Xavier 2017-02-10 3345 mr->ib_umem = umem;
1ac5a4047 Selvin Xavier 2017-02-10 3346
1ac5a4047 Selvin Xavier 2017-02-10 3347 mr->qplib_mr.va = virt_addr;
1ac5a4047 Selvin Xavier 2017-02-10 3348 umem_pgs = ib_umem_page_count(umem);
1ac5a4047 Selvin Xavier 2017-02-10 3349 if (!umem_pgs) {
1ac5a4047 Selvin Xavier 2017-02-10 3350 dev_err(rdev_to_dev(rdev), "umem is invalid!");
1ac5a4047 Selvin Xavier 2017-02-10 3351 rc = -EINVAL;
872f35782 Somnath Kotur 2018-01-11 3352 goto free_umem;
1ac5a4047 Selvin Xavier 2017-02-10 3353 }
1ac5a4047 Selvin Xavier 2017-02-10 3354 mr->qplib_mr.total_size = length;
1ac5a4047 Selvin Xavier 2017-02-10 3355
1ac5a4047 Selvin Xavier 2017-02-10 3356 pbl_tbl = kcalloc(umem_pgs, sizeof(u64 *), GFP_KERNEL);
1ac5a4047 Selvin Xavier 2017-02-10 3357 if (!pbl_tbl) {
872f35782 Somnath Kotur 2018-01-11 3358 rc = -ENOMEM;
872f35782 Somnath Kotur 2018-01-11 3359 goto free_umem;
1ac5a4047 Selvin Xavier 2017-02-10 3360 }
1ac5a4047 Selvin Xavier 2017-02-10 3361
872f35782 Somnath Kotur 2018-01-11 3362 page_shift = umem->page_shift;
872f35782 Somnath Kotur 2018-01-11 3363
872f35782 Somnath Kotur 2018-01-11 3364 if (!bnxt_re_page_size_ok(page_shift)) {
872f35782 Somnath Kotur 2018-01-11 3365 dev_err(rdev_to_dev(rdev), "umem page size unsupported!");
1ac5a4047 Selvin Xavier 2017-02-10 3366 rc = -EFAULT;
1ac5a4047 Selvin Xavier 2017-02-10 3367 goto fail;
1ac5a4047 Selvin Xavier 2017-02-10 3368 }
3e7e1193e Artemy Kovalyov 2017-04-05 3369
872f35782 Somnath Kotur 2018-01-11 3370 if (!umem->hugetlb && length > BNXT_RE_MAX_MR_SIZE_LOW) {
872f35782 Somnath Kotur 2018-01-11 3371 dev_err(rdev_to_dev(rdev), "Requested MR Sz:%llu Max sup:%llu",
872f35782 Somnath Kotur 2018-01-11 3372 length, (u64)BNXT_RE_MAX_MR_SIZE_LOW);
872f35782 Somnath Kotur 2018-01-11 3373 rc = -EINVAL;
1ac5a4047 Selvin Xavier 2017-02-10 3374 goto fail;
1ac5a4047 Selvin Xavier 2017-02-10 3375 }
872f35782 Somnath Kotur 2018-01-11 3376 if (umem->hugetlb && length > BNXT_RE_PAGE_SIZE_2M) {
872f35782 Somnath Kotur 2018-01-11 3377 page_shift = BNXT_RE_PAGE_SHIFT_2M;
872f35782 Somnath Kotur 2018-01-11 3378 dev_warn(rdev_to_dev(rdev), "umem hugetlb set page_size %x",
872f35782 Somnath Kotur 2018-01-11 3379 1 << page_shift);
1ac5a4047 Selvin Xavier 2017-02-10 3380 }
872f35782 Somnath Kotur 2018-01-11 3381
872f35782 Somnath Kotur 2018-01-11 3382 /* Map umem buf ptrs to the PBL */
872f35782 Somnath Kotur 2018-01-11 3383 umem_pgs = fill_umem_pbl_tbl(umem, pbl_tbl, page_shift);
872f35782 Somnath Kotur 2018-01-11 3384 rc = bnxt_qplib_reg_mr(&rdev->qplib_res, &mr->qplib_mr, pbl_tbl,
872f35782 Somnath Kotur 2018-01-11 3385 umem_pgs, false, 1 << page_shift);
1ac5a4047 Selvin Xavier 2017-02-10 3386 if (rc) {
1ac5a4047 Selvin Xavier 2017-02-10 3387 dev_err(rdev_to_dev(rdev), "Failed to register user MR");
1ac5a4047 Selvin Xavier 2017-02-10 3388 goto fail;
1ac5a4047 Selvin Xavier 2017-02-10 3389 }
1ac5a4047 Selvin Xavier 2017-02-10 3390
872f35782 Somnath Kotur 2018-01-11 3391 kfree(pbl_tbl);
1ac5a4047 Selvin Xavier 2017-02-10 3392
1ac5a4047 Selvin Xavier 2017-02-10 3393 mr->ib_mr.lkey = mr->qplib_mr.lkey;
1ac5a4047 Selvin Xavier 2017-02-10 3394 mr->ib_mr.rkey = mr->qplib_mr.lkey;
1ac5a4047 Selvin Xavier 2017-02-10 3395 atomic_inc(&rdev->mr_count);
1ac5a4047 Selvin Xavier 2017-02-10 3396
1ac5a4047 Selvin Xavier 2017-02-10 3397 return &mr->ib_mr;
1ac5a4047 Selvin Xavier 2017-02-10 3398 fail:
872f35782 Somnath Kotur 2018-01-11 3399 kfree(pbl_tbl);
872f35782 Somnath Kotur 2018-01-11 3400 free_umem:
872f35782 Somnath Kotur 2018-01-11 3401 ib_umem_release(umem);
1ac5a4047 Selvin Xavier 2017-02-10 3402 free_mrw:
1ac5a4047 Selvin Xavier 2017-02-10 3403 bnxt_qplib_free_mrw(&rdev->qplib_res, &mr->qplib_mr);
1ac5a4047 Selvin Xavier 2017-02-10 3404 free_mr:
1ac5a4047 Selvin Xavier 2017-02-10 3405 kfree(mr);
1ac5a4047 Selvin Xavier 2017-02-10 3406 return ERR_PTR(rc);
1ac5a4047 Selvin Xavier 2017-02-10 3407 }
1ac5a4047 Selvin Xavier 2017-02-10 3408
:::::: The code at line 3315 was first introduced by commit
:::::: 58d4a671d0eac45db1c7f27c8684c277249ac127 RDMA/bnxt_re: Report supported value to IB stack in query_device
:::::: TO: Selvin Xavier <selvin.xavier@xxxxxxxxxxxx>
:::::: CC: Doug Ledford <dledford@xxxxxxxxxx>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip