[PATCH 1/1] x86: fix text_poke

Jeremy Fitzhardinge jeremy@goop.org
Sun Apr 27 01:01:00 GMT 2008


Masami Hiramatsu wrote:
> Jeremy Fitzhardinge wrote:
>   
>> Mathieu Desnoyers wrote:
>>     
>>> This idea has been considered a few years ago at OLS in the tracing BOF
>>> if I remember well.  The results were this : First, there is no way to
>>> guarantee that no code path, nor any return address from any function,
>>> interrupt, sleeping thread, will return to the "old" version of the
>>> function. Nor is it possible to determine when a quiescent state is
>>> reached. Therefore, we couldn't see how we can do the teardown.
>>>   
>>>       
>> Does that matter?  The new function is semantically identical to the old 
>> one, and the old code will remain in place.  If there's still users in 
>> the old function it may take a while for them to get flushed out (and 
>> won't be traced in the meantime), but you have to expect some missed 
>> events if you're shoving any kind of dynamic marker into the code.  The 
>> main problem is if there's something still depending on the first 5 
>> bytes of the function (most likely if there's a loop head somewhere near 
>> the top of the function).
>>     
>
> I think we have to ensure no threads sleeping or being interrupted on
> the function when removing new function. How would you check it?
>   

Not sure I follow you.  You'd never remove any code.  But you'd only 
start tracing new callers of the function.  If the function loops 
indefinitely, you could potentially have some users which never end up 
getting traced.  Also, if those users depend on instructions in the 
first 5 bytes of the function, they would crash because of the jump to 
the new function patched on top of them.

Overall, it doesn't seem like a very satisfactory mechanism...

    J



More information about the Systemtap mailing list