Skip to contentSkip to conversation

x86/ats: Disable Address Translation Services by default

PATCH In review Andrew Cooper 4 participants 9 messages Aug 20, 2014 – Aug 28, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/ats: Disable Address Translation Services by default

Xen cannot safely use any ATS functionality until it gains asynchronous queued invalidation support, because of the current synchronous wait for completion.

Do not turn ATS on by default.

While editing the default in the command line documentation, correct the statement regarding PCI Passthrough. ATS is purely a performance optimisation, and is certainly not required for PCI Passthrough to function.

---
 docs/misc/xen-command-line.markdown |    9 ++++++---
 xen/drivers/passthrough/x86/ats.c   |    2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)
docs/misc/xen-command-line.markdown +6 -3
index a8cab59..5f4680f 100644
@@ -176,10 +176,13 @@ developers wishing Xen to fall back to older timing methods on newer hardware.
 ### ats
 > `= <boolean>`
 
-> Default: `true`
+> Default: `false`
+
+Permits Xen to set up and use PCI Address Translation Services.  This is a
+performance optimisation for PCI Passthrough.
 
-Permits Xen to set up and use PCI Address Translation Services, which
-is required for PCI Passthrough.
+**WARNING: Xen cannot currently safely use ATS because of its synchronous wait
+loops for Queued Invalidation completions.**
 
 ### availmem
 > `= <size>`
xen/drivers/passthrough/x86/ats.c +1 -1
index 1e3e03a..436eada 100644
@@ -20,7 +20,7 @@
 
 LIST_HEAD(ats_devices);
 
-bool_t __read_mostly ats_enabled = 1;
+bool_t __read_mostly ats_enabled = 0;
 boolean_param("ats", ats_enabled);
 
 int enable_ats_device(int seg, int bus, int devfn, const void *iommu)
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 20.08.14 at 18:01, <[email protected]> wrote:

Xen cannot safely use any ATS functionality until it gains asynchronous queued
invalidation support, because of the current synchronous wait for completion.

Quoted 8 lines

Do not turn ATS on by default.

While editing the default in the command line documentation, correct the statement regarding PCI Passthrough. ATS is purely a performance optimisation, and is certainly not required for PCI Passthrough to function.

Even if not mandated by ./MAINTAINERS I think this definitely should have been Cc-ed to the VT-d and AMD IOMMU maintainers (now done).

Jan

Quoted 45 lines
---
 docs/misc/xen-command-line.markdown |    9 ++++++---
 xen/drivers/passthrough/x86/ats.c   |    2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)
docs/misc/xen-command-line.markdown +0 -0
index a8cab59..5f4680f 100644
@@ -176,10 +176,13 @@ developers wishing Xen to fall back to older timing 

methods on newer hardware.
### ats

Quoted 1 line

= <boolean>

-> Default: true
+> Default: false

docs/misc/xen-command-line.markdown +4 -2
+
+Permits Xen to set up and use PCI Address Translation Services.  This is a
+performance optimisation for PCI Passthrough.
 
-Permits Xen to set up and use PCI Address Translation Services, which
-is required for PCI Passthrough.
+**WARNING: Xen cannot currently safely use ATS because of its synchronous 

wait

docs/misc/xen-command-line.markdown +1 -0
+loops for Queued Invalidation completions.**
 
 ### availmem
 > `= <size>`
xen/drivers/passthrough/x86/ats.c +1 -1
index 1e3e03a..436eada 100644
@@ -20,7 +20,7 @@
 
 LIST_HEAD(ats_devices);
 
-bool_t __read_mostly ats_enabled = 1;
+bool_t __read_mostly ats_enabled = 0;
 boolean_param("ats", ats_enabled);
 
 int enable_ats_device(int seg, int bus, int devfn, const void *iommu)
Signature · 1 line
1.7.10.4
#2 lore raw

Jan Beulich wrote on 2014-08-22:

Quoted 11 lines
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 20.08.14 at 18:01, <[email protected]> wrote:

Xen cannot safely use any ATS functionality until it gains asynchronous queued invalidation support, because of the current synchronous wait for completion.

Do not turn ATS on by default.

While editing the default in the command line documentation, correct
the statement regarding PCI Passthrough. ATS is purely a
performance optimisation, and is certainly not required for PCI Passthrough to function.

Quoted 5 lines
Quoted 2 lines

Even if not mandated by ./MAINTAINERS I think this definitely should have been Cc-ed to the VT-d and AMD IOMMU maintainers (now done).

Thanks for forwarding to us.

BTW, do you want us to give a ack or just let us know?

Quoted 44 lines

Jan

Quoted 41 lines
---
 docs/misc/xen-command-line.markdown |    9 ++++++---
 xen/drivers/passthrough/x86/ats.c   |    2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)
docs/misc/xen-command-line.markdown +0 -0
index a8cab59..5f4680f 100644
@@ -176,10 +176,13 @@ developers wishing Xen to fall back to older

timing methods on newer hardware.
### ats
= <boolean>

-> Default: true
+> Default: false

docs/misc/xen-command-line.markdown +3 -1
+
+Permits Xen to set up and use PCI Address Translation Services.
+This is a performance optimisation for PCI Passthrough.
 
-Permits Xen to set up and use PCI Address Translation Services,

which -is required for PCI Passthrough.

docs/misc/xen-command-line.markdown +2 -0
+**WARNING: Xen cannot currently safely use ATS because of its
+synchronous

wait

docs/misc/xen-command-line.markdown +1 -0
+loops for Queued Invalidation completions.**
 
 ### availmem
 `= <size>`
xen/drivers/passthrough/x86/ats.c +1 -1
index 1e3e03a..436eada 100644
@@ -20,7 +20,7 @@
 
 LIST_HEAD(ats_devices);
-bool_t __read_mostly ats_enabled = 1;
+bool_t __read_mostly ats_enabled = 0;
 boolean_param("ats", ats_enabled);
 
Quoted 6 lines
Quoted 4 lines
xen/drivers/passthrough/x86/ats.c +0 -1
 int enable_ats_device(int seg, int bus, int devfn, const void
 *iommu)
--

1.7.10.4

Best regards,
Yang

#3 lore raw
Quoted 17 lines
Quoted 1 line
Quoted 1 line · On 27.08.14 at 02:37, <[email protected]> wrote:

Jan Beulich wrote on 2014-08-22:

Quoted 10 lines
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 20.08.14 at 18:01, <[email protected]> wrote:

Xen cannot safely use any ATS functionality until it gains asynchronous queued invalidation support, because of the current synchronous wait for completion.

Do not turn ATS on by default.

While editing the default in the command line documentation, correct the statement regarding PCI Passthrough. ATS is purely a performance optimisation, and is certainly not required for PCI Passthrough

to function.

Quoted 4 lines
Quoted 3 lines
Quoted 6 lines
Quoted 2 lines

Even if not mandated by ./MAINTAINERS I think this definitely should have been Cc-ed to the VT-d and AMD IOMMU maintainers (now done).

Thanks for forwarding to us.

BTW, do you want us to give a ack or just let us know?

If you don't object to the change, an ack would certainly be appreciated. If you object, comments as to alternatives would be kind of expected.

Jan

#4 lore raw
In reply to Jan Beulich

Andrew/Jan,

I have verified that PCI device pass-through works with ATS disabled. Although, could you please help described how "asynchronous queued invalidation support" supposed to work?

Thanks,

Suravee

Quoted 69 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 20.08.14 at 18:01, <[email protected]> wrote:

Xen cannot safely use any ATS functionality until it gains asynchronous queued
invalidation support, because of the current synchronous wait for completion.

Quoted 8 lines

Do not turn ATS on by default.

While editing the default in the command line documentation, correct the statement regarding PCI Passthrough. ATS is purely a performance optimisation, and is certainly not required for PCI Passthrough to function.

Even if not mandated by ./MAINTAINERS I think this definitely should have been Cc-ed to the VT-d and AMD IOMMU maintainers (now done).

Jan

Quoted 45 lines
---
  docs/misc/xen-command-line.markdown |    9 ++++++---
  xen/drivers/passthrough/x86/ats.c   |    2 +-
  2 files changed, 7 insertions(+), 4 deletions(-)
docs/misc/xen-command-line.markdown +0 -0
index a8cab59..5f4680f 100644
@@ -176,10 +176,13 @@ developers wishing Xen to fall back to older timing

methods on newer hardware.
### ats

Quoted 1 line

= <boolean>

-> Default: true
+> Default: false

docs/misc/xen-command-line.markdown +4 -2
+
+Permits Xen to set up and use PCI Address Translation Services.  This is a
+performance optimisation for PCI Passthrough.
 
-Permits Xen to set up and use PCI Address Translation Services, which
-is required for PCI Passthrough.
+**WARNING: Xen cannot currently safely use ATS because of its synchronous

wait

docs/misc/xen-command-line.markdown +1 -0
+loops for Queued Invalidation completions.**
 
  ### availmem
  > `= <size>`
xen/drivers/passthrough/x86/ats.c +1 -2
index 1e3e03a..436eada 100644
@@ -20,7 +20,7 @@
 
  LIST_HEAD(ats_devices);
 
-bool_t __read_mostly ats_enabled = 1;
+bool_t __read_mostly ats_enabled = 0;
  boolean_param("ats", ats_enabled);
 
  int enable_ats_device(int seg, int bus, int devfn, const void *iommu)
--

1.7.10.4

#5 lore raw
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 28.08.14 at 09:08, <[email protected]> wrote:

I have verified that PCI device pass-through works with ATS disabled. Although, could you please help described how "asynchronous queued invalidation support" supposed to work?

Are asking about the abstract model, or the specific implementation? The former is quite obvious is think (utilize the respective interrupt to get notified of completions and suspend the execution in the current context until then), while the latter isn't clear at all at this point, due to it being necessary to inspect all involved code paths to see how exactly suspension can be carried out.

Also, QI is - afaik - a VT-d specific feature anyway, i.e. doesn't have a direct equivalent on the AMD side...

Jan

#6 lore raw
Quoted 9 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 28.08.14 at 09:08, <[email protected]> wrote:

I have verified that PCI device pass-through works with ATS disabled. Although, could you please help described how "asynchronous queued invalidation support" supposed to work?

Are asking about the abstract model, or the specific implementation? The former is quite obvious is think (utilize the respective interrupt to get notified of completions and suspend the execution in the current context until then),

So, what Andrew is saying is that the current implementation which uses the "synchronous wait for completion" is not safe? May be I'm not getting the whole picture here of how it is unsafe.

Thanks,

Suravee

#7 lore raw
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 28.08.14 at 10:18, <[email protected]> wrote:
Quoted 5 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 28.08.14 at 09:08, <[email protected]> wrote:

I have verified that PCI device pass-through works with ATS disabled. Although, could you please help described how "asynchronous queued invalidation support" supposed to work?

Quoted 8 lines
Quoted 4 lines

Are asking about the abstract model, or the specific implementation? The former is quite obvious is think (utilize the respective interrupt to get notified of completions and suspend the execution in the current context until then),

So, what Andrew is saying is that the current implementation which uses the "synchronous wait for completion" is not safe? May be I'm not getting the whole picture here of how it is unsafe.

It may be spinning for up to a second, and for ATS it would really need to be spinning for up to 60 seconds (perhaps even 90, depending on how to interpret the spec).

Jan

#8 lore raw
Quoted 16 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 28.08.14 at 10:18, <[email protected]> wrote:
Quoted 5 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 28.08.14 at 09:08, <[email protected]> wrote:

I have verified that PCI device pass-through works with ATS disabled. Although, could you please help described how "asynchronous queued invalidation support" supposed to work?

Quoted 8 lines
Quoted 4 lines

Are asking about the abstract model, or the specific implementation? The former is quite obvious is think (utilize the respective interrupt to get notified of completions and suspend the execution in the current context until then),

So, what Andrew is saying is that the current implementation which uses the "synchronous wait for completion" is not safe? May be I'm not getting the whole picture here of how it is unsafe.

Quoted 6 lines

It may be spinning for up to a second, and for ATS it would really need to be spinning for up to 60 seconds (perhaps even 90, depending on how to interpret the spec).

Jan

Thanks for clarification.