gpu: nvgpu: support cpu unix timestamps for cpu-gpu correlation

This patch extends the CPU-GPU query interface to also support
CPU UNIX-based timestamps.

Bug 4059666

Change-Id: Iecb937df38d3913559499fed1027a7157ad8d151
Signed-off-by: Martin Radev <mradev@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2973572
Reviewed-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Martin Radev
2023-09-04 14:14:47 +03:00
committed by mobile promotions
parent b426d710a2
commit 22e1608e72
6 changed files with 56 additions and 8 deletions

View File

@@ -1230,13 +1230,24 @@ static int nvgpu_gpu_get_cpu_time_correlation_info(
struct nvgpu_gpu_get_cpu_time_correlation_info_args *args)
{
struct nvgpu_cpu_time_correlation_sample *samples;
enum nvgpu_cpu_timestamp_source timestamp_source;
int err;
u32 i;
if (args->count > NVGPU_GPU_GET_CPU_TIME_CORRELATION_INFO_MAX_COUNT ||
args->source_id != NVGPU_GPU_GET_CPU_TIME_CORRELATION_INFO_SRC_ID_TSC)
if (args->count > NVGPU_GPU_GET_CPU_TIME_CORRELATION_INFO_MAX_COUNT)
return -EINVAL;
switch(args->source_id) {
case NVGPU_GPU_GET_CPU_TIME_CORRELATION_INFO_SRC_ID_TSC:
timestamp_source = NVGPU_CPU_TIMESTAMP_SOURCE_TSC;
break;
case NVGPU_GPU_GET_CPU_TIME_CORRELATION_INFO_SRC_ID_OSTIME:
timestamp_source = NVGPU_CPU_TIMESTAMP_SOURCE_UNIX;
break;
default:
return -EINVAL;
}
samples = nvgpu_kzalloc(g, args->count *
sizeof(struct nvgpu_cpu_time_correlation_sample));
if (!samples) {
@@ -1244,7 +1255,7 @@ static int nvgpu_gpu_get_cpu_time_correlation_info(
}
err = g->ops.ptimer.get_timestamps_zipper(g,
args->source_id, args->count, samples);
timestamp_source, args->count, samples);
if (!err) {
for (i = 0; i < args->count; i++) {
args->samples[i].cpu_timestamp = samples[i].cpu_timestamp;