Skip to contentSkip to conversation

amdgfx/gfx: don't use static objects for ce/de meta. (v2)

RFC PATCH In review Dave Airlie 2 participants 2 messages Sep 29, 2017 1 message not in the archive

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

RFC PATCH 1/1 amdgfx/gfx: don't use static objects for ce/de meta. (v2)

From: Dave Airlie <[email protected]>

This isn't safe if we have multiple GPUs plugged in, since there is only one copy of this struct in the bss, just allocate on stack, it's 40/108 bytes which should be safe.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 4 ++--
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -2
index dfc10b1..5887f29 100644
@@ -7076,7 +7076,7 @@ static void gfx_v8_0_ring_emit_ce_meta(struct amdgpu_ring *ring)
 {
 	uint64_t ce_payload_addr;
 	int cnt_ce;
-	static union {
+	union {
 		struct vi_ce_ib_state regular;
 		struct vi_ce_ib_state_chained_ib chained;
 	} ce_payload = {};
@@ -7105,7 +7105,7 @@ static void gfx_v8_0_ring_emit_de_meta(struct amdgpu_ring *ring)
 {
 	uint64_t de_payload_addr, gds_addr, csa_addr;
 	int cnt_de;
-	static union {
+	union {
 		struct vi_de_ib_state regular;
 		struct vi_de_ib_state_chained_ib chained;
 	} de_payload = {};
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
index deeaee14..508efc8 100644
@@ -3806,7 +3806,7 @@ static void gfx_v9_ring_emit_sb(struct amdgpu_ring *ring)
 
 static void gfx_v9_0_ring_emit_ce_meta(struct amdgpu_ring *ring)
 {
-	static struct v9_ce_ib_state ce_payload = {0};
+	struct v9_ce_ib_state ce_payload = {0};
 	uint64_t csa_addr;
 	int cnt;
 
@@ -3825,7 +3825,7 @@ static void gfx_v9_0_ring_emit_ce_meta(struct amdgpu_ring *ring)
 
 static void gfx_v9_0_ring_emit_de_meta(struct amdgpu_ring *ring)
 {
-	static struct v9_de_ib_state de_payload = {0};
+	struct v9_de_ib_state de_payload = {0};
 	uint64_t csa_addr, gds_addr;
 	int cnt;
 
Signature · 6 lines
2.9.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by
#2 lore raw
In reply to a message not in the archive

Am 29.09.2017 um 02:16 schrieb Dave Airlie:

Quoted 7 lines

From: Dave Airlie <[email protected]>

This isn't safe if we have multiple GPUs plugged in, since there is only one copy of this struct in the bss, just allocate on stack, it's 40/108 bytes which should be safe.

Quoted 41 lines
---
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 4 ++--
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++--
  2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -2
index dfc10b1..5887f29 100644
@@ -7076,7 +7076,7 @@ static void gfx_v8_0_ring_emit_ce_meta(struct amdgpu_ring *ring)
  {
  	uint64_t ce_payload_addr;
  	int cnt_ce;
-	static union {
+	union {
  		struct vi_ce_ib_state regular;
  		struct vi_ce_ib_state_chained_ib chained;
  	} ce_payload = {};
@@ -7105,7 +7105,7 @@ static void gfx_v8_0_ring_emit_de_meta(struct amdgpu_ring *ring)
  {
  	uint64_t de_payload_addr, gds_addr, csa_addr;
  	int cnt_de;
-	static union {
+	union {
  		struct vi_de_ib_state regular;
  		struct vi_de_ib_state_chained_ib chained;
  	} de_payload = {};
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -1
index deeaee14..508efc8 100644
@@ -3806,7 +3806,7 @@ static void gfx_v9_ring_emit_sb(struct amdgpu_ring *ring)
 
  static void gfx_v9_0_ring_emit_ce_meta(struct amdgpu_ring *ring)
  {
-	static struct v9_ce_ib_state ce_payload = {0};
+	struct v9_ce_ib_state ce_payload = {0};
  	uint64_t csa_addr;
  	int cnt;
 

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_ring_emit_ce_meta(struct amdgpu_ring *ring) · line 3831

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -1
@@ -3825,7 +3825,7 @@ static void gfx_v9_0_ring_emit_ce_meta(struct amdgpu_ring *ring)
 
  static void gfx_v9_0_ring_emit_de_meta(struct amdgpu_ring *ring)
  {
-	static struct v9_de_ib_state de_payload = {0};
+	struct v9_de_ib_state de_payload = {0};
  	uint64_t csa_addr, gds_addr;
  	int cnt;
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx