return auxtrace_queues__add_buffer(queues, idx, buffer);
 }
 
+static bool filter_cpu(struct perf_session *session, int cpu)
+{
+       unsigned long *cpu_bitmap = session->itrace_synth_opts->cpu_bitmap;
+
+       return cpu_bitmap && cpu != -1 && !test_bit(cpu, cpu_bitmap);
+}
+
 int auxtrace_queues__add_event(struct auxtrace_queues *queues,
                               struct perf_session *session,
                               union perf_event *event, off_t data_offset,
        unsigned int idx;
        int err;
 
+       if (filter_cpu(session, event->auxtrace.cpu))
+               return 0;
+
        buffer = zalloc(sizeof(struct auxtrace_buffer));
        if (!buffer)
                return -ENOMEM;
 
  * @period: 'instructions' events period
  * @period_type: 'instructions' events period type
  * @initial_skip: skip N events at the beginning.
+ * @cpu_bitmap: CPUs for which to synthesize events, or NULL for all
  */
 struct itrace_synth_opts {
        bool                    set;
        unsigned long long      period;
        enum itrace_period_type period_type;
        unsigned long           initial_skip;
+       unsigned long           *cpu_bitmap;
 };
 
 /**