Skip to contentSkip to conversation

drm/amdgpu : Increase the mes log buffer size as per new MES FW version

PATCH In review shaoyunl 4 participants 8 messages Mar 22, 2024 – Mar 26, 2024

Subsystems (2)
lore
Share & tools
lore

shaoyunl

author
#0 lore raw

PATCH 1/1 drm/amdgpu : Increase the mes log buffer size as per new MES FW version

From MES version 0x54, the log entry increased and require the log buffer size to be increased. The 16k is maximum size agreed

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 5 ++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 1 +
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +2 -3
index 9ace848e174c..78e4f88f5134 100644
@@ -103,7 +103,7 @@ static int amdgpu_mes_event_log_init(struct amdgpu_device *adev)
 	if (!amdgpu_mes_log_enable)
 		return 0;
 
-	r = amdgpu_bo_create_kernel(adev, PAGE_SIZE, PAGE_SIZE,
+	r = amdgpu_bo_create_kernel(adev, AMDGPU_MES_LOG_BUFFER_SIZE, PAGE_SIZE,
 				    AMDGPU_GEM_DOMAIN_GTT,
 				    &adev->mes.event_log_gpu_obj,
 				    &adev->mes.event_log_gpu_addr,
@@ -1548,12 +1548,11 @@ static int amdgpu_debugfs_mes_event_log_show(struct seq_file *m, void *unused)
 	uint32_t *mem = (uint32_t *)(adev->mes.event_log_cpu_addr);
 
 	seq_hex_dump(m, "", DUMP_PREFIX_OFFSET, 32, 4,
-		     mem, PAGE_SIZE, false);
+		     mem, AMDGPU_MES_LOG_BUFFER_SIZE, false);
 
 	return 0;
 }
 
-
 DEFINE_SHOW_ATTRIBUTE(amdgpu_debugfs_mes_event_log);
 
 #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h +1 -0
index 7d4f93fea937..4c8fc3117ef8 100644
@@ -52,6 +52,7 @@ enum amdgpu_mes_priority_level {
 
 #define AMDGPU_MES_PROC_CTX_SIZE 0x1000 /* one page area */
 #define AMDGPU_MES_GANG_CTX_SIZE 0x1000 /* one page area */
+#define AMDGPU_MES_LOG_BUFFER_SIZE 0x4000 /* Maximu log buffer size for MES */
 
 struct amdgpu_mes_funcs;
 
Signature · 1 line
2.34.1
#1 lore raw

[AMD Official Use Only - General]

Ping

Get Outlook for iOS<https://aka.ms/o0ukef>
________________________________
From: Liu, Shaoyun <[email protected]>
Sent: Friday, March 22, 2024 12:49:56 PM
To: [email protected] <[email protected]>
Cc: Liu, Shaoyun <[email protected]>
Subject: [PATCH] drm/amdgpu : Increase the mes log buffer size as per new MES FW version

From MES version 0x54, the log entry increased and require the log buffer size to be increased. The 16k is maximum size agreed

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 5 ++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 1 +
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +2 -3
index 9ace848e174c..78e4f88f5134 100644
@@ -103,7 +103,7 @@ static int amdgpu_mes_event_log_init(struct amdgpu_device *adev)
         if (!amdgpu_mes_log_enable)
                 return 0;
 
-       r = amdgpu_bo_create_kernel(adev, PAGE_SIZE, PAGE_SIZE,
+       r = amdgpu_bo_create_kernel(adev, AMDGPU_MES_LOG_BUFFER_SIZE, PAGE_SIZE,
                                     AMDGPU_GEM_DOMAIN_GTT,
                                     &adev->mes.event_log_gpu_obj,
                                     &adev->mes.event_log_gpu_addr,
@@ -1548,12 +1548,11 @@ static int amdgpu_debugfs_mes_event_log_show(struct seq_file *m, void *unused)
         uint32_t *mem = (uint32_t *)(adev->mes.event_log_cpu_addr);
 
         seq_hex_dump(m, "", DUMP_PREFIX_OFFSET, 32, 4,
-                    mem, PAGE_SIZE, false);
+                    mem, AMDGPU_MES_LOG_BUFFER_SIZE, false);
 
         return 0;
 }
 
-
 DEFINE_SHOW_ATTRIBUTE(amdgpu_debugfs_mes_event_log);
 
 #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h +1 -0
index 7d4f93fea937..4c8fc3117ef8 100644
@@ -52,6 +52,7 @@ enum amdgpu_mes_priority_level {
 
 #define AMDGPU_MES_PROC_CTX_SIZE 0x1000 /* one page area */
 #define AMDGPU_MES_GANG_CTX_SIZE 0x1000 /* one page area */
+#define AMDGPU_MES_LOG_BUFFER_SIZE 0x4000 /* Maximu log buffer size for MES */
 
 struct amdgpu_mes_funcs;
 

--
2.34.1

#2 lore raw

[AMD Official Use Only - General]

________________________________
From: amd-gfx <[email protected]> on behalf of Liu, Shaoyun <[email protected]>
Sent: Monday, March 25, 2024 1:58 PM
To: [email protected] <[email protected]>
Subject: Re: [PATCH] drm/amdgpu : Increase the mes log buffer size as per new MES FW version

[AMD Official Use Only - General]

[AMD Official Use Only - General]

Ping

Get Outlook for iOS<https://aka.ms/o0ukef>
________________________________
From: Liu, Shaoyun <[email protected]>
Sent: Friday, March 22, 2024 12:49:56 PM
To: [email protected] <[email protected]>
Cc: Liu, Shaoyun <[email protected]>
Subject: [PATCH] drm/amdgpu : Increase the mes log buffer size as per new MES FW version

From MES version 0x54, the log entry increased and require the log buffer size to be increased. The 16k is maximum size agreed

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 5 ++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 1 +
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +1 -1
index 9ace848e174c..78e4f88f5134 100644
@@ -103,7 +103,7 @@ static int amdgpu_mes_event_log_init(struct amdgpu_device *adev)
         if (!amdgpu_mes_log_enable)
                 return 0;
 
-       r = amdgpu_bo_create_kernel(adev, PAGE_SIZE, PAGE_SIZE,
+       r = amdgpu_bo_create_kernel(adev, AMDGPU_MES_LOG_BUFFER_SIZE, PAGE_SIZE,
 

shouldn't this be under a version check >= 0x54 instead of directly changing it ?

                                     AMDGPU_GEM_DOMAIN_GTT,
                                     &adev->mes.event_log_gpu_obj,
                                     &adev->mes.event_log_gpu_addr,
@@ -1548,12 +1548,11 @@ static int amdgpu_debugfs_mes_event_log_show(struct seq_file *m, void *unused)
         uint32_t *mem = (uint32_t *)(adev->mes.event_log_cpu_addr);

         seq_hex_dump(m, "", DUMP_PREFIX_OFFSET, 32, 4,

- mem, PAGE_SIZE, false);
+ mem, AMDGPU_MES_LOG_BUFFER_SIZE, false);

         return 0;

}

-
DEFINE_SHOW_ATTRIBUTE(amdgpu_debugfs_mes_event_log);

#endif

drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h +1 -0
index 7d4f93fea937..4c8fc3117ef8 100644
@@ -52,6 +52,7 @@ enum amdgpu_mes_priority_level {
 
 #define AMDGPU_MES_PROC_CTX_SIZE 0x1000 /* one page area */
 #define AMDGPU_MES_GANG_CTX_SIZE 0x1000 /* one page area */
+#define AMDGPU_MES_LOG_BUFFER_SIZE 0x4000 /* Maximu log buffer size for MES */
 

Apart from that, it looks good to me.

* Shashank

struct amdgpu_mes_funcs;

--
2.34.1

#3 lore raw
In reply to shaoyunl
Quoted 2 lines · shaoyunl

From MES version 0x54, the log entry increased and require the log buffer
size to be increased. The 16k is maximum size agreed

What happens when you run the new firmware on an old kernel that only allocates 4KB?

Regards,
  Felix

Quoted 46 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 5 ++---
  drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 1 +
  2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +2 -3
index 9ace848e174c..78e4f88f5134 100644
@@ -103,7 +103,7 @@ static int amdgpu_mes_event_log_init(struct amdgpu_device *adev)
  	if (!amdgpu_mes_log_enable)
  		return 0;
 
-	r = amdgpu_bo_create_kernel(adev, PAGE_SIZE, PAGE_SIZE,
+	r = amdgpu_bo_create_kernel(adev, AMDGPU_MES_LOG_BUFFER_SIZE, PAGE_SIZE,
  				    AMDGPU_GEM_DOMAIN_GTT,
  				    &adev->mes.event_log_gpu_obj,
  				    &adev->mes.event_log_gpu_addr,
@@ -1548,12 +1548,11 @@ static int amdgpu_debugfs_mes_event_log_show(struct seq_file *m, void *unused)
  	uint32_t *mem = (uint32_t *)(adev->mes.event_log_cpu_addr);
 
  	seq_hex_dump(m, "", DUMP_PREFIX_OFFSET, 32, 4,
-		     mem, PAGE_SIZE, false);
+		     mem, AMDGPU_MES_LOG_BUFFER_SIZE, false);
 
  	return 0;
  }
 
-
  DEFINE_SHOW_ATTRIBUTE(amdgpu_debugfs_mes_event_log);
 
  #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h +1 -0
index 7d4f93fea937..4c8fc3117ef8 100644
@@ -52,6 +52,7 @@ enum amdgpu_mes_priority_level {
 
  #define AMDGPU_MES_PROC_CTX_SIZE 0x1000 /* one page area */
  #define AMDGPU_MES_GANG_CTX_SIZE 0x1000 /* one page area */
+#define AMDGPU_MES_LOG_BUFFER_SIZE 0x4000 /* Maximu log buffer size for MES */
 
  struct amdgpu_mes_funcs;
 
#4 lore raw

[AMD Official Use Only - General]

It can cause page fault when the log size exceed the page size .

-----Original Message-----
From: Kuehling, Felix <[email protected]>
Sent: Monday, March 25, 2024 2:58 PM
To: Liu, Shaoyun <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu : Increase the mes log buffer size as per new MES FW version

Quoted 2 lines · shaoyunl

From MES version 0x54, the log entry increased and require the log
buffer size to be increased. The 16k is maximum size agreed

What happens when you run the new firmware on an old kernel that only allocates 4KB?

Regards,
Felix

Quoted 50 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 5 ++---
  drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 1 +
  2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +2 -1
index 9ace848e174c..78e4f88f5134 100644
@@ -103,7 +103,7 @@ static int amdgpu_mes_event_log_init(struct amdgpu_device *adev)
      if (!amdgpu_mes_log_enable)
              return 0;
 
-     r = amdgpu_bo_create_kernel(adev, PAGE_SIZE, PAGE_SIZE,
+     r = amdgpu_bo_create_kernel(adev, AMDGPU_MES_LOG_BUFFER_SIZE,
+PAGE_SIZE,
                                  AMDGPU_GEM_DOMAIN_GTT,
                                  &adev->mes.event_log_gpu_obj,
                                  &adev->mes.event_log_gpu_addr, @@ -1548,12 +1548,11 @@

static int amdgpu_debugfs_mes_event_log_show(struct seq_file *m, void *unused)

      uint32_t *mem = (uint32_t *)(adev->mes.event_log_cpu_addr);

      seq_hex_dump(m, "", DUMP_PREFIX_OFFSET, 32, 4,
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +1 -2
-                  mem, PAGE_SIZE, false);
+                  mem, AMDGPU_MES_LOG_BUFFER_SIZE, false);
 
      return 0;
  }
 
-
  DEFINE_SHOW_ATTRIBUTE(amdgpu_debugfs_mes_event_log);
 
  #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h +2 -0
index 7d4f93fea937..4c8fc3117ef8 100644
@@ -52,6 +52,7 @@ enum amdgpu_mes_priority_level {
 
  #define AMDGPU_MES_PROC_CTX_SIZE 0x1000 /* one page area */
  #define AMDGPU_MES_GANG_CTX_SIZE 0x1000 /* one page area */
+#define AMDGPU_MES_LOG_BUFFER_SIZE 0x4000 /* Maximu log buffer size
+for MES */
 
  struct amdgpu_mes_funcs;
Acked-by
#5 lore raw
Quoted 4 lines · Shaoyun

[AMD Official Use Only - General]

It can cause page fault when the log size exceed the page size .

I think we should make sure this patch goes back to stable for all kernel versions where the logging is enabled.

Alex

Quoted 68 lines

-----Original Message-----
From: Kuehling, Felix <[email protected]>
Sent: Monday, March 25, 2024 2:58 PM
To: Liu, Shaoyun <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu : Increase the mes log buffer size as per new MES FW version

Quoted 2 lines · shaoyunl

From MES version 0x54, the log entry increased and require the log
buffer size to be increased. The 16k is maximum size agreed

What happens when you run the new firmware on an old kernel that only allocates 4KB?

Regards,
Felix

Quoted 50 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 5 ++---
  drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 1 +
  2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +2 -1
index 9ace848e174c..78e4f88f5134 100644
@@ -103,7 +103,7 @@ static int amdgpu_mes_event_log_init(struct amdgpu_device *adev)
      if (!amdgpu_mes_log_enable)
              return 0;
 
-     r = amdgpu_bo_create_kernel(adev, PAGE_SIZE, PAGE_SIZE,
+     r = amdgpu_bo_create_kernel(adev, AMDGPU_MES_LOG_BUFFER_SIZE,
+PAGE_SIZE,
                                  AMDGPU_GEM_DOMAIN_GTT,
                                  &adev->mes.event_log_gpu_obj,
                                  &adev->mes.event_log_gpu_addr, @@ -1548,12 +1548,11 @@

static int amdgpu_debugfs_mes_event_log_show(struct seq_file *m, void *unused)

      uint32_t *mem = (uint32_t *)(adev->mes.event_log_cpu_addr);

      seq_hex_dump(m, "", DUMP_PREFIX_OFFSET, 32, 4,
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +1 -2
-                  mem, PAGE_SIZE, false);
+                  mem, AMDGPU_MES_LOG_BUFFER_SIZE, false);
 
      return 0;
  }
 
-
  DEFINE_SHOW_ATTRIBUTE(amdgpu_debugfs_mes_event_log);
 
  #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h +2 -0
index 7d4f93fea937..4c8fc3117ef8 100644
@@ -52,6 +52,7 @@ enum amdgpu_mes_priority_level {
 
  #define AMDGPU_MES_PROC_CTX_SIZE 0x1000 /* one page area */
  #define AMDGPU_MES_GANG_CTX_SIZE 0x1000 /* one page area */
+#define AMDGPU_MES_LOG_BUFFER_SIZE 0x4000 /* Maximu log buffer size
+for MES */
 
  struct amdgpu_mes_funcs;
#6 lore raw
In reply to Liu, Shaoyun
Quoted 3 lines · Shaoyun

[AMD Official Use Only - General]

It can cause page fault when the log size exceed the page size .

I'd consider that a breaking change in the firmware that should be avoided. Is there a way the updated driver can tell the FW the log size that it allocated, so that old drivers continue to work with new firmware?

Regards,
  Felix

Quoted 66 lines

-----Original Message-----
From: Kuehling, Felix <[email protected]>
Sent: Monday, March 25, 2024 2:58 PM
To: Liu, Shaoyun <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu : Increase the mes log buffer size as per new MES FW version

Quoted 2 lines · shaoyunl

From MES version 0x54, the log entry increased and require the log
buffer size to be increased. The 16k is maximum size agreed

What happens when you run the new firmware on an old kernel that only allocates 4KB?

Regards,
Felix

Quoted 49 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 5 ++---
   drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 1 +
   2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +2 -1
index 9ace848e174c..78e4f88f5134 100644
@@ -103,7 +103,7 @@ static int amdgpu_mes_event_log_init(struct amdgpu_device *adev)
       if (!amdgpu_mes_log_enable)
               return 0;
 
-     r = amdgpu_bo_create_kernel(adev, PAGE_SIZE, PAGE_SIZE,
+     r = amdgpu_bo_create_kernel(adev, AMDGPU_MES_LOG_BUFFER_SIZE,
+PAGE_SIZE,
                                   AMDGPU_GEM_DOMAIN_GTT,
                                   &adev->mes.event_log_gpu_obj,
                                   &adev->mes.event_log_gpu_addr, @@ -1548,12 +1548,11 @@

static int amdgpu_debugfs_mes_event_log_show(struct seq_file *m, void *unused)

       uint32_t *mem = (uint32_t *)(adev->mes.event_log_cpu_addr);

       seq_hex_dump(m, "", DUMP_PREFIX_OFFSET, 32, 4,
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +1 -2
-                  mem, PAGE_SIZE, false);
+                  mem, AMDGPU_MES_LOG_BUFFER_SIZE, false);
 
       return 0;
   }
 
-
   DEFINE_SHOW_ATTRIBUTE(amdgpu_debugfs_mes_event_log);
 
   #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h +2 -0
index 7d4f93fea937..4c8fc3117ef8 100644
@@ -52,6 +52,7 @@ enum amdgpu_mes_priority_level {
 
   #define AMDGPU_MES_PROC_CTX_SIZE 0x1000 /* one page area */
   #define AMDGPU_MES_GANG_CTX_SIZE 0x1000 /* one page area */
+#define AMDGPU_MES_LOG_BUFFER_SIZE 0x4000 /* Maximu log buffer size
+for MES */
 
   struct amdgpu_mes_funcs;
#7 lore raw

[AMD Official Use Only - General]

That requires extra work in MES and API level change to let driver send this info to MES . I think that's kind of unnecessary complicated.
The original problem is MES fw doesn't encapsulate their API defines good enough . Windows driver directly use MES internal structure to calculate the buffer size.
I already pushed MES team to have all the necessary info including this log buffer size defined in mes_api_def.h . We also agreed that maximum log buffer size won't exceed 0x4000 in the near future . This will happens on the new MES release and may take some time for driver side to pick it up , but before this I'd like to have a solution that can fix the issue ASAP .

Regards
Shaoyun.liu

-----Original Message-----
From: Kuehling, Felix <[email protected]>
Sent: Tuesday, March 26, 2024 2:07 PM
To: Liu, Shaoyun <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu : Increase the mes log buffer size as per new MES FW version

Quoted 3 lines · Shaoyun

[AMD Official Use Only - General]

It can cause page fault when the log size exceed the page size .

I'd consider that a breaking change in the firmware that should be avoided. Is there a way the updated driver can tell the FW the log size that it allocated, so that old drivers continue to work with new firmware?

Regards,
Felix

Quoted 67 lines

-----Original Message-----
From: Kuehling, Felix <[email protected]>
Sent: Monday, March 25, 2024 2:58 PM
To: Liu, Shaoyun <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu : Increase the mes log buffer size as per new MES FW version

Quoted 2 lines · shaoyunl

From MES version 0x54, the log entry increased and require the log
buffer size to be increased. The 16k is maximum size agreed

What happens when you run the new firmware on an old kernel that only allocates 4KB?

Regards,
Felix

Quoted 49 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 5 ++---
   drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 1 +
   2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +3 -4
index 9ace848e174c..78e4f88f5134 100644
@@ -103,7 +103,7 @@ static int amdgpu_mes_event_log_init(struct amdgpu_device *adev)
       if (!amdgpu_mes_log_enable)
               return 0;
 
-     r = amdgpu_bo_create_kernel(adev, PAGE_SIZE, PAGE_SIZE,
+     r = amdgpu_bo_create_kernel(adev, AMDGPU_MES_LOG_BUFFER_SIZE,
+PAGE_SIZE,
                                   AMDGPU_GEM_DOMAIN_GTT,
                                   &adev->mes.event_log_gpu_obj,
                                   &adev->mes.event_log_gpu_addr, @@
-1548,12 +1548,11 @@ static int amdgpu_debugfs_mes_event_log_show(struct seq_file *m, void *unused)
       uint32_t *mem = (uint32_t *)(adev->mes.event_log_cpu_addr);
 
       seq_hex_dump(m, "", DUMP_PREFIX_OFFSET, 32, 4,
-                  mem, PAGE_SIZE, false);
+                  mem, AMDGPU_MES_LOG_BUFFER_SIZE, false);
 
       return 0;
   }
 
-
   DEFINE_SHOW_ATTRIBUTE(amdgpu_debugfs_mes_event_log);
 
   #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h +2 -0
index 7d4f93fea937..4c8fc3117ef8 100644
@@ -52,6 +52,7 @@ enum amdgpu_mes_priority_level {
 
   #define AMDGPU_MES_PROC_CTX_SIZE 0x1000 /* one page area */
   #define AMDGPU_MES_GANG_CTX_SIZE 0x1000 /* one page area */
+#define AMDGPU_MES_LOG_BUFFER_SIZE 0x4000 /* Maximu log buffer size
+for MES */
 
   struct amdgpu_mes_funcs;