aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/ftrace.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2016-03-16 10:34:32 -0400
committerSteven Rostedt <rostedt@goodmis.org>2016-03-18 10:30:15 -0400
commit84b6d3e6149c5280bc18b42e2f12efdaf354e49c (patch)
treed0356e34860bafc73f580eacb7419c34630c0f8e /kernel/trace/ftrace.c
parent1cf8067b541884366b7db3a328342073fed2f38f (diff)
ftrace: Make ftrace_hash_rec_enable return update bool
Change __ftrace_hash_rec_update to return true in case we need to update dynamic ftrace call records. It return false in case no update is needed. Link: http://lkml.kernel.org/r/1458138873-1553-5-git-send-email-jolsa@kernel.org Acked-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Jiri Olsa <jolsa@kernel.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r--kernel/trace/ftrace.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 57a6eea84694..11ffcfd3804e 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1610,7 +1610,7 @@ static bool test_rec_ops_needs_regs(struct dyn_ftrace *rec)
1610 return keep_regs; 1610 return keep_regs;
1611} 1611}
1612 1612
1613static void __ftrace_hash_rec_update(struct ftrace_ops *ops, 1613static bool __ftrace_hash_rec_update(struct ftrace_ops *ops,
1614 int filter_hash, 1614 int filter_hash,
1615 bool inc) 1615 bool inc)
1616{ 1616{
@@ -1618,12 +1618,13 @@ static void __ftrace_hash_rec_update(struct ftrace_ops *ops,
1618 struct ftrace_hash *other_hash; 1618 struct ftrace_hash *other_hash;
1619 struct ftrace_page *pg; 1619 struct ftrace_page *pg;
1620 struct dyn_ftrace *rec; 1620 struct dyn_ftrace *rec;
1621 bool update = false;
1621 int count = 0; 1622 int count = 0;
1622 int all = 0; 1623 int all = 0;
1623 1624
1624 /* Only update if the ops has been registered */ 1625 /* Only update if the ops has been registered */
1625 if (!(ops->flags & FTRACE_OPS_FL_ENABLED)) 1626 if (!(ops->flags & FTRACE_OPS_FL_ENABLED))
1626 return; 1627 return false;
1627 1628
1628 /* 1629 /*
1629 * In the filter_hash case: 1630 * In the filter_hash case:
@@ -1650,7 +1651,7 @@ static void __ftrace_hash_rec_update(struct ftrace_ops *ops,
1650 * then there's nothing to do. 1651 * then there's nothing to do.
1651 */ 1652 */
1652 if (ftrace_hash_empty(hash)) 1653 if (ftrace_hash_empty(hash))
1653 return; 1654 return false;
1654 } 1655 }
1655 1656
1656 do_for_each_ftrace_rec(pg, rec) { 1657 do_for_each_ftrace_rec(pg, rec) {
@@ -1694,7 +1695,7 @@ static void __ftrace_hash_rec_update(struct ftrace_ops *ops,
1694 if (inc) { 1695 if (inc) {
1695 rec->flags++; 1696 rec->flags++;
1696 if (FTRACE_WARN_ON(ftrace_rec_count(rec) == FTRACE_REF_MAX)) 1697 if (FTRACE_WARN_ON(ftrace_rec_count(rec) == FTRACE_REF_MAX))
1697 return; 1698 return false;
1698 1699
1699 /* 1700 /*
1700 * If there's only a single callback registered to a 1701 * If there's only a single callback registered to a
@@ -1720,7 +1721,7 @@ static void __ftrace_hash_rec_update(struct ftrace_ops *ops,
1720 rec->flags |= FTRACE_FL_REGS; 1721 rec->flags |= FTRACE_FL_REGS;
1721 } else { 1722 } else {
1722 if (FTRACE_WARN_ON(ftrace_rec_count(rec) == 0)) 1723 if (FTRACE_WARN_ON(ftrace_rec_count(rec) == 0))
1723 return; 1724 return false;
1724 rec->flags--; 1725 rec->flags--;
1725 1726
1726 /* 1727 /*
@@ -1753,22 +1754,28 @@ static void __ftrace_hash_rec_update(struct ftrace_ops *ops,
1753 */ 1754 */
1754 } 1755 }
1755 count++; 1756 count++;
1757
1758 /* Must match FTRACE_UPDATE_CALLS in ftrace_modify_all_code() */
1759 update |= ftrace_test_record(rec, 1) != FTRACE_UPDATE_IGNORE;
1760
1756 /* Shortcut, if we handled all records, we are done. */ 1761 /* Shortcut, if we handled all records, we are done. */
1757 if (!all && count == hash->count) 1762 if (!all && count == hash->count)
1758 return; 1763 return update;
1759 } while_for_each_ftrace_rec(); 1764 } while_for_each_ftrace_rec();
1765
1766 return update;
1760} 1767}
1761 1768
1762static void ftrace_hash_rec_disable(struct ftrace_ops *ops, 1769static bool ftrace_hash_rec_disable(struct ftrace_ops *ops,
1763 int filter_hash) 1770 int filter_hash)
1764{ 1771{
1765 __ftrace_hash_rec_update(ops, filter_hash, 0); 1772 return __ftrace_hash_rec_update(ops, filter_hash, 0);
1766} 1773}
1767 1774
1768static void ftrace_hash_rec_enable(struct ftrace_ops *ops, 1775static bool ftrace_hash_rec_enable(struct ftrace_ops *ops,
1769 int filter_hash) 1776 int filter_hash)
1770{ 1777{
1771 __ftrace_hash_rec_update(ops, filter_hash, 1); 1778 return __ftrace_hash_rec_update(ops, filter_hash, 1);
1772} 1779}
1773 1780
1774static void ftrace_hash_rec_update_modify(struct ftrace_ops *ops, 1781static void ftrace_hash_rec_update_modify(struct ftrace_ops *ops,