diff options
-rw-r--r-- | kernel/trace/ftrace.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 483b8c1b1de0..31c90fec4158 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -1925,8 +1925,16 @@ ftrace_find_tramp_ops_curr(struct dyn_ftrace *rec) | |||
1925 | * when we are adding another op to the rec or removing the | 1925 | * when we are adding another op to the rec or removing the |
1926 | * current one. Thus, if the op is being added, we can | 1926 | * current one. Thus, if the op is being added, we can |
1927 | * ignore it because it hasn't attached itself to the rec | 1927 | * ignore it because it hasn't attached itself to the rec |
1928 | * yet. That means we just need to find the op that has a | 1928 | * yet. |
1929 | * trampoline and is not beeing added. | 1929 | * |
1930 | * If an ops is being modified (hooking to different functions) | ||
1931 | * then we don't care about the new functions that are being | ||
1932 | * added, just the old ones (that are probably being removed). | ||
1933 | * | ||
1934 | * If we are adding an ops to a function that already is using | ||
1935 | * a trampoline, it needs to be removed (trampolines are only | ||
1936 | * for single ops connected), then an ops that is not being | ||
1937 | * modified also needs to be checked. | ||
1930 | */ | 1938 | */ |
1931 | do_for_each_ftrace_op(op, ftrace_ops_list) { | 1939 | do_for_each_ftrace_op(op, ftrace_ops_list) { |
1932 | 1940 | ||
@@ -1940,17 +1948,23 @@ ftrace_find_tramp_ops_curr(struct dyn_ftrace *rec) | |||
1940 | if (op->flags & FTRACE_OPS_FL_ADDING) | 1948 | if (op->flags & FTRACE_OPS_FL_ADDING) |
1941 | continue; | 1949 | continue; |
1942 | 1950 | ||
1951 | |||
1943 | /* | 1952 | /* |
1944 | * If the ops is not being added and has a trampoline, | 1953 | * If the ops is being modified and is in the old |
1945 | * then it must be the one that we want! | 1954 | * hash, then it is probably being removed from this |
1955 | * function. | ||
1946 | */ | 1956 | */ |
1947 | if (hash_contains_ip(ip, op->func_hash)) | ||
1948 | return op; | ||
1949 | |||
1950 | /* If the ops is being modified, it may be in the old hash. */ | ||
1951 | if ((op->flags & FTRACE_OPS_FL_MODIFYING) && | 1957 | if ((op->flags & FTRACE_OPS_FL_MODIFYING) && |
1952 | hash_contains_ip(ip, &op->old_hash)) | 1958 | hash_contains_ip(ip, &op->old_hash)) |
1953 | return op; | 1959 | return op; |
1960 | /* | ||
1961 | * If the ops is not being added or modified, and it's | ||
1962 | * in its normal filter hash, then this must be the one | ||
1963 | * we want! | ||
1964 | */ | ||
1965 | if (!(op->flags & FTRACE_OPS_FL_MODIFYING) && | ||
1966 | hash_contains_ip(ip, op->func_hash)) | ||
1967 | return op; | ||
1954 | 1968 | ||
1955 | } while_for_each_ftrace_op(op); | 1969 | } while_for_each_ftrace_op(op); |
1956 | 1970 | ||