Re: [PATCH 1/1] IOMMU: Save pci device id instead of pci_dev* pointer for DMAR devices

2013-11-20 Thread Yijing Wang
On 2013/11/20 23:59, David Woodhouse wrote: > On Fri, 2013-11-08 at 08:46 -0700, Bjorn Helgaas wrote: >> >> I don't know the IOMMU drivers well either, but it seems like they >> rely on notifications of device addition and removal (see >> iommu_bus_notifier()). It doesn't seem right for them to

Re: [PATCH 1/1] IOMMU: Save pci device id instead of pci_dev* pointer for DMAR devices

2013-11-20 Thread David Woodhouse
On Fri, 2013-11-08 at 08:46 -0700, Bjorn Helgaas wrote: > > I don't know the IOMMU drivers well either, but it seems like they > rely on notifications of device addition and removal (see > iommu_bus_notifier()). It doesn't seem right for them to also use the > generic PCI interfaces like

Re: [PATCH 1/1] IOMMU: Save pci device id instead of pci_dev* pointer for DMAR devices

2013-11-20 Thread David Woodhouse
On Fri, 2013-11-08 at 08:46 -0700, Bjorn Helgaas wrote: I don't know the IOMMU drivers well either, but it seems like they rely on notifications of device addition and removal (see iommu_bus_notifier()). It doesn't seem right for them to also use the generic PCI interfaces like

Re: [PATCH 1/1] IOMMU: Save pci device id instead of pci_dev* pointer for DMAR devices

2013-11-20 Thread Yijing Wang
On 2013/11/20 23:59, David Woodhouse wrote: On Fri, 2013-11-08 at 08:46 -0700, Bjorn Helgaas wrote: I don't know the IOMMU drivers well either, but it seems like they rely on notifications of device addition and removal (see iommu_bus_notifier()). It doesn't seem right for them to also use

Re: [PATCH 1/1] IOMMU: Save pci device id instead of pci_dev* pointer for DMAR devices

2013-11-10 Thread Yijing Wang
>> Hmmm, this is the thing I am most worried about. If we just only use >> (pci_dev *) poninter in drhd->devices array as a identification. Change >> (pci_dev *) pointer instead of pci device id segment:bus:devfn is safe. >> Or, this is a wrong way to fix this issue. I don't know IOMMU driver much

Re: [PATCH 1/1] IOMMU: Save pci device id instead of pci_dev* pointer for DMAR devices

2013-11-10 Thread Yijing Wang
Hmmm, this is the thing I am most worried about. If we just only use (pci_dev *) poninter in drhd-devices array as a identification. Change (pci_dev *) pointer instead of pci device id segment:bus:devfn is safe. Or, this is a wrong way to fix this issue. I don't know IOMMU driver much now,

Re: [PATCH 1/1] IOMMU: Save pci device id instead of pci_dev* pointer for DMAR devices

2013-11-08 Thread Bjorn Helgaas
On Thu, Nov 7, 2013 at 8:40 PM, Yijing Wang wrote: > HI Bjorn, >Thanks for your review and comments very much! > >>> +list_for_each_entry(dmar_dev, head, list) >>> +if (dmar_dev->segment == pci_domain_nr(dev->bus) >>> +&& dmar_dev->bus ==

Re: [PATCH 1/1] IOMMU: Save pci device id instead of pci_dev* pointer for DMAR devices

2013-11-08 Thread Bjorn Helgaas
On Thu, Nov 7, 2013 at 8:40 PM, Yijing Wang wangyij...@huawei.com wrote: HI Bjorn, Thanks for your review and comments very much! +list_for_each_entry(dmar_dev, head, list) +if (dmar_dev-segment == pci_domain_nr(dev-bus) + dmar_dev-bus

Re: [PATCH 1/1] IOMMU: Save pci device id instead of pci_dev* pointer for DMAR devices

2013-11-07 Thread Yijing Wang
HI Bjorn, Thanks for your review and comments very much! >> +list_for_each_entry(dmar_dev, head, list) >> +if (dmar_dev->segment == pci_domain_nr(dev->bus) >> +&& dmar_dev->bus == dev->bus->number >> +&&

Re: [PATCH 1/1] IOMMU: Save pci device id instead of pci_dev* pointer for DMAR devices

2013-11-07 Thread Bjorn Helgaas
On Tue, Nov 05, 2013 at 04:24:58PM +0800, Yijing Wang wrote: > Currently, DMAR driver save target pci devices pointers for drhd/rmrr/atsr > in (pci_dev *) array. This is not safe, because pci devices maybe > hot added or removed during system running. They will have new pci_dev * > pointer. So if

Re: [PATCH 1/1] IOMMU: Save pci device id instead of pci_dev* pointer for DMAR devices

2013-11-07 Thread Bjorn Helgaas
On Tue, Nov 05, 2013 at 04:24:58PM +0800, Yijing Wang wrote: Currently, DMAR driver save target pci devices pointers for drhd/rmrr/atsr in (pci_dev *) array. This is not safe, because pci devices maybe hot added or removed during system running. They will have new pci_dev * pointer. So if

Re: [PATCH 1/1] IOMMU: Save pci device id instead of pci_dev* pointer for DMAR devices

2013-11-07 Thread Yijing Wang
HI Bjorn, Thanks for your review and comments very much! +list_for_each_entry(dmar_dev, head, list) +if (dmar_dev-segment == pci_domain_nr(dev-bus) + dmar_dev-bus == dev-bus-number + dmar_dev-devfn == dev-devfn) +

[PATCH 1/1] IOMMU: Save pci device id instead of pci_dev* pointer for DMAR devices

2013-11-05 Thread Yijing Wang
Currently, DMAR driver save target pci devices pointers for drhd/rmrr/atsr in (pci_dev *) array. This is not safe, because pci devices maybe hot added or removed during system running. They will have new pci_dev * pointer. So if there have two IOMMUs or more in system, these devices will find a

[PATCH 1/1] IOMMU: Save pci device id instead of pci_dev* pointer for DMAR devices

2013-11-05 Thread Yijing Wang
Currently, DMAR driver save target pci devices pointers for drhd/rmrr/atsr in (pci_dev *) array. This is not safe, because pci devices maybe hot added or removed during system running. They will have new pci_dev * pointer. So if there have two IOMMUs or more in system, these devices will find a