All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v3 0/2] VT-d flush issue
@ 2015-12-20 13:57 Xu, Quan
  2015-12-20 15:51 ` Andrew Cooper
  2015-12-21 11:46 ` Jan Beulich
  0 siblings, 2 replies; 27+ messages in thread
From: Xu, Quan @ 2015-12-20 13:57 UTC (permalink / raw)
  To: 'jbeulich@suse.com', Tian, Kevin, 'keir@xen.org',
	'tim@xen.org', 'george.dunlap@eu.citrix.com',
	Nakajima, Jun, 'andrew.cooper3@citrix.com',
	Wu, Feng, 'xen-devel@lists.xen.org'
  Cc: Xu, Quan


>On 12.12.2015 at 9:22pm, <quan.xu@intel.com> wrote:
> This patches are based on Kevin Tian's previous discussion 'Revisit 
>VT-d  asynchronous flush issue'.
> Fix current timeout concern and also allow limited ATS support in a light way:


> 2. Fix vt-d flush timeout issue.
> 
>     If IOTLB/Context/IETC flush is timeout, we should think all 
> devices under this IOMMU cannot function correctly.
>     So for each device under this IOMMU we'll mark it as unassignable 
> and kill the domain owning the device.
> 

Hi, 

Through research and investigation, when IEC/Iotlb/Context are flush error(VT-d is bug),
IMO it is unavoidable to panic. The following are some reasons:

1. The below is the general platform topology, illustrated by VT-d spec.
VT-d is a key component of the platform infrastructure in virtualization usage,
providing DMA/Intr remapping capabilities.
If such a key component VT-d is bug, it can't provide reliability for recording
and reporting of DMA/Intr error to VMM that may otherwise corrupt memory or
impact VM isolation.


       Processor  ... Processor
       ---------      ---------
                  ^
                  |

             North Bridge
            --------------      <---> DRAM
           DMA/Intr Remapping

                ^^^^
                |||| PCIe Devices
                vvvv



2. If VT-d is bug, does the hardware_domain continue to work with PCIe Devices / DRAM well with DMA remapping error?
   I think it is no. furthermore, i think VMM can NOT run a normal HVM domain without device-passthrough.

3. There are so many reasons for IEC/iotlb/Conetxt flush, .i.e. msi/ept... update.
   It distributed across the VMM source code, it is challenge to make sure callers actually honor errors
   and check all the way up the call trees. it looks like rewriting VMM source code.

4. Much more detail, some flush errors are very tricky. .i.e. how to deal with msi free with IEC flush error,
   restore or ignore it?


Welcome your comments and correct me if i am wrong. thanks.

-Quan



>     If Device-TLB flush is timeout, we'll mark the target ATS device 
> as unassignable and kill the domain owning
>     this device.
> 
>     If impacted domain is hardware domain, just throw out a warning. 
> It's an open here whether we want to kill
>     hardware domain (or directly panic hypervisor). Comments are welcomed.
> 
>     Device marked as unassignable will be disallowed to be further 
> assigned to any domain.

^ permalink raw reply	[flat|nested] 27+ messages in thread
* [PATCH v3 0/2] VT-d flush issue
@ 2015-12-12 13:21 Quan Xu
  2015-12-19 14:01 ` Xu, Quan
  0 siblings, 1 reply; 27+ messages in thread
From: Quan Xu @ 2015-12-12 13:21 UTC (permalink / raw)
  To: jbeulich, kevin.tian
  Cc: feng.wu, eddie.dong, george.dunlap, andrew.cooper3, tim,
	xen-devel, jun.nakajima, Quan Xu, keir

This patches are based on Kevin Tian's previous discussion 'Revisit VT-d asynchronous flush issue'.
Fix current timeout concern and also allow limited ATS support in a light way:

1. Reduce spin timeout to 1ms, which can be boot-time changed with 'iommu_qi_timeout_ms'.
   For example:
           multiboot /boot/xen.gz ats=1 iommu_qi_timeout_ms=100

2. Fix vt-d flush timeout issue.

    If IOTLB/Context/IETC flush is timeout, we should think all devices under this IOMMU cannot function correctly.
    So for each device under this IOMMU we'll mark it as unassignable and kill the domain owning the device.

    If Device-TLB flush is timeout, we'll mark the target ATS device as unassignable and kill the domain owning
    this device.

    If impacted domain is hardware domain, just throw out a warning. It's an open here whether we want to kill
    hardware domain (or directly panic hypervisor). Comments are welcomed.

    Device marked as unassignable will be disallowed to be further assigned to any domain.

--

 * DMAR_OPERATION_TIMEOUT should be also chopped down to a low number of milliseconds.
   As Kevin Tian mentioned in 'Revisit VT-d asynchronous flush issue', We also confirmed with hardware team
   that 1ms is large enough for IOMMU internal flush. So I can change DMAR_OPERATION_TIMEOUT from 1000 ms to 1 ms.

   IOMMU_WAIT_OP() is only for VT-d registers read/write, and there is also a panic. We need a further discussion
   whether or how to remove this panic in next patch set. 


 * Kevin Tian did basic functional review.

--Changes in v3:
   1. Once found you can break the for loop immediately since BDF is unique.

   2. Separate invalidate_timeout(struct iommu *iommu, int type, u16 did, u16 seg, u8 bus, u8 devfn)
      into invalidate_timeout(struct iommu *iommu) and device_tlb_invalidate_timeout(struct iommu *iommu,
      u16 did, u16 seg, u8 bus, u8 devfn).
      invalidate_timeout() is for iotlb/iec/context flush error.
      device_tlb_invalidate_timeout() is for Device-TLB flush error. 
      then ignore these INVALID_* parameters.

   3. Change macros(mark_pdev_unassignable/IS_PDEV_UNASSIGNABLE) into static inline functions.


Quan Xu (2):
  VT-d: Reduce spin timeout to 1ms, which can be boot-time changed.
  VT-d: Fix vt-d flush timeout issue.

 xen/drivers/passthrough/vtd/extern.h  |  5 ++
 xen/drivers/passthrough/vtd/iommu.c   |  6 +++
 xen/drivers/passthrough/vtd/qinval.c  | 89 +++++++++++++++++++++++++++++++++--
 xen/drivers/passthrough/vtd/x86/ats.c | 16 +++++++
 xen/include/xen/pci.h                 | 11 +++++
 5 files changed, 123 insertions(+), 4 deletions(-)

-- 
1.8.1.2

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2015-12-23  6:21 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-20 13:57 [PATCH v3 0/2] VT-d flush issue Xu, Quan
2015-12-20 15:51 ` Andrew Cooper
2015-12-21 11:46 ` Jan Beulich
2015-12-21 12:28   ` Xu, Quan
2015-12-21 12:50     ` Jan Beulich
2015-12-21 13:08       ` Xu, Quan
2015-12-21 13:22         ` Jan Beulich
2015-12-21 13:35           ` Xu, Quan
2015-12-21 14:08           ` Xu, Quan
2015-12-21 14:16             ` Jan Beulich
2015-12-21 14:31               ` Xu, Quan
2015-12-21 14:52                 ` Jan Beulich
2015-12-21 15:15                   ` Xu, Quan
2015-12-22  7:40           ` Wu, Feng
2015-12-22  8:01             ` Jan Beulich
2015-12-22  8:10               ` Wu, Feng
2015-12-22  8:20                 ` Jan Beulich
2015-12-22  8:10               ` Xu, Quan
2015-12-22  8:27                 ` Jan Beulich
2015-12-22  8:43                   ` Xu, Quan
2015-12-22  9:08                     ` Jan Beulich
2015-12-22  9:18                       ` Xu, Quan
2015-12-22 10:26                       ` Xu, Quan
2015-12-23  6:21                         ` Tian, Kevin
2015-12-21 12:44   ` Xu, Quan
  -- strict thread matches above, loose matches on Subject: below --
2015-12-12 13:21 Quan Xu
2015-12-19 14:01 ` Xu, Quan

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.