diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/ftrace.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index b1e8943fed1d..25b4f4da0fe8 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -948,7 +948,7 @@ struct ftrace_func_probe { | |||
948 | }; | 948 | }; |
949 | 949 | ||
950 | enum { | 950 | enum { |
951 | FTRACE_ENABLE_CALLS = (1 << 0), | 951 | FTRACE_UPDATE_CALLS = (1 << 0), |
952 | FTRACE_DISABLE_CALLS = (1 << 1), | 952 | FTRACE_DISABLE_CALLS = (1 << 1), |
953 | FTRACE_UPDATE_TRACE_FUNC = (1 << 2), | 953 | FTRACE_UPDATE_TRACE_FUNC = (1 << 2), |
954 | FTRACE_START_FUNC_RET = (1 << 3), | 954 | FTRACE_START_FUNC_RET = (1 << 3), |
@@ -1519,7 +1519,7 @@ int ftrace_text_reserved(void *start, void *end) | |||
1519 | 1519 | ||
1520 | 1520 | ||
1521 | static int | 1521 | static int |
1522 | __ftrace_replace_code(struct dyn_ftrace *rec, int enable) | 1522 | __ftrace_replace_code(struct dyn_ftrace *rec, int update) |
1523 | { | 1523 | { |
1524 | unsigned long ftrace_addr; | 1524 | unsigned long ftrace_addr; |
1525 | unsigned long flag = 0UL; | 1525 | unsigned long flag = 0UL; |
@@ -1527,17 +1527,17 @@ __ftrace_replace_code(struct dyn_ftrace *rec, int enable) | |||
1527 | ftrace_addr = (unsigned long)FTRACE_ADDR; | 1527 | ftrace_addr = (unsigned long)FTRACE_ADDR; |
1528 | 1528 | ||
1529 | /* | 1529 | /* |
1530 | * If we are enabling tracing: | 1530 | * If we are updating calls: |
1531 | * | 1531 | * |
1532 | * If the record has a ref count, then we need to enable it | 1532 | * If the record has a ref count, then we need to enable it |
1533 | * because someone is using it. | 1533 | * because someone is using it. |
1534 | * | 1534 | * |
1535 | * Otherwise we make sure its disabled. | 1535 | * Otherwise we make sure its disabled. |
1536 | * | 1536 | * |
1537 | * If we are disabling tracing, then disable all records that | 1537 | * If we are disabling calls, then disable all records that |
1538 | * are enabled. | 1538 | * are enabled. |
1539 | */ | 1539 | */ |
1540 | if (enable && (rec->flags & ~FTRACE_FL_MASK)) | 1540 | if (update && (rec->flags & ~FTRACE_FL_MASK)) |
1541 | flag = FTRACE_FL_ENABLED; | 1541 | flag = FTRACE_FL_ENABLED; |
1542 | 1542 | ||
1543 | /* If the state of this record hasn't changed, then do nothing */ | 1543 | /* If the state of this record hasn't changed, then do nothing */ |
@@ -1553,7 +1553,7 @@ __ftrace_replace_code(struct dyn_ftrace *rec, int enable) | |||
1553 | return ftrace_make_nop(NULL, rec, ftrace_addr); | 1553 | return ftrace_make_nop(NULL, rec, ftrace_addr); |
1554 | } | 1554 | } |
1555 | 1555 | ||
1556 | static void ftrace_replace_code(int enable) | 1556 | static void ftrace_replace_code(int update) |
1557 | { | 1557 | { |
1558 | struct dyn_ftrace *rec; | 1558 | struct dyn_ftrace *rec; |
1559 | struct ftrace_page *pg; | 1559 | struct ftrace_page *pg; |
@@ -1567,7 +1567,7 @@ static void ftrace_replace_code(int enable) | |||
1567 | if (rec->flags & FTRACE_FL_FREE) | 1567 | if (rec->flags & FTRACE_FL_FREE) |
1568 | continue; | 1568 | continue; |
1569 | 1569 | ||
1570 | failed = __ftrace_replace_code(rec, enable); | 1570 | failed = __ftrace_replace_code(rec, update); |
1571 | if (failed) { | 1571 | if (failed) { |
1572 | ftrace_bug(failed, rec->ip); | 1572 | ftrace_bug(failed, rec->ip); |
1573 | /* Stop processing */ | 1573 | /* Stop processing */ |
@@ -1623,7 +1623,7 @@ static int __ftrace_modify_code(void *data) | |||
1623 | */ | 1623 | */ |
1624 | function_trace_stop++; | 1624 | function_trace_stop++; |
1625 | 1625 | ||
1626 | if (*command & FTRACE_ENABLE_CALLS) | 1626 | if (*command & FTRACE_UPDATE_CALLS) |
1627 | ftrace_replace_code(1); | 1627 | ftrace_replace_code(1); |
1628 | else if (*command & FTRACE_DISABLE_CALLS) | 1628 | else if (*command & FTRACE_DISABLE_CALLS) |
1629 | ftrace_replace_code(0); | 1629 | ftrace_replace_code(0); |
@@ -1691,7 +1691,7 @@ static int ftrace_startup(struct ftrace_ops *ops, int command) | |||
1691 | return -ENODEV; | 1691 | return -ENODEV; |
1692 | 1692 | ||
1693 | ftrace_start_up++; | 1693 | ftrace_start_up++; |
1694 | command |= FTRACE_ENABLE_CALLS; | 1694 | command |= FTRACE_UPDATE_CALLS; |
1695 | 1695 | ||
1696 | /* ops marked global share the filter hashes */ | 1696 | /* ops marked global share the filter hashes */ |
1697 | if (ops->flags & FTRACE_OPS_FL_GLOBAL) { | 1697 | if (ops->flags & FTRACE_OPS_FL_GLOBAL) { |
@@ -1743,8 +1743,7 @@ static void ftrace_shutdown(struct ftrace_ops *ops, int command) | |||
1743 | if (ops != &global_ops || !global_start_up) | 1743 | if (ops != &global_ops || !global_start_up) |
1744 | ops->flags &= ~FTRACE_OPS_FL_ENABLED; | 1744 | ops->flags &= ~FTRACE_OPS_FL_ENABLED; |
1745 | 1745 | ||
1746 | if (!ftrace_start_up) | 1746 | command |= FTRACE_UPDATE_CALLS; |
1747 | command |= FTRACE_DISABLE_CALLS; | ||
1748 | 1747 | ||
1749 | if (saved_ftrace_func != ftrace_trace_function) { | 1748 | if (saved_ftrace_func != ftrace_trace_function) { |
1750 | saved_ftrace_func = ftrace_trace_function; | 1749 | saved_ftrace_func = ftrace_trace_function; |
@@ -1766,7 +1765,7 @@ static void ftrace_startup_sysctl(void) | |||
1766 | saved_ftrace_func = NULL; | 1765 | saved_ftrace_func = NULL; |
1767 | /* ftrace_start_up is true if we want ftrace running */ | 1766 | /* ftrace_start_up is true if we want ftrace running */ |
1768 | if (ftrace_start_up) | 1767 | if (ftrace_start_up) |
1769 | ftrace_run_update_code(FTRACE_ENABLE_CALLS); | 1768 | ftrace_run_update_code(FTRACE_UPDATE_CALLS); |
1770 | } | 1769 | } |
1771 | 1770 | ||
1772 | static void ftrace_shutdown_sysctl(void) | 1771 | static void ftrace_shutdown_sysctl(void) |
@@ -2919,7 +2918,7 @@ ftrace_set_regex(struct ftrace_ops *ops, unsigned char *buf, int len, | |||
2919 | ret = ftrace_hash_move(ops, enable, orig_hash, hash); | 2918 | ret = ftrace_hash_move(ops, enable, orig_hash, hash); |
2920 | if (!ret && ops->flags & FTRACE_OPS_FL_ENABLED | 2919 | if (!ret && ops->flags & FTRACE_OPS_FL_ENABLED |
2921 | && ftrace_enabled) | 2920 | && ftrace_enabled) |
2922 | ftrace_run_update_code(FTRACE_ENABLE_CALLS); | 2921 | ftrace_run_update_code(FTRACE_UPDATE_CALLS); |
2923 | 2922 | ||
2924 | mutex_unlock(&ftrace_lock); | 2923 | mutex_unlock(&ftrace_lock); |
2925 | 2924 | ||
@@ -3107,7 +3106,7 @@ ftrace_regex_release(struct inode *inode, struct file *file) | |||
3107 | orig_hash, iter->hash); | 3106 | orig_hash, iter->hash); |
3108 | if (!ret && (iter->ops->flags & FTRACE_OPS_FL_ENABLED) | 3107 | if (!ret && (iter->ops->flags & FTRACE_OPS_FL_ENABLED) |
3109 | && ftrace_enabled) | 3108 | && ftrace_enabled) |
3110 | ftrace_run_update_code(FTRACE_ENABLE_CALLS); | 3109 | ftrace_run_update_code(FTRACE_UPDATE_CALLS); |
3111 | 3110 | ||
3112 | mutex_unlock(&ftrace_lock); | 3111 | mutex_unlock(&ftrace_lock); |
3113 | } | 3112 | } |