Hi Baoquan, [auto build test WARNING on iommu/next] [also build test WARNING on v4.13-rc1] [cannot apply to next-20170721] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Baoquan-He/Fix-the-on-flight-DMA-issue-on-system-with-amd-iommu/20170724-060048 base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next config: x86_64-randconfig-x005-201730 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 Note: it may well be a FALSE warning. FWIW you are at least aware of it now. http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings All warnings (new ones prefixed by >>): drivers//iommu/amd_iommu_v2.c: In function 'ppr_notifier': >> drivers//iommu/amd_iommu_v2.c:566:6: warning: 'ret' may be used >> uninitialized in this function [-Wmaybe-uninitialized] int ret; ^~~ vim +/ret +566 drivers//iommu/amd_iommu_v2.c 028eeacc Joerg Roedel 2011-11-24 556 028eeacc Joerg Roedel 2011-11-24 557 static int ppr_notifier(struct notifier_block *nb, unsigned long e, void *data) 028eeacc Joerg Roedel 2011-11-24 558 { 028eeacc Joerg Roedel 2011-11-24 559 struct amd_iommu_fault *iommu_fault; 028eeacc Joerg Roedel 2011-11-24 560 struct pasid_state *pasid_state; 028eeacc Joerg Roedel 2011-11-24 561 struct device_state *dev_state; 028eeacc Joerg Roedel 2011-11-24 562 unsigned long flags; 028eeacc Joerg Roedel 2011-11-24 563 struct fault *fault; 028eeacc Joerg Roedel 2011-11-24 564 bool finish; 49f3c23d Baoquan He 2017-07-21 565 u16 tag, devid; 028eeacc Joerg Roedel 2011-11-24 @566 int ret; 49f3c23d Baoquan He 2017-07-21 567 struct iommu_dev_data *dev_data; 49f3c23d Baoquan He 2017-07-21 568 struct pci_dev *pdev = NULL; 028eeacc Joerg Roedel 2011-11-24 569 028eeacc Joerg Roedel 2011-11-24 570 iommu_fault = data; 028eeacc Joerg Roedel 2011-11-24 571 tag = iommu_fault->tag & 0x1ff; 028eeacc Joerg Roedel 2011-11-24 572 finish = (iommu_fault->tag >> 9) & 1; 028eeacc Joerg Roedel 2011-11-24 573 49f3c23d Baoquan He 2017-07-21 574 devid = iommu_fault->device_id; 49f3c23d Baoquan He 2017-07-21 575 pdev = pci_get_bus_and_slot(PCI_BUS_NUM(devid), devid & 0xff); 49f3c23d Baoquan He 2017-07-21 576 if (!pdev) 49f3c23d Baoquan He 2017-07-21 577 return -ENODEV; 49f3c23d Baoquan He 2017-07-21 578 dev_data = get_dev_data(&pdev->dev); 49f3c23d Baoquan He 2017-07-21 579 49f3c23d Baoquan He 2017-07-21 580 /* In kdump kernel pci dev is not initialized yet -> send INVALID */ 49f3c23d Baoquan He 2017-07-21 581 if (translation_pre_enabled(amd_iommu_rlookup_table[devid]) 49f3c23d Baoquan He 2017-07-21 582 && dev_data->defer_attach) { 49f3c23d Baoquan He 2017-07-21 583 amd_iommu_complete_ppr(pdev, iommu_fault->pasid, 49f3c23d Baoquan He 2017-07-21 584 PPR_INVALID, tag); 49f3c23d Baoquan He 2017-07-21 585 goto out; 49f3c23d Baoquan He 2017-07-21 586 } 49f3c23d Baoquan He 2017-07-21 587 028eeacc Joerg Roedel 2011-11-24 588 ret = NOTIFY_DONE; 028eeacc Joerg Roedel 2011-11-24 589 dev_state = get_device_state(iommu_fault->device_id); 028eeacc Joerg Roedel 2011-11-24 590 if (dev_state == NULL) 028eeacc Joerg Roedel 2011-11-24 591 goto out; 028eeacc Joerg Roedel 2011-11-24 592 028eeacc Joerg Roedel 2011-11-24 593 pasid_state = get_pasid_state(dev_state, iommu_fault->pasid); 53d340ef Joerg Roedel 2014-07-08 594 if (pasid_state == NULL || pasid_state->invalid) { 028eeacc Joerg Roedel 2011-11-24 595 /* We know the device but not the PASID -> send INVALID */ 028eeacc Joerg Roedel 2011-11-24 596 amd_iommu_complete_ppr(dev_state->pdev, iommu_fault->pasid, 028eeacc Joerg Roedel 2011-11-24 597 PPR_INVALID, tag); 028eeacc Joerg Roedel 2011-11-24 598 goto out_drop_state; 028eeacc Joerg Roedel 2011-11-24 599 } 028eeacc Joerg Roedel 2011-11-24 600 028eeacc Joerg Roedel 2011-11-24 601 spin_lock_irqsave(&pasid_state->lock, flags); 028eeacc Joerg Roedel 2011-11-24 602 atomic_inc(&pasid_state->pri[tag].inflight); 028eeacc Joerg Roedel 2011-11-24 603 if (finish) 028eeacc Joerg Roedel 2011-11-24 604 pasid_state->pri[tag].finish = true; 028eeacc Joerg Roedel 2011-11-24 605 spin_unlock_irqrestore(&pasid_state->lock, flags); 028eeacc Joerg Roedel 2011-11-24 606 028eeacc Joerg Roedel 2011-11-24 607 fault = kzalloc(sizeof(*fault), GFP_ATOMIC); 028eeacc Joerg Roedel 2011-11-24 608 if (fault == NULL) { 028eeacc Joerg Roedel 2011-11-24 609 /* We are OOM - send success and let the device re-fault */ 028eeacc Joerg Roedel 2011-11-24 610 finish_pri_tag(dev_state, pasid_state, tag); 028eeacc Joerg Roedel 2011-11-24 611 goto out_drop_state; 028eeacc Joerg Roedel 2011-11-24 612 } 028eeacc Joerg Roedel 2011-11-24 613 028eeacc Joerg Roedel 2011-11-24 614 fault->dev_state = dev_state; 028eeacc Joerg Roedel 2011-11-24 615 fault->address = iommu_fault->address; 028eeacc Joerg Roedel 2011-11-24 616 fault->state = pasid_state; 028eeacc Joerg Roedel 2011-11-24 617 fault->tag = tag; 028eeacc Joerg Roedel 2011-11-24 618 fault->finish = finish; b00675b8 Alexey Skidanov 2014-07-08 619 fault->pasid = iommu_fault->pasid; 028eeacc Joerg Roedel 2011-11-24 620 fault->flags = iommu_fault->flags; 028eeacc Joerg Roedel 2011-11-24 621 INIT_WORK(&fault->work, do_fault); 028eeacc Joerg Roedel 2011-11-24 622 028eeacc Joerg Roedel 2011-11-24 623 queue_work(iommu_wq, &fault->work); 028eeacc Joerg Roedel 2011-11-24 624 028eeacc Joerg Roedel 2011-11-24 625 ret = NOTIFY_OK; 028eeacc Joerg Roedel 2011-11-24 626 028eeacc Joerg Roedel 2011-11-24 627 out_drop_state: dc88db7e Joerg Roedel 2014-07-08 628 dc88db7e Joerg Roedel 2014-07-08 629 if (ret != NOTIFY_OK && pasid_state) dc88db7e Joerg Roedel 2014-07-08 630 put_pasid_state(pasid_state); dc88db7e Joerg Roedel 2014-07-08 631 028eeacc Joerg Roedel 2011-11-24 632 put_device_state(dev_state); 028eeacc Joerg Roedel 2011-11-24 633 028eeacc Joerg Roedel 2011-11-24 634 out: 028eeacc Joerg Roedel 2011-11-24 635 return ret; 028eeacc Joerg Roedel 2011-11-24 636 } 028eeacc Joerg Roedel 2011-11-24 637 :::::: The code at line 566 was first introduced by commit :::::: 028eeacc412a8bebf6711e58629b0cab56a9ba87 iommu/amd: Implement IO page-fault handler :::::: TO: Joerg Roedel <[email protected]> :::::: CC: Joerg Roedel <[email protected]> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
.config.gz
Description: application/gzip

