~ubuntu-branches/ubuntu/quantal/linux-lowlatency/quantal

« back to all changes in this revision

Viewing changes to kernel/trace/ftrace.c

  • Committer: Package Import Robot
  • Author(s): Alessio Igor Bogani
  • Date: 2011-10-26 11:13:05 UTC
  • Revision ID: package-import@ubuntu.com-20111026111305-04kado7d1u2er2rl
Tags: 3.2.0-16.25
Add new lowlatency kernel flavour

Show diffs side-by-side

added added

removed removed

Lines of Context:
948
948
};
949
949
 
950
950
enum {
951
 
        FTRACE_ENABLE_CALLS             = (1 << 0),
 
951
        FTRACE_UPDATE_CALLS             = (1 << 0),
952
952
        FTRACE_DISABLE_CALLS            = (1 << 1),
953
953
        FTRACE_UPDATE_TRACE_FUNC        = (1 << 2),
954
954
        FTRACE_START_FUNC_RET           = (1 << 3),
1519
1519
 
1520
1520
 
1521
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
1524
        unsigned long ftrace_addr;
1525
1525
        unsigned long flag = 0UL;
1527
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
1532
         *   If the record has a ref count, then we need to enable it
1533
1533
         *   because someone is using it.
1534
1534
         *
1535
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
1538
         * are enabled.
1539
1539
         */
1540
 
        if (enable && (rec->flags & ~FTRACE_FL_MASK))
 
1540
        if (update && (rec->flags & ~FTRACE_FL_MASK))
1541
1541
                flag = FTRACE_FL_ENABLED;
1542
1542
 
1543
1543
        /* If the state of this record hasn't changed, then do nothing */
1553
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
1558
        struct dyn_ftrace *rec;
1559
1559
        struct ftrace_page *pg;
1567
1567
                if (rec->flags & FTRACE_FL_FREE)
1568
1568
                        continue;
1569
1569
 
1570
 
                failed = __ftrace_replace_code(rec, enable);
 
1570
                failed = __ftrace_replace_code(rec, update);
1571
1571
                if (failed) {
1572
1572
                        ftrace_bug(failed, rec->ip);
1573
1573
                        /* Stop processing */
1623
1623
         */
1624
1624
        function_trace_stop++;
1625
1625
 
1626
 
        if (*command & FTRACE_ENABLE_CALLS)
 
1626
        if (*command & FTRACE_UPDATE_CALLS)
1627
1627
                ftrace_replace_code(1);
1628
1628
        else if (*command & FTRACE_DISABLE_CALLS)
1629
1629
                ftrace_replace_code(0);
1691
1691
                return -ENODEV;
1692
1692
 
1693
1693
        ftrace_start_up++;
1694
 
        command |= FTRACE_ENABLE_CALLS;
 
1694
        command |= FTRACE_UPDATE_CALLS;
1695
1695
 
1696
1696
        /* ops marked global share the filter hashes */
1697
1697
        if (ops->flags & FTRACE_OPS_FL_GLOBAL) {
1743
1743
        if (ops != &global_ops || !global_start_up)
1744
1744
                ops->flags &= ~FTRACE_OPS_FL_ENABLED;
1745
1745
 
1746
 
        if (!ftrace_start_up)
1747
 
                command |= FTRACE_DISABLE_CALLS;
 
1746
        command |= FTRACE_UPDATE_CALLS;
1748
1747
 
1749
1748
        if (saved_ftrace_func != ftrace_trace_function) {
1750
1749
                saved_ftrace_func = ftrace_trace_function;
1766
1765
        saved_ftrace_func = NULL;
1767
1766
        /* ftrace_start_up is true if we want ftrace running */
1768
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
1771
static void ftrace_shutdown_sysctl(void)
2919
2918
        ret = ftrace_hash_move(ops, enable, orig_hash, hash);
2920
2919
        if (!ret && ops->flags & FTRACE_OPS_FL_ENABLED
2921
2920
            && ftrace_enabled)
2922
 
                ftrace_run_update_code(FTRACE_ENABLE_CALLS);
 
2921
                ftrace_run_update_code(FTRACE_UPDATE_CALLS);
2923
2922
 
2924
2923
        mutex_unlock(&ftrace_lock);
2925
2924
 
3107
3106
                                       orig_hash, iter->hash);
3108
3107
                if (!ret && (iter->ops->flags & FTRACE_OPS_FL_ENABLED)
3109
3108
                    && ftrace_enabled)
3110
 
                        ftrace_run_update_code(FTRACE_ENABLE_CALLS);
 
3109
                        ftrace_run_update_code(FTRACE_UPDATE_CALLS);
3111
3110
 
3112
3111
                mutex_unlock(&ftrace_lock);
3113
3112
        }