tree:
https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git
20210427-vfio-pcie-trylock-dev
head: 70d0589eb9f34237c5a891c7751802042188461f
commit: 70d0589eb9f34237c5a891c7751802042188461f [1/1] vfio: use helper to simplify try
lock
config: ia64-randconfig-r006-20210618 (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
#
https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git/com...
git remote add mcgrof-next
https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git
git fetch --no-tags mcgrof-next 20210427-vfio-pcie-trylock-dev
git checkout 70d0589eb9f34237c5a891c7751802042188461f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=ia64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
In file included from arch/ia64/include/asm/pgtable.h:154,
from include/linux/pgtable.h:6,
from arch/ia64/include/asm/uaccess.h:40,
from include/linux/uaccess.h:11,
from arch/ia64/include/asm/sections.h:11,
from include/linux/interrupt.h:20,
from drivers/vfio/pci/vfio_pci.c:16:
arch/ia64/include/asm/mmu_context.h: In function 'reload_context':
arch/ia64/include/asm/mmu_context.h:127:41: warning: variable 'old_rr4' set but
not used [-Wunused-but-set-variable]
127 | unsigned long rr0, rr1, rr2, rr3, rr4, old_rr4;
| ^~~~~~~
drivers/vfio/pci/vfio_pci.c: In function 'vfio_pci_disable':
> drivers/vfio/pci/vfio_pci.c:480:27: error: implicit declaration
of function 'pci_dev_trylock'; did you mean 'inode_trylock'?
[-Werror=implicit-function-declaration]
480 | if (vdev->reset_works
&& pci_dev_trylock(pdev)) {
| ^~~~~~~~~~~~~~~
| inode_trylock
> drivers/vfio/pci/vfio_pci.c:483:3: error: implicit declaration of
function 'pci_dev_unlock'; did you mean 'pci_dev_run_wake'?
[-Werror=implicit-function-declaration]
483 | pci_dev_unlock(pdev);
| ^~~~~~~~~~~~~~
| pci_dev_run_wake
cc1: some warnings being treated as errors
vim +480 drivers/vfio/pci/vfio_pci.c
399
400 static void vfio_pci_disable(struct vfio_pci_device *vdev)
401 {
402 struct pci_dev *pdev = vdev->pdev;
403 struct vfio_pci_dummy_resource *dummy_res, *tmp;
404 struct vfio_pci_ioeventfd *ioeventfd, *ioeventfd_tmp;
405 int i, bar;
406
407 /* Stop the device from further DMA */
408 pci_clear_master(pdev);
409
410 vfio_pci_set_irqs_ioctl(vdev, VFIO_IRQ_SET_DATA_NONE |
411 VFIO_IRQ_SET_ACTION_TRIGGER,
412 vdev->irq_type, 0, 0, NULL);
413
414 /* Device closed, don't need mutex here */
415 list_for_each_entry_safe(ioeventfd, ioeventfd_tmp,
416 &vdev->ioeventfds_list, next) {
417 vfio_virqfd_disable(&ioeventfd->virqfd);
418 list_del(&ioeventfd->next);
419 kfree(ioeventfd);
420 }
421 vdev->ioeventfds_nr = 0;
422
423 vdev->virq_disabled = false;
424
425 for (i = 0; i < vdev->num_regions; i++)
426 vdev->region[i].ops->release(vdev, &vdev->region[i]);
427
428 vdev->num_regions = 0;
429 kfree(vdev->region);
430 vdev->region = NULL; /* don't krealloc a freed pointer */
431
432 vfio_config_free(vdev);
433
434 for (i = 0; i < PCI_STD_NUM_BARS; i++) {
435 bar = i + PCI_STD_RESOURCES;
436 if (!vdev->barmap[bar])
437 continue;
438 pci_iounmap(pdev, vdev->barmap[bar]);
439 pci_release_selected_regions(pdev, 1 << bar);
440 vdev->barmap[bar] = NULL;
441 }
442
443 list_for_each_entry_safe(dummy_res, tmp,
444 &vdev->dummy_resources_list, res_next) {
445 list_del(&dummy_res->res_next);
446 release_resource(&dummy_res->resource);
447 kfree(dummy_res);
448 }
449
450 vdev->needs_reset = true;
451
452 /*
453 * If we have saved state, restore it. If we can reset the device,
454 * even better. Resetting with current state seems better than
455 * nothing, but saving and restoring current state without reset
456 * is just busy work.
457 */
458 if (pci_load_and_free_saved_state(pdev, &vdev->pci_saved_state)) {
459 pci_info(pdev, "%s: Couldn't reload saved state\n", __func__);
460
461 if (!vdev->reset_works)
462 goto out;
463
464 pci_save_state(pdev);
465 }
466
467 /*
468 * Disable INTx and MSI, presumably to avoid spurious interrupts
469 * during reset. Stolen from pci_reset_function()
470 */
471 pci_write_config_word(pdev, PCI_COMMAND, PCI_COMMAND_INTX_DISABLE);
472
473 /*
474 * Try to get the locks ourselves to prevent a deadlock. The
475 * success of this is dependent on being able to lock the device,
476 * which is not always possible.
477 * We can not use the "try" reset interface here, which will
478 * overwrite the previously restored configuration information.
479 */
480 if (vdev->reset_works && pci_dev_trylock(pdev)) {
481 if (!__pci_reset_function_locked(pdev))
482 vdev->needs_reset = false;
483 pci_dev_unlock(pdev);
484 }
485
486 pci_restore_state(pdev);
487 out:
488 pci_disable_device(pdev);
489
490 vfio_pci_try_bus_reset(vdev);
491
492 if (!disable_idle_d3)
493 vfio_pci_set_power_state(vdev, PCI_D3hot);
494 }
495
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org