OSDN Git Service

habanalabs: return correct clock throttling period
authorOfir Bitton <obitton@habana.ai>
Tue, 7 Dec 2021 09:20:46 +0000 (11:20 +0200)
committerOded Gabbay <ogabbay@kernel.org>
Sun, 26 Dec 2021 06:59:08 +0000 (08:59 +0200)
Current clock throttling period returned from driver was wrong due
to wrong time comparison.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/habanalabs_ioctl.c

index 9210114..f571641 100644 (file)
@@ -335,9 +335,9 @@ static int clk_throttle_info(struct hl_fpriv *hpriv, struct hl_info_args *args)
                        ktime_to_us(hdev->clk_throttling.timestamp[i].start);
 
                if (ktime_compare(hdev->clk_throttling.timestamp[i].end, zero_time))
-                       end_time = ktime_get();
-               else
                        end_time = hdev->clk_throttling.timestamp[i].end;
+               else
+                       end_time = ktime_get();
 
                clk_throttle.clk_throttling_duration_ns[i] =
                        ktime_to_ns(ktime_sub(end_time,