Merge branch 'for-4.20/microsoft' into for-linus
[linux-2.6-block.git] / kernel / trace / trace_events_filter.c
index 893a206bcba4f76dd504e246d9667475fd7ed456..84a65173b1e91dc347e5d98b1a831da42c1bd7bb 100644 (file)
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * trace_events_filter - generic event filtering
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
  * Copyright (C) 2009 Tom Zanussi <tzanussi@gmail.com>
  */
 
@@ -899,7 +886,8 @@ int filter_match_preds(struct event_filter *filter, void *rec)
        if (!filter)
                return 1;
 
-       prog = rcu_dereference_sched(filter->prog);
+       /* Protected by either SRCU(tracepoint_srcu) or preempt_disable */
+       prog = rcu_dereference_raw(filter->prog);
        if (!prog)
                return 1;
 
@@ -1626,10 +1614,10 @@ static int process_system_preds(struct trace_subsystem_dir *dir,
 
        /*
         * The calls can still be using the old filters.
-        * Do a synchronize_sched() to ensure all calls are
+        * Do a synchronize_sched() and to ensure all calls are
         * done with them before we free them.
         */
-       synchronize_sched();
+       tracepoint_synchronize_unregister();
        list_for_each_entry_safe(filter_item, tmp, &filter_list, list) {
                __free_filter(filter_item->filter);
                list_del(&filter_item->list);
@@ -1648,7 +1636,7 @@ static int process_system_preds(struct trace_subsystem_dir *dir,
        kfree(filter);
        /* If any call succeeded, we still need to sync */
        if (!fail)
-               synchronize_sched();
+               tracepoint_synchronize_unregister();
        list_for_each_entry_safe(filter_item, tmp, &filter_list, list) {
                __free_filter(filter_item->filter);
                list_del(&filter_item->list);
@@ -1790,7 +1778,7 @@ int apply_event_filter(struct trace_event_file *file, char *filter_string)
                event_clear_filter(file);
 
                /* Make sure the filter is not being used */
-               synchronize_sched();
+               tracepoint_synchronize_unregister();
                __free_filter(filter);
 
                return 0;
@@ -1817,7 +1805,7 @@ int apply_event_filter(struct trace_event_file *file, char *filter_string)
 
                if (tmp) {
                        /* Make sure the call is done with the filter */
-                       synchronize_sched();
+                       tracepoint_synchronize_unregister();
                        __free_filter(tmp);
                }
        }
@@ -1847,7 +1835,7 @@ int apply_subsystem_event_filter(struct trace_subsystem_dir *dir,
                filter = system->filter;
                system->filter = NULL;
                /* Ensure all filters are no longer used */
-               synchronize_sched();
+               tracepoint_synchronize_unregister();
                filter_free_subsystem_filters(dir, tr);
                __free_filter(filter);
                goto out_unlock;