Skip to contentSkip to conversation

Add support for XGMI hive reset

PATCH In review Andrey Grodzovsky 2 participants 6 messages Nov 27, 2018 – Nov 28, 2018 2 messages not in the archive

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

v3 cover Add support for XGMI hive reset

This set of patches adds support to reset entire XGMI hive when reset is required.

Patches 1-2 refactoring a bit the XGMI infrastructure as preparaton for the actual hive reset change.

Patch 5 is GPU reset/recovery refactored to support XGMI hive reset.

Andrey Grodzovsky (3):
drm/amdgpu: Refactor amdgpu_xgmi_add_device v3 drm/amdgpu: Expose hive adev list and xgmi_mutex v3 drm/amdgpu: Refactor GPU reset for XGMI hive case v3

 drivers/gpu/drm/amd/amdgpu/amdgpu.h        |   9 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 376 ++++++++++++++++++++---------
 drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c   |  68 +++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h   |  39 +++
 4 files changed, 343 insertions(+), 149 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h
Signature · 6 lines
2.7.4

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

A message that is not in the archive (sent off-list or not yet received): 1543343848-11249-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH v3 1/3 drm/amdgpu: Refactor amdgpu_xgmi_add_device v3

This is prep work for updating each PSP FW in hive after GPU reset.
Split into build topology SW state and update each PSP FW in the hive. Save topology and count of XGMI devices for reuse.

v2: Create seperate header for XGMI.
v3: Rebase

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  6 ----
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  2 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c   | 56 ++++++++++++++++++------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h   | 36 +++++++++++++++++++
 4 files changed, 72 insertions(+), 28 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -6
index adbad0e..1ee3f0b 100644
@@ -1222,12 +1222,6 @@ void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);
 long amdgpu_kms_compat_ioctl(struct file *filp, unsigned int cmd,
 			     unsigned long arg);
 
-
-/*
- * functions used by amdgpu_xgmi.c
- */
-int amdgpu_xgmi_add_device(struct amdgpu_device *adev);
-
 /*
  * functions used by amdgpu_encoder.c
  */
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
index cb06e68..d118394 100644
@@ -59,6 +59,8 @@
 #include "amdgpu_amdkfd.h"
 #include "amdgpu_pm.h"
 
+#include "amdgpu_xgmi.h"
+
 MODULE_FIRMWARE("amdgpu/vega10_gpu_info.bin");
 MODULE_FIRMWARE("amdgpu/vega12_gpu_info.bin");
 MODULE_FIRMWARE("amdgpu/raven_gpu_info.bin");
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +34 -22

110 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h new file +36 -0
new file mode 100644
index 0000000..85a7263
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2016 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __AMDGPU_XGMI_H__
+#define __AMDGPU_XGMI_H__
+
+/*
+ * functions used by amdgpu_xgmi.c
+ */
+
+struct amdgpu_device;
+struct amdgpu_hive_info;
+
+struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev);
+int amdgpu_xgmi_update_topology(struct amdgpu_hive_info *hive, struct amdgpu_device *adev);
+int amdgpu_xgmi_add_device(struct amdgpu_device *adev);
+
+#endif
Signature · 6 lines
2.7.4

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

PATCH v3 2/3 drm/amdgpu: Expose hive adev list and xgmi_mutex v3

In reply to a message not in the archive

It's needed for device reset of entire hive.

v3:
Add per hive lock to allow avoiding duplicate resets triggered by multiple members of same hive.
Expose amdgpu_hive_info instead of adding getter functions.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 16 ++++++++--------
 drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h | 13 ++++++++-----
 2 files changed, 16 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +8 -8
index 59e667a..fb37e69 100644
@@ -23,7 +23,6 @@
  */
 #include <linux/list.h>
 #include "amdgpu.h"
-#include "amdgpu_psp.h"
 #include "amdgpu_xgmi.h"
 
 
@@ -32,16 +31,15 @@ static DEFINE_MUTEX(xgmi_mutex);
 #define AMDGPU_MAX_XGMI_HIVE			8
 #define AMDGPU_MAX_XGMI_DEVICE_PER_HIVE		4
 
-struct amdgpu_hive_info {
-	uint64_t		hive_id;
-	struct list_head	device_list;
-	struct psp_xgmi_topology_info	topology_info;
-	int number_devices;
-};
-
 static struct amdgpu_hive_info xgmi_hives[AMDGPU_MAX_XGMI_HIVE];
 static unsigned hive_count = 0;
 
+
+void *amdgpu_xgmi_hive_try_lock(struct amdgpu_hive_info *hive)
+{
+	return &hive->device_list;
+}
+
 struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev)
 {
 	int i;
@@ -61,6 +59,8 @@ struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev)
 	tmp = &xgmi_hives[hive_count++];
 	tmp->hive_id = adev->gmc.xgmi.hive_id;
 	INIT_LIST_HEAD(&tmp->device_list);
+	mutex_init(&tmp->hive_lock);
+
 	return tmp;
 }
 
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +8 -5
index 85a7263..6335bfd 100644
@@ -22,12 +22,15 @@
 #ifndef __AMDGPU_XGMI_H__
 #define __AMDGPU_XGMI_H__
 
-/*
- * functions used by amdgpu_xgmi.c
- */
+#include "amdgpu_psp.h"
 
-struct amdgpu_device;
-struct amdgpu_hive_info;
+struct amdgpu_hive_info {
+	uint64_t		hive_id;
+	struct list_head	device_list;
+	struct psp_xgmi_topology_info	topology_info;
+	int number_devices;
+	struct mutex hive_lock;
+};
 
 struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev);
 int amdgpu_xgmi_update_topology(struct amdgpu_hive_info *hive, struct amdgpu_device *adev);
Signature · 6 lines
2.7.4

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

PATCH v3 3/3 drm/amdgpu: Refactor GPU reset for XGMI hive case v3

In reply to a message not in the archive

For XGMI hive case do reset in steps where each step iterates over all devs in hive. This especially important for asic reset since all PSP FW in hive must come up within a limited time (around 1 sec) to properply negotiate the link.
Do this by refactoring amdgpu_device_gpu_recover and amdgpu_device_reset into pre_asic_reset, asic_reset and post_asic_reset functions where is part is exectued for all the GPUs in the hive before going to the next step.

v2: Update names for amdgpu_device_lock/unlock functions.

v3: Introduce per hive locking to avoid multiple resets for GPUs
in same hive.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        |   3 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 374 ++++++++++++++++++++---------
 2 files changed, 262 insertions(+), 115 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +3 -0
index 1ee3f0b..9053355 100644
@@ -1026,6 +1026,9 @@ struct amdgpu_device {
 	unsigned long last_mm_index;
 	bool                            in_gpu_reset;
 	struct mutex  lock_reset;
+
+	int asic_reset_res;
+	int resched;
 };
 
 static inline struct amdgpu_device *amdgpu_ttm_adev(struct ttm_bo_device *bdev)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +259 -115

414 lines not on this page · raw message

Signature · 6 lines
2.7.4

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

Ping...

Andrey

Quoted 14 lines · Andrey Grodzovsky

This set of patches adds support to reset entire XGMI hive when reset is required.

Patches 1-2 refactoring a bit the XGMI infrastructure as preparaton for the actual hive reset change.

Patch 5 is GPU reset/recovery refactored to support XGMI hive reset.

Andrey Grodzovsky (3):
drm/amdgpu: Refactor amdgpu_xgmi_add_device v3 drm/amdgpu: Expose hive adev list and xgmi_mutex v3 drm/amdgpu: Refactor GPU reset for XGMI hive case v3

Quoted 7 lines
  drivers/gpu/drm/amd/amdgpu/amdgpu.h        |   9 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 376 ++++++++++++++++++++---------
  drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c   |  68 +++---
  drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h   |  39 +++
  4 files changed, 343 insertions(+), 149 deletions(-)

create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h

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

A message that is not in the archive (sent off-list or not yet received): f68ac17d-657d-81fb-42a5-54dfb8cbbd35-5C7GfCeVMHo@public.gmane.org

#7 lore raw

From the design it looks good to me, but I really don't know much about XGMI.

When you want to simplify it a bit, I'm pretty sure the calls to ttm_bo_lock_delayed_workqueue()/ttm_bo_unlock_delayed_workqueue() can just be dropped.

They are copy & pasted over from radeon and on amdgpu there isn't any reason for that any more.

Christian.

Am 28.11.18 um 16:07 schrieb Grodzovsky, Andrey:

Quoted 27 lines

Ping...

Andrey

Quoted 14 lines · Andrey Grodzovsky

This set of patches adds support to reset entire XGMI hive when reset is required.

Patches 1-2 refactoring a bit the XGMI infrastructure as preparaton for the actual hive reset change.

Patch 5 is GPU reset/recovery refactored to support XGMI hive reset.

Andrey Grodzovsky (3):
drm/amdgpu: Refactor amdgpu_xgmi_add_device v3 drm/amdgpu: Expose hive adev list and xgmi_mutex v3 drm/amdgpu: Refactor GPU reset for XGMI hive case v3

Quoted 7 lines
   drivers/gpu/drm/amd/amdgpu/amdgpu.h        |   9 +-
   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 376 ++++++++++++++++++++---------
   drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c   |  68 +++---
   drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h   |  39 +++
   4 files changed, 343 insertions(+), 149 deletions(-)

create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h

Quoted 4 lines

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

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