Skip to contentSkip to conversation

drm/amdgpu: Fix minmax error

PATCH In review Luben Tuikov 2 participants 2 messages Nov 26, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Fix minmax error

Fix minmax compilation error by using the correct constant and correct integer suffix.

Cc James Zhu <[email protected]>
Cc Felix Kuehling <[email protected]>
Fixes 58170a7a002ad6 ("drm/amdgpu: fix stall on CPU when allocate large system memory")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c +3 -3
index 8a2e5716d8dba2..65715cb395d838 100644
@@ -51,7 +51,7 @@
 #include "amdgpu_amdkfd.h"
 #include "amdgpu_hmm.h"
 
-#define MAX_WALK_BYTE	(64ULL<<30)
+#define MAX_WALK_BYTE	(2UL << 30)
 
 /**
  * amdgpu_hmm_invalidate_gfx - callback to notify about mm change
@@ -197,8 +197,8 @@ int amdgpu_hmm_range_get_pages(struct mmu_interval_notifier *notifier,
 			hmm_range->start, hmm_range->end);
 
 		/* Assuming 512MB takes maxmium 1 second to fault page address */
-		timeout = max((hmm_range->end - hmm_range->start) >> 29, 1ULL) *
-			HMM_RANGE_DEFAULT_TIMEOUT;
+		timeout = max((hmm_range->end - hmm_range->start) >> 29, 1UL);
+		timeout *= HMM_RANGE_DEFAULT_TIMEOUT;
 		timeout = jiffies + msecs_to_jiffies(timeout);
 
 retry:

base-commit: 9e95ce4c60631c1339204f8723008a715391f410

Signature · 1 line
2.39.0.rc0
Reviewed-by on v1 1/1
#1 lore raw

Am 26.11.22 um 06:25 schrieb Luben Tuikov:

Quoted 7 lines

Fix minmax compilation error by using the correct constant and correct integer suffix.

Cc James Zhu <[email protected]>
Cc Felix Kuehling <[email protected]>
Fixes 58170a7a002ad6 ("drm/amdgpu: fix stall on CPU when allocate large system memory")
Quoted 30 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c +3 -3
index 8a2e5716d8dba2..65715cb395d838 100644
@@ -51,7 +51,7 @@
  #include "amdgpu_amdkfd.h"
  #include "amdgpu_hmm.h"
 
-#define MAX_WALK_BYTE	(64ULL<<30)
+#define MAX_WALK_BYTE	(2UL << 30)
 
  /**
   * amdgpu_hmm_invalidate_gfx - callback to notify about mm change
@@ -197,8 +197,8 @@ int amdgpu_hmm_range_get_pages(struct mmu_interval_notifier *notifier,
  			hmm_range->start, hmm_range->end);
 
  		/* Assuming 512MB takes maxmium 1 second to fault page address */
-		timeout = max((hmm_range->end - hmm_range->start) >> 29, 1ULL) *
-			HMM_RANGE_DEFAULT_TIMEOUT;
+		timeout = max((hmm_range->end - hmm_range->start) >> 29, 1UL);
+		timeout *= HMM_RANGE_DEFAULT_TIMEOUT;
  		timeout = jiffies + msecs_to_jiffies(timeout);
 
  retry:

base-commit: 9e95ce4c60631c1339204f8723008a715391f410