• Adrian Hunter's avatar
    perf record: Fix way of handling non-perf-event pollfds · 6562c9ac
    Adrian Hunter authored
    perf record __cmd_record() does not poll evlist pollfds. Instead it polls
    thread_data[0].pollfd. That happens whether or not threads are being used.
    
    perf record duplicates evlist mmap pollfds as needed for separate threads.
    The non-perf-event represented by evlist->ctl_fd has to handled separately,
    which is done explicitly, duplicating it into the thread_data[0] pollfds.
    That approach neglects any other non-perf-event file descriptors. Currently
    there is also done_fd which needs the same handling.
    
    Add a new generalized approach.
    
    Add fdarray_flag__non_perf_event to identify the file descriptors that
    need the special handling. For those cases, also keep a mapping of the
    evlist pollfd index and thread pollfd index, so that the evlist revents
    can be updated.
    
    Although this patch adds the new handling, it does not take it into use.
    There is no functional change, but it is the precursor to a fix, so is
    marked as a fix.
    
    Fixes: 415ccb58 ("perf record: Introduce thread specific data array")
    Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
    Acked-by: default avatarIan Rogers <irogers@google.com>
    Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Link: https://lore.kernel.org/r/20220824072814.16422-2-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    6562c9ac
array.h 1.64 KB