diff mbox

[v4,2/3] VT-d: Reduce spin timeout to 1ms, which can be boot-time changed.

Message ID 1450859136-98482-3-git-send-email-quan.xu@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Quan Xu Dec. 23, 2015, 8:25 a.m. UTC
Signed-off-by: Quan Xu <quan.xu@intel.com>
---
 xen/drivers/passthrough/vtd/qinval.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Comments

Tian, Kevin Dec. 25, 2015, 2:56 a.m. UTC | #1
> From: Xu, Quan
> Sent: Wednesday, December 23, 2015 4:26 PM
> 
> Signed-off-by: Quan Xu <quan.xu@intel.com>

Acked-by: Kevin Tian <kevin.tian@intel.com>
Quan Xu Dec. 25, 2015, 2:58 a.m. UTC | #2
> On 25.12.2015 at 10:57am, <Tian, Kevin> wrote:
> > From: Xu, Quan
> > Sent: Wednesday, December 23, 2015 4:26 PM
> >
> > Signed-off-by: Quan Xu <quan.xu@intel.com>
> 
> Acked-by: Kevin Tian <kevin.tian@intel.com>

Thanks Kevin!

-Quan
Jan Beulich Jan. 13, 2016, 4:55 p.m. UTC | #3
>>> On 23.12.15 at 09:25, <quan.xu@intel.com> wrote:
> --- a/xen/drivers/passthrough/vtd/qinval.c
> +++ b/xen/drivers/passthrough/vtd/qinval.c
> @@ -28,6 +28,11 @@
>  #include "vtd.h"
>  #include "extern.h"
>  
> +static int __read_mostly iommu_qi_timeout_ms = 1;

I'll take the liberty to convert this to "unsigned int" when committing.

Jan
Jan Beulich Jan. 13, 2016, 4:57 p.m. UTC | #4
>>> On 23.12.15 at 09:25, <quan.xu@intel.com> wrote:
> --- a/xen/drivers/passthrough/vtd/qinval.c
> +++ b/xen/drivers/passthrough/vtd/qinval.c
> @@ -28,6 +28,11 @@
>  #include "vtd.h"
>  #include "extern.h"
>  
> +static int __read_mostly iommu_qi_timeout_ms = 1;
> +integer_param("iommu_qi_timeout_ms", iommu_qi_timeout_ms);

But wait - this needs to be accompanied by an entry in
docs/misc/xen-command-line.markdown.

Jan
Quan Xu Jan. 14, 2016, 1:53 a.m. UTC | #5
On 14.01.2016 at 12:56am, <JBeulich@suse.com> wrote:
> >>> On 23.12.15 at 09:25, <quan.xu@intel.com> wrote:
> > --- a/xen/drivers/passthrough/vtd/qinval.c
> > +++ b/xen/drivers/passthrough/vtd/qinval.c
> > @@ -28,6 +28,11 @@
> >  #include "vtd.h"
> >  #include "extern.h"
> >
> > +static int __read_mostly iommu_qi_timeout_ms = 1;
> 
> I'll take the liberty to convert this to "unsigned int" when committing.
> 

Jan, thanks.
I can also do it in next v5.

Quan
diff mbox

Patch

diff --git a/xen/drivers/passthrough/vtd/qinval.c b/xen/drivers/passthrough/vtd/qinval.c
index 946e812..b227e4e 100644
--- a/xen/drivers/passthrough/vtd/qinval.c
+++ b/xen/drivers/passthrough/vtd/qinval.c
@@ -28,6 +28,11 @@ 
 #include "vtd.h"
 #include "extern.h"
 
+static int __read_mostly iommu_qi_timeout_ms = 1;
+integer_param("iommu_qi_timeout_ms", iommu_qi_timeout_ms);
+
+#define IOMMU_QI_TIMEOUT (iommu_qi_timeout_ms * MILLISECS(1))
+
 static void print_qi_regs(struct iommu *iommu)
 {
     u64 val;
@@ -167,10 +172,12 @@  static int queue_invalidate_wait(struct iommu *iommu,
         start_time = NOW();
         while ( poll_slot != QINVAL_STAT_DONE )
         {
-            if ( NOW() > (start_time + DMAR_OPERATION_TIMEOUT) )
+            if ( NOW() > (start_time + IOMMU_QI_TIMEOUT) )
             {
                 print_qi_regs(iommu);
-                panic("queue invalidate wait descriptor was not executed");
+                dprintk(XENLOG_WARNING VTDPREFIX,
+                        "Queue invalidate wait descriptor was timeout.\n");
+                return -ETIMEDOUT;
             }
             cpu_relax();
         }