Re: [Xen-devel] [PATCH 4/5] x86/alternative: Implement NMI/#MC-safe patching

2018-02-01 Thread Jan Beulich
>>> On 01.02.18 at 16:20, wrote: > On 31/01/18 11:00, Jan Beulich wrote: > On 30.01.18 at 20:26, wrote: >>> On 30/01/18 08:39, Jan Beulich wrote: >>> On 29.01.18 at 16:38, wrote: > +/* > + * We are the CPU performing the patching, and might have ended up > here by >>

Re: [Xen-devel] [PATCH 4/5] x86/alternative: Implement NMI/#MC-safe patching

2018-02-01 Thread Andrew Cooper
On 31/01/18 11:00, Jan Beulich wrote: On 30.01.18 at 20:26, wrote: >> On 30/01/18 08:39, Jan Beulich wrote: >> On 29.01.18 at 16:38, wrote: +/* + * We are the CPU performing the patching, and might have ended up here by + * hitting a breakpoint. +

Re: [Xen-devel] [PATCH 4/5] x86/alternative: Implement NMI/#MC-safe patching

2018-01-31 Thread Jan Beulich
>>> On 30.01.18 at 20:26, wrote: > On 30/01/18 08:39, Jan Beulich wrote: > On 29.01.18 at 16:38, wrote: >>> +/* >>> + * We are the CPU performing the patching, and might have ended up >>> here by >>> + * hitting a breakpoint. >>> + * >>> + * Either way, we need to complet

Re: [Xen-devel] [PATCH 4/5] x86/alternative: Implement NMI/#MC-safe patching

2018-01-31 Thread Andrew Cooper
On 31/01/18 06:07, Juergen Gross wrote: > On 30/01/18 20:26, Andrew Cooper wrote: >> However, there is literally nothing we can do to prevent #MC from >> arriving.  We can stop servicing #MC by disabling CR4.MCE, but then the >> processor will shut down. > Hmm, there is a way to avoid #MC on other

Re: [Xen-devel] [PATCH 4/5] x86/alternative: Implement NMI/#MC-safe patching

2018-01-30 Thread Juergen Gross
On 30/01/18 20:26, Andrew Cooper wrote: > However, there is literally nothing we can do to prevent #MC from > arriving.  We can stop servicing #MC by disabling CR4.MCE, but then the > processor will shut down. Hmm, there is a way to avoid #MC on other processors, but this requires the really big h

Re: [Xen-devel] [PATCH 4/5] x86/alternative: Implement NMI/#MC-safe patching

2018-01-30 Thread Andrew Cooper
On 30/01/18 08:39, Jan Beulich wrote: On 29.01.18 at 16:38, wrote: >> +bool init_or_livepatch text_poke_live(const struct cpu_user_regs *regs) >> +{ >> +struct live_poke_info *i = &live_poke_info; >> + >> +if ( unlikely(i->cpu != smp_processor_id()) ) >> +{ >> +ASSERT(regs

Re: [Xen-devel] [PATCH 4/5] x86/alternative: Implement NMI/#MC-safe patching

2018-01-30 Thread Jan Beulich
>>> On 29.01.18 at 16:38, wrote: > +bool init_or_livepatch text_poke_live(const struct cpu_user_regs *regs) > +{ > +struct live_poke_info *i = &live_poke_info; > + > +if ( unlikely(i->cpu != smp_processor_id()) ) > +{ > +ASSERT(regs); > + > +/* > + * We hit a br

[Xen-devel] [PATCH 4/5] x86/alternative: Implement NMI/#MC-safe patching

2018-01-29 Thread Andrew Cooper
Patching code which is being executed is problematic, because it impossible to arrange an atomic update of the instruction stream outside of a few corner cases. Furthermore, we have no feasible way to prevent execution of the NMI and #MC exception handlers, but have patch points in them. Use a br