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: powerpc64-randconfig-r034-20210618 (attached as .config)
compiler: clang version 13.0.0 (
https://github.com/llvm/llvm-project
64720f57bea6a6bf033feef4a5751ab9c0c3b401)
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
# install powerpc64 cross compiling tool for clang build
# apt-get install binutils-powerpc64-linux-gnu
#
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=clang make.cross ARCH=powerpc64
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 drivers/vfio/pci/vfio_pci.c:13:
In file included from include/linux/device.h:15:
In file included from include/linux/dev_printk.h:16:
In file included from include/linux/ratelimit.h:6:
In file included from include/linux/sched.h:12:
In file included from arch/powerpc/include/asm/current.h:13:
In file included from arch/powerpc/include/asm/paca.h:18:
In file included from arch/powerpc/include/asm/mmu.h:147:
In file included from include/linux/bug.h:5:
In file included from arch/powerpc/include/asm/bug.h:109:
In file included from include/asm-generic/bug.h:20:
In file included from include/linux/kernel.h:12:
In file included from include/linux/bitops.h:32:
In file included from arch/powerpc/include/asm/bitops.h:62:
arch/powerpc/include/asm/barrier.h:49:9: warning: '__lwsync' macro redefined
[-Wmacro-redefined]
#define __lwsync() __asm__ __volatile__ (stringify_in_c(LWSYNC) : :
:"memory")
^
<built-in>:309:9: note: previous definition is here
#define __lwsync __builtin_ppc_lwsync
^
> drivers/vfio/pci/vfio_pci.c:480:27: error: implicit declaration
of function 'pci_dev_trylock' [-Werror,-Wimplicit-function-declaration]
if (vdev->reset_works && pci_dev_trylock(pdev)) {
^
drivers/vfio/pci/vfio_pci.c:480:27: note: did you mean 'inode_trylock'?
include/linux/fs.h:792:19: note: 'inode_trylock' declared here
static inline int inode_trylock(struct inode *inode)
^
> drivers/vfio/pci/vfio_pci.c:483:3: error: implicit declaration of
function 'pci_dev_unlock' [-Werror,-Wimplicit-function-declaration]
pci_dev_unlock(pdev);
^
drivers/vfio/pci/vfio_pci.c:483:3: note: did you mean 'pci_dev_trylock'?
drivers/vfio/pci/vfio_pci.c:480:27: note: 'pci_dev_trylock' declared here
if (vdev->reset_works && pci_dev_trylock(pdev)) {
^
1 warning and 2 errors generated.
vim +/pci_dev_trylock +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