[Xen-devel] [PATCH v9 06/11] x86/entry: Organise the use of MSR_SPEC_CTRL at each entry/exit point

2018-01-18 Thread Andrew Cooper
We need to be able to either set or clear IBRS in Xen context, as well as restore appropriate guest values in guest context. See the documentation in asm-x86/spec_ctrl_asm.h for details. Writes to %cr3 are slower when SPEC_CTRL.IBRS is set, so the SPEC_CTRL_{ENTRY/EXIT}* positioning is important,

Re: [Xen-devel] [PATCH v9 06/11] x86/entry: Organise the use of MSR_SPEC_CTRL at each entry/exit point

2018-01-19 Thread Andrew Cooper
On 18/01/18 15:46, Andrew Cooper wrote: > We need to be able to either set or clear IBRS in Xen context, as well as > restore appropriate guest values in guest context. See the documentation in > asm-x86/spec_ctrl_asm.h for details. > > Writes to %cr3 are slower when SPEC_CTRL.IBRS is set, so the

Re: [Xen-devel] [PATCH v9 06/11] x86/entry: Organise the use of MSR_SPEC_CTRL at each entry/exit point

2018-01-19 Thread Jan Beulich
>>> On 18.01.18 at 16:46, wrote: > We need to be able to either set or clear IBRS in Xen context, as well as > restore appropriate guest values in guest context. See the documentation in > asm-x86/spec_ctrl_asm.h for details. > > Writes to %cr3 are slower when SPEC_CTRL.IBRS is set, so the > SPE

Re: [Xen-devel] [PATCH v9 06/11] x86/entry: Organise the use of MSR_SPEC_CTRL at each entry/exit point

2018-01-19 Thread Andrew Cooper
On 19/01/18 11:43, Jan Beulich wrote: On 18.01.18 at 16:46, wrote: >> We need to be able to either set or clear IBRS in Xen context, as well as >> restore appropriate guest values in guest context. See the documentation in >> asm-x86/spec_ctrl_asm.h for details. >> >> Writes to %cr3 are slow

Re: [Xen-devel] [PATCH v9 06/11] x86/entry: Organise the use of MSR_SPEC_CTRL at each entry/exit point

2018-01-19 Thread Jan Beulich
>>> On 19.01.18 at 14:36, wrote: > On 19/01/18 11:43, Jan Beulich wrote: > On 18.01.18 at 16:46, wrote: >>> @@ -729,6 +760,9 @@ ENTRY(nmi) >>> handle_ist_exception: >>> SAVE_ALL CLAC >>> >>> +SPEC_CTRL_ENTRY_FROM_INTR /* Req: %rsp=regs, Clob: acd */ >>> +/* WARNING

Re: [Xen-devel] [PATCH v9 06/11] x86/entry: Organise the use of MSR_SPEC_CTRL at each entry/exit point

2018-01-22 Thread Andrew Cooper
On 19/01/18 13:51, Jan Beulich wrote: On 19.01.18 at 14:36, wrote: >> On 19/01/18 11:43, Jan Beulich wrote: >> On 18.01.18 at 16:46, wrote: @@ -729,6 +760,9 @@ ENTRY(nmi) handle_ist_exception: SAVE_ALL CLAC +SPEC_CTRL_ENTRY_FROM_INTR /* Req: %

Re: [Xen-devel] [PATCH v9 06/11] x86/entry: Organise the use of MSR_SPEC_CTRL at each entry/exit point

2018-01-22 Thread Jan Beulich
>>> On 22.01.18 at 12:42, wrote: > On 19/01/18 13:51, Jan Beulich wrote: > On 19.01.18 at 14:36, wrote: >>> On 19/01/18 11:43, Jan Beulich wrote: >>> On 18.01.18 at 16:46, wrote: > @@ -729,6 +760,9 @@ ENTRY(nmi) > handle_ist_exception: > SAVE_ALL CLAC > >

Re: [Xen-devel] [PATCH v9 06/11] x86/entry: Organise the use of MSR_SPEC_CTRL at each entry/exit point

2018-01-22 Thread Andrew Cooper
On 22/01/18 12:06, Jan Beulich wrote: On 22.01.18 at 12:42, wrote: >> On 19/01/18 13:51, Jan Beulich wrote: >> On 19.01.18 at 14:36, wrote: On 19/01/18 11:43, Jan Beulich wrote: On 18.01.18 at 16:46, wrote: >> @@ -729,6 +760,9 @@ ENTRY(nmi) >> handle_ist_exception

Re: [Xen-devel] [PATCH v9 06/11] x86/entry: Organise the use of MSR_SPEC_CTRL at each entry/exit point

2018-01-22 Thread Boris Ostrovsky
On 01/19/2018 08:36 AM, Andrew Cooper wrote: > On 19/01/18 11:43, Jan Beulich wrote: > >>> @@ -99,6 +106,10 @@ UNLIKELY_END(realmode) >>> .Lvmx_vmentry_fail: >>> sti >>> SAVE_ALL >>> + >>> +SPEC_CTRL_ENTRY_FROM_PV /* Req: %rsp=regs/cpuinfo Clob: acd */ >> I think the use

Re: [Xen-devel] [PATCH v9 06/11] x86/entry: Organise the use of MSR_SPEC_CTRL at each entry/exit point

2018-01-22 Thread Andrew Cooper
On 22/01/2018 22:27, Boris Ostrovsky wrote: > On 01/19/2018 08:36 AM, Andrew Cooper wrote: >> On 19/01/18 11:43, Jan Beulich wrote: >> @@ -99,6 +106,10 @@ UNLIKELY_END(realmode) .Lvmx_vmentry_fail: sti SAVE_ALL + +SPEC_CTRL_ENTRY_FROM_PV /* R

Re: [Xen-devel] [PATCH v9 06/11] x86/entry: Organise the use of MSR_SPEC_CTRL at each entry/exit point

2018-01-22 Thread Boris Ostrovsky
On 01/22/2018 07:17 PM, Andrew Cooper wrote: On 22/01/2018 22:27, Boris Ostrovsky wrote: On 01/19/2018 08:36 AM, Andrew Cooper wrote: On 19/01/18 11:43, Jan Beulich wrote: @@ -99,6 +106,10 @@ UNLIKELY_END(realmode) .Lvmx_vmentry_fail: sti SAVE_ALL + +SPEC_CTRL_

Re: [Xen-devel] [PATCH v9 06/11] x86/entry: Organise the use of MSR_SPEC_CTRL at each entry/exit point

2018-01-23 Thread Andrew Cooper
On 23/01/18 02:19, Boris Ostrovsky wrote: > > > On 01/22/2018 07:17 PM, Andrew Cooper wrote: >> On 22/01/2018 22:27, Boris Ostrovsky wrote: >>> On 01/19/2018 08:36 AM, Andrew Cooper wrote: On 19/01/18 11:43, Jan Beulich wrote: >> @@ -99,6 +106,10 @@ UNLIKELY_END(realmode) >>   .Lv