diff options
author | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2013-09-09 12:05:37 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2013-09-09 12:05:37 -0400 |
commit | 65320fcedaa7affd1736cd7aa51f5e70b5c7e7f2 (patch) | |
tree | 2fb1bdf8a1139262dd13fa671055c7517cb3fffb /kernel/trace/ftrace.c | |
parent | c3f31f6a6f68bcb51689c90733282ec263602a9d (diff) | |
parent | d8dfad3876e4386666b759da3c833d62fb8b2267 (diff) |
Merge tag 'v3.11-rc7' into stable/for-linus-3.12
Linux 3.11-rc7
As we need the git commit 28817e9de4f039a1a8c1fe1df2fa2df524626b9e
Author: Chuck Anderson <chuck.anderson@oracle.com>
Date: Tue Aug 6 15:12:19 2013 -0700
xen/smp: initialize IPI vectors before marking CPU online
* tag 'v3.11-rc7': (443 commits)
Linux 3.11-rc7
ARC: [lib] strchr breakage in Big-endian configuration
VFS: collect_mounts() should return an ERR_PTR
bfs: iget_locked() doesn't return an ERR_PTR
efs: iget_locked() doesn't return an ERR_PTR()
proc: kill the extra proc_readfd_common()->dir_emit_dots()
cope with potentially long ->d_dname() output for shmem/hugetlb
usb: phy: fix build breakage
USB: OHCI: add missing PCI PM callbacks to ohci-pci.c
staging: comedi: bug-fix NULL pointer dereference on failed attach
lib/lz4: correct the LZ4 license
memcg: get rid of swapaccount leftovers
nilfs2: fix issue with counting number of bio requests for BIO_EOPNOTSUPP error detection
nilfs2: remove double bio_put() in nilfs_end_bio_write() for BIO_EOPNOTSUPP error
drivers/platform/olpc/olpc-ec.c: initialise earlier
ipv4: expose IPV4_DEVCONF
ipv6: handle Redirect ICMP Message with no Redirected Header option
be2net: fix disabling TX in be_close()
Revert "ACPI / video: Always call acpi_video_init_brightness() on init"
Revert "genetlink: fix family dump race"
...
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r-- | kernel/trace/ftrace.c | 87 |
1 files changed, 72 insertions, 15 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 8ce9eefc5bb4..a6d098c6df3f 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -2169,12 +2169,57 @@ static cycle_t ftrace_update_time; | |||
2169 | static unsigned long ftrace_update_cnt; | 2169 | static unsigned long ftrace_update_cnt; |
2170 | unsigned long ftrace_update_tot_cnt; | 2170 | unsigned long ftrace_update_tot_cnt; |
2171 | 2171 | ||
2172 | static int ops_traces_mod(struct ftrace_ops *ops) | 2172 | static inline int ops_traces_mod(struct ftrace_ops *ops) |
2173 | { | 2173 | { |
2174 | struct ftrace_hash *hash; | 2174 | /* |
2175 | * Filter_hash being empty will default to trace module. | ||
2176 | * But notrace hash requires a test of individual module functions. | ||
2177 | */ | ||
2178 | return ftrace_hash_empty(ops->filter_hash) && | ||
2179 | ftrace_hash_empty(ops->notrace_hash); | ||
2180 | } | ||
2181 | |||
2182 | /* | ||
2183 | * Check if the current ops references the record. | ||
2184 | * | ||
2185 | * If the ops traces all functions, then it was already accounted for. | ||
2186 | * If the ops does not trace the current record function, skip it. | ||
2187 | * If the ops ignores the function via notrace filter, skip it. | ||
2188 | */ | ||
2189 | static inline bool | ||
2190 | ops_references_rec(struct ftrace_ops *ops, struct dyn_ftrace *rec) | ||
2191 | { | ||
2192 | /* If ops isn't enabled, ignore it */ | ||
2193 | if (!(ops->flags & FTRACE_OPS_FL_ENABLED)) | ||
2194 | return 0; | ||
2195 | |||
2196 | /* If ops traces all mods, we already accounted for it */ | ||
2197 | if (ops_traces_mod(ops)) | ||
2198 | return 0; | ||
2199 | |||
2200 | /* The function must be in the filter */ | ||
2201 | if (!ftrace_hash_empty(ops->filter_hash) && | ||
2202 | !ftrace_lookup_ip(ops->filter_hash, rec->ip)) | ||
2203 | return 0; | ||
2204 | |||
2205 | /* If in notrace hash, we ignore it too */ | ||
2206 | if (ftrace_lookup_ip(ops->notrace_hash, rec->ip)) | ||
2207 | return 0; | ||
2208 | |||
2209 | return 1; | ||
2210 | } | ||
2211 | |||
2212 | static int referenced_filters(struct dyn_ftrace *rec) | ||
2213 | { | ||
2214 | struct ftrace_ops *ops; | ||
2215 | int cnt = 0; | ||
2175 | 2216 | ||
2176 | hash = ops->filter_hash; | 2217 | for (ops = ftrace_ops_list; ops != &ftrace_list_end; ops = ops->next) { |
2177 | return ftrace_hash_empty(hash); | 2218 | if (ops_references_rec(ops, rec)) |
2219 | cnt++; | ||
2220 | } | ||
2221 | |||
2222 | return cnt; | ||
2178 | } | 2223 | } |
2179 | 2224 | ||
2180 | static int ftrace_update_code(struct module *mod) | 2225 | static int ftrace_update_code(struct module *mod) |
@@ -2183,6 +2228,7 @@ static int ftrace_update_code(struct module *mod) | |||
2183 | struct dyn_ftrace *p; | 2228 | struct dyn_ftrace *p; |
2184 | cycle_t start, stop; | 2229 | cycle_t start, stop; |
2185 | unsigned long ref = 0; | 2230 | unsigned long ref = 0; |
2231 | bool test = false; | ||
2186 | int i; | 2232 | int i; |
2187 | 2233 | ||
2188 | /* | 2234 | /* |
@@ -2196,9 +2242,12 @@ static int ftrace_update_code(struct module *mod) | |||
2196 | 2242 | ||
2197 | for (ops = ftrace_ops_list; | 2243 | for (ops = ftrace_ops_list; |
2198 | ops != &ftrace_list_end; ops = ops->next) { | 2244 | ops != &ftrace_list_end; ops = ops->next) { |
2199 | if (ops->flags & FTRACE_OPS_FL_ENABLED && | 2245 | if (ops->flags & FTRACE_OPS_FL_ENABLED) { |
2200 | ops_traces_mod(ops)) | 2246 | if (ops_traces_mod(ops)) |
2201 | ref++; | 2247 | ref++; |
2248 | else | ||
2249 | test = true; | ||
2250 | } | ||
2202 | } | 2251 | } |
2203 | } | 2252 | } |
2204 | 2253 | ||
@@ -2208,12 +2257,16 @@ static int ftrace_update_code(struct module *mod) | |||
2208 | for (pg = ftrace_new_pgs; pg; pg = pg->next) { | 2257 | for (pg = ftrace_new_pgs; pg; pg = pg->next) { |
2209 | 2258 | ||
2210 | for (i = 0; i < pg->index; i++) { | 2259 | for (i = 0; i < pg->index; i++) { |
2260 | int cnt = ref; | ||
2261 | |||
2211 | /* If something went wrong, bail without enabling anything */ | 2262 | /* If something went wrong, bail without enabling anything */ |
2212 | if (unlikely(ftrace_disabled)) | 2263 | if (unlikely(ftrace_disabled)) |
2213 | return -1; | 2264 | return -1; |
2214 | 2265 | ||
2215 | p = &pg->records[i]; | 2266 | p = &pg->records[i]; |
2216 | p->flags = ref; | 2267 | if (test) |
2268 | cnt += referenced_filters(p); | ||
2269 | p->flags = cnt; | ||
2217 | 2270 | ||
2218 | /* | 2271 | /* |
2219 | * Do the initial record conversion from mcount jump | 2272 | * Do the initial record conversion from mcount jump |
@@ -2233,7 +2286,7 @@ static int ftrace_update_code(struct module *mod) | |||
2233 | * conversion puts the module to the correct state, thus | 2286 | * conversion puts the module to the correct state, thus |
2234 | * passing the ftrace_make_call check. | 2287 | * passing the ftrace_make_call check. |
2235 | */ | 2288 | */ |
2236 | if (ftrace_start_up && ref) { | 2289 | if (ftrace_start_up && cnt) { |
2237 | int failed = __ftrace_replace_code(p, 1); | 2290 | int failed = __ftrace_replace_code(p, 1); |
2238 | if (failed) | 2291 | if (failed) |
2239 | ftrace_bug(failed, p->ip); | 2292 | ftrace_bug(failed, p->ip); |
@@ -3384,6 +3437,12 @@ ftrace_match_addr(struct ftrace_hash *hash, unsigned long ip, int remove) | |||
3384 | return add_hash_entry(hash, ip); | 3437 | return add_hash_entry(hash, ip); |
3385 | } | 3438 | } |
3386 | 3439 | ||
3440 | static void ftrace_ops_update_code(struct ftrace_ops *ops) | ||
3441 | { | ||
3442 | if (ops->flags & FTRACE_OPS_FL_ENABLED && ftrace_enabled) | ||
3443 | ftrace_run_update_code(FTRACE_UPDATE_CALLS); | ||
3444 | } | ||
3445 | |||
3387 | static int | 3446 | static int |
3388 | ftrace_set_hash(struct ftrace_ops *ops, unsigned char *buf, int len, | 3447 | ftrace_set_hash(struct ftrace_ops *ops, unsigned char *buf, int len, |
3389 | unsigned long ip, int remove, int reset, int enable) | 3448 | unsigned long ip, int remove, int reset, int enable) |
@@ -3426,9 +3485,8 @@ ftrace_set_hash(struct ftrace_ops *ops, unsigned char *buf, int len, | |||
3426 | 3485 | ||
3427 | mutex_lock(&ftrace_lock); | 3486 | mutex_lock(&ftrace_lock); |
3428 | ret = ftrace_hash_move(ops, enable, orig_hash, hash); | 3487 | ret = ftrace_hash_move(ops, enable, orig_hash, hash); |
3429 | if (!ret && ops->flags & FTRACE_OPS_FL_ENABLED | 3488 | if (!ret) |
3430 | && ftrace_enabled) | 3489 | ftrace_ops_update_code(ops); |
3431 | ftrace_run_update_code(FTRACE_UPDATE_CALLS); | ||
3432 | 3490 | ||
3433 | mutex_unlock(&ftrace_lock); | 3491 | mutex_unlock(&ftrace_lock); |
3434 | 3492 | ||
@@ -3655,9 +3713,8 @@ int ftrace_regex_release(struct inode *inode, struct file *file) | |||
3655 | mutex_lock(&ftrace_lock); | 3713 | mutex_lock(&ftrace_lock); |
3656 | ret = ftrace_hash_move(iter->ops, filter_hash, | 3714 | ret = ftrace_hash_move(iter->ops, filter_hash, |
3657 | orig_hash, iter->hash); | 3715 | orig_hash, iter->hash); |
3658 | if (!ret && (iter->ops->flags & FTRACE_OPS_FL_ENABLED) | 3716 | if (!ret) |
3659 | && ftrace_enabled) | 3717 | ftrace_ops_update_code(iter->ops); |
3660 | ftrace_run_update_code(FTRACE_UPDATE_CALLS); | ||
3661 | 3718 | ||
3662 | mutex_unlock(&ftrace_lock); | 3719 | mutex_unlock(&ftrace_lock); |
3663 | } | 3720 | } |