From: kernel test robot <lkp@intel.com>
To: Saeed Mahameed <saeed@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
Jason Gunthorpe <jgg@nvidia.com>,
Leon Romanovsky <leonro@nvidia.com>, Jiri Pirko <jiri@nvidia.com>,
Leonid Bloch <lbloch@nvidia.com>,
Itay Avraham <itayavr@nvidia.com>,
Jakub Kicinski <kuba@kernel.org>,
linux-kernel@vger.kernel.org, Saeed Mahameed <saeedm@nvidia.com>
Subject: Re: [PATCH v2 5/5] misc: mlx5ctl: Add umem reg/unreg ioctl
Date: Mon, 20 Nov 2023 05:34:19 +0800 [thread overview]
Message-ID: <202311200506.qHEeLcQq-lkp@intel.com> (raw)
In-Reply-To: <20231119092450.164996-6-saeed@kernel.org>
Hi Saeed,
kernel test robot noticed the following build errors:
[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on rdma/for-next linus/master v6.7-rc1 next-20231117]
[cannot apply to char-misc/char-misc-next char-misc/char-misc-linus soc/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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Saeed-Mahameed/misc-mlx5ctl-Add-mlx5ctl-misc-driver/20231119-215311
base: char-misc/char-misc-testing
patch link: https://lore.kernel.org/r/20231119092450.164996-6-saeed%40kernel.org
patch subject: [PATCH v2 5/5] misc: mlx5ctl: Add umem reg/unreg ioctl
config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20231120/202311200506.qHEeLcQq-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231120/202311200506.qHEeLcQq-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311200506.qHEeLcQq-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/misc/mlx5ctl/umem.c:79:21: error: call to undeclared function 'pages_to_mb'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
79 | if (npages == 0 || pages_to_mb(npages) > MLX5CTL_UMEM_MAX_MB)
| ^
1 error generated.
vim +/pages_to_mb +79 drivers/misc/mlx5ctl/umem.c
60
61 static struct mlx5ctl_umem *mlx5ctl_umem_pin(struct mlx5ctl_umem_db *umem_db,
62 unsigned long addr, size_t size)
63 {
64 size_t npages = umem_num_pages(addr, size);
65 struct mlx5_core_dev *mdev = umem_db->mdev;
66 unsigned long endaddr = addr + size;
67 struct mlx5ctl_umem *umem;
68 struct page **page_list;
69 int err = -EINVAL;
70 int pinned = 0;
71
72 dev_dbg(mdev->device, "%s: addr %p size %zu npages %zu\n",
73 __func__, (void __user *)addr, size, npages);
74
75 /* Avoid integer overflow */
76 if (endaddr < addr || PAGE_ALIGN(endaddr) < endaddr)
77 return ERR_PTR(-EINVAL);
78
> 79 if (npages == 0 || pages_to_mb(npages) > MLX5CTL_UMEM_MAX_MB)
80 return ERR_PTR(-EINVAL);
81
82 page_list = kvmalloc_array(npages, sizeof(struct page *), GFP_KERNEL_ACCOUNT);
83 if (!page_list)
84 return ERR_PTR(-ENOMEM);
85
86 umem = kzalloc(sizeof(*umem), GFP_KERNEL_ACCOUNT);
87 if (!umem) {
88 kvfree(page_list);
89 return ERR_PTR(-ENOMEM);
90 }
91
92 umem->addr = addr;
93 umem->size = size;
94 umem->offset = addr & ~PAGE_MASK;
95 umem->npages = npages;
96
97 umem->page_list = page_list;
98 umem->source_mm = current->mm;
99 umem->source_task = current->group_leader;
100 get_task_struct(current->group_leader);
101 umem->source_user = get_uid(current_user());
102
103 /* mm and RLIMIT_MEMLOCK user task accounting similar to what is
104 * being done in iopt_alloc_pages() and do_update_pinned()
105 * for IOPT_PAGES_ACCOUNT_USER @drivers/iommu/iommufd/pages.c
106 */
107 mmgrab(umem->source_mm);
108
109 pinned = pin_user_pages_fast(addr, npages, FOLL_WRITE, page_list);
110 if (pinned != npages) {
111 dev_dbg(mdev->device, "pin_user_pages_fast failed %d\n", pinned);
112 err = pinned < 0 ? pinned : -ENOMEM;
113 goto pin_failed;
114 }
115
116 err = inc_user_locked_vm(umem, npages);
117 if (err)
118 goto pin_failed;
119
120 atomic64_add(npages, &umem->source_mm->pinned_vm);
121
122 err = sg_alloc_table_from_pages(&umem->sgt, page_list, npages, 0,
123 npages << PAGE_SHIFT, GFP_KERNEL_ACCOUNT);
124 if (err) {
125 dev_dbg(mdev->device, "sg_alloc_table failed: %d\n", err);
126 goto sgt_failed;
127 }
128
129 dev_dbg(mdev->device, "\tsgt: size %zu npages %zu sgt.nents (%d)\n",
130 size, npages, umem->sgt.nents);
131
132 err = dma_map_sgtable(mdev->device, &umem->sgt, DMA_BIDIRECTIONAL, 0);
133 if (err) {
134 dev_dbg(mdev->device, "dma_map_sgtable failed: %d\n", err);
135 goto dma_failed;
136 }
137
138 dev_dbg(mdev->device, "\tsgt: dma_nents %d\n", umem->sgt.nents);
139 return umem;
140
141 dma_failed:
142 sgt_failed:
143 sg_free_table(&umem->sgt);
144 atomic64_sub(npages, &umem->source_mm->pinned_vm);
145 dec_user_locked_vm(umem, npages);
146 pin_failed:
147 if (pinned > 0)
148 unpin_user_pages(page_list, pinned);
149 mmdrop(umem->source_mm);
150 free_uid(umem->source_user);
151 put_task_struct(umem->source_task);
152
153 kfree(umem);
154 kvfree(page_list);
155 return ERR_PTR(err);
156 }
157
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
prev parent reply other threads:[~2023-11-19 21:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-19 9:24 [PATCH V2 0/5] mlx5 ConnectX diagnostic misc driver Saeed Mahameed
2023-11-19 9:24 ` [PATCH V2 1/5] mlx5: Add aux dev for ctl interface Saeed Mahameed
2023-11-19 9:24 ` [PATCH V2 2/5] misc: mlx5ctl: Add mlx5ctl misc driver Saeed Mahameed
2023-11-19 9:51 ` Greg Kroah-Hartman
2023-11-21 7:25 ` Saeed Mahameed
2023-11-19 9:24 ` [PATCH V2 3/5] misc: mlx5ctl: Add info ioctl Saeed Mahameed
2023-11-19 9:24 ` [PATCH V2 4/5] misc: mlx5ctl: Add command rpc ioctl Saeed Mahameed
2023-11-19 9:24 ` [PATCH V2 5/5] misc: mlx5ctl: Add umem reg/unreg ioctl Saeed Mahameed
2023-11-19 19:29 ` [PATCH v2 " kernel test robot
2023-11-19 20:06 ` kernel test robot
2023-11-19 21:34 ` kernel test robot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202311200506.qHEeLcQq-lkp@intel.com \
--to=lkp@intel.com \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=itayavr@nvidia.com \
--cc=jgg@nvidia.com \
--cc=jiri@nvidia.com \
--cc=kuba@kernel.org \
--cc=lbloch@nvidia.com \
--cc=leonro@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=saeed@kernel.org \
--cc=saeedm@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.