modify the lock type to 'spinlock' to avoid schedule issue in interrupt context. Signed-off-by: Yang Wang <kevinyang.wang@xxxxxxx> --- drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c | 11 +++++------ drivers/gpu/drm/amd/amdgpu/amdgpu_mca.h | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c index 0c9a271c5028..f743fd6a5a13 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c @@ -233,7 +233,7 @@ int amdgpu_mca_init(struct amdgpu_device *adev) for (i = 0; i < ARRAY_SIZE(mca->mca_caches); i++) { mca_cache = &mca->mca_caches[i]; - mutex_init(&mca_cache->lock); + spin_lock_init(&mca_cache->lock); amdgpu_mca_bank_set_init(&mca_cache->mca_set); } @@ -251,7 +251,6 @@ void amdgpu_mca_fini(struct amdgpu_device *adev) for (i = 0; i < ARRAY_SIZE(mca->mca_caches); i++) { mca_cache = &mca->mca_caches[i]; amdgpu_mca_bank_set_release(&mca_cache->mca_set); - mutex_destroy(&mca_cache->lock); } } @@ -456,9 +455,9 @@ static int amdgpu_mca_add_mca_set_to_cache(struct amdgpu_device *adev, enum amdg struct mca_bank_cache *mca_cache = &adev->mca.mca_caches[type]; int ret; - mutex_lock(&mca_cache->lock); + spin_lock(&mca_cache->lock); ret = amdgpu_mca_bank_set_merge(&mca_cache->mca_set, new); - mutex_unlock(&mca_cache->lock); + spin_unlock(&mca_cache->lock); return ret; } @@ -488,10 +487,10 @@ int amdgpu_mca_smu_log_ras_error(struct amdgpu_device *adev, enum amdgpu_ras_blo } /* dispatch mca set again if mca cache has valid data */ - mutex_lock(&mca_cache->lock); + spin_lock(&mca_cache->lock); if (mca_cache->mca_set.nr_entries) ret = amdgpu_mca_dispatch_mca_set(adev, blk, type, &mca_cache->mca_set, err_data); - mutex_unlock(&mca_cache->lock); + spin_unlock(&mca_cache->lock); out_mca_release: amdgpu_mca_bank_set_release(&mca_set); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mca.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mca.h index e80323ff90c1..c3c184c88dad 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mca.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mca.h @@ -84,7 +84,7 @@ struct mca_bank_set { struct mca_bank_cache { struct mca_bank_set mca_set; - struct mutex lock; + spinlock_t lock; }; struct amdgpu_mca { -- 2.34.1