Re: [Xen-devel] [PATCH v10 4/6] VT-d: introduce update_irte to update irte safely

2017-03-24 Thread Tian, Kevin
> From: Jan Beulich [mailto:jbeul...@suse.com] > Sent: Thursday, March 16, 2017 6:29 PM > > >>> On 15.03.17 at 23:39, wrote: > > On Wed, Mar 15, 2017 at 10:48:25AM -0600, Jan Beulich wrote: > > On 15.03.17 at 06:11, wrote: > >>> +/* > >>> + * The following method to update IR

Re: [Xen-devel] [PATCH v10 4/6] VT-d: introduce update_irte to update irte safely

2017-03-21 Thread Tian, Kevin
> From: Jan Beulich [mailto:jbeul...@suse.com] > Sent: Thursday, March 16, 2017 6:29 PM > > >>> On 15.03.17 at 23:39, wrote: > > On Wed, Mar 15, 2017 at 10:48:25AM -0600, Jan Beulich wrote: > > On 15.03.17 at 06:11, wrote: > >>> +/* > >>> + * The following method to update IR

Re: [Xen-devel] [PATCH v10 4/6] VT-d: introduce update_irte to update irte safely

2017-03-17 Thread Jan Beulich
>>> On 17.03.17 at 02:52, wrote: > On Thu, Mar 16, 2017 at 04:29:29AM -0600, Jan Beulich wrote: > On 15.03.17 at 23:39, wrote: >>> On Wed, Mar 15, 2017 at 10:48:25AM -0600, Jan Beulich wrote: >>> On 15.03.17 at 06:11, wrote: > +/* > + * The following method to upd

Re: [Xen-devel] [PATCH v10 4/6] VT-d: introduce update_irte to update irte safely

2017-03-17 Thread Chao Gao
On Thu, Mar 16, 2017 at 04:29:29AM -0600, Jan Beulich wrote: On 15.03.17 at 23:39, wrote: >> On Wed, Mar 15, 2017 at 10:48:25AM -0600, Jan Beulich wrote: >> On 15.03.17 at 06:11, wrote: +/* + * The following method to update IRTE is safe on condition that +

Re: [Xen-devel] [PATCH v10 4/6] VT-d: introduce update_irte to update irte safely

2017-03-16 Thread Jan Beulich
>>> On 15.03.17 at 23:39, wrote: > On Wed, Mar 15, 2017 at 10:48:25AM -0600, Jan Beulich wrote: > On 15.03.17 at 06:11, wrote: >>> +/* >>> + * The following method to update IRTE is safe on condition that >>> + * only the high qword or the low qword is to be updated. >

Re: [Xen-devel] [PATCH v10 4/6] VT-d: introduce update_irte to update irte safely

2017-03-15 Thread Chao Gao
On Wed, Mar 15, 2017 at 10:48:25AM -0600, Jan Beulich wrote: On 15.03.17 at 06:11, wrote: >> +/* >> + * The following method to update IRTE is safe on condition that >> + * only the high qword or the low qword is to be updated. >> + * If entire IRTE is to be up

Re: [Xen-devel] [PATCH v10 4/6] VT-d: introduce update_irte to update irte safely

2017-03-15 Thread Jan Beulich
>>> On 15.03.17 at 06:11, wrote: > +static void update_irte(struct iremap_entry *entry, > +const struct iremap_entry *new_ire) > +{ > +if ( cpu_has_cx16 ) > +{ > +__uint128_t ret; > +struct iremap_entry old_ire; > + > +old_ire = *entry; > +

[Xen-devel] [PATCH v10 4/6] VT-d: introduce update_irte to update irte safely

2017-03-15 Thread Chao Gao
We used structure assignment to update irte which was not safe when an interrupt happened during update. It is better to update IRTE atomically through cmpxchg16b(). When cmpxchg16b is not supported, two 64-bit write operations can update IRTE safely when only the high qword or the low qword is int