perf_evlist__propagate_maps() cannot easily tell if an evsel has its own
cpu map.  To make that simpler, keep a copy of the PMU cpu map and
adjust the propagation logic accordingly.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@intel.com>
Link: http://lkml.kernel.org/r/1441699142-18905-8-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
                 * We already have cpus for evsel (via PMU sysfs) so
                 * keep it, if there's no target cpu list defined.
                 */
-               if (!evsel->cpus || evlist->has_user_cpus) {
+               if (!evsel->own_cpus || evlist->has_user_cpus) {
                        cpu_map__put(evsel->cpus);
                        evsel->cpus = cpu_map__get(evlist->cpus);
+               } else if (evsel->cpus != evsel->own_cpus) {
+                       cpu_map__put(evsel->cpus);
+                       evsel->cpus = cpu_map__get(evsel->own_cpus);
                }
 
                thread_map__put(evsel->threads);
 
        perf_evsel__free_config_terms(evsel);
        close_cgroup(evsel->cgrp);
        cpu_map__put(evsel->cpus);
+       cpu_map__put(evsel->own_cpus);
        thread_map__put(evsel->threads);
        zfree(&evsel->group_name);
        zfree(&evsel->name);
 
        struct cgroup_sel       *cgrp;
        void                    *handler;
        struct cpu_map          *cpus;
+       struct cpu_map          *own_cpus;
        struct thread_map       *threads;
        unsigned int            sample_size;
        int                     id_pos;
 
        if (!evsel)
                return NULL;
 
-       if (cpus)
-               evsel->cpus = cpu_map__get(cpus);
+       evsel->cpus     = cpu_map__get(cpus);
+       evsel->own_cpus = cpu_map__get(cpus);
 
        if (name)
                evsel->name = strdup(name);