VT-d Device-TLB flush issue
v10 cover VT-d Device-TLB flush issue
This patches fix current timeout concern and also allow limited ATS support:
1. Add a timeout parameter for Queued Invalidation
The parameter 'vtd_qi_timeout' specifies the timeout of the VT-d Queued Invalidation in milliseconds. By default, the timeout is 1ms, which can be boot-time changed.
Add a __must_check annotation. The followup patch titled 'VT-d IOTLB/Context/IEC flush issue' addresses the __mustcheck. That is the other callers of this routine (two or three levels up) ignore the return code. This patch does not address this but the other does.
2. Synchronize for Device-TLB flush one by one
Today we do Device-TLB flush synchronization after issuing flush requests for all ATS devices belonging to a VM. Doing so however imposes a limitation, i.e. that we can not figure out which flush request is blocked in the flush queue list, based on VT-d spec.
To prepare correct Device-TLB flush timeout handling in next patch, we change the behavior to synchronize for every Device-TLB flush request. So the Device-TLB flush interface is changed a little bit, by checking timeout within the function instead of outside of function.
Accordingly we also do a similar change for flush interfaces of IOTLB/IEC/Context, i.e. moving synchronization into the function. Since there is no user of a non-synced interface, we just rename existing ones with _sync suffix.
3. Fix vt-d Device-TLB flush timeout issue
If Device-TLB flush timed out, we hide the target ATS device immediately and crash the domain owning this ATS device. If impacted domain is hardware domain, just throw out a warning.
By hiding the device, we make sure it can't be assigned to any domain any longer (see device_assigned).
**NOTE**
This patch set should base on one prereq patch sets:
a). Check VT-d Device-TLB flush error.
----
Not covered in this series:
a) Eliminate the panic() in IOMMU_WAIT_OP, used only in VT-d register read/write. Further discussion is required on whether and how to improve it.
b) Handle IOTLB/Context/IEC flush timeout.
--Changes in v10:
#patch1
* Enhance commit message.
* Enhance description in docs/misc/xen-command-line.markdown
#patch2
* Enhance commit message.
* Fix indentation issue.
* Add __must_check anotation.
* Remove redundant comment.
* leave the existing logic as - best effort invalidation even when an error has occurred.
#patch3
* Remove stray blanks.
* Remove pointless local variable.
* Add comment.
* Add printk().
Quan Xu (3):
vt-d: add a timeout parameter for Queued Invalidation
vt-d: synchronize for Device-TLB flush one by one
vt-d: fix vt-d Device-TLB flush timeout issue
docs/misc/xen-command-line.markdown | 10 +++ xen/drivers/passthrough/pci.c | 6 +- xen/drivers/passthrough/vtd/extern.h | 6 +- xen/drivers/passthrough/vtd/qinval.c | 141 ++++++++++++++++++++++++++-------- xen/drivers/passthrough/vtd/x86/ats.c | 11 +-- xen/include/xen/pci.h | 1 + 6 files changed, 134 insertions(+), 41 deletions(-)
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH v10 1/3 vt-d: add a timeout parameter for Queued Invalidation
The parameter 'vtd_qi_timeout' specifies the timeout of the VT-d Queued Invalidation in milliseconds. By default, the timeout is 1ms, which can be boot-time changed.
Add a __must_check annotation. The followup patch titled 'VT-d IOTLB/Context/IEC flush issue' addresses the __mustcheck. That is the other callers of this routine (two or three levels up) ignore the return code. This patch does not address this but the other does.
--- docs/misc/xen-command-line.markdown | 10 ++++++++++ xen/drivers/passthrough/vtd/qinval.c | 17 ++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-)
docs/misc/xen-command-line.markdown +10 -0
@@ -1532,6 +1532,16 @@ Note that if **watchdog** option is also specified vpmu will be turned off. As the virtualisation is not 100% safe, don't use the vpmu flag on production systems (see http://xenbits.xen.org/xsa/advisory-163.html)! +### vtd\_qi\_timeout (VT-d) +> `= <integer>` + +> Default: `1` + +Specify the timeout of the VT-d Queued Invalidation in milliseconds. + +By default, the timeout is 1ms. When you see error 'Queue invalidate wait +descriptor timed out', try increasing this value. + ### watchdog > `= force | <boolean>`
xen/drivers/passthrough/vtd/qinval.c +12 -5
@@ -28,6 +28,11 @@#include "vtd.h" #include "extern.h" +static unsigned int __read_mostly vtd_qi_timeout =1 ; +integer_param ("vtd_qi_timeout" , vtd_qi_timeout); + +#define IOMMU_QI_TIMEOUT (vtd_qi_timeout * MILLISECS(1)) +static void print_qi_regs (struct iommu *iommu) {u64 val;
@@ -130,10 +135,10 @@ static void queue_invalidate_iotlb(struct iommu *iommu,spin_unlock_irqrestore (&iommu->register_lock, flags); } -static int queue_invalidate_wait (struct iommu *iommu, +static int __must_check queue_invalidate_wait (struct iommu *iommu,u8 iflag,u8 sw,u8 fn) { -s_time_t start_time; +s_time_t timeout;volatile u32 poll_slot =QINVAL_STAT_INIT ;unsigned int index;unsigned long flags;
@@ -164,13 +169,15 @@ static int queue_invalidate_wait(struct iommu *iommu,if ( sw ) {/* In case all wait descriptor writes to same addr with same data */ - start_time =NOW (); + timeout =NOW () +IOMMU_QI_TIMEOUT ;while ( poll_slot !=QINVAL_STAT_DONE ) { -if (NOW () > (start_time +DMAR_OPERATION_TIMEOUT ) ) +if (NOW () > timeout ) {print_qi_regs (iommu); -panic ("queue invalidate wait descriptor was not executed" ); + printk(XENLOG_WARNING VTDPREFIX + "Queue invalidate wait descriptor timed out.\n"); +return -ETIMEDOUT ; }cpu_relax (); }
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH v10 1/3] vt-d: add a timeout parameter for Queued Invalidation
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 22.04.16 at 12:54, <[email protected]> wrote:
docs/misc/xen-command-line.markdown +0
-0@@ -1532,6 +1532,16 @@ Note that if **watchdog** option is also specified vpmu will be turned off. As the virtualisation is not 100% safe, don't use the vpmu flag on production systems (see http://xenbits.xen.org/xsa/advisory-163.html)!
docs/misc/xen-command-line.markdown Note that if **watchdog** option is also specified vpmu will be turned off. · line 1543
Quoted 10 lines
docs/misc/xen-command-line.markdown +9
-0+### vtd\_qi\_timeout (VT-d) +> `= <integer>` + +> Default: `1` + +Specify the timeout of the VT-d Queued Invalidation in milliseconds. + +By default, the timeout is 1ms. When you see error 'Queue invalidate wait +descriptor timed out', try increasing this value.
So when someone enables ATS, will the 1ms timeout apply to the dev iotlb invalidations too? If so, that's surely too short, and would ideally be adjusted automatically, but the need for a higher timeout in that case should in any event be mentioned here.
Apart from that aspect this patch seems to be ready, but will clearly need a VT-d maintainer's ack.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v10 1/3] vt-d: add a timeout parameter for Queued Invalidation
Quoted 8 lines · Jan Beulich
docs/misc/xen-command-line.markdown Note that if **watchdog** option is also
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 22.04.16 at 12:54, <[email protected]> wrote:
docs/misc/xen-command-line.markdown +0
-0@@ -1532,6 +1532,16 @@ Note that if **watchdog** option is alsospecified vpmu will be turned off.
Quoted 3 lines
docs/misc/xen-command-line.markdown +0
-0As the virtualisation is not 100% safe, don't use the vpmu flag onproduction systems (see http://xenbits.xen.org/xsa/advisory-163.html)!
Quoted 12 lines
docs/misc/xen-command-line.markdown Note that if **watchdog** option is also specified vpmu will be turned off.
Quoted 9 lines
docs/misc/xen-command-line.markdown +9
-0+### vtd\_qi\_timeout (VT-d) +> `= <integer>` + +> Default: `1` + +Specify the timeout of the VT-d Queued Invalidation in milliseconds. + +By default, the timeout is 1ms. When you see error 'Queue invalidate +wait descriptor timed out', try increasing this value.So when someone enables ATS, will the 1ms timeout apply to the dev iotlb invalidations too?
Yes,
The timeout is the same for IOTLB, Context, IEC and Device-TLB invalidation.
Quoted 3 lines
If so, that's surely too short, and would ideally be adjusted automatically, but the need for a higher timeout in that case should in any event be mentioned here.
I can try to use 1ms for IOTLB, Context and IEC invalidation. As mentioned, 1 ms is enough for IOTLB, Context and IEC invalidation. What about 10 ms for Device-TLB (10 ms is just a higher timeout, no specific meaning)?
Quoted 4 lines
Apart from that aspect this patch seems to be ready, but will clearly need a VT- d maintainer's ack.
Thanks for your review. I will also test this patch against the last commit ( I am still out of office and I will do it around this Wednesday).
Quan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v10 1/3] vt-d: add a timeout parameter for Queued Invalidation
Quoted 28 lines
From: Xu, Quan
Sent: Monday, May 16, 2016 11:26 PMQuoted 8 lines · Jan Beulich
docs/misc/xen-command-line.markdown Note that if **watchdog** option is also
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 22.04.16 at 12:54, <[email protected]> wrote:
docs/misc/xen-command-line.markdown +0
-0@@ -1532,6 +1532,16 @@ Note that if **watchdog** option is alsospecified vpmu will be turned off.
Quoted 3 lines
docs/misc/xen-command-line.markdown +0
-0As the virtualisation is not 100% safe, don't use the vpmu flag onproduction systems (see http://xenbits.xen.org/xsa/advisory-163.html)!
Quoted 12 lines
docs/misc/xen-command-line.markdown Note that if **watchdog** option is also specified vpmu will be turned off.
Quoted 9 lines
docs/misc/xen-command-line.markdown +9
-0+### vtd\_qi\_timeout (VT-d) +> `= <integer>` + +> Default: `1` + +Specify the timeout of the VT-d Queued Invalidation in milliseconds. + +By default, the timeout is 1ms. When you see error 'Queue invalidate +wait descriptor timed out', try increasing this value.So when someone enables ATS, will the 1ms timeout apply to the dev iotlb invalidations too?
Yes,
The timeout is the same for IOTLB, Context, IEC and Device-TLB invalidation.
Quoted 7 lines
Quoted 3 lines
If so, that's surely too short, and would ideally be adjusted automatically, but the need for a higher timeout in that case should in any event be mentioned here.
I can try to use 1ms for IOTLB, Context and IEC invalidation. As mentioned, 1 ms is enough for IOTLB, Context and IEC invalidation.
What about 10 ms for Device-TLB (10 ms is just a higher timeout, no specific meaning)?
I remember in earlier discussion we agreed to use 1ms as the default for both IOMMU-side and device-side flushes. For device-side flushes, we checked internal HW team that 1ms is a reasonable threshold for integrated devices. It's likely insufficient for discrete devices. We may check any automatic adjustment method later when it becomes a real problem. For now, please elaborate above information in the text.
Quoted 9 lines
Quoted 5 lines
Apart from that aspect this patch seems to be ready, but will clearly need a VT- d maintainer's ack.
Thanks for your review. I will also test this patch against the last commit ( I am still out of office and I will do it around this Wednesday).
Jan, do you want me to ack this series now, or wait until previous series handling error is checked in? (I thought you wanted the later in one of your replies earlier). Either way is OK to me. :-)
Thanks
Kevin
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v10 1/3] vt-d: add a timeout parameter for Queued Invalidation
Quoted 37 lines
Quoted 29 lines
Quoted 1 line · On 17.05.16 at 05:19, <[email protected]> wrote:
From: Xu, Quan
Sent: Monday, May 16, 2016 11:26 PMQuoted 8 lines · Jan Beulich
docs/misc/xen-command-line.markdown Note that if **watchdog** option is also
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 22.04.16 at 12:54, <[email protected]> wrote:
docs/misc/xen-command-line.markdown +0
-0@@ -1532,6 +1532,16 @@ Note that if **watchdog** option is alsospecified vpmu will be turned off.
Quoted 3 lines
docs/misc/xen-command-line.markdown +0
-0As the virtualisation is not 100% safe, don't use the vpmu flag onproduction systems (see http://xenbits.xen.org/xsa/advisory-163.html)!
Quoted 12 lines
docs/misc/xen-command-line.markdown Note that if **watchdog** option is also specified vpmu will be turned off.
Quoted 9 lines
docs/misc/xen-command-line.markdown +9
-0+### vtd\_qi\_timeout (VT-d) +> `= <integer>` + +> Default: `1` + +Specify the timeout of the VT-d Queued Invalidation in milliseconds. + +By default, the timeout is 1ms. When you see error 'Queue invalidate +wait descriptor timed out', try increasing this value.So when someone enables ATS, will the 1ms timeout apply to the dev iotlb invalidations too?
Yes,
The timeout is the same for IOTLB, Context, IEC and Device-TLB invalidation.Quoted 7 lines
Quoted 3 lines
If so, that's surely too short, and would ideally be adjusted automatically, but the need for a higher timeout in that case should in any event be mentioned here.
I can try to use 1ms for IOTLB, Context and IEC invalidation. As mentioned, 1 ms is enough for IOTLB, Context and IEC invalidation.
What about 10 ms for Device-TLB (10 ms is just a higher timeout, no specific meaning)?
Quoted 6 lines
I remember in earlier discussion we agreed to use 1ms as the default for both IOMMU-side and device-side flushes. For device-side flushes, we checked internal HW team that 1ms is a reasonable threshold for integrated devices. It's likely insufficient for discrete devices. We may check any automatic adjustment method later when it becomes a real problem. For now, please elaborate above information in the text.
Well, taking care of automation later is fine with me, but tying everything to a single timeout, when device iotlb invalidation may require a much larger value, isn't.
Quoted 11 lines
Quoted 7 lines
Quoted 3 lines
Apart from that aspect this patch seems to be ready, but will clearly need a VT- d maintainer's ack.
Thanks for your review. I will also test this patch against the last commit ( I am still out of office and I will do it around this Wednesday).
Jan, do you want me to ack this series now, or wait until previous series handling error is checked in? (I thought you wanted the later in one of your replies earlier). Either way is OK to me. :-)
Well, I'm not to tell you when to ack a certain series. You should ack it once it meets the criteria for you to ack it. The dependency on the other series is what should be spelled out explicitly in this series, or even better this series should be merged with the other one (to the dependency make most obvious). But I'm repeating myself...
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v10 1/3] vt-d: add a timeout parameter for Queued Invalidation
Quoted 46 lines · Jan Beulich
Quoted 4 lines
Quoted 4 lines
Quoted 1 line · On 17.05.16 at 05:19, <[email protected]> wrote:
From: Xu, Quan
Sent: Monday, May 16, 2016 11:26 PMQuoted 8 lines
Quoted 8 lines · Jan Beulich
Quoted 7 lines
docs/misc/xen-command-line.markdown Note that if **watchdog** option is also
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 22.04.16 at 12:54, <[email protected]> wrote:
docs/misc/xen-command-line.markdown +0
-0@@ -1532,6 +1532,16 @@ Note that if **watchdog** option is alsospecified vpmu will be turned off.
Quoted 2 lines
docs/misc/xen-command-line.markdown +0
-0As the virtualisation is not 100% safe, don't use the vpmu flagon production systems (see http://xenbits.xen.org/xsa/advisory-
163.html)!
Quoted 17 lines
Quoted 17 lines
Quoted 13 lines
docs/misc/xen-command-line.markdown Note that if **watchdog** option is also specified vpmu will be turned off.
Quoted 10 lines
docs/misc/xen-command-line.markdown +9
-0+### vtd\_qi\_timeout (VT-d) +> `= <integer>` + +> Default: `1` + +Specify the timeout of the VT-d Queued Invalidation in milliseconds. + +By default, the timeout is 1ms. When you see error 'Queue +invalidate wait descriptor timed out', try increasing this value.So when someone enables ATS, will the 1ms timeout apply to the dev iotlb invalidations too?
Yes,
The timeout is the same for IOTLB, Context, IEC and Device-TLB invalidation.Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
If so, that's surely too short, and would ideally be adjusted automatically, but the need for a higher timeout in that case should in any event be mentioned here.
I can try to use 1ms for IOTLB, Context and IEC invalidation. As mentioned, 1 ms is enough for IOTLB, Context and IEC invalidation. What about 10 ms for Device-TLB (10 ms is just a higher timeout, no
specific meaning)?
Quoted 7 lines
I remember in earlier discussion we agreed to use 1ms as the default for both IOMMU-side and device-side flushes. For device-side flushes, we checked internal HW team that 1ms is a reasonable threshold for integrated devices. It's likely insufficient for discrete devices. We may check any automatic adjustment method later when it becomes a real problem. For now, please elaborate above information in the text.
Quoted 5 lines
Well, taking care of automation later is fine with me,
but tying everything to a
single timeout, when device iotlb invalidation may require a much larger value, isn't.
A little bit confused. Check it -- could I leave patch 1/3 as is?
btw, I have tested it against the last commit, no conflict.
Quan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v10 1/3] vt-d: add a timeout parameter for Queued Invalidation
Quoted 48 lines
Quoted 1 line
Quoted 1 line · On 18.05.16 at 14:53, <[email protected]> wrote:
Quoted 46 lines · Jan Beulich
Quoted 4 lines
Quoted 4 lines
Quoted 1 line · On 17.05.16 at 05:19, <[email protected]> wrote:
From: Xu, Quan
Sent: Monday, May 16, 2016 11:26 PMQuoted 8 lines
Quoted 8 lines · Jan Beulich
Quoted 7 lines
docs/misc/xen-command-line.markdown Note that if **watchdog** option is also
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 22.04.16 at 12:54, <[email protected]> wrote:
docs/misc/xen-command-line.markdown +0
-0@@ -1532,6 +1532,16 @@ Note that if **watchdog** option is alsospecified vpmu will be turned off.
Quoted 2 lines
docs/misc/xen-command-line.markdown +0
-0As the virtualisation is not 100% safe, don't use the vpmu flagon production systems (see http://xenbits.xen.org/xsa/advisory-
163.html)!
Quoted 17 lines
Quoted 17 lines
Quoted 13 lines
docs/misc/xen-command-line.markdown Note that if **watchdog** option is also specified vpmu will be turned off.
Quoted 10 lines
docs/misc/xen-command-line.markdown +9
-0+### vtd\_qi\_timeout (VT-d) +> `= <integer>` + +> Default: `1` + +Specify the timeout of the VT-d Queued Invalidation in milliseconds. + +By default, the timeout is 1ms. When you see error 'Queue +invalidate wait descriptor timed out', try increasing this value.So when someone enables ATS, will the 1ms timeout apply to the dev iotlb invalidations too?
Yes,
The timeout is the same for IOTLB, Context, IEC and Device-TLB invalidation.Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
If so, that's surely too short, and would ideally be adjusted automatically, but the need for a higher timeout in that case should in any event be mentioned here.
I can try to use 1ms for IOTLB, Context and IEC invalidation. As mentioned, 1 ms is enough for IOTLB, Context and IEC invalidation. What about 10 ms for Device-TLB (10 ms is just a higher timeout, no
specific meaning)?
Quoted 7 lines
I remember in earlier discussion we agreed to use 1ms as the default for both IOMMU-side and device-side flushes. For device-side flushes, we checked internal HW team that 1ms is a reasonable threshold for integrated devices. It's likely insufficient for discrete devices. We may check any automatic adjustment method later when it becomes a real problem. For now, please elaborate above information in the text.
Quoted 7 lines
Quoted 5 lines
Well, taking care of automation later is fine with me,
but tying everything to a
single timeout, when device iotlb invalidation may require a much larger value, isn't.A little bit confused. Check it -- could I leave patch 1/3 as is?
The patch can imo remain as is only if the new default timeout is large enough for all possible cases (including those users who are adventurous enough to turn on ATS).
Quoted 1 line
btw, I have tested it against the last commit, no conflict.
No idea what you mean to say with this.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v10 1/3] vt-d: add a timeout parameter for Queued Invalidation
Quoted 59 lines
From: Jan Beulich [mailto:[email protected]]
Sent: Wednesday, May 18, 2016 11:05 PMQuoted 48 lines
Quoted 1 line
Quoted 1 line · On 18.05.16 at 14:53, <[email protected]> wrote:
Quoted 46 lines · Jan Beulich
Quoted 4 lines
Quoted 4 lines
Quoted 1 line · On 17.05.16 at 05:19, <[email protected]> wrote:
From: Xu, Quan
Sent: Monday, May 16, 2016 11:26 PMQuoted 8 lines
Quoted 8 lines · Jan Beulich
Quoted 7 lines
docs/misc/xen-command-line.markdown Note that if **watchdog** option is also
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 22.04.16 at 12:54, <[email protected]> wrote:
docs/misc/xen-command-line.markdown +0
-0@@ -1532,6 +1532,16 @@ Note that if **watchdog** option is alsospecified vpmu will be turned off.
Quoted 2 lines
docs/misc/xen-command-line.markdown +0
-0As the virtualisation is not 100% safe, don't use the vpmu flagon production systems (see http://xenbits.xen.org/xsa/advisory-
163.html)!
Quoted 17 lines
Quoted 17 lines
Quoted 13 lines
docs/misc/xen-command-line.markdown
Quoted 10 lines
docs/misc/xen-command-line.markdown +9
-0+### vtd\_qi\_timeout (VT-d) +> `= <integer>` + +> Default: `1` + +Specify the timeout of the VT-d Queued Invalidation in milliseconds. + +By default, the timeout is 1ms. When you see error 'Queue +invalidate wait descriptor timed out', try increasing this value.So when someone enables ATS, will the 1ms timeout apply to the dev iotlb invalidations too?
Yes,
The timeout is the same for IOTLB, Context, IEC and Device-TLB invalidation.Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
If so, that's surely too short, and would ideally be adjusted automatically, but the need for a higher timeout in that case should in any event be mentioned here.
I can try to use 1ms for IOTLB, Context and IEC invalidation. As mentioned, 1 ms is enough for IOTLB, Context and IEC invalidation. What about 10 ms for Device-TLB (10 ms is just a higher timeout, no
specific meaning)?
Quoted 7 lines
I remember in earlier discussion we agreed to use 1ms as the default for both IOMMU-side and device-side flushes. For device-side flushes, we checked internal HW team that 1ms is a reasonable threshold for integrated devices. It's likely insufficient for discrete devices. We may check any automatic adjustment method later when it becomes a real problem. For now, please elaborate above information in the text.
Quoted 7 lines
Quoted 5 lines
Well, taking care of automation later is fine with me,
but tying everything to a
single timeout, when device iotlb invalidation may require a much larger value, isn't.A little bit confused. Check it -- could I leave patch 1/3 as is?
Quoted 8 lines
The patch can imo remain as is only if the new default timeout is large enough for all possible cases (including those users who are adventurous enough to turn on ATS).
Quoted 1 line
btw, I have tested it against the last commit, no conflict.
No idea what you mean to say with this.
A single default value for both IOMMU-side and device-side is anyway not optimal. What about introducing a new knob e.g. vtd_qi_device_timeout specifically for device-side flush while using vtd_qi_timeout for other places? If device-side timeout is not specified, it is then default to vtd_qi_timeout.
Thanks
Kevin
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v10 1/3] vt-d: add a timeout parameter for Queued Invalidation
Quoted 49 lines · Kevin
Quoted 19 lines
From: Jan Beulich [mailto:[email protected]]
Sent: Wednesday, May 18, 2016 11:05 PMQuoted 16 lines
Quoted 1 line
Quoted 1 line · On 18.05.16 at 14:53, <[email protected]> wrote:
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 14 lines
Quoted 1 line · On 17.05.16 at 05:19, <[email protected]> wrote:
From: Xu, Quan
Sent: Monday, May 16, 2016 11:26 PMQuoted 9 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 22.04.16 at 12:54, <[email protected]> wrote:
docs/misc/xen-command-line.markdown +0
-0@@ -1532,6 +1532,16 @@ Note that if **watchdog** option isalso
specified vpmu will be turned off.
Quoted 3 lines
As the virtualisation is not 100% safe, don't use the vpmu
flag on production systems (see
http://xenbits.xen.org/xsa/advisory-Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
163.html)!
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
docs/misc/xen-command-line.markdown
Quoted 7 lines
docs/misc/xen-command-line.markdown +6
-0+### vtd\_qi\_timeout (VT-d) +> `= <integer>` + +> Default: `1` + +Specify the timeout of the VT-d Queued Invalidation inmilliseconds.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 6 lines
docs/misc/xen-command-line.markdown
Quoted 3 lines
docs/misc/xen-command-line.markdown +3
-0+ +By default, the timeout is 1ms. When you see error 'Queue +invalidate wait descriptor timed out', try increasing this value.So when someone enables ATS, will the 1ms timeout apply to the dev iotlb invalidations too?
Yes,
The timeout is the same for IOTLB, Context, IEC and Device-TLBinvalidation.
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 9 lines
Quoted 9 lines
Quoted 4 lines
If so, that's surely too short, and would ideally be adjusted automatically, but the need for a higher timeout in that case should in any event be mentioned here.
I can try to use 1ms for IOTLB, Context and IEC invalidation. As mentioned, 1 ms is enough for IOTLB, Context and IEC invalidation. What about 10 ms for Device-TLB (10 ms is just a higher timeout, no
specific meaning)?
Quoted 1 line
Quoted 19 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
I remember in earlier discussion we agreed to use 1ms as the default for both IOMMU-side and device-side flushes. For device-side flushes, we checked internal HW team that 1ms is a reasonable threshold for integrated devices. It's likely insufficient for discrete devices. We may check any automatic adjustment method later when it becomes a real problem. For now,
please elaborate above information in the text.
Quoted 12 lines
Quoted 7 lines
Quoted 5 lines
Well, taking care of automation later is fine with me, but tying everything to a single timeout, when device iotlb invalidation may require a much larger value, isn't.
A little bit confused. Check it -- could I leave patch 1/3 as is?
The patch can imo remain as is only if the new default timeout is large enough for all possible cases (including those users who are adventurous enough to turn on ATS).
Jan,
I only have an ATS device (MYRICOM Inc. Myri-10G Dual-Protocol NIC). 1 ms is large enough for invalidation so far. Any suggestion for this new default timeout?
Quoted 5 lines
A single default value for both IOMMU-side and device-side is anyway not optimal. What about introducing a new knob e.g.
vtd_qi_device_timeoutspecifically for device-side flush while usingvtd_qi_timeoutfor other places? If device-side timeout is not specified, it is then default tovtd_qi_timeout.
IMO, we are better to introduce only one variable for VT-d invalidation.
The users may be not interested in such a detailed VT-d knowledge. Also this is taking into consideration of consistency. :)
Quan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v10 1/3] vt-d: add a timeout parameter for Queued Invalidation
Quoted 11 lines
Quoted 1 line
Quoted 1 line
"Xu, Quan" <[email protected]> 05/19/16 3:35 AM >>>
Quoted 6 lines · Kevin
Quoted 6 lines
From: Jan Beulich [mailto:[email protected]]
Sent: Wednesday, May 18, 2016 11:05 PMQuoted 1 line
Quoted 1 line
Quoted 1 line · On 18.05.16 at 14:53, <[email protected]> wrote:
The patch can imo remain as is only if the new default timeout is large enough for all possible cases (including those users who are adventurous enough to turn on ATS).
I only have an ATS device (MYRICOM Inc. Myri-10G Dual-Protocol NIC). 1 ms is large enough for invalidation so far. Any suggestion for this new default timeout?
Unless you have theoretical proof that a lower than the current value would suffice (as you do for the IOMMU side flushes), I think the default needs to remain the same as it is right now (which iirc is already _much_ lower than the real theoretical one).
Quoted 4 lines
Quoted 4 lines
A single default value for both IOMMU-side and device-side is anyway not optimal. What about introducing a new knob e.g.
vtd_qi_device_timeoutspecifically for device-side flush while usingvtd_qi_timeoutfor other places? If device-side timeout is not specified, it is then default tovtd_qi_timeout.
There should imo be a single command line option, allowing for two values to be passed (e.g. comma-separated).
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v10 1/3] vt-d: add a timeout parameter for Queued Invalidation
Quoted 11 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line
"Xu, Quan" <[email protected]> 05/19/16 3:35 AM >>>
Quoted 4 lines · Kevin
A single default value for both IOMMU-side and device-side is anyway not optimal. What about introducing a new knob e.g.
vtd_qi_device_timeoutspecifically for device-side flush while usingvtd_qi_timeoutfor other places? If device-side timeout is not specified, it isthen default to
vtd_qi_timeout.There should imo be a single command line option, allowing for two values to be passed (e.g. comma-separated).
As mentioned, 1 ms is enough for VT-d IOTLB/Context/IEC invalidation, so we are no need to increasing the value of timeout or introduce a boot-time changed parameter. What about a constant (e.g. a macro), 1 ms, for VT-d IOTLB/Context/IEC invalidation timeout.
For Device-TLB invalidation, we can introduce 'vtd_qi_device_timeout', which is boot-time changed, and 1 ms by default.
Quan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v10 1/3] vt-d: add a timeout parameter for Queued Invalidation
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 19.05.16 at 13:26, <[email protected]> wrote:
Quoted 8 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line
"Xu, Quan" <[email protected]> 05/19/16 3:35 AM >>>
Quoted 4 lines · Kevin
A single default value for both IOMMU-side and device-side is anyway not optimal. What about introducing a new knob e.g.
vtd_qi_device_timeoutspecifically for device-side flush while usingvtd_qi_timeoutfor other places? If device-side timeout is not specified, it isthen default to
vtd_qi_timeout.
Quoted 8 lines
Quoted 2 lines
There should imo be a single command line option, allowing for two values to be passed (e.g. comma-separated).
As mentioned, 1 ms is enough for VT-d IOTLB/Context/IEC invalidation, so we are no need to increasing the value of timeout or introduce a boot-time changed parameter.
What about a constant (e.g. a macro), 1 ms, for VT-d IOTLB/Context/IEC invalidation timeout.
If you're absolutely certain no-one will ever find a need to increase that value - sure.
Quoted 2 lines
For Device-TLB invalidation, we can introduce '
vtd_qi_device_timeout', which is boot-time changed, and 1 ms by default.
One question is whether making this a VT-d specific command line option is a good idea: Other IOMMU implementations ought to be in need of doing device IOTLB invalidation too, at least sooner or later.
The other question is whether any timeout lower than the current one can be considered safe (and hence is usable as a default).
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v10 1/3] vt-d: add a timeout parameter for Queued Invalidation
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 19.05.16 at 13:26, <[email protected]> wrote:
Quoted 11 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line
"Xu, Quan" <[email protected]> 05/19/16 3:35 AM >>>
Quoted 5 lines · Kevin
A single default value for both IOMMU-side and device-side is anyway not optimal. What about introducing a new knob e.g.
vtd_qi_device_timeoutspecifically for device-side flush while usingvtd_qi_timeoutfor other places? If device-side timeout is not specified, it isthen default to
vtd_qi_timeout.There should imo be a single command line option, allowing for two values to be passed (e.g. comma-separated).
Quoted 9 lines
Quoted 5 lines
As mentioned, 1 ms is enough for VT-d IOTLB/Context/IEC invalidation, so we are no need to increasing the value of timeout or introduce a boot-time changed parameter.
What about a constant (e.g. a macro), 1 ms, for VT-d IOTLB/Context/IEC invalidation timeout.If you're absolutely certain no-one will ever find a need to increase that value - sure.
Sure.
Also this was mentioned in Kevin's ' Revisit VT-d asynchronous flush issue ' , http://lists.xenproject.org/archives/html/xen-devel/2015-11/msg00041.html
"""-For context/iotlb/iec flush, our measurements show worst cases <10us. We also confirmed with hardware team, that 1ms is large enough for IOMMU internal flush. """
Quoted 7 lines
Quoted 2 lines
For Device-TLB invalidation, we can introduce '
vtd_qi_device_timeout', which is boot-time changed, and 1 ms by default.One question is whether making this a VT-d specific command line option is a good idea: Other IOMMU implementations ought to be in need of doing device IOTLB invalidation too, at least sooner or later.
This is indeed farsighted. Agreed.
Quoted 3 lines
The other question is whether any timeout lower than the current one can be considered safe (and hence is usable as a default).
Actually the criticality, 1 ms, is from hardware team.
IOW, Our hardware team confirmed that 1ms should be enough for integrated PCI devices with ATS.
for discrete PCI devices with ATS, it's uncertain whether 1ms or 10ms is too restrictive to them, but there are only a few devices now in the market.
Quan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH v10 2/3 vt-d: synchronize for Device-TLB flush one by one
In reply to Quan XuToday we do Device-TLB flush synchronization after issuing flush requests for all ATS devices belonging to a VM. Doing so however imposes a limitation, i.e. that we can not figure out which flush request is blocked in the flush queue list, based on VT-d spec.
To prepare correct Device-TLB flush timeout handling in next patch, we change the behavior to synchronize for every Device-TLB flush request. So the Device-TLB flush interface is changed a little bit, by checking timeout within the function instead of outside of function.
Accordingly we also do a similar change for flush interfaces of IOTLB/IEC/Context, i.e. moving synchronization into the function. Since there is no user of a non-synced interface, we just rename existing ones with _sync suffix.
--- xen/drivers/passthrough/vtd/extern.h | 5 +-- xen/drivers/passthrough/vtd/qinval.c | 61 +++++++++++++++++++++-------------- xen/drivers/passthrough/vtd/x86/ats.c | 8 ++--- 3 files changed, 43 insertions(+), 31 deletions(-)
xen/drivers/passthrough/vtd/extern.h +3 -2
@@ -59,8 +59,9 @@ int ats_device(const struct pci_dev *, const struct acpi_drhd_unit *);int dev_invalidate_iotlb (struct iommu *iommu,u16 did,u64 addr,unsigned int size_order,u64 type); -int qinval_device_iotlb (struct iommu *iommu, -u32 max_invs_pend,u16 sid,u16 size,u64 addr); +int __must_check qinval_device_iotlb_sync (struct iommu *iommu, +u32 max_invs_pend, +u16 sid,u16 size,u64 addr);unsigned int get_cache_line_size (void );void cacheline_flush (char *);
xen/drivers/passthrough/vtd/qinval.c +36 -25
139 lines not on this page · raw message
xen/drivers/passthrough/vtd/x86/ats.c +4 -4
@@ -134,8 +134,8 @@ int dev_invalidate_iotlb(struct iommu *iommu, u16 did,/* invalidate all translations: sbit=1,bit_63=0,bit[62:12]=1 */ sbit =1 ; addr = (~0UL <<PAGE_SHIFT_4K ) &0x7FFFFFFFFFFFFFFF ; - rc =qinval_device_iotlb (iommu, pdev->ats_queue_depth, - sid, sbit, addr); + rc =qinval_device_iotlb_sync (iommu, pdev->ats_queue_depth, + sid, sbit, addr);break ;case DMA_TLB_PSI_FLUSH :if ( !device_in_domain (iommu, pdev, did) )
@@ -154,8 +154,8 @@ int dev_invalidate_iotlb(struct iommu *iommu, u16 did, addr |= (((u64 )1 << (size_order -1 )) -1 ) <<PAGE_SHIFT_4K ; } - rc =qinval_device_iotlb (iommu, pdev->ats_queue_depth, - sid, sbit, addr); + rc =qinval_device_iotlb_sync (iommu, pdev->ats_queue_depth, + sid, sbit, addr);break ;default : dprintk(XENLOG_WARNING VTDPREFIX, "invalid vt-d flush type\n");
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH v10 2/3] vt-d: synchronize for Device-TLB flush one by one
xen/drivers/passthrough/vtd/qinval.c integer_param("vtd_qi_timeout", vtd_qi_timeout); · line 36
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 22.04.16 at 12:54, <[email protected]> wrote:
xen/drivers/passthrough/vtd/qinval.c +1
-0@@ -33,6 +33,8 @@ integer_param("vtd_qi_timeout", vtd_qi_timeout);#define IOMMU_QI_TIMEOUT (vtd_qi_timeout * MILLISECS(1)) +static int invalidate_sync (struct iommu *iommu);
__must_check?
Quoted 10 lines
xen/drivers/passthrough/vtd/qinval.c +4
-2-static void queue_invalidate_iotlb (struct iommu *iommu, -u8 granu,u8 dr,u8 dw,u16 did,u8 am,u8 ih,u64 addr) +static int __must_check queue_invalidate_iotlb_sync (struct iommu *iommu, +u8 granu,u8 dr,u8 dw, +u16 did,u8 am,u8 ih, +u64 addr) {unsigned long flags;unsigned int index;
xen/drivers/passthrough/vtd/qinval.c static void queue_invalidate_iotlb(struct iommu *iommu, · line 146
Quoted 6 lines
xen/drivers/passthrough/vtd/qinval.c +2
-0@@ -133,10 +141,12 @@ static void queue_invalidate_iotlb(struct iommu *iommu,unmap_vtd_domain_page (qinval_entries);qinval_update_qtail (iommu, index);spin_unlock_irqrestore (&iommu->register_lock, flags); + +return invalidate_sync (iommu); }
With this, ...
Quoted 7 lines
xen/drivers/passthrough/vtd/qinval.c +0
-3@@ -346,9 +353,13 @@ static int flush_iotlb_qi(if (cap_read_drain (iommu->cap)) dr =1 ;/* Need to conside the ih bit later */ -queue_invalidate_iotlb (iommu, - type >>DMA_TLB_FLUSH_GRANU_OFFSET , dr, - dw, did, size_order,0 , addr);
xen/drivers/passthrough/vtd/qinval.c static int flush_iotlb_qi( · line 365
Quoted 10 lines
xen/drivers/passthrough/vtd/qinval.c +7
-0+ ret =queue_invalidate_iotlb_sync (iommu, + type >>DMA_TLB_FLUSH_GRANU_OFFSET , + dr, dw, did, size_order,0 , addr); + +if ( ret ) +return ret; +if ( flush_dev_iotlb ) ret =dev_invalidate_iotlb (iommu, did, addr, size_order, type); rc =invalidate_sync (iommu);
... why does this invalidate_sync() not go away?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v10 2/3] vt-d: synchronize for Device-TLB flush one by one
Quoted 11 lines · Jan Beulich
xen/drivers/passthrough/vtd/qinval.c integer_param("vtd_qi_timeout", vtd_qi_timeout); · line 36
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 22.04.16 at 12:54, <[email protected]> wrote:
xen/drivers/passthrough/vtd/qinval.c +1
-0@@ -33,6 +33,8 @@ integer_param("vtd_qi_timeout", vtd_qi_timeout);#define IOMMU_QI_TIMEOUT (vtd_qi_timeout * MILLISECS(1)) +static int invalidate_sync (struct iommu *iommu);
__must_check?
Yes, I will add it.
Quoted 32 lines
xen/drivers/passthrough/vtd/qinval.c static void queue_invalidate_context(struct iommu *iommu,
Quoted 3 lines
xen/drivers/passthrough/vtd/qinval.c +1
-2-static void queue_invalidate_iotlb (struct iommu *iommu, -u8 granu,u8 dr,u8 dw,u16 did,u8 am,u8 ih,u64 addr) +static int __must_check queue_invalidate_iotlb_sync(struct iommu*iommu,
xen/drivers/passthrough/vtd/qinval.c static void queue_invalidate_iotlb(struct iommu
Quoted 7 lines
xen/drivers/passthrough/vtd/qinval.c +3
-0+ u8 granu, u8 dr, u8 dw, + u16 did, u8 am, u8 ih, + u64 addr) { unsigned long flags;unsigned int index;@@ -133,10 +141,12 @@ static void queue_invalidate_iotlb(struct iommu*iommu,
xen/drivers/passthrough/vtd/qinval.c static void queue_invalidate_iotlb(struct iommu *iommu, · line 146
Quoted 6 lines
xen/drivers/passthrough/vtd/qinval.c +2
-0unmap_vtd_domain_page (qinval_entries);qinval_update_qtail (iommu, index);spin_unlock_irqrestore (&iommu->register_lock, flags); + +return invalidate_sync (iommu); }With this, ...
Quoted 11 lines
xen/drivers/passthrough/vtd/qinval.c +4
-3@@ -346,9 +353,13 @@ static int flush_iotlb_qi(if (cap_read_drain (iommu->cap)) dr =1 ;/* Need to conside the ih bit later */ -queue_invalidate_iotlb (iommu, - type >>DMA_TLB_FLUSH_GRANU_OFFSET , dr, - dw, did, size_order,0 , addr); + ret =queue_invalidate_iotlb_sync (iommu, + type >>DMA_TLB_FLUSH_GRANU_OFFSET , + dr, dw, did, size_order,0 , addr); +
Quoted 9 lines
xen/drivers/passthrough/vtd/qinval.c static int flush_iotlb_qi( · line 365
Quoted 6 lines
xen/drivers/passthrough/vtd/qinval.c +3
-0+if ( ret ) +return ret; +if ( flush_dev_iotlb ) ret =dev_invalidate_iotlb (iommu, did, addr, size_order, type); rc =invalidate_sync (iommu);... why does this
invalidate_sync()not go away?
Oh, it is your suggestion -- leaving the existing logic as is would be better - best effort invalidation even when an error has occurred.
http://lists.xenproject.org/archives/html/xen-devel/2016-04/msg00523.html
Quan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v10 2/3] vt-d: synchronize for Device-TLB flush one by one
Quoted 45 lines
Quoted 1 line
Quoted 1 line · On 18.05.16 at 10:53, <[email protected]> wrote:
Quoted 33 lines · Jan Beulich
xen/drivers/passthrough/vtd/qinval.c static void queue_invalidate_context(struct iommu *iommu,
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 22.04.16 at 12:54, <[email protected]> wrote:
xen/drivers/passthrough/vtd/qinval.c +1
-2-static void queue_invalidate_iotlb (struct iommu *iommu, -u8 granu,u8 dr,u8 dw,u16 did,u8 am,u8 ih,u64 addr) +static int __must_check queue_invalidate_iotlb_sync(struct iommu*iommu,
xen/drivers/passthrough/vtd/qinval.c static void queue_invalidate_iotlb(struct iommu
Quoted 7 lines
xen/drivers/passthrough/vtd/qinval.c +3
-0+ u8 granu, u8 dr, u8 dw, + u16 did, u8 am, u8 ih, + u64 addr) { unsigned long flags;unsigned int index;@@ -133,10 +141,12 @@ static void queue_invalidate_iotlb(struct iommu*iommu,
xen/drivers/passthrough/vtd/qinval.c static void queue_invalidate_iotlb(struct iommu *iommu, · line 146
Quoted 6 lines
xen/drivers/passthrough/vtd/qinval.c +2
-0unmap_vtd_domain_page (qinval_entries);qinval_update_qtail (iommu, index);spin_unlock_irqrestore (&iommu->register_lock, flags); + +return invalidate_sync (iommu); }With this, ...
Quoted 11 lines
xen/drivers/passthrough/vtd/qinval.c +4
-3@@ -346,9 +353,13 @@ static int flush_iotlb_qi(if (cap_read_drain (iommu->cap)) dr =1 ;/* Need to conside the ih bit later */ -queue_invalidate_iotlb (iommu, - type >>DMA_TLB_FLUSH_GRANU_OFFSET , dr, - dw, did, size_order,0 , addr); + ret =queue_invalidate_iotlb_sync (iommu, + type >>DMA_TLB_FLUSH_GRANU_OFFSET , + dr, dw, did, size_order,0 , addr); +Quoted 9 lines
xen/drivers/passthrough/vtd/qinval.c static int flush_iotlb_qi( · line 365
Quoted 6 lines
xen/drivers/passthrough/vtd/qinval.c +3
-0+if ( ret ) +return ret; +if ( flush_dev_iotlb ) ret =dev_invalidate_iotlb (iommu, did, addr, size_order, type); rc =invalidate_sync (iommu);... why does this
invalidate_sync()not go away?
Quoted 4 lines
Oh, it is your suggestion -- leaving the existing logic as is would be better - best effort invalidation even when an error has occurred.
http://lists.xenproject.org/archives/html/xen-devel/2016-04/msg00523.html
Look like this was a bad comment of mine (resulting from dev_invalidate_iotlb(), other than the other respective functions, not getting a _sync tag added), and I would have appreciated if you had simply pointed out the redundancy. Please remember that the review process is bi-directional, and hence doesn't mean you need to blindly do everything a reviewer asks for: Things you agree with should be changed in code. For things you don't agree with you should reply verbally, explaining why a requested change shouldn't be done.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v10 2/3] vt-d: synchronize for Device-TLB flush one by one
Quoted 50 lines · Jan Beulich
Quoted 50 lines
Quoted 1 line
Quoted 1 line · On 18.05.16 at 10:53, <[email protected]> wrote:
Quoted 35 lines · Jan Beulich
xen/drivers/passthrough/vtd/qinval.c static void queue_invalidate_context(struct iommu *iommu,
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 22.04.16 at 12:54, <[email protected]> wrote:
xen/drivers/passthrough/vtd/qinval.c +1
-2-static void queue_invalidate_iotlb (struct iommu *iommu, -u8 granu,u8 dr,u8 dw,u16 did,u8 am,u8 ih,u64 addr) +static int __must_check queue_invalidate_iotlb_sync(struct iommu*iommu,
Quoted 8 lines
xen/drivers/passthrough/vtd/qinval.c +3
-0+ u8 granu, u8 dr, u8 dw, + u16 did, u8 am, u8 ih, + u64 addr) { unsigned long flags;unsigned int index;@@ -133,10 +141,12 @@ static void queue_invalidate_iotlb(structiommu
*iommu,
xen/drivers/passthrough/vtd/qinval.c static void queue_invalidate_context(struct iommu *iommu, · line 109
Quoted 6 lines
unmap_vtd_domain_page(qinval_entries); qinval_update_qtail(iommu, index); spin_unlock_irqrestore(&iommu->register_lock, flags);xen/drivers/passthrough/vtd/qinval.c +2
-0+ +return invalidate_sync (iommu); }With this, ...
Quoted 12 lines
xen/drivers/passthrough/vtd/qinval.c +5
-3@@ -346,9 +353,13 @@ static int flush_iotlb_qi(if (cap_read_drain (iommu->cap)) dr =1 ;/* Need to conside the ih bit later */ -queue_invalidate_iotlb (iommu, - type >>DMA_TLB_FLUSH_GRANU_OFFSET , dr, - dw, did, size_order,0 , addr); + ret =queue_invalidate_iotlb_sync (iommu, + type >>DMA_TLB_FLUSH_GRANU_OFFSET , + dr, dw, did, size_order, +0 , addr); +Quoted 9 lines
xen/drivers/passthrough/vtd/qinval.c static int flush_iotlb_qi( · line 365
Quoted 6 lines
xen/drivers/passthrough/vtd/qinval.c +3
-0+if ( ret ) +return ret; +if ( flush_dev_iotlb ) ret =dev_invalidate_iotlb (iommu, did, addr, size_order, type); rc =invalidate_sync (iommu);... why does this
invalidate_sync()not go away?Oh, it is your suggestion -- leaving the existing logic as is would be better - best effort invalidation even when an error has occurred.
Quoted 7 lines
Look like this was a bad comment of mine (resulting from
dev_invalidate_iotlb(), other than the other respective functions, not getting a_synctag added), and I would have appreciated if you had simply pointed out the redundancy.
I just issued an open for this point in v9 discussion. I felt a strange, but really didn't have obvious reasons at that time. --
I'll drop this invalidate_sync() in v11.
Quoted 6 lines
Please remember that the review process is bi-directional,
and hence doesn't mean you need to blindly do everything a reviewer asks for:
Things you agree with should be changed in code. For things you don't agree with you should reply verbally, explaining why a requested change shouldn't be done.
Thanks. I will try to follow it.
Quan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH v10 3/3 vt-d: fix vt-d Device-TLB flush timeout issue
In reply to Quan XuIf Device-TLB flush timed out, we hide the target ATS device immediately and crash the domain owning this ATS device. If impacted domain is hardware domain, just throw out a warning.
By hiding the device, we make sure it can't be assigned to any domain any longer (see device_assigned).
--- xen/drivers/passthrough/pci.c | 6 +-- xen/drivers/passthrough/vtd/extern.h | 5 ++- xen/drivers/passthrough/vtd/qinval.c | 71 ++++++++++++++++++++++++++++++++--- xen/drivers/passthrough/vtd/x86/ats.c | 11 +++--- xen/include/xen/pci.h | 1 + 5 files changed, 79 insertions(+), 15 deletions(-)
xen/drivers/passthrough/pci.c +3 -3
@@ -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 ; }
xen/drivers/passthrough/vtd/extern.h +3 -2
@@ -60,8 +60,9 @@ int dev_invalidate_iotlb(struct iommu *iommu, u16 did, u64 addr, unsigned int size_order, u64 type);int __must_check qinval_device_iotlb_sync (struct iommu *iommu, -u32 max_invs_pend, -u16 sid,u16 size,u64 addr); +u32 max_invs_pend,u16 did, +u16 seg,u8 bus,u8 devfn, +u16 size,u64 addr);unsigned int get_cache_line_size (void );void cacheline_flush (char *);
xen/drivers/passthrough/vtd/qinval.c +66 -5
90 lines not on this page · raw message
xen/drivers/passthrough/vtd/x86/ats.c +6 -5
@@ -116,7 +116,6 @@ int dev_invalidate_iotlb(struct iommu *iommu, u16 did,list_for_each_entry ( pdev, &ats_devices, list ) { -u16 sid =PCI_BDF2 (pdev->bus, pdev->devfn);bool_t sbit;int rc =0 ;
@@ -134,8 +133,9 @@ int dev_invalidate_iotlb(struct iommu *iommu, u16 did,/* invalidate all translations: sbit=1,bit_63=0,bit[62:12]=1 */ sbit =1 ; addr = (~0UL <<PAGE_SHIFT_4K ) &0x7FFFFFFFFFFFFFFF ; - rc =qinval_device_iotlb_sync (iommu, pdev->ats_queue_depth, - sid, sbit, addr); + rc =qinval_device_iotlb_sync (iommu, pdev->ats_queue_depth, did, + pdev->seg, pdev->bus, pdev->devfn, + sbit, addr);break ;case DMA_TLB_PSI_FLUSH :if ( !device_in_domain (iommu, pdev, did) )
@@ -154,8 +154,9 @@ int dev_invalidate_iotlb(struct iommu *iommu, u16 did, addr |= (((u64 )1 << (size_order -1 )) -1 ) <<PAGE_SHIFT_4K ; } - rc =qinval_device_iotlb_sync (iommu, pdev->ats_queue_depth, - sid, sbit, addr); + rc =qinval_device_iotlb_sync (iommu, pdev->ats_queue_depth, did, + pdev->seg, pdev->bus, pdev->devfn, + sbit, addr);break ;default : dprintk(XENLOG_WARNING VTDPREFIX, "invalid vt-d flush type\n");
xen/include/xen/pci.h +1 -0
@@ -118,6 +118,7 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn,int pci_remove_device (u16 seg,u8 bus,u8 devfn);int pci_ro_device (int seg,int bus,int devfn);int pci_hide_device (int bus,int devfn); +void pci_hide_existing_device (struct pci_dev *pdev);struct pci_dev *pci_get_pdev (int seg,int bus,int devfn);struct pci_dev *pci_get_real_pdev (int seg,int bus,int devfn); struct pci_dev *pci_get_pdev_by_domain(
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH v10 3/3] vt-d: fix vt-d Device-TLB flush timeout issue
Quoted 28 lines
Quoted 1 line
Quoted 1 line · On 22.04.16 at 12:54, <[email protected]> wrote:
xen/drivers/passthrough/vtd/qinval.c +21
-0@@ -206,10 +206,71 @@ static int invalidate_sync(struct iommu *iommu)return 0 ; } +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]); + +/* +* In case the domain has been freed or the IOMMU domid bitmap is +* not valid, the device no longer belongs to this domain. +*/ +if ( d ==NULL ) +return ; + +pcidevs_lock (); + +for_each_pdev (d, pdev) + { + if ( (pdev->seg == seg) &&
xen/drivers/passthrough/vtd/qinval.c static int invalidate_sync(struct iommu *iommu) · line 239
Quoted 10 lines
xen/drivers/passthrough/vtd/qinval.c +10
-0+ (pdev->bus == bus) && + (pdev->devfn == devfn) ) + { +ASSERT (pdev->domain); +list_del (&pdev->domain_list); + pdev->domain =NULL ; +pci_hide_existing_device (pdev); +break ; + } + }
A loop like this is of course not ideal (especially for Dom0, which may have many devices). And I wonder why you, ...
Quoted 13 lines
xen/drivers/passthrough/vtd/qinval.c +3
-2@@ -134,8 +133,9 @@ int dev_invalidate_iotlb(struct iommu *iommu, u16 did,/* invalidate all translations: sbit=1,bit_63=0,bit[62:12]=1 */ sbit =1 ; addr = (~0UL <<PAGE_SHIFT_4K ) &0x7FFFFFFFFFFFFFFF ; - rc =qinval_device_iotlb_sync (iommu, pdev->ats_queue_depth, - sid, sbit, addr); + rc =qinval_device_iotlb_sync (iommu, pdev->ats_queue_depth, did, + pdev->seg, pdev->bus, pdev->devfn, + sbit, addr);break ;case DMA_TLB_PSI_FLUSH :if ( !device_in_domain (iommu, pdev, did) )
xen/drivers/passthrough/vtd/qinval.c int dev_invalidate_iotlb(struct iommu *iommu, u16 did, · line 160
Quoted 9 lines
xen/drivers/passthrough/vtd/qinval.c +3
-2@@ -154,8 +154,9 @@ int dev_invalidate_iotlb(struct iommu *iommu, u16 did, addr |= (((u64 )1 << (size_order -1 )) -1 ) <<PAGE_SHIFT_4K ; } - rc =qinval_device_iotlb_sync (iommu, pdev->ats_queue_depth, - sid, sbit, addr); + rc =qinval_device_iotlb_sync (iommu, pdev->ats_queue_depth, did, + pdev->seg, pdev->bus, pdev->devfn, + sbit, addr);break ;
... holding pdev in your hands here, don't just pass it down (which at once would make the function signature less convoluted: you could even eliminate the currently 2nd parameter that way).
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v10 3/3] vt-d: fix vt-d Device-TLB flush timeout issue
Quoted 65 lines · Jan Beulich
Quoted 27 lines
Quoted 1 line
Quoted 1 line · On 22.04.16 at 12:54, <[email protected]> wrote:
xen/drivers/passthrough/vtd/qinval.c +20
-0@@ -206,10 +206,71 @@ static int invalidate_sync(struct iommu *iommu)return 0 ; } +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]); + +/* +* In case the domain has been freed or the IOMMU domid bitmap is +* not valid, the device no longer belongs to this domain. +*/ +if ( d ==NULL ) +return ; + +pcidevs_lock (); + +for_each_pdev (d, pdev) + { + if ( (pdev->seg == seg) &&xen/drivers/passthrough/vtd/qinval.c static int invalidate_sync(struct iommu *iommu) · line 238
Quoted 10 lines
xen/drivers/passthrough/vtd/qinval.c +10
-0+ (pdev->bus == bus) && + (pdev->devfn == devfn) ) + { +ASSERT (pdev->domain); +list_del (&pdev->domain_list); + pdev->domain =NULL ; +pci_hide_existing_device (pdev); +break ; + } + }A loop like this is of course not ideal (especially for Dom0, which may have many devices). And I wonder why you, ...
xen/drivers/passthrough/vtd/qinval.c int dev_invalidate_iotlb(struct iommu *iommu, u16
Quoted 1 line
xen/drivers/passthrough/vtd/qinval.c +0
-0@@ -134,8 +133,9 @@ int dev_invalidate_iotlb(struct iommu *iommu, u16did,
Quoted 11 lines
xen/drivers/passthrough/vtd/qinval.c +3
-2/* invalidate all translations: sbit=1,bit_63=0,bit[62:12]=1 */ sbit =1 ; addr = (~0UL <<PAGE_SHIFT_4K ) &0x7FFFFFFFFFFFFFFF ; - rc =qinval_device_iotlb_sync (iommu, pdev->ats_queue_depth, - sid, sbit, addr); + rc =qinval_device_iotlb_sync (iommu, pdev->ats_queue_depth, did, + pdev->seg, pdev->bus, pdev->devfn, + sbit, addr);break ;case DMA_TLB_PSI_FLUSH : if ( !device_in_domain(iommu, pdev, did) ) @@ -154,8xen/drivers/passthrough/vtd/qinval.c int dev_invalidate_iotlb(struct iommu *iommu, u16
Quoted 10 lines
xen/drivers/passthrough/vtd/qinval.c +4
-2+154,9 @@ int dev_invalidate_iotlb(struct iommu *iommu, u16 did, addr |= (((u64)1 << (size_order - 1)) - 1) << PAGE_SHIFT_4K; } - rc =qinval_device_iotlb_sync (iommu, pdev->ats_queue_depth, - sid, sbit, addr); + rc =qinval_device_iotlb_sync (iommu, pdev->ats_queue_depth, did, + pdev->seg, pdev->bus, pdev->devfn, + sbit, addr);break ;
Quoted 4 lines
... holding pdev in your hands here, don't just pass it down (which at once would make the function signature less convoluted: you could even eliminate the currently 2nd parameter that way).
Good idea!!
Quan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v10 3/3] vt-d: fix vt-d Device-TLB flush timeout issue
In reply to Jan BeulichQuoted 65 lines · Jan Beulich
Quoted 27 lines
Quoted 1 line
Quoted 1 line · On 22.04.16 at 12:54, <[email protected]> wrote:
xen/drivers/passthrough/vtd/qinval.c +20
-0@@ -206,10 +206,71 @@ static int invalidate_sync(struct iommu *iommu)return 0 ; } +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]); + +/* +* In case the domain has been freed or the IOMMU domid bitmap is +* not valid, the device no longer belongs to this domain. +*/ +if ( d ==NULL ) +return ; + +pcidevs_lock (); + +for_each_pdev (d, pdev) + { + if ( (pdev->seg == seg) &&xen/drivers/passthrough/vtd/qinval.c static int invalidate_sync(struct iommu *iommu) · line 238
Quoted 10 lines
xen/drivers/passthrough/vtd/qinval.c +10
-0+ (pdev->bus == bus) && + (pdev->devfn == devfn) ) + { +ASSERT (pdev->domain); +list_del (&pdev->domain_list); + pdev->domain =NULL ; +pci_hide_existing_device (pdev); +break ; + } + }A loop like this is of course not ideal (especially for Dom0, which may have many devices). And I wonder why you, ...
xen/drivers/passthrough/vtd/qinval.c int dev_invalidate_iotlb(struct iommu *iommu, u16
Quoted 1 line
xen/drivers/passthrough/vtd/qinval.c +0
-0@@ -134,8 +133,9 @@ int dev_invalidate_iotlb(struct iommu *iommu, u16did,
Quoted 11 lines
xen/drivers/passthrough/vtd/qinval.c +3
-2/* invalidate all translations: sbit=1,bit_63=0,bit[62:12]=1 */ sbit =1 ; addr = (~0UL <<PAGE_SHIFT_4K ) &0x7FFFFFFFFFFFFFFF ; - rc =qinval_device_iotlb_sync (iommu, pdev->ats_queue_depth, - sid, sbit, addr); + rc =qinval_device_iotlb_sync (iommu, pdev->ats_queue_depth, did, + pdev->seg, pdev->bus, pdev->devfn, + sbit, addr);break ;case DMA_TLB_PSI_FLUSH : if ( !device_in_domain(iommu, pdev, did) ) @@ -154,8xen/drivers/passthrough/vtd/qinval.c int dev_invalidate_iotlb(struct iommu *iommu, u16
Quoted 10 lines
xen/drivers/passthrough/vtd/qinval.c +4
-2+154,9 @@ int dev_invalidate_iotlb(struct iommu *iommu, u16 did, addr |= (((u64)1 << (size_order - 1)) - 1) << PAGE_SHIFT_4K; } - rc =qinval_device_iotlb_sync (iommu, pdev->ats_queue_depth, - sid, sbit, addr); + rc =qinval_device_iotlb_sync (iommu, pdev->ats_queue_depth, did, + pdev->seg, pdev->bus, pdev->devfn, + sbit, addr);break ;
Quoted 4 lines
... holding pdev in your hands here, don't just pass it down (which at once would make the function signature less convoluted: you could even eliminate the currently 2nd parameter that way).
Jan,
I am afraid we need to leave it as is.. this pdev , in dev_invalidate_iotlb(), is 'struct pci_ats_dev',
but we need a 'struct pci_dev' to hide device in dev_invalidate_iotlb_timeout().
'struct pci_ats_dev' and 'struct pci_dev' are quite different, however, SBDF is connection between them..
Quan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v10 3/3] vt-d: fix vt-d Device-TLB flush timeout issue
Quoted 72 lines
Quoted 1 line
Quoted 1 line · On 20.05.16 at 09:15, <[email protected]> wrote:
Quoted 41 lines · Jan Beulich
Quoted 27 lines
Quoted 1 line
Quoted 1 line · On 22.04.16 at 12:54, <[email protected]> wrote:
xen/drivers/passthrough/vtd/qinval.c +20
-0@@ -206,10 +206,71 @@ static int invalidate_sync(struct iommu *iommu)return 0 ; } +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]); + +/* +* In case the domain has been freed or the IOMMU domid bitmap is +* not valid, the device no longer belongs to this domain. +*/ +if ( d ==NULL ) +return ; + +pcidevs_lock (); + +for_each_pdev (d, pdev) + { + if ( (pdev->seg == seg) &&xen/drivers/passthrough/vtd/qinval.c static int invalidate_sync(struct iommu *iommu) · line 238
Quoted 10 lines
xen/drivers/passthrough/vtd/qinval.c +10
-0+ (pdev->bus == bus) && + (pdev->devfn == devfn) ) + { +ASSERT (pdev->domain); +list_del (&pdev->domain_list); + pdev->domain =NULL ; +pci_hide_existing_device (pdev); +break ; + } + }A loop like this is of course not ideal (especially for Dom0, which may have many devices). And I wonder why you, ...
Quoted 3 lines
xen/drivers/passthrough/vtd/qinval.c int dev_invalidate_iotlb(struct iommu *iommu, u16
Quoted 1 line
xen/drivers/passthrough/vtd/qinval.c +0
-0@@ -134,8 +133,9 @@ int dev_invalidate_iotlb(struct iommu *iommu, u16did,
Quoted 1 line
xen/drivers/passthrough/vtd/qinval.c +0
-0/* invalidate all translations: sbit=1,bit_63=0,bit[62:12]=1 */
Quoted 21 lines
Quoted 10 lines
xen/drivers/passthrough/vtd/qinval.c +3
-2sbit =1 ; addr = (~0UL <<PAGE_SHIFT_4K ) &0x7FFFFFFFFFFFFFFF ; - rc =qinval_device_iotlb_sync (iommu, pdev->ats_queue_depth, - sid, sbit, addr); + rc =qinval_device_iotlb_sync (iommu, pdev->ats_queue_depth, did, + pdev->seg, pdev->bus, pdev->devfn, + sbit, addr);break ;case DMA_TLB_PSI_FLUSH : if ( !device_in_domain(iommu, pdev, did) ) @@ -154,8xen/drivers/passthrough/vtd/qinval.c int dev_invalidate_iotlb(struct iommu *iommu, u16
Quoted 10 lines
xen/drivers/passthrough/vtd/qinval.c +4
-2+154,9 @@ int dev_invalidate_iotlb(struct iommu *iommu, u16 did, addr |= (((u64)1 << (size_order - 1)) - 1) << PAGE_SHIFT_4K; } - rc =qinval_device_iotlb_sync (iommu, pdev->ats_queue_depth, - sid, sbit, addr); + rc =qinval_device_iotlb_sync (iommu, pdev->ats_queue_depth, did, + pdev->seg, pdev->bus, pdev->devfn, + sbit, addr);break ;Quoted 3 lines
... holding pdev in your hands here, don't just pass it down (which at once would make the function signature less convoluted: you could even eliminate the currently 2nd parameter that way).
Quoted 7 lines
I am afraid we need to leave it as is.. this pdev , in
dev_invalidate_iotlb(), is 'structpci_ats_dev', but we need a 'structpci_dev' to hide device indev_invalidate_iotlb_timeout().'struct
pci_ats_dev' and 'structpci_dev' are quite different, however, SBDF is connection between them..
Oh, indeed. Yet - can't enable_ats_device() be passed a struct pci_dev *, and that be stored instead of SBDF inside struct pci_ats_dev?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v10 3/3] vt-d: fix vt-d Device-TLB flush timeout issue
Quoted 81 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 20.05.16 at 09:15, <[email protected]> wrote:
Quoted 4 lines · Jan Beulich
xen/drivers/passthrough/vtd/qinval.c static int invalidate_sync(struct iommu
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 22.04.16 at 12:54, <[email protected]> wrote:
xen/drivers/passthrough/vtd/qinval.c +0
-0@@ -206,10 +206,71 @@ static int invalidate_sync(struct iommu*iommu)
Quoted 37 lines
Quoted 37 lines
Quoted 23 lines
xen/drivers/passthrough/vtd/qinval.c +20
-0return 0 ; } +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]); + +/* +* In case the domain has been freed or the IOMMU domid bitmap is +* not valid, the device no longer belongs to this domain. +*/ +if ( d ==NULL ) +return ; + +pcidevs_lock (); + +for_each_pdev (d, pdev) + { + if ( (pdev->seg == seg) &&xen/drivers/passthrough/vtd/qinval.c static int invalidate_sync(struct iommu *iommu) · line 239
Quoted 10 lines
xen/drivers/passthrough/vtd/qinval.c +10
-0+ (pdev->bus == bus) && + (pdev->devfn == devfn) ) + { +ASSERT (pdev->domain); +list_del (&pdev->domain_list); + pdev->domain =NULL ; +pci_hide_existing_device (pdev); +break ; + } + }A loop like this is of course not ideal (especially for Dom0, which may have many devices). And I wonder why you, ...
Quoted 11 lines
Quoted 5 lines
Quoted 2 lines
xen/drivers/passthrough/vtd/qinval.c +0
-0@@ -134,8 +133,9 @@ int dev_invalidate_iotlb(struct iommu *iommu,u16
did,
Quoted 2 lines
/* invalidate all translations:sbit=1,bit_63=0,bit[62:12]=1
*/
Quoted 5 lines
Quoted 5 lines
sbit = 1; addr = (~0UL << PAGE_SHIFT_4K) & 0x7FFFFFFFFFFFFFFF;xen/drivers/passthrough/vtd/qinval.c +1
-2- rc =qinval_device_iotlb_sync (iommu, pdev->ats_queue_depth, - sid, sbit, addr); + rc = qinval_device_iotlb_sync(iommu, pdev->ats_queue_depth,did,
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
xen/drivers/passthrough/vtd/qinval.c +3
-0+ pdev->seg, pdev->bus, pdev->devfn, + sbit, addr);break ;case DMA_TLB_PSI_FLUSH : if ( !device_in_domain(iommu, pdev, did) ) @@ -154,8 +154,9 @@ int dev_invalidate_iotlb(struct iommu *iommu, u16 did, addr |= (((u64)1 << (size_order - 1)) - 1) << PAGE_SHIFT_4K; }Quoted 3 lines
Quoted 3 lines
xen/drivers/passthrough/vtd/qinval.c
Quoted 3 lines
xen/drivers/passthrough/vtd/qinval.c +1
-2- rc =qinval_device_iotlb_sync (iommu, pdev->ats_queue_depth, - sid, sbit, addr); + rc = qinval_device_iotlb_sync(iommu, pdev->ats_queue_depth,did,
Quoted 12 lines
Quoted 7 lines
xen/drivers/passthrough/vtd/qinval.c
Quoted 3 lines
xen/drivers/passthrough/vtd/qinval.c +2
-0+ pdev->seg, pdev->bus, pdev->devfn, + sbit, addr);break ;... holding pdev in your hands here, don't just pass it down (which at once would make the function signature less convoluted: you could even eliminate the currently 2nd parameter that way).
I am afraid we need to leave it as is.. this pdev , in
dev_invalidate_iotlb(), is 'structpci_ats_dev', but we need a 'structpci_dev' to hide device indev_invalidate_iotlb_timeout().
Quoted 6 lines
Quoted 2 lines
'struct
pci_ats_dev' and 'structpci_dev' are quite different, however, SBDF is connection between them..Oh, indeed. Yet - can't
enable_ats_device()be passed a structpci_dev*, and that be stored instead of SBDF inside structpci_ats_dev?
Make sense. I appreciate your specific advice.
Quan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel