From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Quan Xu <quan.xu@intel.com>
Cc: kevin.tian@intel.com, feng.wu@intel.com,
dario.faggioli@citrix.com, jbeulich@suse.com,
xen-devel@lists.xen.org
Subject: Re: [PATCH v8 3/3] VT-d: Fix vt-d Device-TLB flush timeout issue
Date: Fri, 25 Mar 2016 16:31:34 -0400 [thread overview]
Message-ID: <20160325203134.GG14689@char.us.oracle.com> (raw)
In-Reply-To: <1458799079-79825-4-git-send-email-quan.xu@intel.com>
On Thu, Mar 24, 2016 at 01:57:59PM +0800, Quan Xu wrote:
> If Device-TLB flush timed out, we would hide the target ATS
> device and crash the domain owning this ATS device. If impacted
> domain is hardware domain, just throw out a warning.
>
> The hidden device should be disallowed to be further assigned
> to any domain.
>
> Signed-off-by: Quan Xu <quan.xu@intel.com>
> ---
> xen/drivers/passthrough/pci.c | 6 ++--
> xen/drivers/passthrough/vtd/extern.h | 3 +-
> xen/drivers/passthrough/vtd/qinval.c | 58 +++++++++++++++++++++++++++++++++--
> xen/drivers/passthrough/vtd/x86/ats.c | 11 ++++---
> xen/include/xen/pci.h | 1 +
> 5 files changed, 68 insertions(+), 11 deletions(-)
>
> diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
> index 9f1716a..9a214c6 100644
> --- a/xen/drivers/passthrough/pci.c
> +++ b/xen/drivers/passthrough/pci.c
> @@ -420,7 +420,7 @@ static void free_pdev(struct pci_seg *pseg, struct pci_dev *pdev)
> xfree(pdev);
> }
>
> -static void _pci_hide_device(struct pci_dev *pdev)
> +void pci_hide_existing_device(struct pci_dev *pdev)
> {
> if ( pdev->domain )
> return;
> @@ -437,7 +437,7 @@ int __init pci_hide_device(int bus, int devfn)
> pdev = alloc_pdev(get_pseg(0), bus, devfn);
> if ( pdev )
> {
> - _pci_hide_device(pdev);
> + pci_hide_existing_device(pdev);
> rc = 0;
> }
> pcidevs_unlock();
> @@ -467,7 +467,7 @@ int __init pci_ro_device(int seg, int bus, int devfn)
> }
>
> __set_bit(PCI_BDF2(bus, devfn), pseg->ro_map);
> - _pci_hide_device(pdev);
> + pci_hide_existing_device(pdev);
>
> return 0;
> }
> diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
> index 6d3187d..94e2c11 100644
> --- a/xen/drivers/passthrough/vtd/extern.h
> +++ b/xen/drivers/passthrough/vtd/extern.h
> @@ -62,7 +62,8 @@ int dev_invalidate_iotlb(struct iommu *iommu, u16 did,
> int qinval_device_iotlb(struct iommu *iommu,
> u32 max_invs_pend, u16 sid, u16 size, u64 addr);
> int qinval_device_iotlb_sync(struct iommu *iommu, u32 max_invs_pend,
> - u16 sid, u16 size, u64 addr);
> + u16 did, u16 seg, u8 bus, u8 devfn,
> + u16 size, u64 addr);
>
> unsigned int get_cache_line_size(void);
> void cacheline_flush(char *);
> diff --git a/xen/drivers/passthrough/vtd/qinval.c b/xen/drivers/passthrough/vtd/qinval.c
> index ad9e265..10c5684 100644
> --- a/xen/drivers/passthrough/vtd/qinval.c
> +++ b/xen/drivers/passthrough/vtd/qinval.c
> @@ -216,6 +216,58 @@ static int queue_invalidate_iotlb_sync(struct iommu *iommu,
> return invalidate_sync(iommu);
> }
>
> +static void dev_invalidate_iotlb_timeout(struct iommu *iommu, u16 did,
> + u16 seg, u8 bus, u8 devfn)
> +{
> + struct domain *d = NULL;
> + struct pci_dev *pdev;
> +
> + if ( test_bit(did, iommu->domid_bitmap) )
> + d = rcu_lock_domain_by_id(iommu->domid_map[did]);
> +
> + if ( d == NULL )
> + return;
> +
> + pcidevs_lock();
> +
> + for_each_pdev(d, pdev)
> + {
> + if ( ( pdev->seg == seg ) &&
> + ( pdev->bus == bus ) &&
> + ( pdev->devfn == devfn ) )
> + {
> + ASSERT ( pdev->domain );
Oddly enough (and I don't see this in the StyleGuide), the ASSERTS
do not require the spaces. So it can be:
ASSERT(pdev->domain);
> + list_del(&pdev->domain_list);
> + pdev->domain = NULL;
> + pci_hide_existing_device(pdev);
> + break;
> + }
> + }
> +
> + pcidevs_unlock();
> +
> + if ( !is_hardware_domain(d) )
> + domain_crash(d);
The description said something about 'just throw out a warning' (if
the domain owning it is a hardware domain). That seems to be missing?
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-03-25 20:31 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-24 5:57 [PATCH v8 0/3] VT-d Device-TLB flush issue Quan Xu
2016-03-24 5:57 ` [PATCH v8 2/3] VT-d: Wrap a _sync version for all VT-d flush interfaces Quan Xu
2016-03-24 13:56 ` Dario Faggioli
2016-03-24 15:06 ` Dario Faggioli
2016-03-25 3:11 ` Xu, Quan
2016-03-24 5:57 ` [PATCH v8 1/3] VT-d: Reduce spin timeout to 1ms, which can be boot-time changed Quan Xu
2016-03-24 11:04 ` Dario Faggioli
2016-03-24 11:28 ` Xu, Quan
2016-03-25 20:06 ` Konrad Rzeszutek Wilk
2016-03-28 6:27 ` Xu, Quan
2016-03-28 13:31 ` Konrad Rzeszutek Wilk
2016-04-01 15:03 ` Xu, Quan
2016-03-24 5:57 ` [PATCH v8 3/3] VT-d: Fix vt-d Device-TLB flush timeout issue Quan Xu
2016-03-24 15:38 ` Dario Faggioli
2016-03-25 3:43 ` Xu, Quan
2016-03-25 20:40 ` Konrad Rzeszutek Wilk
2016-03-28 3:44 ` Xu, Quan
2016-03-28 7:45 ` Xu, Quan
2016-03-25 20:31 ` Konrad Rzeszutek Wilk [this message]
2016-03-28 3:56 ` Xu, Quan
2016-03-28 14:11 ` Konrad Rzeszutek Wilk
2016-03-29 1:32 ` Xu, Quan
2016-03-29 14:20 ` Konrad Rzeszutek Wilk
2016-03-29 14:32 ` Xu, Quan
2016-03-24 10:33 ` [PATCH v8 0/3] VT-d Device-TLB flush issue Jan Beulich
2016-03-24 11:11 ` Xu, Quan
2016-04-01 14:47 ` Xu, Quan
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=20160325203134.GG14689@char.us.oracle.com \
--to=konrad.wilk@oracle.com \
--cc=dario.faggioli@citrix.com \
--cc=feng.wu@intel.com \
--cc=jbeulich@suse.com \
--cc=kevin.tian@intel.com \
--cc=quan.xu@intel.com \
--cc=xen-devel@lists.xen.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).