From: Yijing Wang <wangyijing-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
To: Don Dutile <ddutile-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Hanjun Guo <guohanjun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
Bjorn Helgaas <bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
Dan Williams
<dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
David Woodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
Subject: Re: [PATCH v2] Enhance dmar to support device hotplug
Date: Thu, 12 Dec 2013 19:46:08 +0800 [thread overview]
Message-ID: <52A9A200.6050007@huawei.com> (raw)
In-Reply-To: <52A7495D.6010905-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
On 2013/12/11 1:03, Don Dutile wrote:
> On 11/21/2013 03:21 AM, Yijing Wang wrote:
>> This is the v2 patch, the v1 link: http://marc.info/?l=linux-pci&m=138364004628824&w=2
>>
>> v1->v2: keep (pci_dev *) pointer array in dmar_drhd_uni, only use pci device id
>> to update pci_dev * pointer info during device hotplug in intel iommu
>> driver notifier.
>>
>> Currently, DMAR driver save target pci devices pointers for drhd/rmrr/atsr
>> in (pci_dev *) array, but never update these info after initialization.
>> It's 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 wrong drhd during
>> DMA mapping. And DMAR faults will occur. This patch save pci device id
>> as well as (pci_dev *) to fix this issue. Pci device id will be used to update
>> pci_dev * poninter during device hotplug in intel iommu driver notifier.
>> Other, here use list to manage target devices for IOMMU,
>> we can easily use list helper.
>>
>> Yijing Wang (1):
>> IOMMU: enhance dmar to support device hotplug
>>
>> drivers/iommu/dmar.c | 82 +++++++++++-----------
>> drivers/iommu/intel-iommu.c | 161 +++++++++++++++++++++++++++++-------------
>> include/linux/dmar.h | 24 ++++--
>> 3 files changed, 167 insertions(+), 100 deletions(-)
>>
>>
>> _______________________________________________
>> iommu mailing list
>> iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
>> https://lists.linuxfoundation.org/mailman/listinfo/iommu
>>
>
> Can this bug & fix be demonstrated by configuring & de-configuring VFs
> on an SRIOV device, since that effectively looks like a hot-add & hot-remove ?
Hi Don,
It seems can not be demonstrated by configuring & de-configuring VFs, because
if we only hotplug VFs, the device scope info saved in drhd->devices array will not
become stale. In my platform, the target device scope devices are root port, so only
we remove and rescan root port, we can trigger this problem.
Thanks!
Yijing.
>
>
>
> .
>
--
Thanks!
Yijing
WARNING: multiple messages have this Message-ID (diff)
From: Yijing Wang <wangyijing@huawei.com>
To: Don Dutile <ddutile@redhat.com>
Cc: Alex Williamson <alex.williamson@redhat.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Joerg Roedel <joro@8bytes.org>,
David Woodhouse <dwmw2@infradead.org>,
Vinod Koul <vinod.koul@intel.com>, <linux-kernel@vger.kernel.org>,
<iommu@lists.linux-foundation.org>,
"Hanjun Guo" <guohanjun@huawei.com>, <dmaengine@vger.kernel.org>,
Dan Williams <dan.j.williams@intel.com>
Subject: Re: [PATCH v2] Enhance dmar to support device hotplug
Date: Thu, 12 Dec 2013 19:46:08 +0800 [thread overview]
Message-ID: <52A9A200.6050007@huawei.com> (raw)
In-Reply-To: <52A7495D.6010905@redhat.com>
On 2013/12/11 1:03, Don Dutile wrote:
> On 11/21/2013 03:21 AM, Yijing Wang wrote:
>> This is the v2 patch, the v1 link: http://marc.info/?l=linux-pci&m=138364004628824&w=2
>>
>> v1->v2: keep (pci_dev *) pointer array in dmar_drhd_uni, only use pci device id
>> to update pci_dev * pointer info during device hotplug in intel iommu
>> driver notifier.
>>
>> Currently, DMAR driver save target pci devices pointers for drhd/rmrr/atsr
>> in (pci_dev *) array, but never update these info after initialization.
>> It's 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 wrong drhd during
>> DMA mapping. And DMAR faults will occur. This patch save pci device id
>> as well as (pci_dev *) to fix this issue. Pci device id will be used to update
>> pci_dev * poninter during device hotplug in intel iommu driver notifier.
>> Other, here use list to manage target devices for IOMMU,
>> we can easily use list helper.
>>
>> Yijing Wang (1):
>> IOMMU: enhance dmar to support device hotplug
>>
>> drivers/iommu/dmar.c | 82 +++++++++++-----------
>> drivers/iommu/intel-iommu.c | 161 +++++++++++++++++++++++++++++-------------
>> include/linux/dmar.h | 24 ++++--
>> 3 files changed, 167 insertions(+), 100 deletions(-)
>>
>>
>> _______________________________________________
>> iommu mailing list
>> iommu@lists.linux-foundation.org
>> https://lists.linuxfoundation.org/mailman/listinfo/iommu
>>
>
> Can this bug & fix be demonstrated by configuring & de-configuring VFs
> on an SRIOV device, since that effectively looks like a hot-add & hot-remove ?
Hi Don,
It seems can not be demonstrated by configuring & de-configuring VFs, because
if we only hotplug VFs, the device scope info saved in drhd->devices array will not
become stale. In my platform, the target device scope devices are root port, so only
we remove and rescan root port, we can trigger this problem.
Thanks!
Yijing.
>
>
>
> .
>
--
Thanks!
Yijing
next prev parent reply other threads:[~2013-12-12 11:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-21 8:21 [PATCH v2] Enhance dmar to support device hotplug Yijing Wang
2013-11-21 8:21 ` Yijing Wang
[not found] ` <1385022116-228-1-git-send-email-wangyijing-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-11-21 8:21 ` [PATCH v2] IOMMU: enhance " Yijing Wang
2013-11-21 8:21 ` Yijing Wang
[not found] ` <1385022116-228-2-git-send-email-wangyijing-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-03-04 14:31 ` Joerg Roedel
2014-03-04 14:31 ` Joerg Roedel
[not found] ` <20140304143158.GC2799-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2014-03-05 2:53 ` Yijing Wang
2014-03-05 2:53 ` Yijing Wang
2013-12-10 17:03 ` [PATCH v2] Enhance " Don Dutile
2013-12-10 17:03 ` Don Dutile
[not found] ` <52A7495D.6010905-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-12-12 11:46 ` Yijing Wang [this message]
2013-12-12 11:46 ` Yijing Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52A9A200.6050007@huawei.com \
--to=wangyijing-hv44wf8li93qt0dzr+alfa@public.gmane.org \
--cc=bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=ddutile-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
--cc=guohanjun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.