Mathieu Desnoyers wrote:> * Masami Hiramatsu (mhiramat@redhat.com) wrote:>> Mathieu Desnoyers wrote:>>> * Masami Hiramatsu (mhiramat@redhat.com) wrote:>>>> Steven Rostedt wrote:>>>>> On Mon, 23 Feb 2009, Mathieu Desnoyers wrote:>>>>>>> Hmm, lets see. I simply set a bit in the PTE mappings. There's not many, >>>>>>> since a lot are 2M pages, for x86_64. Call stop_machine, and now I can >>>>>>> modify 1 or 20,000 locations. Set the PTE bit back. Note, the changing of >>>>>>> the bits are only done when CONFIG_DEBUG_RODATA is set.>>>>>>>>>>>>>> text_poke requires allocating a page. Map the page into memory. Set up a >>>>>>> break point.>>>>>> text_poke does not _require_ a break point. text_poke can work with>>>>>> stop_machine.>>>>> It can? Doesn't text_poke require allocating pages? The code called by >>>>> stop_machine is all atomic. vmap does not give an option to allocate with >>>>> GFP_ATOMIC.>>>> Hi,>>>>>>>> With my patch, text_poke() never allocate pages any more :)>>>>>>>> BTW, IMHO, both of your methods are useful and have trade-off.>>>>>>>> ftrace wants to change massive amount of code at once. If we do>>>> that with text_poke(), we have to map/unmap pages each time and>>>> it will take a long time -- might be longer than one stop_machine_run().>>>>>>>> On the other hand, text_poke() user like as kprobes and tracepoints,>>>> just want to change a few amount of code at once, and it will be>>>> added/removed incrementally. If we do that with stop_machine_run(),>>>> we'll be annoyed by frequent machine stops.(Moreover, kprobes uses>>>> breakpoint, so it doesn't need stop_machine_run())>>>>>>> Hi Masami,>>>>>> Is this text_poke version executable in atomic context ? If yes, then>>> that would be good to add a comment saying it. Please see below for>>> comments.>> Thank you for comments!>> I think it could be. ah, spin_lock might be changed to spin_lock_irqsave()...>>> > You are right. If we plan to execute this in both atomic and non-atomic> context, spin_lock_irqsave would make sure we are always busy-looping> with interrupts off.