Re: [patch 3/3] x86/paravirt: Replace paravirt patch asm magic

2019-04-25 Thread Ingo Molnar
* Peter Zijlstra wrote: > > I think these open-coded hexa versions are somewhat fragile as well, how > > about putting these into a .S file and controlling the sections in an LTO > > safe manner there? > > > > That will also allow us to write proper asm, and global labels can be > > used to

Re: [patch 3/3] x86/paravirt: Replace paravirt patch asm magic

2019-04-25 Thread Peter Zijlstra
On Thu, Apr 25, 2019 at 10:08:10AM +0200, Peter Zijlstra wrote: > On Thu, Apr 25, 2019 at 08:52:09AM +0200, Ingo Molnar wrote: > > > > -# ifdef CONFIG_PARAVIRT_XXL > > > -DEF_NATIVE(irq, irq_disable, "cli"); > > > -DEF_NATIVE(irq, irq_enable, "sti"); > > > -DEF_NATIVE(irq, restore_fl, "push %eax;

Re: [patch 3/3] x86/paravirt: Replace paravirt patch asm magic

2019-04-25 Thread Peter Zijlstra
On Thu, Apr 25, 2019 at 08:52:09AM +0200, Ingo Molnar wrote: > > -# ifdef CONFIG_PARAVIRT_XXL > > -DEF_NATIVE(irq, irq_disable, "cli"); > > -DEF_NATIVE(irq, irq_enable, "sti"); > > -DEF_NATIVE(irq, restore_fl, "push %eax; popf"); > > -DEF_NATIVE(irq, save_fl, "pushf; pop %eax"); > > -DEF_NATIVE(cp

Re: [patch 3/3] x86/paravirt: Replace paravirt patch asm magic

2019-04-25 Thread Juergen Gross
On 25/04/2019 09:22, Thomas Gleixner wrote: > On Thu, 25 Apr 2019, Ingo Molnar wrote: >>> +# else >>> + .irq_restore_fl = { 0x50, 0x9d }, // push %eax; popf >>> + .mmu_write_cr3 = { 0x0f, 0x22, 0xd8 }, // mov %eax, %cr3 >>> + .cpu_iret = { 0xcf },

Re: [patch 3/3] x86/paravirt: Replace paravirt patch asm magic

2019-04-25 Thread Thomas Gleixner
On Thu, 25 Apr 2019, Ingo Molnar wrote: > > +# else > > + .irq_restore_fl = { 0x50, 0x9d }, // push %eax; popf > > + .mmu_write_cr3 = { 0x0f, 0x22, 0xd8 }, // mov %eax, %cr3 > > + .cpu_iret = { 0xcf }, // iret > > +# endif > > I think these op

Re: [patch 3/3] x86/paravirt: Replace paravirt patch asm magic

2019-04-24 Thread Ingo Molnar
* Thomas Gleixner wrote: > The magic macro DEF_NATIVE() in the paravirt patching code uses inline > assembly to generate a data table for patching in the native instructions. > > While clever this is falling apart with LTO and even aside of LTO the > construct is just working by chance accordi

[patch 3/3] x86/paravirt: Replace paravirt patch asm magic

2019-04-24 Thread Thomas Gleixner
The magic macro DEF_NATIVE() in the paravirt patching code uses inline assembly to generate a data table for patching in the native instructions. While clever this is falling apart with LTO and even aside of LTO the construct is just working by chance according to GCC folks. Aside of that the tab