*/
 static int ftrace_disabled __read_mostly;
 
-static DEFINE_SPINLOCK(ftrace_lock);
+static DEFINE_MUTEX(ftrace_lock);
 static DEFINE_MUTEX(ftrace_sysctl_lock);
 static DEFINE_MUTEX(ftrace_start_lock);
 
 
 static int __register_ftrace_function(struct ftrace_ops *ops)
 {
-       /* should not be called from interrupt context */
-       spin_lock(&ftrace_lock);
+       mutex_lock(&ftrace_lock);
 
        ops->next = ftrace_list;
        /*
 #endif
        }
 
-       spin_unlock(&ftrace_lock);
+       mutex_unlock(&ftrace_lock);
 
        return 0;
 }
        struct ftrace_ops **p;
        int ret = 0;
 
-       /* should not be called from interrupt context */
-       spin_lock(&ftrace_lock);
+       mutex_lock(&ftrace_lock);
 
        /*
         * If we are removing the last function, then simply point
        }
 
  out:
-       spin_unlock(&ftrace_lock);
+       mutex_unlock(&ftrace_lock);
 
        return ret;
 }
 {
        ftrace_func_t func;
 
-       /* should not be called from interrupt context */
-       spin_lock(&ftrace_lock);
+       mutex_lock(&ftrace_lock);
 
        if (ftrace_trace_function == ftrace_stub)
                goto out;
 #endif
 
  out:
-       spin_unlock(&ftrace_lock);
+       mutex_unlock(&ftrace_lock);
 }
 
 #ifdef CONFIG_DYNAMIC_FTRACE
        if (ftrace_disabled || !start)
                return;
 
-       /* should not be called from interrupt context */
-       spin_lock(&ftrace_lock);
-
+       mutex_lock(&ftrace_lock);
        do_for_each_ftrace_rec(pg, rec) {
                if ((rec->ip >= s) && (rec->ip < e))
                        ftrace_free_rec(rec);
        } while_for_each_ftrace_rec();
-
-       spin_unlock(&ftrace_lock);
+       mutex_unlock(&ftrace_lock);
 }
 
 static struct dyn_ftrace *ftrace_alloc_dyn_node(unsigned long ip)
        if (iter->flags & FTRACE_ITER_PRINTALL)
                return NULL;
 
-       /* should not be called from interrupt context */
-       spin_lock(&ftrace_lock);
+       mutex_lock(&ftrace_lock);
  retry:
        if (iter->idx >= iter->pg->index) {
                if (iter->pg->next) {
                        goto retry;
                }
        }
-       spin_unlock(&ftrace_lock);
+       mutex_unlock(&ftrace_lock);
 
        return rec;
 }
        struct dyn_ftrace *rec;
        unsigned long type = enable ? FTRACE_FL_FILTER : FTRACE_FL_NOTRACE;
 
-       /* should not be called from interrupt context */
-       spin_lock(&ftrace_lock);
+       mutex_lock(&ftrace_lock);
        if (enable)
                ftrace_filtered = 0;
        do_for_each_ftrace_rec(pg, rec) {
                        continue;
                rec->flags &= ~type;
        } while_for_each_ftrace_rec();
-
-       spin_unlock(&ftrace_lock);
+       mutex_unlock(&ftrace_lock);
 }
 
 static int
 
        search_len = strlen(search);
 
-       /* should not be called from interrupt context */
-       spin_lock(&ftrace_lock);
+       mutex_lock(&ftrace_lock);
        do_for_each_ftrace_rec(pg, rec) {
 
                if (rec->flags & FTRACE_FL_FAILED)
                if (enable && (rec->flags & FTRACE_FL_FILTER))
                        ftrace_filtered = 1;
        } while_for_each_ftrace_rec();
-       spin_unlock(&ftrace_lock);
+       mutex_unlock(&ftrace_lock);
 }
 
 static int
                search_len = strlen(search);
        }
 
-       /* should not be called from interrupt context */
-       spin_lock(&ftrace_lock);
+       mutex_lock(&ftrace_lock);
        do_for_each_ftrace_rec(pg, rec) {
 
                if (rec->flags & FTRACE_FL_FAILED)
                        ftrace_filtered = 1;
 
        } while_for_each_ftrace_rec();
-       spin_unlock(&ftrace_lock);
+       mutex_unlock(&ftrace_lock);
 }
 
 /*
        if (ftrace_disabled)
                return -ENODEV;
 
-       /* should not be called from interrupt context */
-       spin_lock(&ftrace_lock);
-
+       mutex_lock(&ftrace_lock);
        do_for_each_ftrace_rec(pg, rec) {
 
                if (rec->flags & (FTRACE_FL_FAILED | FTRACE_FL_FREE))
                }
        } while_for_each_ftrace_rec();
  out:
-       spin_unlock(&ftrace_lock);
+       mutex_unlock(&ftrace_lock);
 
        return found ? 0 : -EINVAL;
 }