From d601ff515902b4840109742f5f2ac8881058405c Mon Sep 17 00:00:00 2001 From: Leon Yu Date: Wed, 21 Aug 2019 21:02:12 +0800 Subject: nvgpu: don't report max load when counter overflow This is to prevent GPU (and thus EMC) frequency from being boosted from time to time when system is completely idle. It's caused by max GPU load being incorrectly reported by perfmon. When the issue happens, it can be observed that max load is reported but busy_cycles read from PMU is actually zero. Even though busy and total cycles returned by PMU may not be completely accurate when counter overflows, the counters accumulated so far still have some value that we shouldn't ignore. OTOH, returning max load could be the least accurate approximation in such cases. So let's just clear the interrupt status and let rest of the code handle the exception cases. Bug 200545546 Change-Id: I6882ae265029e881f5417fb2b82005b0112b0fda Signed-off-by: Leon Yu Reviewed-on: https://git-master.nvidia.com/r/2180771 Reviewed-by: Peng Liu Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Mubushir Rahman Reviewed-by: Bibek Basu Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/pmu/pmu_perfmon.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/gpu/nvgpu') diff --git a/drivers/gpu/nvgpu/common/pmu/pmu_perfmon.c b/drivers/gpu/nvgpu/common/pmu/pmu_perfmon.c index bf07bd79..175482a3 100644 --- a/drivers/gpu/nvgpu/common/pmu/pmu_perfmon.c +++ b/drivers/gpu/nvgpu/common/pmu/pmu_perfmon.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -263,9 +263,10 @@ int nvgpu_pmu_busy_cycles_norm(struct gk20a *g, u32 *norm) g->ops.pmu.pmu_reset_idle_counter(g, 0); if (intr_status != 0UL) { - *norm = PMU_BUSY_CYCLES_NORM_MAX; g->ops.pmu.pmu_clear_idle_intr_status(g); - } else if (total_cycles == 0ULL || busy_cycles > total_cycles) { + } + + if (total_cycles == 0ULL || busy_cycles > total_cycles) { *norm = PMU_BUSY_CYCLES_NORM_MAX; } else { *norm = (u32)(busy_cycles * PMU_BUSY_CYCLES_NORM_MAX -- cgit v1.2.2