perf/x86/intel/lbr: Use dynamic data structure for task_ctx
authorKan Liang <kan.liang@linux.intel.com>
Fri, 3 Jul 2020 12:49:12 +0000 (05:49 -0700)
committerPeter Zijlstra <peterz@infradead.org>
Wed, 8 Jul 2020 09:38:52 +0000 (11:38 +0200)
commitf42be8651a7a9d5cb165e5d176fc0b09621b4f4d
tree34920f9367f679edb7efc4e00637633b69b54444
parent530bfff6480307d210734222a54d56af7f908957
perf/x86/intel/lbr: Use dynamic data structure for task_ctx

The type of task_ctx is hardcoded as struct x86_perf_task_context,
which doesn't apply for Architecture LBR. For example, Architecture LBR
doesn't have the TOS MSR. The number of LBR entries is variable. A new
struct will be introduced for Architecture LBR. Perf has to determine
the type of task_ctx at run time.

The type of task_ctx pointer is changed to 'void *', which will be
determined at run time.

The generic LBR optimization can be shared between Architecture LBR and
model-specific LBR. Both need to access the structure for the generic
LBR optimization. A helper task_context_opt() is introduced to retrieve
the pointer of the structure at run time.

Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/1593780569-62993-7-git-send-email-kan.liang@linux.intel.com
arch/x86/events/intel/lbr.c
arch/x86/events/perf_event.h