Re: [RFC PATCH 2/3] powerpc/lib: Initialize a temporary mm for code patching
From: Steven Rostedt <rostedt@goodmis.org>
Date: 2020-04-24 13:14:40
From: Steven Rostedt <rostedt@goodmis.org>
Date: 2020-04-24 13:14:40
On Fri, 17 Apr 2020 10:57:10 +1000 Michael Ellerman [off-list ref] wrote:
quoted
quoted
quoted
Does it needs to be a BUG_ON() ? Can't we fail gracefully with just a WARN_ON ?I'm not sure what failing gracefully means here? The main reason this could fail is if there is not enough memory to allocate the patching_mm. The previous implementation had this justification for BUG_ON():But the system can continue running just fine after this failure. Only the things that make use of code patching will fail (ftrace, kgdb, ...)That's probably true of ftrace, but we can't fail patching for jump labels (static keys). See: void arch_jump_label_transform(struct jump_entry *entry, enum jump_label_type type) { u32 *addr = (u32 *)(unsigned long)entry->code; if (type == JUMP_LABEL_JMP) patch_branch(addr, entry->target, 0); else patch_instruction(addr, PPC_INST_NOP); }
I would still error on a WARN_ON() as a lot of static keys should still work if they don't get switched over. If a user is concerned about something like this, they can always set panic_on_warn. -- Steve