All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/ats: Disable Address Translation Services by default
@ 2014-08-20 16:01 Andrew Cooper
  2014-08-22 12:39 ` Jan Beulich
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew Cooper @ 2014-08-20 16:01 UTC (permalink / raw)
  To: Xen-devel; +Cc: Andrew Cooper, Jan Beulich

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.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Jan Beulich <JBeulich@suse.com>
---
 docs/misc/xen-command-line.markdown |    9 ++++++---
 xen/drivers/passthrough/x86/ats.c   |    2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index a8cab59..5f4680f 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -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>`
diff --git a/xen/drivers/passthrough/x86/ats.c b/xen/drivers/passthrough/x86/ats.c
index 1e3e03a..436eada 100644
--- a/xen/drivers/passthrough/x86/ats.c
+++ b/xen/drivers/passthrough/x86/ats.c
@@ -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

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

* Re: [PATCH] x86/ats: Disable Address Translation Services by default
  2014-08-20 16:01 [PATCH] x86/ats: Disable Address Translation Services by default Andrew Cooper
@ 2014-08-22 12:39 ` Jan Beulich
  2014-08-27  0:37   ` Zhang, Yang Z
  2014-08-28  7:08   ` Suravee Suthikulpanit
  0 siblings, 2 replies; 9+ messages in thread
From: Jan Beulich @ 2014-08-22 12:39 UTC (permalink / raw)
  To: Andrew Cooper
  Cc: Yang Z Zhang, Kevin Tian, Aravind Gopalakrishnan,
	suravee.suthikulpanit, Xen-devel

>>> On 20.08.14 at 18:01, <andrew.cooper3@citrix.com> 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.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> CC: Jan Beulich <JBeulich@suse.com>

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

> ---
>  docs/misc/xen-command-line.markdown |    9 ++++++---
>  xen/drivers/passthrough/x86/ats.c   |    2 +-
>  2 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/docs/misc/xen-command-line.markdown 
> b/docs/misc/xen-command-line.markdown
> index a8cab59..5f4680f 100644
> --- a/docs/misc/xen-command-line.markdown
> +++ b/docs/misc/xen-command-line.markdown
> @@ -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>`
> diff --git a/xen/drivers/passthrough/x86/ats.c 
> b/xen/drivers/passthrough/x86/ats.c
> index 1e3e03a..436eada 100644
> --- a/xen/drivers/passthrough/x86/ats.c
> +++ b/xen/drivers/passthrough/x86/ats.c
> @@ -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

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

* Re: [PATCH] x86/ats: Disable Address Translation Services by default
  2014-08-22 12:39 ` Jan Beulich
@ 2014-08-27  0:37   ` Zhang, Yang Z
  2014-08-27  6:21     ` Jan Beulich
  2014-08-28  7:08   ` Suravee Suthikulpanit
  1 sibling, 1 reply; 9+ messages in thread
From: Zhang, Yang Z @ 2014-08-27  0:37 UTC (permalink / raw)
  To: Jan Beulich, Andrew Cooper
  Cc: Tian, Kevin, Aravind Gopalakrishnan, suravee.suthikulpanit, Xen-devel

Jan Beulich wrote on 2014-08-22:
>>>> On 20.08.14 at 18:01, <andrew.cooper3@citrix.com> 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.
>> 
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>> CC: Jan Beulich <JBeulich@suse.com>
> 
> 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?

> 
> Jan
> 
>> ---
>>  docs/misc/xen-command-line.markdown |    9 ++++++---
>>  xen/drivers/passthrough/x86/ats.c   |    2 +-
>>  2 files changed, 7 insertions(+), 4 deletions(-)
>> diff --git a/docs/misc/xen-command-line.markdown
>> b/docs/misc/xen-command-line.markdown
>> index a8cab59..5f4680f 100644
>> --- a/docs/misc/xen-command-line.markdown
>> +++ b/docs/misc/xen-command-line.markdown
>> @@ -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>`
>> diff --git a/xen/drivers/passthrough/x86/ats.c
>> b/xen/drivers/passthrough/x86/ats.c
>> index 1e3e03a..436eada 100644
>> --- a/xen/drivers/passthrough/x86/ats.c
>> +++ b/xen/drivers/passthrough/x86/ats.c
>> @@ -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
> 
>


Best regards,
Yang

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

* Re: [PATCH] x86/ats: Disable Address Translation Services by default
  2014-08-27  0:37   ` Zhang, Yang Z
@ 2014-08-27  6:21     ` Jan Beulich
  0 siblings, 0 replies; 9+ messages in thread
From: Jan Beulich @ 2014-08-27  6:21 UTC (permalink / raw)
  To: Yang Z Zhang
  Cc: Andrew Cooper, Kevin Tian, Aravind Gopalakrishnan,
	suravee.suthikulpanit, Xen-devel

>>> On 27.08.14 at 02:37, <yang.z.zhang@intel.com> wrote:
> Jan Beulich wrote on 2014-08-22:
>>>>> On 20.08.14 at 18:01, <andrew.cooper3@citrix.com> 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.
>>> 
>>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>>> CC: Jan Beulich <JBeulich@suse.com>
>> 
>> 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

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

* Re: [PATCH] x86/ats: Disable Address Translation Services by default
  2014-08-22 12:39 ` Jan Beulich
  2014-08-27  0:37   ` Zhang, Yang Z
@ 2014-08-28  7:08   ` Suravee Suthikulpanit
  2014-08-28  7:32     ` Jan Beulich
  1 sibling, 1 reply; 9+ messages in thread
From: Suravee Suthikulpanit @ 2014-08-28  7:08 UTC (permalink / raw)
  To: Jan Beulich, Andrew Cooper
  Cc: Yang Z Zhang, Kevin Tian, Aravind Gopalakrishnan, Xen-devel

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

On 08/22/2014 07:39 AM, Jan Beulich wrote:
>>>> On 20.08.14 at 18:01, <andrew.cooper3@citrix.com> 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.
>>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>> CC: Jan Beulich <JBeulich@suse.com>
>
> 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
>
>> ---
>>   docs/misc/xen-command-line.markdown |    9 ++++++---
>>   xen/drivers/passthrough/x86/ats.c   |    2 +-
>>   2 files changed, 7 insertions(+), 4 deletions(-)
>>
>> diff --git a/docs/misc/xen-command-line.markdown
>> b/docs/misc/xen-command-line.markdown
>> index a8cab59..5f4680f 100644
>> --- a/docs/misc/xen-command-line.markdown
>> +++ b/docs/misc/xen-command-line.markdown
>> @@ -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>`
>> diff --git a/xen/drivers/passthrough/x86/ats.c
>> b/xen/drivers/passthrough/x86/ats.c
>> index 1e3e03a..436eada 100644
>> --- a/xen/drivers/passthrough/x86/ats.c
>> +++ b/xen/drivers/passthrough/x86/ats.c
>> @@ -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
>
>
>

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

* Re: [PATCH] x86/ats: Disable Address Translation Services by default
  2014-08-28  7:08   ` Suravee Suthikulpanit
@ 2014-08-28  7:32     ` Jan Beulich
  2014-08-28  8:18       ` Suravee Suthikulpanit
  0 siblings, 1 reply; 9+ messages in thread
From: Jan Beulich @ 2014-08-28  7:32 UTC (permalink / raw)
  To: Suravee Suthikulpanit
  Cc: Yang Z Zhang, Andrew Cooper, Kevin Tian, Aravind Gopalakrishnan,
	Xen-devel

>>> On 28.08.14 at 09:08, <suravee.suthikulpanit@amd.com> 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

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

* Re: [PATCH] x86/ats: Disable Address Translation Services by default
  2014-08-28  7:32     ` Jan Beulich
@ 2014-08-28  8:18       ` Suravee Suthikulpanit
  2014-08-28  8:30         ` Jan Beulich
  0 siblings, 1 reply; 9+ messages in thread
From: Suravee Suthikulpanit @ 2014-08-28  8:18 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Yang Z Zhang, Andrew Cooper, Kevin Tian, Aravind Gopalakrishnan,
	Xen-devel



On 08/28/2014 02:32 AM, Jan Beulich wrote:
>>>> On 28.08.14 at 09:08, <suravee.suthikulpanit@amd.com> 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

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

* Re: [PATCH] x86/ats: Disable Address Translation Services by default
  2014-08-28  8:18       ` Suravee Suthikulpanit
@ 2014-08-28  8:30         ` Jan Beulich
  2014-08-28 10:07           ` Suravee Suthikulpanit
  0 siblings, 1 reply; 9+ messages in thread
From: Jan Beulich @ 2014-08-28  8:30 UTC (permalink / raw)
  To: Suravee Suthikulpanit
  Cc: Yang Z Zhang, Andrew Cooper, Kevin Tian, Aravind Gopalakrishnan,
	Xen-devel

>>> On 28.08.14 at 10:18, <suravee.suthikulpanit@amd.com> wrote:
> On 08/28/2014 02:32 AM, Jan Beulich wrote:
>>>>> On 28.08.14 at 09:08, <suravee.suthikulpanit@amd.com> 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.

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

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

* Re: [PATCH] x86/ats: Disable Address Translation Services by default
  2014-08-28  8:30         ` Jan Beulich
@ 2014-08-28 10:07           ` Suravee Suthikulpanit
  0 siblings, 0 replies; 9+ messages in thread
From: Suravee Suthikulpanit @ 2014-08-28 10:07 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Yang Z Zhang, Andrew Cooper, Kevin Tian, Aravind Gopalakrishnan,
	Xen-devel



On 08/28/2014 03:30 AM, Jan Beulich wrote:
>>>> On 28.08.14 at 10:18, <suravee.suthikulpanit@amd.com> wrote:
>> On 08/28/2014 02:32 AM, Jan Beulich wrote:
>>>>>> On 28.08.14 at 09:08, <suravee.suthikulpanit@amd.com> 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.
>
> 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.

Acked-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>

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

end of thread, other threads:[~2014-08-28 10:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-20 16:01 [PATCH] x86/ats: Disable Address Translation Services by default Andrew Cooper
2014-08-22 12:39 ` Jan Beulich
2014-08-27  0:37   ` Zhang, Yang Z
2014-08-27  6:21     ` Jan Beulich
2014-08-28  7:08   ` Suravee Suthikulpanit
2014-08-28  7:32     ` Jan Beulich
2014-08-28  8:18       ` Suravee Suthikulpanit
2014-08-28  8:30         ` Jan Beulich
2014-08-28 10:07           ` Suravee Suthikulpanit

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.