Pull perf fixes from Thomas Gleixner: "A set of fixes and improvements for the perf subsystem: Kernel fixes: - Install cgroup events to the correct CPU context to prevent a potential list double add - Prevent an integer underflow in the perf mlock accounting - Add a missing prototype for arch_perf_update_userpage() Tooling: - Add a missing unlock in the error path of maps__insert() in perf maps. - Fix the build with the latest libbfd - Fix the perf parser so it does not delete parse event terms, which caused a regression for using perf with the ARM CoreSight as the sink configuration was missing due to the deletion. - Fix the double free in the perf CPU map merging test case - Add the missing ustring support for the perf probe command" * tag 'perf-urgent-2020-02-09' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf maps: Add missing unlock to maps__insert() error case perf probe: Add ustring support for perf probe command perf: Make perf able to build with latest libbfd perf test: Fix test case Merge cpu map perf parse: Copy string to perf_evsel_config_term perf parse: Refactor 'struct perf_evsel_config_term' kernel/events: Add a missing prototype for arch_perf_update_userpage() perf/cgroups: Install cgroup events to correct cpuctx perf/core: Fix mlock accounting in perf_mmap()
Showing the changes to kernel (1 of 10 files). Show all
Unified · Split
| @@ -951,9 +951,9 @@ list_update_cgroup_event(struct perf_event *event, · 950 unmodified lines | ||
| 951 | 951 | |
| 952 | 952 | /* |
| 953 | 953 | * Because cgroup events are always per-cpu events, |
| 954 | − * this will always be called from the right CPU. | |
| 954 | + * @ctx == &cpuctx->ctx. | |
| 955 | 955 | */ |
| 956 | − cpuctx = __get_cpu_context(ctx); | |
| 956 | + cpuctx = container_of(ctx, struct perf_cpu_context, ctx); | |
| 957 | 957 | |
| 958 | 958 | /* |
| 959 | 959 | * Since setting cpuctx->cgrp is conditional on the current @cgrp |
| @@ -979,7 +979,8 @@ list_update_cgroup_event(struct perf_event *event, · 19 unmodified lines | ||
| 979 | 979 | |
| 980 | 980 | cpuctx_entry = &cpuctx->cgrp_cpuctx_entry; |
| 981 | 981 | if (add) |
| 982 | − list_add(cpuctx_entry, this_cpu_ptr(&cgrp_cpuctx_list)); | |
| 982 | + list_add(cpuctx_entry, | |
| 983 | + per_cpu_ptr(&cgrp_cpuctx_list, event->cpu)); | |
| 983 | 984 | else |
| 984 | 985 | list_del(cpuctx_entry); |
| 985 | 986 | } |
| @@ -5916,7 +5917,15 @@ accounting: · 4930 unmodified lines | ||
| 5916 | 5917 | */ |
| 5917 | 5918 | user_lock_limit *= num_online_cpus(); |
| 5918 | 5919 | |
| 5919 | − user_locked = atomic_long_read(&user->locked_vm) + user_extra; | |
| 5920 | + user_locked = atomic_long_read(&user->locked_vm); | |
| 5921 | + | |
| 5922 | + /* | |
| 5923 | + * sysctl_perf_event_mlock may have changed, so that | |
| 5924 | + * user->locked_vm > user_lock_limit | |
| 5925 | + */ | |
| 5926 | + if (user_locked > user_lock_limit) | |
| 5927 | + user_locked = user_lock_limit; | |
| 5928 | + user_locked += user_extra; | |
| 5920 | 5929 | |
| 5921 | 5930 | if (user_locked > user_lock_limit) { |
| 5922 | 5931 | /* |