On Thu, Jun 21, 2018 at 05:25:08PM -0400, Pavel Tatashin wrote: > --- > arch/x86/include/asm/text-patching.h | 1 + > arch/x86/kernel/alternative.c | 10 +++++++++- > 2 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/include/asm/text-patching.h b/arch/x86/include/asm/text-patching.h > index 2ecd34e2d46c..e85ff65c43c3 100644 > --- a/arch/x86/include/asm/text-patching.h > +++ b/arch/x86/include/asm/text-patching.h > @@ -37,5 +37,6 @@ extern void *text_poke_early(void *addr, const void *opcode, size_t len); > extern void *text_poke(void *addr, const void *opcode, size_t len); > extern int poke_int3_handler(struct pt_regs *regs); > extern void *text_poke_bp(void *addr, const void *opcode, size_t len, void *handler); > +extern int after_bootmem; > > #endif /* _ASM_X86_TEXT_PATCHING_H */ > diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c > index a481763a3776..0230dbc3c599 100644 > --- a/arch/x86/kernel/alternative.c > +++ b/arch/x86/kernel/alternative.c > @@ -686,13 +686,21 @@ void *__init_or_module text_poke_early(void *addr, const void *opcode, > * > * Note: Must be called under text_mutex. > */ > -void *text_poke(void *addr, const void *opcode, size_t len) > +void __ref *text_poke(void *addr, const void *opcode, size_t len) > { > unsigned long flags; > char *vaddr; > struct page *pages[2]; > int i; > > + /* While boot memory allocator is runnig we cannot use struct Broken comment style.. > + * pages as they are not yet initialized. However, we also know > + * that this is early in boot, and it is safe to fallback to > + * text_poke_early. > + */ > + if (unlikely(!after_bootmem)) > + return text_poke_early(addr, opcode, len); I'm not entirely sure this is right.. Because not only do we need the whole fixmap stuff working, we also need #DB and the IPI handlers set-up and working. Also, why do this here and not override @poker in __jump_label_transform() ? And I added a sync_core() in text_poke_early(), which I think we need for this. > if (!core_kernel_text((unsigned long)addr)) { > pages[0] = vmalloc_to_page(addr); > pages[1] = vmalloc_to_page(addr + PAGE_SIZE); > -- > 2.17.1 > -- To unsubscribe from this list: send the line "unsubscribe linux-s390" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html