]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amdgpu: change aca bank error lock type to spinlock
authorYang Wang <kevinyang.wang@amd.com>
Thu, 16 May 2024 11:57:24 +0000 (19:57 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 17 May 2024 21:40:38 +0000 (17:40 -0400)
modify the lock type to 'spinlock' to avoid schedule issue
in interrupt context.

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c
drivers/gpu/drm/amd/amdgpu/amdgpu_aca.h

index 0002d3ae4761a666ba5914ce71b4a7c3d2c2c47e..7260a6ce015af18b3d5f2b5ad9f5eef4d0fe74c3 100644 (file)
@@ -222,9 +222,9 @@ static struct aca_bank_error *new_bank_error(struct aca_error *aerr, struct aca_
        INIT_LIST_HEAD(&bank_error->node);
        memcpy(&bank_error->info, info, sizeof(*info));
 
-       mutex_lock(&aerr->lock);
+       spin_lock(&aerr->lock);
        list_add_tail(&bank_error->node, &aerr->list);
-       mutex_unlock(&aerr->lock);
+       spin_unlock(&aerr->lock);
 
        return bank_error;
 }
@@ -235,7 +235,7 @@ static struct aca_bank_error *find_bank_error(struct aca_error *aerr, struct aca
        struct aca_bank_info *tmp_info;
        bool found = false;
 
-       mutex_lock(&aerr->lock);
+       spin_lock(&aerr->lock);
        list_for_each_entry(bank_error, &aerr->list, node) {
                tmp_info = &bank_error->info;
                if (tmp_info->socket_id == info->socket_id &&
@@ -246,7 +246,7 @@ static struct aca_bank_error *find_bank_error(struct aca_error *aerr, struct aca
        }
 
 out_unlock:
-       mutex_unlock(&aerr->lock);
+       spin_unlock(&aerr->lock);
 
        return found ? bank_error : NULL;
 }
@@ -474,7 +474,7 @@ static int aca_log_aca_error(struct aca_handle *handle, enum aca_error_type type
        struct aca_error *aerr = &error_cache->errors[type];
        struct aca_bank_error *bank_error, *tmp;
 
-       mutex_lock(&aerr->lock);
+       spin_lock(&aerr->lock);
 
        if (list_empty(&aerr->list))
                goto out_unlock;
@@ -485,7 +485,7 @@ static int aca_log_aca_error(struct aca_handle *handle, enum aca_error_type type
        }
 
 out_unlock:
-       mutex_unlock(&aerr->lock);
+       spin_unlock(&aerr->lock);
 
        return 0;
 }
@@ -542,7 +542,7 @@ int amdgpu_aca_get_error_data(struct amdgpu_device *adev, struct aca_handle *han
 
 static void aca_error_init(struct aca_error *aerr, enum aca_error_type type)
 {
-       mutex_init(&aerr->lock);
+       spin_lock_init(&aerr->lock);
        INIT_LIST_HEAD(&aerr->list);
        aerr->type = type;
        aerr->nr_errors = 0;
@@ -561,11 +561,10 @@ static void aca_error_fini(struct aca_error *aerr)
 {
        struct aca_bank_error *bank_error, *tmp;
 
-       mutex_lock(&aerr->lock);
+       spin_lock(&aerr->lock);
        list_for_each_entry_safe(bank_error, tmp, &aerr->list, node)
                aca_bank_error_remove(aerr, bank_error);
-
-       mutex_destroy(&aerr->lock);
+       spin_unlock(&aerr->lock);
 }
 
 static void aca_fini_error_cache(struct aca_handle *handle)
index 5ef6b745f2223b8dd3eb94a33763a79c7d94d491..ba724c2a997d3298320f94f519cc43143332e233 100644 (file)
@@ -25,6 +25,7 @@
 #define __AMDGPU_ACA_H__
 
 #include <linux/list.h>
+#include <linux/spinlock.h>
 
 struct ras_err_data;
 struct ras_query_context;
@@ -133,7 +134,7 @@ struct aca_bank_error {
 
 struct aca_error {
        struct list_head list;
-       struct mutex lock;
+       spinlock_t lock;
        enum aca_error_type type;
        int nr_errors;
 };