From: kernel test robot <lkp@intel.com>
To: Xuan Zhuo <xuanzhuo@linux.alibaba.com>, virtualization@lists.linux.dev
Cc: oe-kbuild-all@lists.linux.dev,
"Richard Weinberger" <richard@nod.at>,
"Anton Ivanov" <anton.ivanov@cambridgegreys.com>,
"Johannes Berg" <johannes@sipsolutions.net>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Hans de Goede" <hdegoede@redhat.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Vadim Pasternak" <vadimp@nvidia.com>,
"Bjorn Andersson" <andersson@kernel.org>,
"Mathieu Poirier" <mathieu.poirier@linaro.org>,
"Cornelia Huck" <cohuck@redhat.com>,
"Halil Pasic" <pasic@linux.ibm.com>,
"Eric Farman" <farman@linux.ibm.com>,
"Heiko Carstens" <hca@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
"Sven Schnelle" <svens@linux.ibm.com>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Jesper Dangaard Brouer" <hawk@kernel.org>,
"John Fastabend" <john.fastabend@gmail.com>,
"Benjamin Berg" <benjamin.berg@intel.com>,
"Yang Li" <yang.lee@linux.alibaba.com>,
linux-um@lists.infradead.org
Subject: Re: [PATCH vhost 07/17] virtio: find_vqs: pass struct instead of multi parameters
Date: Fri, 2 Feb 2024 18:17:40 +0800 [thread overview]
Message-ID: <202402021724.AisZOf9F-lkp@intel.com> (raw)
In-Reply-To: <20240130114224.86536-8-xuanzhuo@linux.alibaba.com>
Hi Xuan,
kernel test robot noticed the following build errors:
[auto build test ERROR on v6.7]
[also build test ERROR on next-20240202]
[cannot apply to remoteproc/rproc-next uml/next s390/features linus/master uml/fixes v6.8-rc2 v6.8-rc1]
[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/Xuan-Zhuo/virtio_ring-introduce-vring_need_unmap_buffer/20240130-195202
base: v6.7
patch link: https://lore.kernel.org/r/20240130114224.86536-8-xuanzhuo%40linux.alibaba.com
patch subject: [PATCH vhost 07/17] virtio: find_vqs: pass struct instead of multi parameters
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20240202/202402021724.AisZOf9F-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240202/202402021724.AisZOf9F-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/202402021724.AisZOf9F-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/virtio/virtio_vdpa.c: In function 'virtio_vdpa_setup_vq':
>> drivers/virtio/virtio_vdpa.c:212:59: error: 'cfg' undeclared (first use in this function)
212 | vq = vring_create_virtqueue(vdev, index, &tp_cfg, cfg);
| ^~~
drivers/virtio/virtio_vdpa.c:212:59: note: each undeclared identifier is reported only once for each function it appears in
drivers/virtio/virtio_vdpa.c: In function 'virtio_vdpa_find_vqs':
>> drivers/virtio/virtio_vdpa.c:389:66: error: passing argument 3 of 'virtio_vdpa_setup_vq' from incompatible pointer type [-Werror=incompatible-pointer-types]
389 | vqs[i] = virtio_vdpa_setup_vq(vdev, queue_idx++, cfg);
| ^~~
| |
| struct virtio_vq_config *
drivers/virtio/virtio_vdpa.c:145:29: note: expected 'void (*)(struct virtqueue *)' but argument is of type 'struct virtio_vq_config *'
145 | void (*callback)(struct virtqueue *vq),
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/virtio/virtio_vdpa.c:389:26: error: too few arguments to function 'virtio_vdpa_setup_vq'
389 | vqs[i] = virtio_vdpa_setup_vq(vdev, queue_idx++, cfg);
| ^~~~~~~~~~~~~~~~~~~~
drivers/virtio/virtio_vdpa.c:144:1: note: declared here
144 | virtio_vdpa_setup_vq(struct virtio_device *vdev, unsigned int index,
| ^~~~~~~~~~~~~~~~~~~~
drivers/virtio/virtio_vdpa.c: At top level:
>> drivers/virtio/virtio_vdpa.c:473:27: error: initialization of 'int (*)(struct virtio_device *, struct virtio_vq_config *)' from incompatible pointer type 'int (*)(struct virtio_device *, struct virtio_vq_config *, struct irq_affinity *)' [-Werror=incompatible-pointer-types]
473 | .find_vqs = virtio_vdpa_find_vqs,
| ^~~~~~~~~~~~~~~~~~~~
drivers/virtio/virtio_vdpa.c:473:27: note: (near initialization for 'virtio_vdpa_config_ops.find_vqs')
cc1: some warnings being treated as errors
vim +/cfg +212 drivers/virtio/virtio_vdpa.c
142
143 static struct virtqueue *
144 virtio_vdpa_setup_vq(struct virtio_device *vdev, unsigned int index,
145 void (*callback)(struct virtqueue *vq),
146 const char *name, bool ctx)
147 {
148 struct virtio_vdpa_device *vd_dev = to_virtio_vdpa_device(vdev);
149 struct vdpa_device *vdpa = vd_get_vdpa(vdev);
150 struct transport_vq_config tp_cfg = {};
151 const struct vdpa_config_ops *ops = vdpa->config;
152 struct virtio_vdpa_vq_info *info;
153 bool (*notify)(struct virtqueue *vq) = virtio_vdpa_notify;
154 struct vdpa_callback cb;
155 struct virtqueue *vq;
156 u64 desc_addr, driver_addr, device_addr;
157 /* Assume split virtqueue, switch to packed if necessary */
158 struct vdpa_vq_state state = {0};
159 unsigned long flags;
160 u32 align, max_num, min_num = 1;
161 bool may_reduce_num = true;
162 int err;
163
164 if (!name)
165 return NULL;
166
167 if (index >= vdpa->nvqs)
168 return ERR_PTR(-ENOENT);
169
170 /* We cannot accept VIRTIO_F_NOTIFICATION_DATA without kick_vq_with_data */
171 if (__virtio_test_bit(vdev, VIRTIO_F_NOTIFICATION_DATA)) {
172 if (ops->kick_vq_with_data)
173 notify = virtio_vdpa_notify_with_data;
174 else
175 __virtio_clear_bit(vdev, VIRTIO_F_NOTIFICATION_DATA);
176 }
177
178 /* Queue shouldn't already be set up. */
179 if (ops->get_vq_ready(vdpa, index))
180 return ERR_PTR(-ENOENT);
181
182 /* Allocate and fill out our active queue description */
183 info = kmalloc(sizeof(*info), GFP_KERNEL);
184 if (!info)
185 return ERR_PTR(-ENOMEM);
186
187 max_num = ops->get_vq_num_max(vdpa);
188 if (max_num == 0) {
189 err = -ENOENT;
190 goto error_new_virtqueue;
191 }
192
193 if (ops->get_vq_num_min)
194 min_num = ops->get_vq_num_min(vdpa);
195
196 may_reduce_num = (max_num == min_num) ? false : true;
197
198 /* Create the vring */
199 align = ops->get_vq_align(vdpa);
200
201 if (ops->get_vq_dma_dev)
202 tp_cfg.dma_dev = ops->get_vq_dma_dev(vdpa, index);
203 else
204 tp_cfg.dma_dev = vdpa_get_dma_dev(vdpa);
205
206 tp_cfg.num = max_num;
207 tp_cfg.vring_align = align;
208 tp_cfg.weak_barriers = true;
209 tp_cfg.may_reduce_num = may_reduce_num;
210 tp_cfg.notify = notify;
211
> 212 vq = vring_create_virtqueue(vdev, index, &tp_cfg, cfg);
213 if (!vq) {
214 err = -ENOMEM;
215 goto error_new_virtqueue;
216 }
217
218 vq->num_max = max_num;
219
220 /* Setup virtqueue callback */
221 cb.callback = callback ? virtio_vdpa_virtqueue_cb : NULL;
222 cb.private = info;
223 cb.trigger = NULL;
224 ops->set_vq_cb(vdpa, index, &cb);
225 ops->set_vq_num(vdpa, index, virtqueue_get_vring_size(vq));
226
227 desc_addr = virtqueue_get_desc_addr(vq);
228 driver_addr = virtqueue_get_avail_addr(vq);
229 device_addr = virtqueue_get_used_addr(vq);
230
231 if (ops->set_vq_address(vdpa, index,
232 desc_addr, driver_addr,
233 device_addr)) {
234 err = -EINVAL;
235 goto err_vq;
236 }
237
238 /* reset virtqueue state index */
239 if (virtio_has_feature(vdev, VIRTIO_F_RING_PACKED)) {
240 struct vdpa_vq_state_packed *s = &state.packed;
241
242 s->last_avail_counter = 1;
243 s->last_avail_idx = 0;
244 s->last_used_counter = 1;
245 s->last_used_idx = 0;
246 }
247 err = ops->set_vq_state(vdpa, index, &state);
248 if (err)
249 goto err_vq;
250
251 ops->set_vq_ready(vdpa, index, 1);
252
253 vq->priv = info;
254 info->vq = vq;
255
256 spin_lock_irqsave(&vd_dev->lock, flags);
257 list_add(&info->node, &vd_dev->virtqueues);
258 spin_unlock_irqrestore(&vd_dev->lock, flags);
259
260 return vq;
261
262 err_vq:
263 vring_del_virtqueue(vq);
264 error_new_virtqueue:
265 ops->set_vq_ready(vdpa, index, 0);
266 /* VDPA driver should make sure vq is stopeed here */
267 WARN_ON(ops->get_vq_ready(vdpa, index));
268 kfree(info);
269 return ERR_PTR(err);
270 }
271
272 static void virtio_vdpa_del_vq(struct virtqueue *vq)
273 {
274 struct virtio_vdpa_device *vd_dev = to_virtio_vdpa_device(vq->vdev);
275 struct vdpa_device *vdpa = vd_dev->vdpa;
276 const struct vdpa_config_ops *ops = vdpa->config;
277 struct virtio_vdpa_vq_info *info = vq->priv;
278 unsigned int index = vq->index;
279 unsigned long flags;
280
281 spin_lock_irqsave(&vd_dev->lock, flags);
282 list_del(&info->node);
283 spin_unlock_irqrestore(&vd_dev->lock, flags);
284
285 /* Select and deactivate the queue (best effort) */
286 ops->set_vq_ready(vdpa, index, 0);
287
288 vring_del_virtqueue(vq);
289
290 kfree(info);
291 }
292
293 static void virtio_vdpa_del_vqs(struct virtio_device *vdev)
294 {
295 struct virtqueue *vq, *n;
296
297 list_for_each_entry_safe(vq, n, &vdev->vqs, list)
298 virtio_vdpa_del_vq(vq);
299 }
300
301 static void default_calc_sets(struct irq_affinity *affd, unsigned int affvecs)
302 {
303 affd->nr_sets = 1;
304 affd->set_size[0] = affvecs;
305 }
306
307 static struct cpumask *
308 create_affinity_masks(unsigned int nvecs, struct irq_affinity *affd)
309 {
310 unsigned int affvecs = 0, curvec, usedvecs, i;
311 struct cpumask *masks = NULL;
312
313 if (nvecs > affd->pre_vectors + affd->post_vectors)
314 affvecs = nvecs - affd->pre_vectors - affd->post_vectors;
315
316 if (!affd->calc_sets)
317 affd->calc_sets = default_calc_sets;
318
319 affd->calc_sets(affd, affvecs);
320
321 if (!affvecs)
322 return NULL;
323
324 masks = kcalloc(nvecs, sizeof(*masks), GFP_KERNEL);
325 if (!masks)
326 return NULL;
327
328 /* Fill out vectors at the beginning that don't need affinity */
329 for (curvec = 0; curvec < affd->pre_vectors; curvec++)
330 cpumask_setall(&masks[curvec]);
331
332 for (i = 0, usedvecs = 0; i < affd->nr_sets; i++) {
333 unsigned int this_vecs = affd->set_size[i];
334 int j;
335 struct cpumask *result = group_cpus_evenly(this_vecs);
336
337 if (!result) {
338 kfree(masks);
339 return NULL;
340 }
341
342 for (j = 0; j < this_vecs; j++)
343 cpumask_copy(&masks[curvec + j], &result[j]);
344 kfree(result);
345
346 curvec += this_vecs;
347 usedvecs += this_vecs;
348 }
349
350 /* Fill out vectors at the end that don't need affinity */
351 if (usedvecs >= affvecs)
352 curvec = affd->pre_vectors + affvecs;
353 else
354 curvec = affd->pre_vectors + usedvecs;
355 for (; curvec < nvecs; curvec++)
356 cpumask_setall(&masks[curvec]);
357
358 return masks;
359 }
360
361 static int virtio_vdpa_find_vqs(struct virtio_device *vdev,
362 struct virtio_vq_config *cfg,
363 struct irq_affinity *desc)
364 {
365 struct virtio_vdpa_device *vd_dev = to_virtio_vdpa_device(vdev);
366 struct vdpa_device *vdpa = vd_get_vdpa(vdev);
367 const struct vdpa_config_ops *ops = vdpa->config;
368 struct irq_affinity default_affd = { 0 };
369 struct cpumask *masks;
370 struct vdpa_callback cb;
371 bool has_affinity = desc && ops->set_vq_affinity;
372 struct virtqueue **vqs = cfg->vqs;
373 unsigned int nvqs = cfg->nvqs;
374 int i, err, queue_idx = 0;
375
376 if (has_affinity) {
377 masks = create_affinity_masks(nvqs, desc ? desc : &default_affd);
378 if (!masks)
379 return -ENOMEM;
380 }
381
382 for (i = 0; i < nvqs; ++i) {
383 if (!cfg->names[i]) {
384 vqs[i] = NULL;
385 continue;
386 }
387
388 cfg->cfg_idx = i;
> 389 vqs[i] = virtio_vdpa_setup_vq(vdev, queue_idx++, cfg);
390 if (IS_ERR(vqs[i])) {
391 err = PTR_ERR(vqs[i]);
392 goto err_setup_vq;
393 }
394
395 if (has_affinity)
396 ops->set_vq_affinity(vdpa, i, &masks[i]);
397 }
398
399 cb.callback = virtio_vdpa_config_cb;
400 cb.private = vd_dev;
401 ops->set_config_cb(vdpa, &cb);
402 if (has_affinity)
403 kfree(masks);
404
405 return 0;
406
407 err_setup_vq:
408 virtio_vdpa_del_vqs(vdev);
409 if (has_affinity)
410 kfree(masks);
411 return err;
412 }
413
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next prev parent reply other threads:[~2024-02-02 10:19 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-30 11:42 [PATCH vhost 00/17] virtio: drivers maintain dma info for premapped vq Xuan Zhuo
2024-01-30 11:42 ` [PATCH vhost 01/17] virtio_ring: introduce vring_need_unmap_buffer Xuan Zhuo
2024-01-31 9:12 ` Jason Wang
2024-01-30 11:42 ` [PATCH vhost 02/17] virtio_ring: packed: remove double check of the unmap ops Xuan Zhuo
2024-01-31 9:12 ` Jason Wang
2024-01-31 9:58 ` Xuan Zhuo
2024-01-30 11:42 ` [PATCH vhost 03/17] virtio_ring: packed: structure the indirect desc table Xuan Zhuo
2024-01-31 9:12 ` Jason Wang
2024-01-31 10:00 ` Xuan Zhuo
2024-02-01 0:41 ` Jason Wang
2024-01-30 11:42 ` [PATCH vhost 04/17] virtio_ring: split: remove double check of the unmap ops Xuan Zhuo
2024-01-31 9:12 ` Jason Wang
2024-01-31 9:43 ` Michael S. Tsirkin
2024-02-01 5:47 ` Jason Wang
2024-02-01 6:43 ` Xuan Zhuo
2024-01-30 11:42 ` [PATCH vhost 05/17] virtio_ring: split: structure the indirect desc table Xuan Zhuo
2024-01-31 9:12 ` Jason Wang
2024-01-30 11:42 ` [PATCH vhost 06/17] virtio_ring: no store dma info when unmap is not needed Xuan Zhuo
2024-01-31 9:12 ` Jason Wang
2024-02-01 6:04 ` Xuan Zhuo
2024-02-02 3:04 ` Jason Wang
2024-01-30 11:42 ` [PATCH vhost 07/17] virtio: find_vqs: pass struct instead of multi parameters Xuan Zhuo
2024-01-31 9:12 ` Jason Wang
2024-02-01 3:00 ` Xuan Zhuo
2024-02-20 14:18 ` Halil Pasic
2024-02-21 2:03 ` Xuan Zhuo
2024-02-02 10:17 ` kernel test robot [this message]
2024-01-30 11:42 ` [PATCH vhost 08/17] virtio: vring_new_virtqueue(): " Xuan Zhuo
2024-01-31 9:12 ` Jason Wang
2024-01-31 11:03 ` Ilpo Järvinen
2024-02-01 2:24 ` Xuan Zhuo
2024-01-30 11:42 ` [PATCH vhost 09/17] virtio_ring: reuse the parameter struct of find_vqs() Xuan Zhuo
2024-01-30 11:42 ` [PATCH vhost 10/17] virtio: find_vqs: add new parameter premapped Xuan Zhuo
2024-01-30 11:42 ` [PATCH vhost 11/17] virtio_ring: export premapped to driver by struct virtqueue Xuan Zhuo
2024-01-31 9:12 ` Jason Wang
2024-02-01 3:17 ` Xuan Zhuo
2024-01-30 11:42 ` [PATCH vhost 12/17] virtio_net: set premapped mode by find_vqs() Xuan Zhuo
2024-01-30 11:42 ` [PATCH vhost 13/17] virtio_ring: remove api of setting vq premapped Xuan Zhuo
2024-01-30 11:42 ` [PATCH vhost 14/17] virtio_ring: introduce dma map api for page Xuan Zhuo
2024-01-30 11:42 ` [PATCH vhost 15/17] virtio_net: unify the code for recycling the xmit ptr Xuan Zhuo
2024-01-30 11:42 ` [PATCH vhost 16/17] virtio_net: rename free_old_xmit_skbs to free_old_xmit Xuan Zhuo
2024-01-30 11:42 ` [PATCH vhost 17/17] virtio_net: sq support premapped mode Xuan Zhuo
2024-01-31 9:12 ` Jason Wang
2024-02-01 3:21 ` Xuan Zhuo
2024-02-01 5:36 ` Jason Wang
2024-02-01 5:56 ` Xuan Zhuo
2024-02-02 3:06 ` Jason Wang
2024-02-01 7:43 ` [PATCH vhost 00/17] virtio: drivers maintain dma info for premapped vq Zhu Yanjun
2024-02-01 9:57 ` Xuan Zhuo
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=202402021724.AisZOf9F-lkp@intel.com \
--to=lkp@intel.com \
--cc=agordeev@linux.ibm.com \
--cc=andersson@kernel.org \
--cc=anton.ivanov@cambridgegreys.com \
--cc=ast@kernel.org \
--cc=benjamin.berg@intel.com \
--cc=borntraeger@linux.ibm.com \
--cc=cohuck@redhat.com \
--cc=daniel@iogearbox.net \
--cc=edumazet@google.com \
--cc=farman@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hawk@kernel.org \
--cc=hca@linux.ibm.com \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jasowang@redhat.com \
--cc=johannes@sipsolutions.net \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-um@lists.infradead.org \
--cc=mathieu.poirier@linaro.org \
--cc=mst@redhat.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=pabeni@redhat.com \
--cc=pasic@linux.ibm.com \
--cc=richard@nod.at \
--cc=svens@linux.ibm.com \
--cc=vadimp@nvidia.com \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.com \
--cc=yang.lee@linux.alibaba.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).