Commit f6bce954 authored by Yang Wang's avatar Yang Wang Committed by Alex Deucher

drm/amdgpu: change aca bank error lock type to spinlock

modify the lock type to 'spinlock' to avoid schedule issue
in interrupt context.
Signed-off-by: default avatarYang Wang <kevinyang.wang@amd.com>
Reviewed-by: default avatarTao Zhou <tao.zhou1@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 50bff04d
...@@ -222,9 +222,9 @@ static struct aca_bank_error *new_bank_error(struct aca_error *aerr, struct aca_ ...@@ -222,9 +222,9 @@ static struct aca_bank_error *new_bank_error(struct aca_error *aerr, struct aca_
INIT_LIST_HEAD(&bank_error->node); INIT_LIST_HEAD(&bank_error->node);
memcpy(&bank_error->info, info, sizeof(*info)); memcpy(&bank_error->info, info, sizeof(*info));
mutex_lock(&aerr->lock); spin_lock(&aerr->lock);
list_add_tail(&bank_error->node, &aerr->list); list_add_tail(&bank_error->node, &aerr->list);
mutex_unlock(&aerr->lock); spin_unlock(&aerr->lock);
return bank_error; return bank_error;
} }
...@@ -235,7 +235,7 @@ static struct aca_bank_error *find_bank_error(struct aca_error *aerr, struct aca ...@@ -235,7 +235,7 @@ static struct aca_bank_error *find_bank_error(struct aca_error *aerr, struct aca
struct aca_bank_info *tmp_info; struct aca_bank_info *tmp_info;
bool found = false; bool found = false;
mutex_lock(&aerr->lock); spin_lock(&aerr->lock);
list_for_each_entry(bank_error, &aerr->list, node) { list_for_each_entry(bank_error, &aerr->list, node) {
tmp_info = &bank_error->info; tmp_info = &bank_error->info;
if (tmp_info->socket_id == info->socket_id && 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 ...@@ -246,7 +246,7 @@ static struct aca_bank_error *find_bank_error(struct aca_error *aerr, struct aca
} }
out_unlock: out_unlock:
mutex_unlock(&aerr->lock); spin_unlock(&aerr->lock);
return found ? bank_error : NULL; return found ? bank_error : NULL;
} }
...@@ -474,7 +474,7 @@ static int aca_log_aca_error(struct aca_handle *handle, enum aca_error_type type ...@@ -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_error *aerr = &error_cache->errors[type];
struct aca_bank_error *bank_error, *tmp; struct aca_bank_error *bank_error, *tmp;
mutex_lock(&aerr->lock); spin_lock(&aerr->lock);
if (list_empty(&aerr->list)) if (list_empty(&aerr->list))
goto out_unlock; goto out_unlock;
...@@ -485,7 +485,7 @@ static int aca_log_aca_error(struct aca_handle *handle, enum aca_error_type type ...@@ -485,7 +485,7 @@ static int aca_log_aca_error(struct aca_handle *handle, enum aca_error_type type
} }
out_unlock: out_unlock:
mutex_unlock(&aerr->lock); spin_unlock(&aerr->lock);
return 0; return 0;
} }
...@@ -542,7 +542,7 @@ int amdgpu_aca_get_error_data(struct amdgpu_device *adev, struct aca_handle *han ...@@ -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) 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); INIT_LIST_HEAD(&aerr->list);
aerr->type = type; aerr->type = type;
aerr->nr_errors = 0; aerr->nr_errors = 0;
...@@ -561,11 +561,10 @@ static void aca_error_fini(struct aca_error *aerr) ...@@ -561,11 +561,10 @@ static void aca_error_fini(struct aca_error *aerr)
{ {
struct aca_bank_error *bank_error, *tmp; 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) list_for_each_entry_safe(bank_error, tmp, &aerr->list, node)
aca_bank_error_remove(aerr, bank_error); aca_bank_error_remove(aerr, bank_error);
spin_unlock(&aerr->lock);
mutex_destroy(&aerr->lock);
} }
static void aca_fini_error_cache(struct aca_handle *handle) static void aca_fini_error_cache(struct aca_handle *handle)
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#define __AMDGPU_ACA_H__ #define __AMDGPU_ACA_H__
#include <linux/list.h> #include <linux/list.h>
#include <linux/spinlock.h>
struct ras_err_data; struct ras_err_data;
struct ras_query_context; struct ras_query_context;
...@@ -133,7 +134,7 @@ struct aca_bank_error { ...@@ -133,7 +134,7 @@ struct aca_bank_error {
struct aca_error { struct aca_error {
struct list_head list; struct list_head list;
struct mutex lock; spinlock_t lock;
enum aca_error_type type; enum aca_error_type type;
int nr_errors; int nr_errors;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment