• Ian Rogers's avatar
    perf jevents: Autogenerate empty-pmu-events.c · 0fe881f1
    Ian Rogers authored
    empty-pmu-events.c exists so that builds may occur without python
    being installed on a system. Manually updating empty-pmu-events.c to
    be in sync with jevents.py is a pain, let's use jevents.py to generate
    empty-pmu-events.c.
    
    1) change jevents.py so that an arch and model of none cause
       generation of a pmu-events.c without any json. Add a SPDX and
       autogenerated warning to the start of the file.
    
    2) change Build so that if a generated pmu-events.c for arch none and
       model none doesn't match empty-pmu-events.c the build fails with a
       cat of the differences. Update Makefile.perf to clean up the files
       used for this.
    
    3) update empty-pmu-events.c to match the output of jevents.py with
       arch and mode of none.
    
    Committer notes:
    
    The firtst paragraph is confusing, so I asked and Ian further clarified:
    
     ---
    The requirement for python hasn't changed.
    
    Case 1: no python or NO_JEVENTS=1
    Build happens using empty-pmu-events.c that is checked in, no python
    is required.
    
    Case 2: python
    pmu-events.c is created by jevents.py (requiring python) and then built.
    This change adds a step where the empty-pmu-events.c is created using
    jevents.py and that file is diffed against the checked in version.
    
    This stops the checked in empty-pmu-events.c diverging if changes are
    made to jevents.py. If the diff causes the build to fail then you just
    copy the diff empty-pmu-events.c over the checked in one.
     ---
    Reviewed-by: default avatarJohn Garry <john.g.garry@oracle.com>
    Signed-off-by: default avatarIan Rogers <irogers@google.com>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Kan Liang <kan.liang@linux.intel.com>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Oliver Sang <oliver.sang@intel.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Philip Li <philip.li@intel.com>
    Cc: Sandipan Das <sandipan.das@amd.com>
    Cc: Weilin Wang <weilin.wang@intel.com>
    Cc: Xu Yang <xu.yang_2@nxp.com>
    Link: https://lore.kernel.org/r/20240730191744.3097329-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    0fe881f1
empty-pmu-events.c 26.1 KB