[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202006260708.U4chgqpZ%lkp@intel.com>
Date: Fri, 26 Jun 2020 07:37:07 +0800
From: kernel test robot <lkp@...el.com>
To: Andres Beltran <lkmlabelt@...il.com>, kys@...rosoft.com,
haiyangz@...rosoft.com, sthemmin@...rosoft.com, wei.liu@...nel.org
Cc: kbuild-all@...ts.01.org, linux-hyperv@...r.kernel.org,
linux-kernel@...r.kernel.org, mikelley@...rosoft.com,
parri.andrea@...il.com, Andres Beltran <lkmlabelt@...il.com>,
Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH 3/3] hv_netvsc: Use vmbus_requestor to generate
transaction IDs for VMBus hardening
Hi Andres,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on next-20200625]
[also build test WARNING on v5.8-rc2]
[cannot apply to mkp-scsi/for-next scsi/for-next linux/master linus/master v5.8-rc2 v5.8-rc1 v5.7]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Andres-Beltran/Drivers-hv-vmbus-vmbus_requestor-data-structure/20200625-234113
base: 3f9437c6234d95d96967f1b438a4fb71b6be254d
config: i386-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce (this is a W=1 build):
# save the attached .config to linux build tree
make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
drivers/net/hyperv/netvsc.c: In function 'netvsc_init_buf':
>> drivers/net/hyperv/netvsc.c:354:63: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
354 | rqst_id = vmbus_next_request_id(&device->channel->requestor, (u64)init_packet);
| ^
drivers/net/hyperv/netvsc.c:444:63: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
444 | rqst_id = vmbus_next_request_id(&device->channel->requestor, (u64)init_packet);
| ^
drivers/net/hyperv/netvsc.c: In function 'negotiate_nvsp_ver':
drivers/net/hyperv/netvsc.c:524:63: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
524 | rqst_id = vmbus_next_request_id(&device->channel->requestor, (u64)init_packet);
| ^
drivers/net/hyperv/netvsc.c: In function 'netvsc_send_tx_complete':
>> drivers/net/hyperv/netvsc.c:722:8: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
722 | skb = (struct sk_buff *)cmd_rqst;
| ^
drivers/net/hyperv/netvsc.c: In function 'netvsc_send_pkt':
drivers/net/hyperv/netvsc.c:883:59: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
883 | rqst_id = vmbus_next_request_id(&out_channel->requestor, (u64)skb);
| ^
vim +354 drivers/net/hyperv/netvsc.c
296
297 static int netvsc_init_buf(struct hv_device *device,
298 struct netvsc_device *net_device,
299 const struct netvsc_device_info *device_info)
300 {
301 struct nvsp_1_message_send_receive_buffer_complete *resp;
302 struct net_device *ndev = hv_get_drvdata(device);
303 struct nvsp_message *init_packet;
304 unsigned int buf_size;
305 size_t map_words;
306 int ret = 0;
307 u64 rqst_id;
308
309 /* Get receive buffer area. */
310 buf_size = device_info->recv_sections * device_info->recv_section_size;
311 buf_size = roundup(buf_size, PAGE_SIZE);
312
313 /* Legacy hosts only allow smaller receive buffer */
314 if (net_device->nvsp_version <= NVSP_PROTOCOL_VERSION_2)
315 buf_size = min_t(unsigned int, buf_size,
316 NETVSC_RECEIVE_BUFFER_SIZE_LEGACY);
317
318 net_device->recv_buf = vzalloc(buf_size);
319 if (!net_device->recv_buf) {
320 netdev_err(ndev,
321 "unable to allocate receive buffer of size %u\n",
322 buf_size);
323 ret = -ENOMEM;
324 goto cleanup;
325 }
326
327 net_device->recv_buf_size = buf_size;
328
329 /*
330 * Establish the gpadl handle for this buffer on this
331 * channel. Note: This call uses the vmbus connection rather
332 * than the channel to establish the gpadl handle.
333 */
334 ret = vmbus_establish_gpadl(device->channel, net_device->recv_buf,
335 buf_size,
336 &net_device->recv_buf_gpadl_handle);
337 if (ret != 0) {
338 netdev_err(ndev,
339 "unable to establish receive buffer's gpadl\n");
340 goto cleanup;
341 }
342
343 /* Notify the NetVsp of the gpadl handle */
344 init_packet = &net_device->channel_init_pkt;
345 memset(init_packet, 0, sizeof(struct nvsp_message));
346 init_packet->hdr.msg_type = NVSP_MSG1_TYPE_SEND_RECV_BUF;
347 init_packet->msg.v1_msg.send_recv_buf.
348 gpadl_handle = net_device->recv_buf_gpadl_handle;
349 init_packet->msg.v1_msg.
350 send_recv_buf.id = NETVSC_RECEIVE_BUFFER_ID;
351
352 trace_nvsp_send(ndev, init_packet);
353
> 354 rqst_id = vmbus_next_request_id(&device->channel->requestor, (u64)init_packet);
355 if (rqst_id == VMBUS_RQST_ERROR) {
356 netdev_err(ndev, "No request id available\n");
357 goto cleanup;
358 }
359
360 /* Send the gpadl notification request */
361 ret = vmbus_sendpacket(device->channel, init_packet,
362 sizeof(struct nvsp_message),
363 rqst_id,
364 VM_PKT_DATA_INBAND,
365 VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
366 if (ret != 0) {
367 /* Reclaim request ID to avoid leak of IDs */
368 vmbus_request_addr(&device->channel->requestor, rqst_id);
369 netdev_err(ndev,
370 "unable to send receive buffer's gpadl to netvsp\n");
371 goto cleanup;
372 }
373
374 wait_for_completion(&net_device->channel_init_wait);
375
376 /* Check the response */
377 resp = &init_packet->msg.v1_msg.send_recv_buf_complete;
378 if (resp->status != NVSP_STAT_SUCCESS) {
379 netdev_err(ndev,
380 "Unable to complete receive buffer initialization with NetVsp - status %d\n",
381 resp->status);
382 ret = -EINVAL;
383 goto cleanup;
384 }
385
386 /* Parse the response */
387 netdev_dbg(ndev, "Receive sections: %u sub_allocs: size %u count: %u\n",
388 resp->num_sections, resp->sections[0].sub_alloc_size,
389 resp->sections[0].num_sub_allocs);
390
391 /* There should only be one section for the entire receive buffer */
392 if (resp->num_sections != 1 || resp->sections[0].offset != 0) {
393 ret = -EINVAL;
394 goto cleanup;
395 }
396
397 net_device->recv_section_size = resp->sections[0].sub_alloc_size;
398 net_device->recv_section_cnt = resp->sections[0].num_sub_allocs;
399
400 /* Setup receive completion ring.
401 * Add 1 to the recv_section_cnt because at least one entry in a
402 * ring buffer has to be empty.
403 */
404 net_device->recv_completion_cnt = net_device->recv_section_cnt + 1;
405 ret = netvsc_alloc_recv_comp_ring(net_device, 0);
406 if (ret)
407 goto cleanup;
408
409 /* Now setup the send buffer. */
410 buf_size = device_info->send_sections * device_info->send_section_size;
411 buf_size = round_up(buf_size, PAGE_SIZE);
412
413 net_device->send_buf = vzalloc(buf_size);
414 if (!net_device->send_buf) {
415 netdev_err(ndev, "unable to allocate send buffer of size %u\n",
416 buf_size);
417 ret = -ENOMEM;
418 goto cleanup;
419 }
420
421 /* Establish the gpadl handle for this buffer on this
422 * channel. Note: This call uses the vmbus connection rather
423 * than the channel to establish the gpadl handle.
424 */
425 ret = vmbus_establish_gpadl(device->channel, net_device->send_buf,
426 buf_size,
427 &net_device->send_buf_gpadl_handle);
428 if (ret != 0) {
429 netdev_err(ndev,
430 "unable to establish send buffer's gpadl\n");
431 goto cleanup;
432 }
433
434 /* Notify the NetVsp of the gpadl handle */
435 init_packet = &net_device->channel_init_pkt;
436 memset(init_packet, 0, sizeof(struct nvsp_message));
437 init_packet->hdr.msg_type = NVSP_MSG1_TYPE_SEND_SEND_BUF;
438 init_packet->msg.v1_msg.send_send_buf.gpadl_handle =
439 net_device->send_buf_gpadl_handle;
440 init_packet->msg.v1_msg.send_send_buf.id = NETVSC_SEND_BUFFER_ID;
441
442 trace_nvsp_send(ndev, init_packet);
443
444 rqst_id = vmbus_next_request_id(&device->channel->requestor, (u64)init_packet);
445 if (rqst_id == VMBUS_RQST_ERROR) {
446 netdev_err(ndev, "No request id available\n");
447 goto cleanup;
448 }
449
450 /* Send the gpadl notification request */
451 ret = vmbus_sendpacket(device->channel, init_packet,
452 sizeof(struct nvsp_message),
453 rqst_id,
454 VM_PKT_DATA_INBAND,
455 VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
456 if (ret != 0) {
457 /* Reclaim request ID to avoid leak of IDs */
458 vmbus_request_addr(&device->channel->requestor, rqst_id);
459 netdev_err(ndev,
460 "unable to send send buffer's gpadl to netvsp\n");
461 goto cleanup;
462 }
463
464 wait_for_completion(&net_device->channel_init_wait);
465
466 /* Check the response */
467 if (init_packet->msg.v1_msg.
468 send_send_buf_complete.status != NVSP_STAT_SUCCESS) {
469 netdev_err(ndev, "Unable to complete send buffer "
470 "initialization with NetVsp - status %d\n",
471 init_packet->msg.v1_msg.
472 send_send_buf_complete.status);
473 ret = -EINVAL;
474 goto cleanup;
475 }
476
477 /* Parse the response */
478 net_device->send_section_size = init_packet->msg.
479 v1_msg.send_send_buf_complete.section_size;
480
481 /* Section count is simply the size divided by the section size. */
482 net_device->send_section_cnt = buf_size / net_device->send_section_size;
483
484 netdev_dbg(ndev, "Send section size: %d, Section count:%d\n",
485 net_device->send_section_size, net_device->send_section_cnt);
486
487 /* Setup state for managing the send buffer. */
488 map_words = DIV_ROUND_UP(net_device->send_section_cnt, BITS_PER_LONG);
489
490 net_device->send_section_map = kcalloc(map_words, sizeof(ulong), GFP_KERNEL);
491 if (net_device->send_section_map == NULL) {
492 ret = -ENOMEM;
493 goto cleanup;
494 }
495
496 goto exit;
497
498 cleanup:
499 netvsc_revoke_recv_buf(device, net_device, ndev);
500 netvsc_revoke_send_buf(device, net_device, ndev);
501 netvsc_teardown_recv_gpadl(device, net_device, ndev);
502 netvsc_teardown_send_gpadl(device, net_device, ndev);
503
504 exit:
505 return ret;
506 }
507
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (74226 bytes)
Powered by blists - more mailing lists