Re: [Xen-devel] [PATCH] x86/emul: Corrections to cmpxchg{8, 16}b emulation (to fix 32bit PV guests)

2017-01-20 Thread Jan Beulich
>>> On 20.01.17 at 09:52, wrote: Commenting on just the parts not replaced by the other patch. > @@ -461,6 +484,53 @@ int main(int argc, char **argv) > goto fail; > printf("okay\n"); > > +#ifdef __x86_64__ > +memset(&state, 0, sizeof(state)); > +printf("%-40s", "Testing l

Re: [Xen-devel] [PATCH] x86/emul: Corrections to cmpxchg{8, 16}b emulation (to fix 32bit PV guests)

2017-01-20 Thread Jan Beulich
>>> On 20.01.17 at 11:39, wrote: > On 20/01/17 09:54, Jan Beulich wrote: > On 20.01.17 at 09:52, wrote: >>> @@ -2852,6 +2852,11 @@ x86_emulate( >>> else if ( !(d & Mov) ) /* optimisation - avoid slow emulated read >>> */ >>> { >>> fail_if(lock_prefix ? !ops->cm

Re: [Xen-devel] [PATCH] x86/emul: Corrections to cmpxchg{8, 16}b emulation (to fix 32bit PV guests)

2017-01-20 Thread Andrew Cooper
On 20/01/17 09:54, Jan Beulich wrote: On 20.01.17 at 09:52, wrote: >> @@ -2852,6 +2852,11 @@ x86_emulate( >> else if ( !(d & Mov) ) /* optimisation - avoid slow emulated read */ >> { >> fail_if(lock_prefix ? !ops->cmpxchg : !ops->write); >> + >> +/*

Re: [Xen-devel] [PATCH] x86/emul: Corrections to cmpxchg{8, 16}b emulation (to fix 32bit PV guests)

2017-01-20 Thread Jan Beulich
>>> On 20.01.17 at 09:52, wrote: > @@ -2852,6 +2852,11 @@ x86_emulate( > else if ( !(d & Mov) ) /* optimisation - avoid slow emulated read */ > { > fail_if(lock_prefix ? !ops->cmpxchg : !ops->write); > + > +/* cmpxchg{8,16}b handles its own operand read.

[Xen-devel] [PATCH] x86/emul: Corrections to cmpxchg{8, 16}b emulation (to fix 32bit PV guests)

2017-01-20 Thread Andrew Cooper
c/s ff913f6 "x86/PV: restrict permitted instructions during memory write emulation" added an x86_insn_is_mem_write() restriction to all PV instructions which trap for emulation because of read-only mappings (pagetables, mmcfg and msi-x intercepts). Because of the way cmpxchg{8,16}b was decoded (be