[{"id":3684527,"web_url":"http://patchwork.ozlabs.org/comment/3684527/","msgid":"<202604301612.XQrb9dxs-lkp@intel.com>","list_archive_url":null,"date":"2026-04-30T08:15:48","subject":"Re: [PATCH] smb: smbdirect: fix MR registration for coalesced SG\n lists","submitter":{"id":67315,"url":"http://patchwork.ozlabs.org/api/people/67315/","name":"kernel test robot","email":"lkp@intel.com"},"content":"Hi Yi,\n\nkernel test robot noticed the following build warnings:\n\n[auto build test WARNING on v7.1-rc1]\n[also build test WARNING on linus/master next-20260429]\n[cannot apply to brauner-vfs/vfs.all]\n[If your patch is applied to the wrong git tree, kindly drop us a note.\nAnd when submitting patch, we suggest to use '--base' as documented in\nhttps://git-scm.com/docs/git-format-patch#_base_tree_information]\n\nurl:    https://github.com/intel-lab-lkp/linux/commits/Yi-Kuo/smb-smbdirect-fix-MR-registration-for-coalesced-SG-lists/20260429-221606\nbase:   v7.1-rc1\npatch link:    https://lore.kernel.org/r/4bf423bb.AU4AAJbgzlAAAAAAAAAABAMtJJMAAYKKIjQAAAAAAC-ZZgBp8Ww0%40mailjet.com\npatch subject: [PATCH] smb: smbdirect: fix MR registration for coalesced SG lists\nconfig: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20260430/202604301612.XQrb9dxs-lkp@intel.com/config)\ncompiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)\nrustc: rustc 1.88.0 (6b00bc388 2025-06-23)\nreproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260430/202604301612.XQrb9dxs-lkp@intel.com/reproduce)\n\nIf you fix the issue in a separate patch/commit (i.e. not just a new version of\nthe same patch/commit), kindly add following tags\n| Reported-by: kernel test robot <lkp@intel.com>\n| Closes: https://lore.kernel.org/oe-kbuild-all/202604301612.XQrb9dxs-lkp@intel.com/\n\nAll warnings (new ones prefixed by >>):\n\n>> fs/smb/smbdirect/mr.c:304:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]\n     304 |         if (!num_mapped) {\n         |             ^~~~~~~~~~~\n   fs/smb/smbdirect/mr.c:361:40: note: uninitialized use occurs here\n     361 |         smbdirect_socket_schedule_cleanup(sc, ret);\n         |                                               ^~~\n   fs/smb/smbdirect/internal.h:63:23: note: expanded from macro 'smbdirect_socket_schedule_cleanup'\n      63 |                 __func__, __LINE__, __error, NULL)\n         |                                     ^~~~~~~\n   fs/smb/smbdirect/mr.c:304:2: note: remove the 'if' if its condition is always false\n     304 |         if (!num_mapped) {\n         |         ^~~~~~~~~~~~~~~~~~\n     305 |                 smbdirect_log_rdma_mr(sc, SMBDIRECT_LOG_ERR,\n         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n     306 |                         \"ib_dma_map_sg num_pages=%u dir=%x num_mapped=%d\\n\",\n         |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n     307 |                         num_pages, mr->dir, num_mapped);\n         |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n     308 |                 goto dma_map_error;\n         |                 ~~~~~~~~~~~~~~~~~~~\n     309 |         }\n         |         ~\n   fs/smb/smbdirect/mr.c:272:9: note: initialize the variable 'ret' to silence this warning\n     272 |         int ret, num_pages, num_mapped;\n         |                ^\n         |                 = 0\n   1 warning generated.\n\n\nvim +304 fs/smb/smbdirect/mr.c\n\n   256\t\n   257\t/*\n   258\t * Register memory for RDMA read/write\n   259\t * iter: the buffer to register memory with\n   260\t * writing: true if this is a RDMA write (SMB read), false for RDMA read\n   261\t * need_invalidate: true if this MR needs to be locally invalidated after I/O\n   262\t * return value: the MR registered, NULL if failed.\n   263\t */\n   264\tstruct smbdirect_mr_io *\n   265\tsmbdirect_connection_register_mr_io(struct smbdirect_socket *sc,\n   266\t\t\t\t\t    struct iov_iter *iter,\n   267\t\t\t\t\t    bool writing,\n   268\t\t\t\t\t    bool need_invalidate)\n   269\t{\n   270\t\tconst struct smbdirect_socket_parameters *sp = &sc->parameters;\n   271\t\tstruct smbdirect_mr_io *mr;\n   272\t\tint ret, num_pages, num_mapped;\n   273\t\tstruct ib_reg_wr *reg_wr;\n   274\t\n   275\t\tnum_pages = iov_iter_npages(iter, sp->max_frmr_depth + 1);\n   276\t\tif (num_pages > sp->max_frmr_depth) {\n   277\t\t\tsmbdirect_log_rdma_mr(sc, SMBDIRECT_LOG_ERR,\n   278\t\t\t\t\"num_pages=%d max_frmr_depth=%d\\n\",\n   279\t\t\t\tnum_pages, sp->max_frmr_depth);\n   280\t\t\tWARN_ON_ONCE(1);\n   281\t\t\treturn NULL;\n   282\t\t}\n   283\t\n   284\t\tmr = smbdirect_connection_get_mr_io(sc);\n   285\t\tif (!mr) {\n   286\t\t\tsmbdirect_log_rdma_mr(sc, SMBDIRECT_LOG_ERR,\n   287\t\t\t\t\"smbdirect_connection_get_mr_io returning NULL\\n\");\n   288\t\t\treturn NULL;\n   289\t\t}\n   290\t\n   291\t\tmutex_lock(&mr->mutex);\n   292\t\n   293\t\tmr->dir = writing ? DMA_FROM_DEVICE : DMA_TO_DEVICE;\n   294\t\tmr->need_invalidate = need_invalidate;\n   295\t\tmr->sgt.nents = 0;\n   296\t\tmr->sgt.orig_nents = 0;\n   297\t\n   298\t\tsmbdirect_log_rdma_mr(sc, SMBDIRECT_LOG_INFO,\n   299\t\t\t\"num_pages=%u count=%zu depth=%u\\n\",\n   300\t\t\tnum_pages, iov_iter_count(iter), sp->max_frmr_depth);\n   301\t\tsmbdirect_iter_to_sgt(iter, &mr->sgt, sp->max_frmr_depth);\n   302\t\n   303\t\tnum_mapped = ib_dma_map_sg(sc->ib.dev, mr->sgt.sgl, mr->sgt.nents, mr->dir);\n > 304\t\tif (!num_mapped) {\n   305\t\t\tsmbdirect_log_rdma_mr(sc, SMBDIRECT_LOG_ERR,\n   306\t\t\t\t\"ib_dma_map_sg num_pages=%u dir=%x num_mapped=%d\\n\",\n   307\t\t\t\tnum_pages, mr->dir, num_mapped);\n   308\t\t\tgoto dma_map_error;\n   309\t\t}\n   310\t\n   311\t\tret = ib_map_mr_sg(mr->mr, mr->sgt.sgl, num_mapped, NULL, PAGE_SIZE);\n   312\t\tif (ret != num_mapped) {\n   313\t\t\tsmbdirect_log_rdma_mr(sc, SMBDIRECT_LOG_ERR,\n   314\t\t\t\t\"ib_map_mr_sg failed ret = %d num_mapped = %u\\n\",\n   315\t\t\t\tret, num_mapped);\n   316\t\t\tgoto map_mr_error;\n   317\t\t}\n   318\t\n   319\t\tib_update_fast_reg_key(mr->mr, ib_inc_rkey(mr->mr->rkey));\n   320\t\treg_wr = &mr->wr;\n   321\t\treg_wr->wr.opcode = IB_WR_REG_MR;\n   322\t\tmr->cqe.done = smbdirect_connection_mr_io_register_done;\n   323\t\treg_wr->wr.wr_cqe = &mr->cqe;\n   324\t\treg_wr->wr.num_sge = 0;\n   325\t\treg_wr->wr.send_flags = IB_SEND_SIGNALED;\n   326\t\treg_wr->mr = mr->mr;\n   327\t\treg_wr->key = mr->mr->rkey;\n   328\t\treg_wr->access = writing ?\n   329\t\t\t\tIB_ACCESS_REMOTE_WRITE | IB_ACCESS_LOCAL_WRITE :\n   330\t\t\t\tIB_ACCESS_REMOTE_READ;\n   331\t\n   332\t\t/*\n   333\t\t * There is no need for waiting for complemtion on ib_post_send\n   334\t\t * on IB_WR_REG_MR. Hardware enforces a barrier and order of execution\n   335\t\t * on the next ib_post_send when we actually send I/O to remote peer\n   336\t\t */\n   337\t\tret = ib_post_send(sc->ib.qp, &reg_wr->wr, NULL);\n   338\t\tif (!ret) {\n   339\t\t\t/*\n   340\t\t\t * smbdirect_connection_get_mr_io() gave us a reference\n   341\t\t\t * via kref_get(&mr->kref), we keep that and let\n   342\t\t\t * the caller use smbdirect_connection_deregister_mr_io()\n   343\t\t\t * to remove it again.\n   344\t\t\t */\n   345\t\t\tmutex_unlock(&mr->mutex);\n   346\t\t\treturn mr;\n   347\t\t}\n   348\t\n   349\t\tsmbdirect_log_rdma_mr(sc, SMBDIRECT_LOG_ERR,\n   350\t\t\t\"ib_post_send failed ret=%d (%1pe) reg_wr->key=0x%x\\n\",\n   351\t\t\tret, SMBDIRECT_DEBUG_ERR_PTR(ret), reg_wr->key);\n   352\t\n   353\tmap_mr_error:\n   354\t\tib_dma_unmap_sg(sc->ib.dev, mr->sgt.sgl, mr->sgt.nents, mr->dir);\n   355\t\n   356\tdma_map_error:\n   357\t\tmr->sgt.nents = 0;\n   358\t\tmr->state = SMBDIRECT_MR_ERROR;\n   359\t\tatomic_dec(&sc->mr_io.used.count);\n   360\t\n   361\t\tsmbdirect_socket_schedule_cleanup(sc, ret);\n   362\t\n   363\t\t/*\n   364\t\t * smbdirect_connection_get_mr_io() gave us a reference\n   365\t\t * via kref_get(&mr->kref), we need to remove it again\n   366\t\t * on error.\n   367\t\t *\n   368\t\t * No kref_put_mutex() as it's already locked.\n   369\t\t *\n   370\t\t * If smbdirect_mr_io_free_locked() is called\n   371\t\t * and the mutex is unlocked and mr is gone,\n   372\t\t * in that case kref_put() returned 1.\n   373\t\t *\n   374\t\t * If kref_put() returned 0 we know that\n   375\t\t * smbdirect_mr_io_free_locked() didn't\n   376\t\t * run. Not by us nor by anyone else, as we\n   377\t\t * still hold the mutex, so we need to unlock.\n   378\t\t */\n   379\t\tif (!kref_put(&mr->kref, smbdirect_mr_io_free_locked))\n   380\t\t\tmutex_unlock(&mr->mutex);\n   381\t\treturn NULL;\n   382\t}\n   383\t__SMBDIRECT_EXPORT_SYMBOL__(smbdirect_connection_register_mr_io);\n   384","headers":{"Return-Path":"\n <linux-cifs+bounces-11308-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-cifs@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256\n header.s=Intel header.b=CYkl67TU;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-cifs+bounces-11308-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com\n header.b=\"CYkl67TU\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=192.198.163.7","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=intel.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=intel.com"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g5nCb6Zdmz1yHZ\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 18:19:55 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 4960F301F333\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 08:16:09 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id EA10C3FBEA7;\n\tThu, 30 Apr 2026 08:16:08 +0000 (UTC)","from mgamail.intel.com (mgamail.intel.com [192.198.163.7])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D48E3FBEA3;\n\tThu, 30 Apr 2026 08:16:06 +0000 (UTC)","from fmviesa005.fm.intel.com ([10.60.135.145])\n  by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 30 Apr 2026 01:16:06 -0700","from lkp-server01.sh.intel.com (HELO aa799cca880d) ([10.239.97.150])\n  by fmviesa005.fm.intel.com with ESMTP; 30 Apr 2026 01:16:03 -0700","from kbuild by aa799cca880d with local (Exim 4.98.2)\n\t(envelope-from <lkp@intel.com>)\n\tid 1wIMYy-00000000C9Q-3S0W;\n\tThu, 30 Apr 2026 08:16:00 +0000"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777536968; cv=none;\n b=NFRyn2EBL36r5oLdsKRrmUQHdQkzbZ8RUoL2NgIRrrCIi4Hm9ntl2wPM7Uv9HtnXhguINZfkwvy4RAe3/aVN2cUlm+i8RM7gl+jcJsy9QXm5R/zOpI/VQbgz8h+UA9WHVHf+78OcwRIsEahFsX19bz5RazwqHBo252pg3525NJI=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777536968; c=relaxed/simple;\n\tbh=nNc09jnoJHgCs8XfAA6jn5DCZcc//vq0Xyqf8q+70sw=;\n\th=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:\n\t Content-Type:Content-Disposition:In-Reply-To;\n b=ZgtWJxbteT013aXfWyeyDj6GWaCKxGWQRZw8P+/NpRpP72TVxPVFdcRle7nWta5WGpcyjEXD+0Yvr2dgi+7sNhX1zac5Ekl3zwwR3Bw4GnVoRXKJyvbOtU8pxkDFDEQSD58nMC+caenQdxhAaMVGXS70EXFi7KCJYp1tvpRGQ1c=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=intel.com;\n spf=pass smtp.mailfrom=intel.com;\n dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com\n header.b=CYkl67TU; arc=none smtp.client-ip=192.198.163.7","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n  d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n  t=1777536967; x=1809072967;\n  h=date:from:to:cc:subject:message-id:references:\n   mime-version:in-reply-to;\n  bh=nNc09jnoJHgCs8XfAA6jn5DCZcc//vq0Xyqf8q+70sw=;\n  b=CYkl67TUG7gpEZ+zm39jrJJdpKbAoJTIBO52F3dwM1hQ7f6FrU/8/8Ha\n   C00IIJ40hz5OaRQ7pVjGj4O4/zgUa2sEGoYUMwiAfkju4LfNNvGsA5r5I\n   +BgvExsqe3KrwVCm+4WqQGm4aAC8bOuA3NJ7WbnUfvaihOr7GLZhXM0XT\n   4qHSebP2HJ1XRfuwdvsRuw65XoQ+ECqw1dRqGvYg25KyptiJNt1QjjyR8\n   SGCapFk5maDvl715ckSC52NRRIDvwDJe0FMzCavrsfSAjgpBweGRBZMCe\n   7iKm3OB+5C4EVQw0QkE0ND7GIfxZlj4eRet/Kejx7s1xKsQUa4xs9HP8A\n   w==;","X-CSE-ConnectionGUID":["0AFoqdILSG+npfnKTCJ4hg==","UwlkE/3zT8mSpHkl5lpyBg=="],"X-CSE-MsgGUID":["KwIjnpHeROi8W/NXbJ2W7A==","hqfwesjfQaWrJS/8diNheQ=="],"X-IronPort-AV":["E=McAfee;i=\"6800,10657,11771\"; a=\"103934138\"","E=Sophos;i=\"6.23,207,1770624000\";\n   d=\"scan'208\";a=\"103934138\"","E=Sophos;i=\"6.23,207,1770624000\";\n   d=\"scan'208\";a=\"239503745\""],"X-ExtLoop1":"1","Date":"Thu, 30 Apr 2026 16:15:48 +0800","From":"kernel test robot <lkp@intel.com>","To":"Yi Kuo <yi@yikuo.dev>, smfrench@gmail.com, linkinjeon@kernel.org","Cc":"llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev, metze@samba.org,\n\ttom@talpey.com, linux-cifs@vger.kernel.org,\n\tsamba-technical@lists.samba.org, linux-kernel@vger.kernel.org,\n\tYi Kuo <yi@yikuo.dev>","Subject":"Re: [PATCH] smb: smbdirect: fix MR registration for coalesced SG\n lists","Message-ID":"<202604301612.XQrb9dxs-lkp@intel.com>","References":"\n <4bf423bb.AU4AAJbgzlAAAAAAAAAABAMtJJMAAYKKIjQAAAAAAC-ZZgBp8Ww0@mailjet.com>","Precedence":"bulk","X-Mailing-List":"linux-cifs@vger.kernel.org","List-Id":"<linux-cifs.vger.kernel.org>","List-Subscribe":"<mailto:linux-cifs+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-cifs+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"\n <4bf423bb.AU4AAJbgzlAAAAAAAAAABAMtJJMAAYKKIjQAAAAAAC-ZZgBp8Ww0@mailjet.com>"}}]