Skip to content

Commit f6bce95

Browse files
Yang Wangalexdeucher
authored andcommitted
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: Yang Wang <kevinyang.wang@amd.com> Reviewed-by: Tao Zhou <tao.zhou1@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 50bff04 commit f6bce95

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,9 @@ static struct aca_bank_error *new_bank_error(struct aca_error *aerr, struct aca_
222222
INIT_LIST_HEAD(&bank_error->node);
223223
memcpy(&bank_error->info, info, sizeof(*info));
224224

225-
mutex_lock(&aerr->lock);
225+
spin_lock(&aerr->lock);
226226
list_add_tail(&bank_error->node, &aerr->list);
227-
mutex_unlock(&aerr->lock);
227+
spin_unlock(&aerr->lock);
228228

229229
return bank_error;
230230
}
@@ -235,7 +235,7 @@ static struct aca_bank_error *find_bank_error(struct aca_error *aerr, struct aca
235235
struct aca_bank_info *tmp_info;
236236
bool found = false;
237237

238-
mutex_lock(&aerr->lock);
238+
spin_lock(&aerr->lock);
239239
list_for_each_entry(bank_error, &aerr->list, node) {
240240
tmp_info = &bank_error->info;
241241
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
246246
}
247247

248248
out_unlock:
249-
mutex_unlock(&aerr->lock);
249+
spin_unlock(&aerr->lock);
250250

251251
return found ? bank_error : NULL;
252252
}
@@ -474,7 +474,7 @@ static int aca_log_aca_error(struct aca_handle *handle, enum aca_error_type type
474474
struct aca_error *aerr = &error_cache->errors[type];
475475
struct aca_bank_error *bank_error, *tmp;
476476

477-
mutex_lock(&aerr->lock);
477+
spin_lock(&aerr->lock);
478478

479479
if (list_empty(&aerr->list))
480480
goto out_unlock;
@@ -485,7 +485,7 @@ static int aca_log_aca_error(struct aca_handle *handle, enum aca_error_type type
485485
}
486486

487487
out_unlock:
488-
mutex_unlock(&aerr->lock);
488+
spin_unlock(&aerr->lock);
489489

490490
return 0;
491491
}
@@ -542,7 +542,7 @@ int amdgpu_aca_get_error_data(struct amdgpu_device *adev, struct aca_handle *han
542542

543543
static void aca_error_init(struct aca_error *aerr, enum aca_error_type type)
544544
{
545-
mutex_init(&aerr->lock);
545+
spin_lock_init(&aerr->lock);
546546
INIT_LIST_HEAD(&aerr->list);
547547
aerr->type = type;
548548
aerr->nr_errors = 0;
@@ -561,11 +561,10 @@ static void aca_error_fini(struct aca_error *aerr)
561561
{
562562
struct aca_bank_error *bank_error, *tmp;
563563

564-
mutex_lock(&aerr->lock);
564+
spin_lock(&aerr->lock);
565565
list_for_each_entry_safe(bank_error, tmp, &aerr->list, node)
566566
aca_bank_error_remove(aerr, bank_error);
567-
568-
mutex_destroy(&aerr->lock);
567+
spin_unlock(&aerr->lock);
569568
}
570569

571570
static void aca_fini_error_cache(struct aca_handle *handle)

drivers/gpu/drm/amd/amdgpu/amdgpu_aca.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#define __AMDGPU_ACA_H__
2626

2727
#include <linux/list.h>
28+
#include <linux/spinlock.h>
2829

2930
struct ras_err_data;
3031
struct ras_query_context;
@@ -133,7 +134,7 @@ struct aca_bank_error {
133134

134135
struct aca_error {
135136
struct list_head list;
136-
struct mutex lock;
137+
spinlock_t lock;
137138
enum aca_error_type type;
138139
int nr_errors;
139140
};

0 commit comments

Comments
 (0)